Serpent Showdown is a 1v1 versus snake game where two players battle it out on a dynamic grid. Each player starts with a snake of fixed length and a score of 1000 points. The goal is to outmaneuver your opponent by collecting items, avoiding hazards, and grabbing power-ups that either boost your score or disrupt your enemy.
The arena continuously changes throughout the match. After a set number of moves, the grid begins to shrink, forcing the snakes into closer quarters and raising the risk of collisions. The game ends when a snake crashes or when a player's score reaches zero. In a simultaneous loss, the winner is determined by the higher score or, if equal, by the longer snake.
Created by:
- Jakov Jakovac (Topic responsible)
- Albert Maršić
- Martin Vrbovčan
- Ivan Androšević
- Barbara Jozić
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
This topic was used in the following events:
Before you begin, make sure your environment is set up to run the game. The following prerequisites will help you configure your system to run the server, agents, and visuals correctly.
-
Install Node.js and npm (for server and JavaScript agent)
-
(Optional) Install Python 3.7+ (for Python agent)
-
Install an IDE with Live Server extension (for visuals)
-
Install required dependencies:
-
For server:
cd server npm install -
For JavaScript agents:
cd agents npm install -
For Python agents:
cd agents pip install websockets
-
- Start the server
- Start the visuals (they connect automatically to the server on port 3000)
- Connect two agents using valid IDs from
players.json(game starts automatically when both agents connect) - Server shuts down automatically after the game ends
-
Create a
players.jsonfile in the server directory using the example:cp players.json.example players.json
- Edit player IDs and names in the newly created
players.jsonas needed
- Edit player IDs and names in the newly created
-
Start the server:
cd server node server.js [port] [timeout]- The server runs on port defined on start or
3000by default - The server accepts an optional timeout value in milliseconds (default:
150ms; use0to disable). - The server automatically creates the game object (logic) on start
- The server runs on port defined on start or
- Open the project in your IDE (we recommend VS Code)
- Right-click on
visuals/index.html→ "Open with Live Server"- Live Server extension has to be installed
- The game visualization will open in your default browser
- The visuals auto-connect to the server on port 3000 once the server is running
To test the game manually, add ?mode=debug query string to the end of the url, for example:
http://127.0.0.1:5500/visuals/index.html?mode=debug
Manual gameplay connects to the server using IDs "k" and "l" so remember to add them to players.json.
node agents/testAgent.js [playerID] [mode]python agents/testAgent.py [playerID] [mode]"up","down","left","right": Constant direction"random": Random valid moves"timeout": Delayed actions"survive": Avoids death and collisions"apple": Seeks the closest apple (most advanced)
To deploy the game server on a VPS:
-
Install prerequisites
Make suregit,node, andnpmare installed:sudo apt update sudo apt install git nodejs npm
-
Get the project files on your VPS
You can either clone the public repository (recommended), or usersync/scpto copy files manually.-
Clone the repository (recommended):
git clone https://github.com/AIBG-vault/topic-name.git cd AIBG -
Or copy files using
rsyncorscp:# Using rsync rsync -av /path/to/AIBG user@your-vps-ip:/home/user/ # Or using scp scp -r /path/to/AIBG user@your-vps-ip:/home/user/
-
-
Install dependencies
cd server npm install -
Create and edit
players.jsoncp players.json.example players.json nano players.json
Add your teams' IDs and names.
-
Start the server
node server.js [port] [timeout]
-
Open firewall ports
Make sure port 3000 (or your chosen port) is open:sudo ufw allow 3000
Players can now connect to the server using your VPS IP and the chosen port (e.g., ws://your-vps-ip:3000).
For easier access, consider setting up a DNS record (e.g., topic.aibg.best.hr) that points to your VPS IP. This makes it simpler for players to connect and remember the server address.
Example WebSocket connection URLs:
ws://topic.aibg.best.hr:3000ws://your-vps-ip:3000
To set up a DNS record, use your domain provider’s dashboard to create an A record pointing to your VPS.




