[Solved] Problem with chunk generation

Place to get help with not working mods / modding interface.
ZpmFred
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 30, 2016 9:13 pm
Contact:

[Solved] Problem with chunk generation

Post by ZpmFred »

Hello,

I'm currently developing a mod that deals with surface and i am facing a little problem with chunk generation so i came here in the hope that someone could help me.
Here is the initial situation

On a new map with only my mod, I'm the only player on the map, and i don't move

then
I create a new surface named "nauvis-underground-expansion-1".
(The new surface is striped of all it's entities and resources on chuck generation)
and call the function request_to_generate_chunks({-12, 1], 2) on the new surface
after that I wait like 15 to 30 seconds and call is_chunk_generated({-12, 1}) and it return me false

I fact i have to wait around 5 minutes for it to be generated

To troubleshoot the problem I added an event listener on the on_chunk_generated event and for the whole 5 minus it generate chunk for the nauvis surface, meanwhile my proc is idling at a little 6%

Is this a normal behavior ?
And how can i do to prioritize the chunk generation ?

I hope that with those information someone could help me :)
Last edited by ZpmFred on Fri Jan 27, 2017 9:57 pm, edited 1 time in total.
ZpmFred
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 30, 2016 9:13 pm
Contact:

Re: Problem with chunk generation

Post by ZpmFred »

No one has an idea, explanation or a workaround ?
orzelek
Smart Inserter
Smart Inserter
Posts: 3928
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Problem with chunk generation

Post by orzelek »

I don't think you can do anything about this.

Map gen has a scheduler that works at it's own speed to not cause map stutters. It seems that in your case it's so busy generating map on main surface that it doesn't have time to take a look at yours.
It would be good to prepare a simple test case so that devs could take a look.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5412
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Problem with chunk generation

Post by Klonan »

ZpmFred wrote:Hello,

I'm currently developing a mod that deals with surface and i am facing a little problem with chunk generation so i came here in the hope that someone could help me.
Here is the initial situation

On a new map with only my mod, I'm the only player on the map, and i don't move

then
I create a new surface named "nauvis-underground-expansion-1".
(The new surface is striped of all it's entities and resources on chuck generation)
and call the function request_to_generate_chunks({-12, 1], 2) on the new surface
after that I wait like 15 to 30 seconds and call is_chunk_generated({-12, 1}) and it return me false

I fact i have to wait around 5 minutes for it to be generated

To troubleshoot the problem I added an event listener on the on_chunk_generated event and for the whole 5 minus it generate chunk for the nauvis surface, meanwhile my proc is idling at a little 6%

Is this a normal behavior ?
And how can i do to prioritize the chunk generation ?

I hope that with those information someone could help me :)
If you want it done quickly, just chart the area for the neutral force, it should prioritize the chunks that need charting
ZpmFred
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 30, 2016 9:13 pm
Contact:

Re: Problem with chunk generation

Post by ZpmFred »

Thanks for the reply and idea.

I just tied the charting solution but it does not work it's still generating chunk for nauvis but not for the new surface :(
ZpmFred
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 30, 2016 9:13 pm
Contact:

Re: Problem with chunk generation

Post by ZpmFred »

here are detailed steps to reproduce my situation on vanilla

first create a new game just set in peaceful

Code: Select all

game.create_surface("test-1")
game.surfaces["test-1"].request_to_generate_chunks({-20, -20}, 2)
wait 30 sec

Code: Select all

game.player.print(tostring(game.surfaces["test-1"].is_chunk_generated({-20, -20})))
--> return false

Code: Select all

game.forces["neutral"].chart("test-1", {{-30, -30}, {-10, -10}})
wait another 30 sec

Code: Select all

game.player.print(tostring(game.surfaces["test-1"].is_chunk_generated({-20, -20})))
--> return false again
Rseding91
Factorio Staff
Factorio Staff
Posts: 15999
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Problem with chunk generation

Post by Rseding91 »

http://lua-api.factorio.com/latest/LuaS ... ate_chunks takes world positions

http://lua-api.factorio.com/latest/LuaS ... _generated takes chunk positions

http://lua-api.factorio.com/latest/LuaF ... orce.chart takes a bounding box which is world positions

You're giving the wrong locations to the different calls.
If you want to get ahold of me I'm almost always on Discord.
ZpmFred
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 30, 2016 9:13 pm
Contact:

Re: Problem with chunk generation

Post by ZpmFred »

Ho ho no don't tell me that I just have done that ... RTFM (facepalm)

from this point the chunk generate instantly after the call to request_to_generate_chunk ..

Thank you for the time you spent into helping me :D
Post Reply

Return to “Modding help”