adonthell-devel
[Top][All Lists]
Advanced

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

[Adonthell-devel] new and updated code summary


From: Kai Sterker
Subject: [Adonthell-devel] new and updated code summary
Date: Sun, 9 Jun 2002 00:15:39 +0200

I've finally found some time to continue on the character schedule
stuff. (Sphair: talking about Morrowind was a bad idea ;).)

I've practically completed the gamedate and time_event stuff, as this is
needed for the character schedules. Apart from seperating the different
event classes into different files, I also plan a change to the
event_handler. Instead of handling events itself, it'll handle
specialized event handlers. That was necessary to allow a efficient
implementation of the time events, but I imagine that other events will
benefit from this as well.

As an alternative, we could possibly even remove the generic
eventhandler and use the specialized ones directly; we'll have to see
what makes more sense.


The gametime class is completely independent from gamedate this time.
And, as suggested, gamedate is based on game cycles, not on realtime.
However, gamedate is closely tied to the time events: whenever a minute
of gametime passed, the gamedate::update function looks whether a time
event needs to be raised. As time events are sorted by their 'alarm
time', this will require only a single comparison, no matter how many
time events are registered.


Time events (and any other type of events) can now be repeated a certain
number of times (or forever). For time events, it is possible to specify
a delay between two occurances. This delay (and the original alarm time)
has to be given as a string in a certain format. "2h" means 2 hours (as
does "120m"), etc. It's possible to combine those, e.g "1h30m". Possible
format letters are (w)eek, (d)ay, (h)our and (m)inute. Others can be
added if neccessary. 

The alarm time can be set to a relative date (i.e. n hours from now) or
an absolute one (i.e. week 1, day 3, hour 12).


As far as the schedule stuff goes, I hope to get a little demo going
soon. Probably next week. As I said, there's the manager script that
determines what schedule runs at a given time. It is possible to limit
the time a schedule runs with the schedule::set_alarm function. This
makes use of the time events to run the manager script once the
specified time has passed, As an alternative, the schedule script may
call schedule::set_running (false) to indicate that it is finished and
the manager script should pick a new schedule (or the same again).
Finally, a schedule script may call schedule::set_schedule to change the
current schedule without the manager script interfering. In that case,
any pending alarm is cancelled. Of course it is also possible to
exchange the manager script, or to change the alarm time from the
schedule. That should give plenty of possibility to create life-like
character behaviour.


To speed up the schedules as such, I've implemented a way to partly save
and restore the scripts internal state. (Hope that really works!)
Therefore, we no longer need to keep everything in the character
storage, but can use python class variables. This state saving/loading
is part of the py_object class and therefore available to all scripts.
But I guess it is only useful for the schedule stuff, as there are too
many restrictions at present.


Okay, that's been a brief summary of the stuff I committed recently. For
more details, read the code. It's well enough documented, I think :).

Kai



reply via email to

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