When working on network packet structure for games, what is more efficient (in terms of code structure) for packet reading for client/server?
Currently, Our packet structure is to send the packet ID as an Int32, which is read when it is coming into the server. But to minimize the amount of packet ID's we use, instead of having a (for example) LoginRequest AND a LoginResponse, we use just a Login packet. The data is structured differently whether it is the server, or client sending the packet.
Should we use an individual Packet for each Request/Response? Or is there a better way?
EDIT:
And by data being different for whether it is the client or server sending, it is different in terms of complete packet structure. So while it still has the same ID, it uses entirely different data types.
Example (Using a Lobby Request/Lobby Response as one packet)
Client Request
- Packet Id (Int32) (Lets say ID = 5)
- LobbyName (String)
- LobbyPassword (String)
- GameLobby (Boolean)
Server Response
- Packet Id (Int32) (still ID = 5)
- LobbyName (String)
- GameLobby (Boolean)
- MemberCount (Int32)