adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] game-timing


From: Kai Sterker
Subject: [Adonthell-devel] game-timing
Date: Sun, 5 May 2002 21:57:02 +0200

Well, I committed the first part of the new schedules. Actually, little
is done on the schedules themselves so far.

As we said that schedules should be able to have some sort of counter
that tells them how long they should run, and as said counter should
count gametime minutes for easing its use, I had to start work with the
gametime stuff.

The goal was to make the current gametime class independent from the
rest of the code. Therefore I made a seperate gamedate class that keeps
track of the current time.

The next step is to readd the time event, as I think it is more
convenient to have an event telling a script that its time is over
instead of polling the current gametime each cycle.

I am currently thinking of writing a special event handler for those
time events. The old solution was to check through all registered time
events whenever a gametime minute passed, whether they should be raised
or not. It might be much faster though to store the time when the first
registered event should be raised with the event handler. Then most of
the work will be done when registering time events, which doesn't happen
very often. Whenever a minute of gametime passed, only one comparison
needs to be made.

And if all time events are sorted by the time they need to be raised,
not much has to be done once the first event is raised. We simply look
at the next event, and either raise it too (in which case we look at the
following, etc) otherwise it'll specify when the next event has to be
raised.

Hope I made myself halfway clear - otherwise you'll have to wait for the
code :). 

Btw, even though the current event system is pretty nice (being generic
and all that) maybe there is some room for speedups by using specialized
event handlers instead. Have to check that some day. Possibly before
adding mapevents to the new mapengine.

Kai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]