Skip to content

Client-server multiplayer game made using C#. The game contains lobby where players can challenge each other and two games: Roll a Dice and Trivia game. The purpose of project was to learn networking and client-server communication.

Notifications You must be signed in to change notification settings

Djolee00/world-of-games-MULTIPLAYER

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

World-of-games-CLIENT-SERVER

This is a client-server multiplayer desktop game made using C#. It was a collaboration with my colleague on our school project. The main purpose of project was to learn about sockets, asynchronous programming, threads and client-server architecture.

Client-server communication

There is a Server which must be started before starting the game. At a startup a new C# Task is made to listen for connection requests. After the request is received the whole communication between server and client is transfered to new thread - ClientHandler

ClientHandler contains method called ProcessRequests which is responsible for whole communication with particular client. It waits for Requests and based on enum OperationRequest it serves the request.

On the other hand, when new user clicks play button, a Task is being created on client side which has method to listen for Responses from server and based enum OperationResponse it takes further actions.

As we can see, the whole communication is based on requests from clients (they are generated by user interaction with GUI) and responses from server.

Lobby

The game contains fully functional lobby where people can see other players waiting for game. Anyone can create game and wait to be challenged. When someone is waiting for game it is displayed to all users instantly. Challenges can be accepted or declined. When user which created game accepts challenge, the game starts.

Screenshot 2022-09-15 213833

Games

When the game starts the whole communication is transfered to GameHandler which is on server side responsible for communication with both clients

Roll a Dice game

  • it's a turn based game where one player rolls a dice until he gets One or until he holds. It's a risk because every time player gets One their current score in that round goes to zero. Every turn is a risk! Player who first comes to 30 wins and and carries over 20 points to the next game.

Trivia Game

  • it's a simple quiz with IT questions where players have 10 seconds to answer. Speed matters! First who answers, if the answer is true gets 5p, if the answer is false player loses 3p and the other player has a 5 seconds to answer if he wants.

Screenshot 2022-09-15 220009

Screenshot 2022-09-15 220114

Limitations

1. Currently the game can be runned on be locally.
2. We used Entity framework as ORM to design database tables, but we are not satisfied with database design (although there wasn't great need for database at all)

Tech Stack

C# 10.0
Entity Framework Core 6.0
SQL Server
.NET 4.8

About

Client-server multiplayer game made using C#. The game contains lobby where players can challenge each other and two games: Roll a Dice and Trivia game. The purpose of project was to learn networking and client-server communication.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%