Kalin wrote:
skell wrote:
Basically the presentation of the game and the logic are completely separate - when you input a key DROD Library executes it in the room and returns to the presentation layer list of events that happened. Those events are used to add visual and sound effects, it redraws the room on the screen.
Is the list of events provided in the order they are triggered? So the library could process the whole turn, and then the presentation layer could display each animation one at a time instead of simultaneously?
In addition to what hyperme said there is also the issue of the room state as events don't tell the whole story - there is no event for monster moving and a whole bunch of other things (or they don't have all the details).
The snapshots could solve it all though, in theory. It's not easy though!
but there would need to be a way to do a delta between each step.
Deltaing Cue Events would thankfully be trivial - the event datas are stored in a linked list and new datas are added at the end so you could just go through each event type and remove from the next snapshot as many entries as they are in the older snapshot, starting from the oldest. Whatever is left is new events added since. A bigger problem would be ensuring that the room's snapshot and Cue Events both refer to the same objects as after cloning the room we'd have a new instance for every monster, every character command, etc - all of which would then need to be updated in Cue Events.
Which is, again, doable. During the clone we could make a map of every original to clone and use that when making the Cue Event diff.
But once again - the high level description of this is relatively simple. The issue is actual implementation.
As for when the snapshots should happen probably a good rule of thumb between any major process happening, so things like:
* After player movement
* After every monster movement
* After each tar type grows
* After spikes are processed
* After fire traps are processed
And so on.
____________________________
My website