Multiplayer Snake Game
A simple multiplayer Snake game built with Python and Pygame, featuring both server and client components. Supports singleplayer and local network multiplayer.
Features
Singleplayer mode
Multiplayer over TCP
Multiple players at the same time
Food spawning and scoring
Basic HUD showing player scores
Simple JSON-over-TCP protocol
Requirements
Python 3.11+
Pygame
Install Pygame with:
pip install pygame
Files
snake_server.py – Run the server to host the game.
snake_client.py – Run the client to connect to a server or play singleplayer.
Usage Run the Server python snake_server.py --port 5000
--port is optional (default: 5000).
Run a Client (Multiplayer) python snake_client.py --host <server_ip> --port 5000
Replace <server_ip> with the server's IP address.
Port must match the server's port.
Run a Client (Singleplayer) python snake_client.py --single
Controls
Arrow keys or WASD to change direction.
Esc or closing the window to quit.
Notes
This is a simple educational implementation: no authentication or encryption.
Server enforces collisions and scoring.
Client sends only direction changes.
License
MIT License. See LICENSE for details.