This project is a prototype for a core system of a battle server designed for a turn-based fighting game. It showcases the basics of a server that can handle real-time battles through WebSocket connections using socket.io. The server architecture is designed to be sufficiently decoupled, allowing it to run efficiently in different contexts, such as within a single API request or as a dedicated app instance.
- Real-time battle handling via WebSocket (socket.io).
- Decoupled battle logic for high-performance execution.
- Integrated API server for handling non-real-time game operations.
- Flexible project structure supporting new application additions, like a matchmaking server.
- Monorepo architecture for ease of development and scalability.
- Docker: Install Docker
- Node.js (v18.x): Install Node.js
- Install Docker following the instructions for your OS:
- Install Node.js (version 18.x).
- Initialize the project by running:
./bin/init.sh
To start developing, follow these steps:
- Launch the servers:
./bin/start.sh
To stop the servers and containers, execute:
- Stop the Docker containers:
./bin/stop-containers.sh
or
- Refresh all services:
./bin/refresh.sh
For cleaning up the environment:
- Prune all unused Docker resources:
./bin/prune-all.sh
- To build individual applications, use the
./bin/build.sh
script. - To create a new application within the project, run:
./bin/create-app.sh <app_name>
- Implement simple player CRUD operations in the API.
- Develop a simple matchmaking server/app that will be triggered by a queue (RabbitMQ?) to run battle instances.
- Utilize the existing Redis cache layer in the core, incorporating a consistent hashing approach, particularly in the API server.
- This project is a proof of concept and is open for showcase purposes. It is not concerned with the monorepo versus multi-repo discussion but rather focuses on demonstrating a practical implementation of a game server system.
- The local API utilizes the PostgreSQL Docker image for database services. However, the battle server does not directly interact with the database.
- The API does not currently use libraries like
routing-controllers
to create basic features, as the goal was to implement these features manually for fun. However, for time-saving purposes, such libraries might be incorporated in the future.