Quote
Originally Posted By: Norbyte
Some nice research here!

Ameranth:
Indeed! Thank you again for the effort Abraxas, it's nice to know that a strategy like this is possible, whether or not it would be safe/would require significant testing before implementation.

Thanks for all your comments and interest!

Quote
Originally Posted By: Norbyte
A possible optimization would be adding a flag to the RootTemplate to indicate that the character can be safely destroyed without consequences, which would allow the engine to clean up the majority of characters. I'm not sure if characters lingering there forever is a problem in practice though, a roughly ~1M save size growth [by killing all characters on all maps] will likely not matter.

Ameranth:
Certainly would be a nice addition.


Probably the largest benefit of such cleanup, apart from save file reduction, is that the scripts would no longer need to be loaded in/their events would no longer need to fire.

Indeed, local characters don't seem to contribute much to the save file; global characters are the majority (a bit concerning thinking of all the events they might receive in modded games and the amount of events Osiris receives from them) which leads me to a question I always ask myself when I add events to character scripts:

What exactly does the engine do when an event occurs, e. g. OnCharacterStatus? Does it look through all scripts of all global characters and all scripts of all local characters (of the current level) and check if there's an OnCharacterStatus event scripted or does it already know which characters to check if this event occurs? And how much of a difference is there in terms of performance if there is 1) no OnCharacterStatus event in any of the scripts, 2) one OnCharacterStatus event in the scripts of every character which doesn't match the conditions (e. g. not the required status), so no actions are performed, 3) one OnCharacterStatus event in the scripts of every character which does match the conditions and performs one action, 4) ten OnCharacterStatus events in the scripts of all characters which don't match the conditions, 5) ten events in the scripts of all characters that do match the conditions...
In short: How much effect on the game's performance do I have to expect whenever I add an additional event to the 'Base' script, which all characters share; is it more efficient to have one OnCharacterStatus event block for several possible status events, checking the status inside the ACTIONS part and executing further actions if it is equal to certain statuses, rather than scripting several OnCharacterStatus event blocks? And how many events can I add until there is a notable effect on the amount of hardware resources required to perform this?


My mods for DOS 1 EE: FasterAnimations - QuietDay - Samaritan