Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The only games I've made have been the game loop variety. I'm just starting to think about building an online poker game where people could meet up in a lobby, etc. Cards seem event based... is the game loop strategy viable here? Or is it just a waste of time to keep running while waiting for someone to make a move?

share|improve this question
How can you check if someone made a move if you don't run something continuously to do just that? – user15805 Jan 29 '13 at 20:24
Using events/messages, as is common in GUI applications. – drxzcl Jan 29 '13 at 20:36
Doesn't then, an event listener, have to continuously <listen>? – user15805 Jan 29 '13 at 20:39
Or from another point of view, remain active? – user15805 Jan 29 '13 at 20:40
You've never heard of event listeners and/or the Observer pattern? Long story short, yes something does have to be continuously listening, but that something could just be one organized hub rather than everything in the entire game looping over and over. – jhocking Jan 29 '13 at 20:54
up vote 3 down vote accepted

Strictly separate your game engine from the rest of the project, such as GUI, net code, etc. The game engine itself should be event-based, let the OS provide the "game loop" in form of its regular event handling. Make all game events that are relevant to the outside accessible through events to which the GUI and all other parts can subscribe. Then you are free to implement your GUI whichever way you want.

share|improve this answer

Your Answer


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.