Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Game freezing during worldgen  (Read 1715 times)

squamous

  • Bay Watcher
    • View Profile
Game freezing during worldgen
« on: August 28, 2021, 07:10:45 pm »

Anyone familiar with a bug where the game freezes during world generation? Like, it just hangs on a random year until I force quit the program. Pretty sporadic too, it doesn't happen on the same year every time and I can sometimes even generate over a thousand years of history before this happens, or even just finish worldgen. No explanation in the errorlog either. I am currently trying to isolate the bug through process of elimination but it is taking ages and if anyone at all has had this happen to them I would very much appreciate any explanation on how you fixed it, if you did. That would make everything go much quicker.
« Last Edit: August 29, 2021, 01:48:30 am by squamous »
Logged
I make huge and comprehensive overhaul mods, consider supporting me on Patreon so I can do this full-time:
https://www.patreon.com/themodsmith
Have questions? Need to report bugs? Post them in the discord:  https://discord.gg/dGzGr5svS2

DwarfStar

  • Bay Watcher
    • View Profile
Re: Game freezing during worldgen
« Reply #1 on: August 29, 2021, 10:36:01 pm »

I've seen this problem with quite a few mods. I assume it's some rare set of world gen circumstances (perhaps, say, a wereperson giving birth? except that one was fixed) that doesn't happen in vanilla. It's a hassle to use a mod that has this problem, because world gen is always a crap shoot: OK I got an alright world...do I go for 1000 years of history to ensure lots of interesting stuff? Or do I only try for 250 because I'm afraid it will crash before it gets to 500?

One question I didn't research yet: if you run the same world gen starting from the same seed twice, does it crash on the same year? If so then it seems like it should be possible to upload all the mod files plus the seeds (or a whole DF installation with everything in place), and then the devs should be able to catch it happening in the debugger and fix it.

A few things come to mind that could be done with the code that would help with these situations:

* This thread's suggestion, resuming world history generation. So we could save our world with 0 years of history at first, then reload it and generate only 100 years at a time. That way if it crashes on year 467, at least I have 400 years of history to start my fort.
* Date stamp messages to the error log during world gen. Maybe a line for each year (or decade), so we can tell (within a few years) when the crash happened.
* I guess we could log some random events to the game log during world gen, but we'd have to get lucky to log the actual one causing the crash. Still might be worth adding a few random ones just to be able to orient yourself looking through the logs.
Logged

squamous

  • Bay Watcher
    • View Profile
Re: Game freezing during worldgen
« Reply #2 on: August 30, 2021, 03:38:38 pm »

I've seen this problem with quite a few mods. I assume it's some rare set of world gen circumstances (perhaps, say, a wereperson giving birth? except that one was fixed) that doesn't happen in vanilla. It's a hassle to use a mod that has this problem, because world gen is always a crap shoot: OK I got an alright world...do I go for 1000 years of history to ensure lots of interesting stuff? Or do I only try for 250 because I'm afraid it will crash before it gets to 500?

One question I didn't research yet: if you run the same world gen starting from the same seed twice, does it crash on the same year? If so then it seems like it should be possible to upload all the mod files plus the seeds (or a whole DF installation with everything in place), and then the devs should be able to catch it happening in the debugger and fix it.

A few things come to mind that could be done with the code that would help with these situations:

* This thread's suggestion, resuming world history generation. So we could save our world with 0 years of history at first, then reload it and generate only 100 years at a time. That way if it crashes on year 467, at least I have 400 years of history to start my fort.
* Date stamp messages to the error log during world gen. Maybe a line for each year (or decade), so we can tell (within a few years) when the crash happened.
* I guess we could log some random events to the game log during world gen, but we'd have to get lucky to log the actual one causing the crash. Still might be worth adding a few random ones just to be able to orient yourself looking through the logs.

I'm currently just generating worlds over and over until I get the crash, and then removing some files, and then I'll continue to do this until I can gen a large, 1000+ year world over a dozen times without a crash and slowly add files back in until I find the offending one. These are some good suggestions too but I'm not code-savvy enough to do anything but brute-force it.
Logged
I make huge and comprehensive overhaul mods, consider supporting me on Patreon so I can do this full-time:
https://www.patreon.com/themodsmith
Have questions? Need to report bugs? Post them in the discord:  https://discord.gg/dGzGr5svS2

brewer bob

  • Bay Watcher
  • euphoric due to inebriation
    • View Profile
Re: Game freezing during worldgen
« Reply #3 on: September 01, 2021, 08:34:39 am »

I'm not sure if this is of any help, but my previous modding attempt had frequent worldgen freezes and I think I managed to stop them by removing some stuff from the entity files (though I didn't test extensively to see if the issue would've persisted).

Removing MONUMENT and PLAYER_FORTRESS from site types (default, likes, tolerates) lessened the frequency of freezing. After that I removed SITE_VARIABLE_POSITIONS and VARIABLE_POSITIONS from entities that had custom positions. That seemed to end the freezes, but I can't remember if I did some other changes too (didn't take notes and ended up scrapping the project). If it was the variable positions conflicting with custom ones, I don't know if it was just a particular position/responsibility which caused the freezing or all of them.

In my latest attempts I haven't used those tokens in entities, and haven't had any worldgen freezing, but it could very well be something else.

squamous

  • Bay Watcher
    • View Profile
Re: Game freezing during worldgen
« Reply #4 on: September 01, 2021, 11:15:19 pm »

I'm not sure if this is of any help, but my previous modding attempt had frequent worldgen freezes and I think I managed to stop them by removing some stuff from the entity files (though I didn't test extensively to see if the issue would've persisted).

Removing MONUMENT and PLAYER_FORTRESS from site types (default, likes, tolerates) lessened the frequency of freezing. After that I removed SITE_VARIABLE_POSITIONS and VARIABLE_POSITIONS from entities that had custom positions. That seemed to end the freezes, but I can't remember if I did some other changes too (didn't take notes and ended up scrapping the project). If it was the variable positions conflicting with custom ones, I don't know if it was just a particular position/responsibility which caused the freezing or all of them.

In my latest attempts I haven't used those tokens in entities, and haven't had any worldgen freezing, but it could very well be something else.

I've done all that, thanks for the advice. As it happens, I have managed to prevent the crash from happening by removing a selection of creatures and interactions, so I have technically solved the problem in that regard. Now comes the tricky part though, as I need to start adding files back in until one causes a crash, and then I can try and figure out why it is doing that.
Logged
I make huge and comprehensive overhaul mods, consider supporting me on Patreon so I can do this full-time:
https://www.patreon.com/themodsmith
Have questions? Need to report bugs? Post them in the discord:  https://discord.gg/dGzGr5svS2

Fatace

  • Bay Watcher
  • Cease hostilities? Never!
    • View Profile
Re: Game freezing during worldgen
« Reply #5 on: September 06, 2021, 05:01:08 pm »

Anyone familiar with a bug where the game freezes during world generation? Like, it just hangs on a random year until I force quit the program. Pretty sporadic too, it doesn't happen on the same year every time and I can sometimes even generate over a thousand years of history before this happens, or even just finish worldgen. No explanation in the errorlog either. I am currently trying to isolate the bug through process of elimination but it is taking ages and if anyone at all has had this happen to them I would very much appreciate any explanation on how you fixed it, if you did. That would make everything go much quicker.

Ive noticed this issue as well with mine, although the only time Ive noticed it (while i was finding a good random seed for my playthroughs using Advanced Parameters), that game will freeze/hang sometimes if I pause the world generation (to look at what the world looks like), and then resuming it, which it usually freezes around 90 or higher years.
Logged
I once had a 30 dwarf glacier fortress once.. was going great till the dwarf merchants brought along a WereKoala and killed everyone...

squamous

  • Bay Watcher
    • View Profile
Re: Game freezing during worldgen
« Reply #6 on: September 07, 2021, 02:41:55 am »

Anyone familiar with a bug where the game freezes during world generation? Like, it just hangs on a random year until I force quit the program. Pretty sporadic too, it doesn't happen on the same year every time and I can sometimes even generate over a thousand years of history before this happens, or even just finish worldgen. No explanation in the errorlog either. I am currently trying to isolate the bug through process of elimination but it is taking ages and if anyone at all has had this happen to them I would very much appreciate any explanation on how you fixed it, if you did. That would make everything go much quicker.

Ive noticed this issue as well with mine, although the only time Ive noticed it (while i was finding a good random seed for my playthroughs using Advanced Parameters), that game will freeze/hang sometimes if I pause the world generation (to look at what the world looks like), and then resuming it, which it usually freezes around 90 or higher years.

How long did it freeze? For me it was well over several minutes and CPU/memory usage spiked, leading me to believe it was more than just a temporary hang.
Logged
I make huge and comprehensive overhaul mods, consider supporting me on Patreon so I can do this full-time:
https://www.patreon.com/themodsmith
Have questions? Need to report bugs? Post them in the discord:  https://discord.gg/dGzGr5svS2

Fatace

  • Bay Watcher
  • Cease hostilities? Never!
    • View Profile
Re: Game freezing during worldgen
« Reply #7 on: September 08, 2021, 06:12:46 pm »

No clue, after like 5 minutes of the game not responding, I just /die to close it with dfhack.
Logged
I once had a 30 dwarf glacier fortress once.. was going great till the dwarf merchants brought along a WereKoala and killed everyone...

squamous

  • Bay Watcher
    • View Profile
Re: Game freezing during worldgen
« Reply #8 on: September 13, 2021, 04:31:03 pm »

No clue, after like 5 minutes of the game not responding, I just /die to close it with dfhack.

Oh alright, I thought you meant it froze and then started moving again at some point
Logged
I make huge and comprehensive overhaul mods, consider supporting me on Patreon so I can do this full-time:
https://www.patreon.com/themodsmith
Have questions? Need to report bugs? Post them in the discord:  https://discord.gg/dGzGr5svS2