Using idle time in turn-based (RPG) games for updating

Posted by The Communist Duck on Game Development See other posts from Game Development or by The Communist Duck
Published on 2010-12-30T16:18:13Z Indexed on 2010/12/30 16:59 UTC
Read the original article Hit count: 431

If you take any turn based RPG game there will be large periods of time when nothing is happening because the game is looping over 'wait_for_player_input'. Naturally it seems sensible to use this time to update things.

However, this immediately seems to suggest that it would need to be threaded. Is this sort of design possible in a single thread?

loop:  
if not check_something_pressed:  
    update_a_very_small_amount  
else  
  keep going

But if we says 'a_very_small_amount' is only updating a single object each loop, it's going to be very slow at updating.

How would you go about this, preferably in a single thread?

EDIT: I've tagged this language-agnostic as that seems the sensible thing, though anything more specific to Python would be great. ;-)

© Game Development or respective owner

Related posts about architecture

Related posts about language-agnostic