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.

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? –  Alex M. 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>? –  Alex M. Jan 29 '13 at 20:39
    
Or from another point of view, remain active? –  Alex M. 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
show 3 more comments

1 Answer 1

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
add comment

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.