You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A 2d platformer game built using a custom Pygame game engine. This engine provides a flexible and modular architecture for creating games with Pygame, featuring components for physics, rendering, UI, and more.
The game uses a custom protocol for network communication, which is defined in the packets module. The protocol includes various packet types for different game events and states. It uses the UDP protocol for communication, as it is lighter and more suitable for real-time games where losing some packets is not critical.
The packet format is a binary structure that includes a header and a payload. The header contains the packet type and length, while the payload contains the actual data.
Name
Type
Description
Packet ID
uint8
The id of the packet.
Data
bytes
The data payload of the packet. It will vary depending on the packet type.
Status
The status is used to check if there is a game server running on this address. The client can send a ping packet to the port 1337 to check if the server is available. The server will respond with a pong packet if it is running.
Client
Ping
Packet ID
State
Bound To
Field Name
Field Type
Description
0x00
Status
Server
No fields
Server
Pong
Packet ID
State
Bound To
Field Name
Field Type
Description
0x01
Play
Client
Name
string
The Name of the server.
Port
uint32
The port of the server.
Play
The play state is used during the game. It includes packets for player actions, game state updates, and other gameplay-related events.
Client
Keep Alive
Packet ID
State
Bound To
Field Name
Field Type
Description
0x05
Play
Server
Value
uint32
A value expected to be returned by the client to check if the client is still connected.
Join
Packet ID
State
Bound To
Field Name
Field Type
Description
0x02
Play
Server
Name
string
The name of the player joining the game.
Disconnect
Packet ID
State
Bound To
Field Name
Field Type
Description
0x04
Play
Server
No fields
Indicates that the player is disconnecting from the game.
Player Move
Packet ID
State
Bound To
Field Name
Field Type
Description
0x09
Play
Server
Player ID
uint32
The ID of the player moving.
Position
float[2]
The new position of the player in the game world.
Acceleration
float[2]
The acceleration vector of the player.
Velocity
float[2]
The velocity vector of the player.
Player Look
Packet ID
State
Bound To
Field Name
Field Type
Description
0x15
Play
Server
Angle
float
The angle the player is looking at, in degrees.
Player Die
Packet ID
State
Bound To
Field Name
Field Type
Description
0x19
Play
Server
No fields
Indicates that the player has died.
Shoot
Packet ID
State
Bound To
Field Name
Field Type
Description
0x17
Play
Server
Gun Type
string
The type of gun being used to shoot.
Angle
float
The angle of the shot, in degrees.
Position
float[2]
The position where the shot was fired in the game world.
Change Character
Packet ID
State
Bound To
Field Name
Field Type
Description
0x0B
Play
Server
Index
uint8
The index of the character being changed to.
Start Game
Packet ID
State
Bound To
Field Name
Field Type
Description
0x0D
Play
Server
Map Name
string
The name of the map to start the game on.
Add Item
Packet ID
State
Bound To
Field Name
Field Type
Description
0x0F
Play
Server
Gun Type
string
The type of the gun item being added.
Position
float[2]
The new position of the item in the game world.
Item Pickup
Packet ID
State
Bound To
Field Name
Field Type
Description
0x10
Play
Server
Gun Type
string
The type of gun being picked up.
Object ID
uint32
The unique identifier of the item being picked up.
Item Drop
Packet ID
State
Bound To
Field Name
Field Type
Description
0x13
Play
Server
No fields
Indicates that the player is dropping an item.
Server
Keep Alive
Packet ID
State
Bound To
Field Name
Field Type
Description
0x06
Play
Client
Value
uint32
A value sent by the server to the client to check if the client is still connected. The client should respond with a packet containing the same value.
Welcome
Packet ID
State
Bound To
Field Name
Field Type
Description
0x03
Play
Client
Is Welcome
boolean
Indicates if the player is welcome to join the game.
Player ID
uint32
The ID of the player if they are welcome. If not, this will be `0`.
Message
string
An error message if the player is not welcome.
Player Move
Packet ID
State
Bound To
Field Name
Field Type
Description
0x08
Play
Client
Player ID
uint32
The ID of the player moving.
Position
float[2]
The new position of the player in the game world.
Acceleration
float[2]
The acceleration vector of the player.
Velocity
float[2]
The velocity vector of the player.
Player Join
Packet ID
State
Bound To
Field Name
Field Type
Description
0x07
Play
Client
Player ID
uint32
The joining player's ID.
Name
string
The joining player's nickname.
Player Leave
Packet ID
State
Bound To
Field Name
Field Type
Description
0x0A
Play
Client
Player ID
uint32
The ID of the player leaving the game.
Player Look
Packet ID
State
Bound To
Field Name
Field Type
Description
0x16
Play
Client
Player ID
uint32
The joining player's ID.
Angle
float
The angle the player is looking at, in degrees.
Player Die
Packet ID
State
Bound To
Field Name
Field Type
Description
0x1A
Play
Server
Player ID
uint32
The ID of the player that has died.
Shoot
Packet ID
State
Bound To
Field Name
Field Type
Description
0x18
Play
Client
Player ID
uint32
The joining player's ID.
Gun Type
string
The type of gun being used to shoot.
Angle
float
The angle of the shot, in degrees.
Position
float[2]
The position where the shot was fired in the game world.
Change Character
Packet ID
State
Bound To
Field Name
Field Type
Description
0x0C
Play
Client
Player ID
uint32
The ID of the player changing character.
Index
uint8
The index of the character being changed to.
Start Game
Packet ID
State
Bound To
Field Name
Field Type
Description
0x0E
Play
Client
Map Name
string
The name of the map to start the game on.
Add Item
Packet ID
State
Bound To
Field Name
Field Type
Description
0x11
Play
Client
Gun Type
string
The type of the gun item being added.
Position
float[2]
The new position of the item in the game world.
Item Pickup
Packet ID
State
Bound To
Field Name
Field Type
Description
0x12
Play
Client
Player ID
uint32
The ID of the player picking up the item.
Gun Type
string
The type of gun being picked up.
Object ID
uint32
The unique identifier of the item being picked up.
Item Drop
Packet ID
State
Bound To
Field Name
Field Type
Description
0x14
Play
Client
Player ID
uint32
The ID of the player dropping the item.
License
This project is licensed under the MIT License. See the LICENSE file for details.