Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
docs(server): README
Browse files Browse the repository at this point in the history
  • Loading branch information
Pixselve committed Feb 3, 2024
1 parent 21cb930 commit 06d1da4
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions packages/server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# @viper-vortex/server

This package is the server-side component of the Viper Vortex project. It handles player connections, game logic, and communication with the client-side component.

## Installation

You can install this package by cloning the repository and running the following command in the `packages/server` directory:

```bash
npm install
```

## Usage

To start the server, use the following command:

```bash
npm run start
```

## Docker Image

A Docker image for the server is available at `ghcr.io/pixselve-school/sr-projet/server:main`. You can pull and run the Docker image with the following commands:

```bash
docker pull ghcr.io/pixselve-school/sr-projet/server:main
docker run -p 4000:4000 ghcr.io/pixselve-school/sr-projet/server:main
```

The server will be available at `http://localhost:4000`.

## Protocol

The server uses the Socket.IO library for real-time, bidirectional and event-based communication. The protocol is defined in the `@viper-vortex/shared` package and includes the following events:

- `SOCKET_EVENTS.CONNECT`: Triggered when a new client connects to the server.
- `SOCKET_EVENTS.JOIN`: Triggered when a client joins the game. The client sends their player name with this event.
- `SOCKET_EVENTS.DISCONNECT`: Triggered when a client disconnects from the server.
- `SOCKET_EVENTS.MOVE`: Triggered when a client sends a move command. The client sends the direction and speed of the move with this event.
- `SOCKET_EVENTS.FRAME`: Triggered by the server to send game state updates to the clients.
- `SOCKET_EVENTS.ORBS`: Triggered by the server to send orb updates to the clients.
- `SOCKET_EVENTS.SCORES`: Triggered by the server to send score updates to the clients.

For more details on the protocol, please refer to the `@viper-vortex/shared` package.

0 comments on commit 06d1da4

Please sign in to comment.