-
Notifications
You must be signed in to change notification settings - Fork 3
ABI Network
The Application Binary Interface (ABI) is a fundamental concept in computing that relates to how applications (or programs) interact at the binary level with the operating system, libraries, or other applications. A network ABI (Network ABI) refers to the conventions and specifications that define how applications interact with network protocols at the binary level.
A network ABI is essential for network protocols, especially in environments such as online gaming or distributed systems. It ensures that each party understands the messages exactly as intended, regardless of platform. Without a standardized network ABI, each component could misinterpret data, causing errors or incompatibilities.
In summary, the network ABI is a crucial convention for any application or system that depends on reliable and consistent binary interactions over a network.
ABINetwork is a network interface for managing communication between the server and clients in the R-Type project. It provides tools to manage connection information, data packets, and the organization of rooms and users. The ABI allows developers to manage client connections, transmit session information and set up entities in-game.
- Namespace structure
- Functions of Package Management
- User Management and Authentification
- Room and Communication Management
- Package Formats and Dependencies
The ABINetwork namespace centralizes network functions, and each function manages a specific aspect of client-server communication:
-
createServer: Initializes a network unit that acts as a server, allowing connections and the creation of game rooms.
-
createClient: Initializes a network unit that acts as client, allowing to receive information from the server and update the graph
These functions are designed to extract specific information from UDP packets and send the data packets to clients:
-
getLoginInfoFromPacket: Extracts login information, returning a username and password.
-
getRegisterInfoFromPacket: Similar to getLoginInfoFromPacket, but intended for new user registrations.
-
getLogoutInfoFromPacket: Extracts the user token to identify users who log out.
-
getKeyPressedInfoFromPacket: Extracts information from keystrokes for real-time synchronization of movements.
-
sendPacketCreateEntity: Sends a request to create a remote entity by specifying the type of component.
-
sendUpdateComponent: Transmits component updates through a list of dynamic parameters, used to update the state of an entity in the game.
-
sendPacketRoomCreated, sendPacketRooms: Inform customers about the creation of rooms and available rooms.
-
sendPacketLoginAllowed: Sends a response indicating whether the client is allowed to connect.
-
getQueueConnection: Retrieves the connection queue to manage pending clients.
-
sendPacketAssignToken: Sends the entity ID and a token to the client to uniquely identify the connection.
-
sendPacketWrongRoomPassword and sendPacketFullRoom: Inform the customer if password is incorrect or room is full.
Room management functions ensure that each client is placed in the room of their choice or creates a new one:
-
getCreateRoomInfoFromPacket: Extracts information to create a room (name, capacity, game type).
-
getJoinRoomInfoFromPacket: Retrieves room access information from an existing package.
-
sendPacketAllowedToinRoom: Allows a client to join a specific room and provides the TCP port.
-
sendPacketRooms: Sends the client information about all available rooms, ideal for displaying a list of rooms.
-
sendPacketRoomCreated: Sends a confirmation message for the creation of a room, containing essential details.
Packets are instances of UDPPacket and contain the data formatted for transmission. Each package uses specific data structures, often encapsulated in objects or types like roomInfo_t. This allows important information, such as user data or connection status to be serialized.
Examples of Package Structures
-
UDPPacket: General package structure with data field.
-
roomInfo_t: Contains essential information for the rooms (name, capacity, and additional settings).
-
INetworkUnit: Interface for all network units, whether servers or clients.
-
Associated files: 1. RoomMessage.hpp: Definition of room messages, used in ABIServer.hpp for interactions with rooms.