Giter Site home page Giter Site logo

durak-game's Introduction

Durak Multiplayer Game Server

This is the server-side code for a multiplayer game of Durak. It's built with Node.js, Express, and Socket.IO, and uses Firebase Admin SDK for Firestore database operations.

Features

  • Player connection and disconnection handling
  • Game room creation and deletion
  • Player joining and leaving game rooms
  • Game start and end handling
  • Card play and table card take handling
  • Turn end handling
  • Player decision handling for replaying the game

Setup

  1. Clone the repository to your local machine.
  2. Navigate to the project directory.
  3. Run npm install to install the necessary dependencies.
  4. You need to provide your own Firebase service account key file (serviceAccountKey.json). Place this file in the root directory.
  5. Run node server.js to start the server.

API

The server listens for the following Socket.IO events:

  • connection: Triggered when a new player connects to the server.
  • playerName: Triggered when a player sends their name.
  • createGameRoom: Triggered when a player wants to create a new game room.
  • joinGameRoom: Triggered when a player wants to join an existing game room.
  • leaveGameRoom: Triggered when a player wants to leave a game room.
  • deleteGameRoom: Triggered when a player wants to delete a game room.
  • playCard: Triggered when a player plays a card.
  • takeCardsFromTable: Triggered when a player takes cards from the table.
  • startGame: Triggered when a player wants to start a game.
  • playAgain: Triggered when a player decides whether to play again or not.
  • resumeGame: Triggered when a player wants to resume a game.
  • endTurn: Triggered when a player ends their turn.

Dependencies

  • express
  • path
  • firebase-admin
  • socket.io
  • socket.io-client

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Screenshot

durak-game's People

Contributors

nof-sh avatar

Watchers

 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.