Code Monkey home page Code Monkey logo

djolee00 / world-of-games-multiplayer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from djuriccaleksa/rmt_onlinegame

1.0 0.0 0.0 229 KB

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.

C# 100.00%
async asynchronous-programming client-server entity-framework multithreading network-programming task tcp-socket windows-forms sql-server-database

world-of-games-multiplayer's Introduction

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

world-of-games-multiplayer's People

Contributors

djolee00 avatar djuriccaleksa avatar

Stargazers

netero avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.