zexlr8er / Wazzal_II

Wazzal II: The Final Dawn mod for Notrium
http://www.instantkingdom.com/forum/viewtopic.php?t=823
9 stars 2 forks source link

Game critically freezes in desert planet when visited after extended gameplay #58

Closed zexlr8er closed 8 years ago

zexlr8er commented 8 years ago

New version will hopefully include new desert planet with a major tank vs tank battle ("21;//Desert planet Garreempir;//area name"). I've probably tried to do more than Notrium can strictly support in this area (dozens of creatures fighting at a time), but so far in my testing the area has loaded and run reasonably well when entered right after loading the game.

However, when entering the game after e.g. 1 hour of extended gameplay, Notrium freezes completely and does not fix itself for at least 20 minutes. This freezing even prevents me from closing the game using Task Manager; the only way I can exit Notrium is to completely restart my laptop.

@villemonkkonen: I've uploaded a savegame where this issue occurs here (pull latest version of code): https://github.com/zexlr8er/Wazzal_II/blob/master/s1.sav . I was wondering if there's any way you can give me any insights into what is causing the freeze (spawners? too many creatures/props?) so I can try and make the area playable? Just be careful you don't have any important things running at the same time, as there's a good chance the freezing may also force you to restart!

zexlr8er commented 8 years ago

A similar problem also occurs when entering area "3;//Water planet ---- Naquarin;//area name", but to a much smaller extent (freezing for ~20 seconds)

villemonkkonen commented 8 years ago

I'll have a look, it sounds like a bug in the game engine causing an infinite loop.

villemonkkonen commented 8 years ago

Found it. Something called an Alien light (81) is adding all the lights it has missed out from before. We're getting up to millions of lights in the one location, so it's stalling. I'm going to add a limit of something like a 1000 lights so it will help a bit. As for the mod, it's the same as before with the timing - objects and items roll the missed time, creatures don't - so it might be possible to change the light to a creature. Or make the light destroy and recreate a new copy of itself, I don't recall if that was possible though. Or see if the code change is enough for the performance, though you may still end up with a lot of extra lights in the beginning.

villemonkkonen commented 8 years ago

I released a new version that limits lights to 1000, and that seems to work nicely with that particular scenario. Great looking map by the way!

zexlr8er commented 8 years ago

@villemonkkonen Brilliant, this makes the map load perfectly. In fact it also makes other areas load more smoothly - along with the freezing problem, in the past I often noticed the game engine struggling at the beginning of areas, with lots of jittering and missed frames for ~10 seconds. That seems to happen a lot less now, so it's quite possible it was caused by lighting issues.

A question: would a simple "player is nearer than x" condition prevent plot objects from making up for missed events? i.e. if the player isn't actually in the area, the events wouldn't have been triggered in the first place? I think I looked into this when trying to solve #2, but can't remember what I concluded.

villemonkkonen commented 8 years ago

A condition would check the current situation, so the location would be where the player is when entering the map. If no lights are near that, then that's the ticket. Making the light a creature would be the only surefire way I think, but I don't know what that exactly entails.