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.
Note
Clique aqui para a versĂŁo em
PortuguĂŞs.
To install the game, you need to have Python 3.12 or higher installed. You can download it from python.org.
After installing Python, you can clone the repository and install the required dependencies:
git clone https://github.com/italoseara/pixel-rumble.git
cd pixel-rumble
pip install -r requirements.txtTo run the game, execute the following command in your terminal:
cd src
python main.pyThe 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. |
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.
| Packet ID | State | Bound To | Field Name | Field Type | Description |
|---|---|---|---|---|---|
0x00 |
Status |
Server |
No fields |
| 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. |
The play state is used during the game. It includes packets for player actions, game state updates, and other gameplay-related events.
| 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. |
| Packet ID | State | Bound To | Field Name | Field Type | Description |
|---|---|---|---|---|---|
0x02 |
Play |
Server |
Name | string |
The name of the player joining the game. |
| Packet ID | State | Bound To | Field Name | Field Type | Description |
|---|---|---|---|---|---|
0x04 |
Play |
Server |
No fields | Indicates that the player is disconnecting from the game. |
| 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. |
| Packet ID | State | Bound To | Field Name | Field Type | Description |
|---|---|---|---|---|---|
0x15 |
Play |
Server |
Angle | float |
The angle the player is looking at, in degrees. |
| Packet ID | State | Bound To | Field Name | Field Type | Description |
|---|---|---|---|---|---|
0x19 |
Play |
Server |
No fields | Indicates that the player has died. |
| 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. |
| Packet ID | State | Bound To | Field Name | Field Type | Description |
|---|---|---|---|---|---|
0x0B |
Play |
Server |
Index | uint8 |
The index of the character being changed to. |
| 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. |
| 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. |
| 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. |
| Packet ID | State | Bound To | Field Name | Field Type | Description |
|---|---|---|---|---|---|
0x13 |
Play |
Server |
No fields | Indicates that the player is dropping an item. |
| 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. |
| 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. |
| 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. |
| 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. |
| Packet ID | State | Bound To | Field Name | Field Type | Description |
|---|---|---|---|---|---|
0x0A |
Play |
Client |
Player ID | uint32 |
The ID of the player leaving the game. |
| 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. |
| Packet ID | State | Bound To | Field Name | Field Type | Description |
|---|---|---|---|---|---|
0x1A |
Play |
Server |
Player ID | uint32 |
The ID of the player that has died. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| Packet ID | State | Bound To | Field Name | Field Type | Description |
|---|---|---|---|---|---|
0x14 |
Play |
Client |
Player ID | uint32 |
The ID of the player dropping the item. |
This project is licensed under the MIT License. See the LICENSE file for details.