View Issue Details
ID | Project | Category | Date Submitted | Last Update | |
---|---|---|---|---|---|
0023279 | AI War 2 | Bug - Gameplay | Jun 10, 2020 5:42 pm | Jun 12, 2020 9:27 am | |
Reporter | ynof | Assigned To | BadgerBadger | ||
Status | resolved | Resolution | fixed | ||
Product Version | Beta 2.063 Fixes and Tweaks | ||||
Fixed in Version | Beta 2.065 To Infinity And... No, Knock It Off | ||||
Summary | 0023279: Save game doesn't make progress | ||||
Description | Original Summary: Hostile Scourge Spawner on Home Planet Summary pretty much says it. Savefile attached. | ||||
Tags | No tags attached. | ||||
|
|
|
Oh, and another thing: the game froze and crashed about an hour in. Granted the map was 160 planets and there's a fair number of factions, but my computer is pretty powerful. I tried to save the game at the crash, but no luck. |
|
Actually, if I load the last autosave the crash happens pretty quickly. So here it is: |
|
Hey Chris, I believe I've resolved the scourge problem, but ynof's "Autosave.3000.save" is definitely in bad shape; I load it and it basically grinds to a halt |
|
Wow, that's literally the worst performing save I've ever seen. And it's not volume of data, either, that I can tell. At least not volume of ships. RAM is not exploding at all, but something that blocks the main sim thread is causing lots of churn. |
|
Something is hitting an infinite loop on a background thread. I'm looking into it. |
|
Okay, Badger, I'm tossing this one back to you. I solved the performance problem part of it, and the game locking up. And also it filling up with thousands of null waves. But it is still generating over 200 waves, which you get an error message about about 8 seconds in. Can you look into that one aspect of it? I don't have a good sense for why or how it would generate that many waves, but they are not on the UI so I assume they are against minor factions. * Fixed a bug where the AI could add null waves into the wave list, causing all sorts of problems. * Put in a limiter where if a single faction tries to add more than 200 waves at once, it will throw an exception. ** In one savegame, we were having linear growth of waves, causing the entire simulation to stop. ** Most of the waves were null, but there are still north of 200 waves generated, so that's a piece we still need to fix separately from that. * PlanWave() has been renamed to PlanWave_OrGetNull(), since it's possible that these don't actually plan a wave if they are for instance trying to do a type of wave that there is no valid target for, or there's no budget for it, or whatever. ** This is a reminder to calling code to check for nullness and not do things like increment counters for successful waves or whatever if it is null. ** Adjusted all the surrounding code to account for this. The only one that was notably affected was wormhole invasions. |
|
I assume this was started on 2.062? I did some rework of Allegiances for this beta, and I screwed it up on 2.062. What's happened here is that the AI is hostile to the Neutral Faction, so it's trying to send waves against it; the game later realizes this is inappropriate and it gets into a loop trying to correct it. I did say that weird stuff could happen to games started in 2.062! I think this is an impossible situation to get into if the allegiances aren't screwed up, and allegiances are now correct in the current build. If ynof is okay with it, I'd say to quit this game and just start a new one. |
|
That seems reasonable to me, personally, but I'm still wary of the fact that so many waves are able to be launched at all. How does it have the budget for that? Is there any way that could happen with factions that are not screwed up? I put in some overflow valves that basically make it not eat the game when this happens, but it still generates enough waves to hit that error message. Do you think it's possible to do an overflow valve of sorts to prevent it from doing this sort of thing ever? The thing that I find unsettling here is that we can't see how many waves are currently in progress in the game at all. So if a game is randomly really slow, there's not a great way to know if maybe there are accidentally 50 waves happening against the nanocaust right now or something. I think that I'm going to actually add the number of queued waves in the escape menu so that it's not invisible anymore, but I still think it's really nice to have it barred from skyrocketing if we can avoid it. TLDR: the sheer invisibility of this (not showing up as unit count spikes or anything I can see in the escape menu or even in profiling directly) has me spooked a bit. So I'm trying to make it more visible and also make sure it doesn't happen more. |
|
So here's what's happening. Lets say we have 3 waves in our QueuedWaves list. Wave 1 Wave 2 (pointed at a Neutral planet, so this is and invalid) Wave 3 We scan them and detect that wave 2 is invalid. This is normally for cases like "the hunter fleet just killed all your units at that planet, so don't bother sending a wave, since this planet is now neutral", but in this case its because the AI thinks its hostile to Neutral Planets. The game then adds a new wave (to replace wave 2), then wave 2 flags itself for removal. So after this step, we now have Wave 1 Wave 2 (flagged for removal) Wave 3 Wave 4 (replacement for wave 2, but unfortunately its also pointed at a neutral planet). We scan wave 3 and its fine. We then scan wave 4 and realize its invalid, so we flag wave 4 for removal and add a new wave 5 Now we have Wave 1 Wave 2 (flagged for removal) Wave 3 Wave 4 (flagged for removal) Wave 5 (replacement for wave 2 and 4, but unfortunately its also pointed at a neutral planet) Wave 5 flags itself for removal, but adds a wave 6 that's pointed at a neutral planet. Repeat ad infinitum. This can only happen when an invalid location for a wave is selected, which will cause that wave to be immediately flagged for removal. It's the side effect of some other bug. I've added some defensive code that basically says "If we detect that we are adding waves then immediately removing them, throw an exception rather than just run infinitely" |
|
That makes a lot of sense! Thanks for that. And if yours somehow gets missed, then my "stop adding after 200" code will catch it and stop the infinite loop, too. So we should be doubly good. I appreciate the explanation. |
Date Modified | Username | Field | Change |
---|---|---|---|
Jun 10, 2020 5:42 pm | ynof | New Issue | |
Jun 10, 2020 5:42 pm | ynof | File Added: Bug.save | |
Jun 10, 2020 5:42 pm | ynof | File Added: Bug.savemet | |
Jun 10, 2020 5:43 pm | ynof | Note Added: 0057261 | |
Jun 10, 2020 5:45 pm | ynof | File Added: Autosave.3000.save | |
Jun 10, 2020 5:45 pm | ynof | File Added: Autosave.3000.savemet | |
Jun 10, 2020 5:45 pm | ynof | Note Added: 0057262 | |
Jun 10, 2020 6:55 pm | BadgerBadger | Assigned To | => Chris_McElligottPark |
Jun 10, 2020 6:55 pm | BadgerBadger | Status | new => assigned |
Jun 10, 2020 6:56 pm | BadgerBadger | Note Added: 0057263 | |
Jun 10, 2020 7:04 pm | BadgerBadger | Summary | Hostile Scourge Spawner on Home Planet => Save game doesn't make progress |
Jun 10, 2020 7:04 pm | BadgerBadger | Description Updated | |
Jun 11, 2020 12:24 pm | Chris_McElligottPark | Note Added: 0057277 | |
Jun 11, 2020 12:44 pm | Chris_McElligottPark | Note Added: 0057278 | |
Jun 11, 2020 1:54 pm | Chris_McElligottPark | Note Added: 0057279 | |
Jun 11, 2020 1:54 pm | Chris_McElligottPark | Assigned To | Chris_McElligottPark => BadgerBadger |
Jun 11, 2020 4:05 pm | BadgerBadger | Note Added: 0057280 | |
Jun 11, 2020 4:30 pm | Chris_McElligottPark | Note Added: 0057281 | |
Jun 11, 2020 5:55 pm | BadgerBadger | Note Added: 0057285 | |
Jun 11, 2020 5:58 pm | BadgerBadger | Note Edited: 0057285 | |
Jun 11, 2020 5:58 pm | BadgerBadger | Status | assigned => resolved |
Jun 11, 2020 5:58 pm | BadgerBadger | Resolution | open => fixed |
Jun 11, 2020 5:58 pm | BadgerBadger | Fixed in Version | => Beta 2.065 To Infinity And... No, Knock It Off |
Jun 12, 2020 9:27 am | Chris_McElligottPark | Note Added: 0057287 |