A multiplayer top-down shooter game built with Python and Pygame. Players control circular characters in a shared arena, shooting at each other to gain kills and climb the leaderboard.
- Real-time multiplayer gameplay using TCP sockets
- Host or join game sessions
- Player customization with name and color selection
- Smooth camera movement that follows the player
- Health system with damage and respawn mechanics
- Kill tracking and leaderboard
- Minimap for spatial awareness
- Support for up to 12 players with unique colors
- Python 3.7 or higher
- Pygame 2.5.2
-
Clone or download this repository
-
Install dependencies:
pip install -r requirements.txtBall_shooter/
├── config.py # Game configuration and constants
├── main.py # Main entry point
├── game/
│ ├── entities.py # Player, Bullet, and Camera classes
│ ├── renderer.py # Game rendering logic
│ └── ui.py # User interface menus and screens
├── network/
│ ├── client.py # Client-side networking
│ └── server.py # Server-side game logic
└── utils/
└── helpers.py # Utility functions
- Run the game:
python main.py-
Choose to either:
- Host Game: Start a new server and automatically connect to it
- Join Game: Connect to an existing server by entering the host's IP address
-
Enter your player name (up to 15 characters)
-
Select your color from the available options
- W, A, S, D: Move your character
- Mouse: Aim in the direction of the cursor
- Left Click: Shoot bullets
- R: Respawn after death
- ESC: Exit when disconnected
- Navigate the arena and shoot other players to reduce their health
- Each hit deals 20 damage
- Players die when their health reaches 0
- Press R to respawn at a random location after death
- Gain kills by eliminating other players
- Check your position on the leaderboard in the bottom-left corner
- Use the minimap in the top-right corner to track other players
When hosting, the server will start on port 7777. Other players will need your local IP address to connect.
To find your local IP:
- Windows: Open Command Prompt and run
ipconfig, look for IPv4 Address - Mac/Linux: Open Terminal and run
ifconfigorip addr, look for inet address
Enter the host's IP address when prompted. Both players must be on the same local network, or the host must have proper port forwarding configured for internet play.
You can modify game settings in config.py:
- PORT: Server port (default: 7777)
- SCREEN_WIDTH/HEIGHT: Window dimensions
- MAP_WIDTH/HEIGHT: Game world dimensions
- PLAYER_SPEED: Movement speed
- BULLET_SPEED: Projectile speed
- BULLET_DAMAGE: Damage per hit
- SHOOT_COOLDOWN: Time between shots in seconds
- Ensure both host and client are on the same network
- Check that port 7777 is not blocked by firewall
- Verify the IP address is entered correctly
- Try using "localhost" or "127.0.0.1" when connecting to a server on the same machine
- Close other applications to free up system resources
- Reduce the number of players if experiencing lag
- Check network connection stability