Original Post
I'm trying to wrap my head around how to map input into network commands to be sent to the server in an extensible way. Right now, the way input is handled locally is the input is polled every frame and systems interested in handling input can then check the state of a particular action. At startup, an XML file is loaded that maps keys to actions. Currently actions are referred to using strings since I couldn't really see a more mod-friendly way of creating new actions.
The problem is, how should I send the networked-related actions out to the server? The simple solution is to just let each input-handling system say "if IsHeld(action) then NetMessage.send(action)" but that's going to send a bunch of separate packets. I'm not a networking expert but that's probably a bad idea, right? I'm looking for a better idea that allows me to send the changed state of relevant actions across the network in 1 go.
I'm also wondering how to handle the commands on the other end. I'm trying to keep as much overlap as possible between client and server code. It's obviously not possible for everything but I think the input handling could be set up in a way that it doesn't matter if the command came in locally or is being handled on the server. This is also why I want to find a higher-level way of sending out actions to the server. If it's done in the input-handling of the system, I can't reuse that same code on the server.
The problem is, how should I send the networked-related actions out to the server? The simple solution is to just let each input-handling system say "if IsHeld(action) then NetMessage.send(action)" but that's going to send a bunch of separate packets. I'm not a networking expert but that's probably a bad idea, right? I'm looking for a better idea that allows me to send the changed state of relevant actions across the network in 1 go.
I'm also wondering how to handle the commands on the other end. I'm trying to keep as much overlap as possible between client and server code. It's obviously not possible for everything but I think the input handling could be set up in a way that it doesn't matter if the command came in locally or is being handled on the server. This is also why I want to find a higher-level way of sending out actions to the server. If it's done in the input-handling of the system, I can't reuse that same code on the server.