Page 1 of 1

[0.17.79] Crash on force chunk generation request

Posted: Tue Dec 17, 2019 8:39 pm
by orzelek
While trying to make sure that chunks are generated when placing ores in RSO I managed to crash the game.
I was expecting it might not work (generating chunk requests and calling force_generate_chunk_requests from handler of chunk generated event) but did not expect it to die to desktop.
Relevant log part:
log

Re: [0.17.79] Crash on force chunk generation request

Posted: Thu Dec 19, 2019 1:12 am
by Rseding91
Thanks for the report. What you've done is simply unsupported and the only sane way to handle it is to terminate the game. So, don't do that :P

Re: [0.17.79] Crash on force chunk generation request

Posted: Thu Dec 19, 2019 6:04 pm
by orzelek
Rseding91 wrote: Thu Dec 19, 2019 1:12 am Thanks for the report. What you've done is simply unsupported and the only sane way to handle it is to terminate the game. So, don't do that :P
I'm guessing it will survive if chunk requests are from chunk generated event and force generate would get scheduled for next tick?

Re: [0.17.79] Crash on force chunk generation request

Posted: Thu Dec 19, 2019 8:52 pm
by Rseding91
The issue is requesting new chunks in the chunk generated event. It's a run-away system because "force all the queued chunksto generate" generates more, which then get forced, which generates more and so on forever.

So instead, the game detects it's happening and says "no, goodbye"

Re: [0.17.79] Crash on force chunk generation request

Posted: Fri Dec 20, 2019 5:02 pm
by orzelek
Rseding91 wrote: Thu Dec 19, 2019 8:52 pm The issue is requesting new chunks in the chunk generated event. It's a run-away system because "force all the queued chunksto generate" generates more, which then get forced, which generates more and so on forever.

So instead, the game detects it's happening and says "no, goodbye"
This problem is one of reasons I'm not inclined to try and implement it over multiple ticks in mod. I don't see a good way to prevent the runaway on mod side.

Re: [0.17.79] Crash on force chunk generation request

Posted: Fri Dec 20, 2019 5:08 pm
by Klonan
orzelek wrote: Fri Dec 20, 2019 5:02 pm
Rseding91 wrote: Thu Dec 19, 2019 8:52 pm The issue is requesting new chunks in the chunk generated event. It's a run-away system because "force all the queued chunksto generate" generates more, which then get forced, which generates more and so on forever.

So instead, the game detects it's happening and says "no, goodbye"
This problem is one of reasons I'm not inclined to try and implement it over multiple ticks in mod. I don't see a good way to prevent the runaway on mod side.
The PvP scenario calls force_generate_chunk_requests on tick, and it works just fine

What are you trying to do?

Re: [0.17.79] Crash on force chunk generation request

Posted: Sat Dec 21, 2019 1:04 pm
by orzelek
Klonan wrote: Fri Dec 20, 2019 5:08 pm
orzelek wrote: Fri Dec 20, 2019 5:02 pm
Rseding91 wrote: Thu Dec 19, 2019 8:52 pm The issue is requesting new chunks in the chunk generated event. It's a run-away system because "force all the queued chunksto generate" generates more, which then get forced, which generates more and so on forever.

So instead, the game detects it's happening and says "no, goodbye"
This problem is one of reasons I'm not inclined to try and implement it over multiple ticks in mod. I don't see a good way to prevent the runaway on mod side.
The PvP scenario calls force_generate_chunk_requests on tick, and it works just fine

What are you trying to do?
I've noticed some time ago that RSO cheats a bit in chunk generated events.
Ore generation is triggered in one chunk but can spawn in surrounding chunks too. This seems to work in most cases but there are some rare situations where part of patch won't spawn or tree removal will fail since it tries to remove trees before game spawned them (thats what I managed to figure out from debug I think).

Since I do whole patch generation in memory I wanted to make sure all the chunks are spawned first then check where ore should go and spawn it plus remove the trees as needed.

I know that proper way would be schedule this over many ticks but thats a lot of data to store in global over those ticks and it might get tricky to manage so one tick solution would be better. I think simplest thinkg would be to send chunk generation requests from generate chunk then in next on tick call the force generate and spawn the ore patch.