Real-time Games

If you want your game to work in real-time, set the realtime_interval tag in the prelude.

realtime_interval 0.5

The number indicates how long each realtime frame should be. In the above case, twice a second the game engine will tick, but with no input. Player input is processed as regular.

So, there are two sorts of ticks - one where the player has input, and then realtime ones - to tell them apart, you can search for this pattern.

(only triggers on real-time ticks)
[ stationary Player ] [ a ] -> [ Player ] [ b ] 

(only triggers in response to player input)
[ moving Player ] [ c ] -> [ moving Player ] [ d ] 

Because you're working on a realtime game, you might want to limit the speed at which a player can move - you can do this with the throttle_movement prelude switch:


With this switch, if you press the same direction multiple times in rapid succession, you'll still move no more quickly than key_repeat_interval. You can still alternate directions quickly, and press action as quickly as you like.

A small note on the interaction of realtime and again:

If again is triggered, no realtime ticks will happen until the again stuff has finished.

Note: Apologies for not including any examples here. Other people have used realtime a bunch to varying effects, some of which I like, but I'm still trying to find a good simple example that shows it off at its best. Drop me a line if you have a suggestion for a good example. :)