This project consists of a player client and a server that communicate to simulate a game environment. The player client can be controlled via keyboard inputs or automated logic, and the server manages the game state and communication between multiple players.
The project is organized into two main components:
The player client is implemented in the player
directory. The main components are:
player.py
: Contains thePlayer
class,PlayerDataClient
class for server communication, andKeyListener
class for handling keyboard inputs.player_logic.py
: Contains theplayer_logic
function that processes game state and updates the player's actions and velocity.
Check Player README to see how to implement the player logic
- Ensure the server is running.
- Run the player client:
python player/player.py
The server is implemented in the server
directory. The main components are:
manager.py
: Contains theManager
class that handles the game state and communication with players.serial_interface.py
: Contains theSerialInterface
class for handling serial communication.socket_server.py
: Contains theSocketInterface
andSocketClient
classes for handling socket communication with players.
- Run the server:
python server/manager.py
The player client communicates with the server using socket communication. The server processes the player's data and sends back the game state.
- Python 3.x
pynput
for keyboard handling (install usingpip install pynput
)pyserial
for serial communication (install usingpip install pyserial
)