adonthell-devel
[Top][All Lists]
Advanced

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

[Adonthell-devel] schedule stuff update


From: Kai Sterker
Subject: [Adonthell-devel] schedule stuff update
Date: Mon, 19 Aug 2002 17:26:49 +0200

Hey folks!

Yesterday evening I finally committed the (hopefully) fixed event stuff
and most of the new character schedules. I didn't manage to rewrite all
of them though. See the dev diary for more details.

Anyway, today I continued with the schedule rewrite and also had some
thoughts about saving/restoring the exact state of a schedule.
Unfortunately, the old idea of saving the state from within the script
does not work any more, basically because the events are no longer
members of the script. They're stored in the event_list instead.

The event_list however was partly made to allow saving/restoring any
events it contains. And events that have a complete schedule attached
can easily be saved and restored. Our time_events however only have a
callback to a python method and no complete script.

But, I think I have a way to save and restore this callback as well! As
the event_list only stores events that belong to a character, all the
callbacks are methods of this character's schedule. So if we save the
name of the method in question it should be easy to re-connect that
callback to the event. And it seems that each python method has an
attribute __name__ that, surprise, contains its name as a string.

So it seems that we can easily save and restore all the time_events that
drive the schedule scripts and therefore the exact schedule state. And
best of all, this would work without any additional code in the
schedules themselves!


As an aside, this should also help with the limitation that callbacks to
methods of a character's schedule can only be set from within that
schedule. It would be very useful however, if we could do this from
anywhere: other schedules, dialogues and whatnot.

So that is what I'll be doing now. I hope you like the idea as much as I
do :)


Another thought that fits in here, but has to wait for later:
So far, the player schedule has to remain the old way, as it needs to
poll the input system. However, I believe the new input system is
event-based as well. So maybe we should integrate those input_events
into the map- and time_event stuff. So that the player's schedule is
only called in the case of a keypress it wants to catch, and not
permanently. Then we had actually eliminated all need to run schedules
permanently, and could remove this 'feature' from the code. That would
make everything in the game event-driven, which is a very good thing,
IMO. What do you think, Alex?

Kai




reply via email to

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