I'm sending out packets at least twice every second to each client, for updating.
The client is supposed to send packets when something happens, such as movement or chat.
I'm using KryoNet, so I kind of want to use the same bindings for packet-handlers on both the client and the server.
It's an array with classes that handles what happens in the application every time a packet is rechieved. Each of these handlers, are on the index in the array that matches the packetID of whateverr packet needs handling. It's kind of like a huge switch.
I'm thinking I would like to bind them like this the same way on the client, as on the server. However, I'd like to override the actual handlers.
Would that even be possible, let alone "correct" for a networked application?
Can anyone give me some pseudo-code or soemthing, around how the entry-point of the client, the game-code, and the network-relating code is/could be/should be connected?