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

Unpredictable bug where player is swamped by enemy fighters when entering new area #2

Closed zexlr8er closed 8 years ago

zexlr8er commented 8 years ago

Occurs when player has spent a long time in one area then moves to a new area which contains spawning enemies, resulting in a very large coordinated group of enemies attacking and killing player in seconds. Difficult to replicate, but could try:

1) Spending relatively large amount of time (>15 minutes) on Errxelz 8 planet 2) Leave planet, then navigate south-east to jumpgate to Ennekkomo System. 3) If sufficient time has passed, large group of spawned enemy fighters will mob player, resulting in near instantaneous death

I remember trying to solve this bug by placing major restrictions on the spawning of Alien fighters by Alien Battleship creatures: only when player is within a distance, a random probability, and only if less than X Aliens remaining in the system. This has not resolved the issue.

villemonkkonen commented 8 years ago

I tried but couldn't get this to happen. Have you by chance got a save where you're just about to enter a map where all the spawning happens (from before you've entered the area). I can try it with a debugger to see what activates the spawners. It should be useful info even if it's something to do with mod scripting.

villemonkkonen commented 8 years ago

Looking at how the code works, it seems that the time used for timed effects is cumulative, so that if you're on one map, then that time counts for timers on other maps. For creatures the timer runs only once if it reaches the trigger time, so all creature timers will probably run at once when you open a map. But for objects it runs the timer retroactively when you open a map. So if you spend a lot of time on one map, it runs as many times as needed to make up the lost time. Could that be the cause?

It was designed this way so that you could leave a map and expect the original fungus spawning food generator to have generated you more fungi to eat.

zexlr8er commented 8 years ago

Thanks for looking into this, @villemonkkonen. The areas where I have problems are ones that I have Alien fighters (creatures) spawning from Alien battleships (also creatures). I've finally got a good saved game example of where the issue happens... only thing is, I can't seem to find where the saved games are actually kept in the Steam version!

villemonkkonen commented 8 years ago

Great! The saves are at C:\Users\yourusername\AppData\Roaming\Notrium

zexlr8er commented 8 years ago

@villemonkkonen The savegame can be found here; use on the latest commit: https://github.com/zexlr8er/Wazzal_II/blob/master/sample_saves/s5.sav

When you load it up, head straight to the jumpgate to the neighboring system. Once there, head directly south-east to somewhere between the jumpgate and the sun, and do some big circles for a while. Within a few seconds, streams of dozens of fighters will appear, and kill the player in seconds.

The moment you start in the savegame comes after the player has spent quite a while on a planet in the previous system. I get the feeling that all the spawning events which would have occurred during that time happen almost instantly as soon as the player arrives in the new system, but I really don't know... this issue has been hanging around since the very earliest days of Wazzal II!

villemonkkonen commented 8 years ago

I'm getting swamped by about 50 enemy fighters, and ysing a debugger reveals that there are actually no enemies spawned on the map, except for the missiles which are spawned creatures. All the fighters are there from the beginning, they're preset in areas.dat, so if you want to reduce the number, that's the place to do it. The problem here is that for some reason they all attack at once, so next I'm going check out why that happens.

zexlr8er commented 8 years ago

@villemonkkonen So the problem may be more associated with the creatures added in "areas.dat" than generated via spawning? That would explain why my attempts to solve the problem by adjusting spawning have failed, and also possibly fits with something I recently found in a terrestrial area ("4;//Errxelz 8"): I experimented adding approximately 50 aliens from the beginning (in "areas.dat") rather than through spawning. Usually in Notrium this results in creatures being spread randomly throughout an area, but this time I encountered a large group of approximately 50 aliens all together up in the north-east corner of the map, which then chased the player in one group across the map. This is particularly strange given the terrestrial Aliens use an AI ("0;//Attack Normal") which shouldn't encourage clumping/leader following.

villemonkkonen commented 8 years ago

They're all attacking at once because something has triggered the "alien attack" earlier. That's effect 2, and that's used by the main game to trigger the ending when you use the subspace radio, and it causes all available aliens on all maps to attack you. If this isn't the intent, I can try to play the game and see if I can find what triggers effect 2. Shall I have a look?

zexlr8er commented 8 years ago

@villemonkkonen I searched all the scripts for "2;//effect" and found three instances of that effect: the death blocks of three Alien spawners (18 Landed fighter (Enemy spawner); 61 Landed L fighter (on alien planet); 62 Landed S fighter (on alien planet), i.e. the spawing fighter creatures the Captain destroys on planets). I can't recall adding this, but I imagine the purpose was to cause a limited attack to occur when the player threatens an Alien spawner.

Would this actually cause attacks of all Alien creatures (both on planets and in space) to continue for the rest of the game's entire duration? That would certainly explain the issue (especially how it only occurs after the player spends time on a terrestrial area), and would be a trivial fix.

villemonkkonen commented 8 years ago

Yes, it causes. I originally intended the game to end during the attack, so it continues on and on even if you change the map. I can easily add a script to disable it or a parameter to time it, but then your mod would only be compatible with the new Steam version. :)

zexlr8er commented 8 years ago

I think I will just go with removing those effects for now; I didn't realise it was even in the code so it won't be missed. Thanks for identifying the effect as the issue - that's now all of the major bugs from the older versions theoretically fixed!

villemonkkonen commented 8 years ago

You're welcome!