[airstrike] bug in timing code

Eero Tamminen eero.tamminen at netsonic.fi
Thu Sep 1 18:43:17 EDT 2005


(It's a bit too late in the day to grok the whole mail so I answer just
a few points.)

On Thursday 01 September 2005 10:34, Erik Auerswald wrote:
> The comments should be updated and IMHO delays should be specified in
> the same time unit in the whole code. What unit to use (game frames,
> 100ms, 10ms or something else) should be discussed and the result
> documented.

The documentation should be correct & consistent, but don't see it 
necessarily a problem if core uses frame based and game engine uses time
based timings.

It's just that the FRAMERATE should be handled only in one place in the
engine/, in schedule.c, currently it's not:
$ grep FRAMERATE */*.c
core/display.c:    .frame_time = FRAMERATE,
engine/schedule.c:      *timer = now + delay * FRAMERATE / 10;
tests/testengine.c:  for (idx = 0; idx < 2*FRAMERATE; idx++) {

Rest of the code, the game objects (AIs, sprites etc), should then use the 
schedule functions and whatever time base they have.

> All timing code should be based on one representation, either framerate
> or frame duration, given in one define (or variable read from a
> configuration file). If the other information is needed it should be
> deduced from the definition (using a macro or function). Either the
> function wait_frame() (or rather using display.frame_time =
> 1000/FRAMERATE) or rate_limit() should be rewritten to reflect this
> decision. Changing rate_limit() would mean changing delay values in many
> parts of the code. If I hadn't already done this (see attached patch) I
> would object this change as the current code obviously works. ;-)

Hm.  Why you've changed the delay values so much (100 to 900 instead of 1000 
etc.) and to wierd values?

For example:
-       sprite_alarm(120, b, msg_kill());
+       sprite_alarm(1080, b, msg_kill());

When seeing a value like 1080 in a code, I would immediately wonder about
the 80 part, is that somehow significant?  :-)

	- Eero

More information about the airstrike mailing list