Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Assume a client-server game where there server manages all state and the clients are simply rendering / input.

How much should I bake user input from the client before sending it off to the server?

Does it make sense to send "jump" or "space keydown"?

I'm inclined to bake the input as much as possible. Am I setting myself up for pain later?

share|improve this question
    
What kind of game are we talking about? –  Nitram Apr 6 '12 at 23:21
    
Do you want your game to support key remapping? –  Kai Apr 7 '12 at 3:32
    
@Nitram, I thought the question wouldn't have a genre specific answer. Either way, side view worms/scorched earth genre. –  deft_code Apr 9 '12 at 18:27
    
@Kai, I don't know :). Ostensibly yeah it will support every feature. In practice YAGNI, or its more vicious cousin YAGHT(you-aint-gonna-have-time). Will the answer be significantly different if user configurable controls are required? –  deft_code Apr 9 '12 at 18:31

2 Answers 2

I'd send "jump", reason being that it applies to each keyboard, gamepad, and AI. "space keydown" might be useful in some cases, but I can't think of any right now.

share|improve this answer
    
+1. You always want to abstract over the details of user input on the client machine. –  DeadMG Apr 7 '12 at 11:44

Speaking from MVC perspective, the client would be the View and the Controller, and the server would run the Model. One of the job of the Controller is to translate raw user input into model-appropriate input (i.e. Spacebar to Jump). Doing it this way will allow the client/controller to easily do key remapping, write alternative controller, and write alternative client (e.g. you might want a mobile-version and a desktop-version playing in the same server; with the controller translating them to mode-appropriate input, you woouldn't need to modify the server to add them).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.