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.

In the process of preparing my game for networking I'm adding a layer of seperation between the physical input (mouse/keyboard) and the actual game "engine"/logic. All input that has any relation to the game logic is wrapped inside action objects such as BuildBuildingAction.

I was thinking of having an action processing layer that would determine what to do with the input. This layer could then be set up to either just pass the actions locally to the game engine or send it via sockets to the network server depending on whether the game was single- or multiplayer.

In network games it would make sense that the player's actions should be sent to the server, but should the game logic be pulling (polling?) the data through some sort of interface or should the action processing layer be adding the actions to an input queue in the game logic code?

share|improve this question

2 Answers 2

What type of game is it? How dynamic are the objects?

If it is the type of game that waits for each player to post their turns then that kind of network model will do.

But if the game is realtime players running around then it won't really do because you can't have players waiting around for the server to get all movements before allowing the movement to be sent back.

share|improve this answer

Assuming that your 'action processing layer' spits out data like 'move-right' or 'turn-around', I don't think that it makes any difference whether you push to a queue and read that queue or let the game poll the action processing layer repeatedly. All that happens both on client- and server-side since, of course, both sides need to keep track of user actions.

So I don't see why this would be a network related question. In both cases fresh actions need to be transmitted to the server asap.

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.