Skip to content

shalonjovan/Ball_shooter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ball Shooter

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.

Features

  • 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

Requirements

  • Python 3.7 or higher
  • Pygame 2.5.2

Installation

  1. Clone or download this repository

  2. Install dependencies:

pip install -r requirements.txt

Project Structure

Ball_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

How to Play

Starting a Game

  1. Run the game:
python main.py
  1. 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
  2. Enter your player name (up to 15 characters)

  3. Select your color from the available options

Controls

  • 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

Gameplay

  • 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

Network Setup

Hosting a Game

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 ifconfig or ip addr, look for inet address

Joining a Game

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.

Configuration

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

Troubleshooting

Connection Issues

  • 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

Performance Issues

  • Close other applications to free up system resources
  • Reduce the number of players if experiencing lag
  • Check network connection stability

About

This is a demo version of the game I'm currently working on right now, Ball_Shooter , this version works over LAN. And the main version is supposed to work over the internet, but is still a work in progress

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages