How many "chunks" are loaded?

Place to get help with not working mods / modding interface.
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

How many "chunks" are loaded?

Post by ficolas »

I am making world generation for my mod, and I was thinking:
I need to generate the world inside the chunks that are loaded, or it may not work... but how many chunks are loaded?
So I need to know that to make the worldgen part of the f mod

MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: How many "chunks" are loaded?

Post by MF- »

I am not sure that there is any chunkloading/unloading.
Shouldn't unloading the chunks with your power plant kill your power?

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: How many "chunks" are loaded?

Post by ficolas »

Im not sure about chunk unloading, but im sure about chunk loading ( the map is infinite, but it generates when you go throught the chunks), obiously, your computer cant interpretate infinite chunks.

kovarex
Factorio Staff
Factorio Staff
Posts: 8194
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: How many "chunks" are loaded?

Post by kovarex »

All generated chunks are active all the time.
Providing event like "chunk-generated" could help.

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: How many "chunks" are loaded?

Post by ficolas »

but how many chunks are generated? what distance from the player

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: How many "chunks" are loaded?

Post by FreeER »

Probably the most useful answer here would be how many 'chunks' are generated around the player at start (assuming that is the buffer around the player where if a chunk is not loaded it becomes loaded).
ficolas wrote:I am making world generation for my mod, and I was thinking:
I need to generate the world inside the chunks that are loaded, or it may not work... but how many chunks are loaded?
So I need to know that to make the worldgen part of the f mod
Well assuming that your terraforming worked based off placing a machine down then (once we know) as along as it doesn't go farther than what the buffer is around the player it would work fine. I'd take a wild guess (until we get an answer) that it's only slightly more than the size of the minimap. Which would still be a fairly insane amount of land to terraform, even if it took an hour or two :)

PS. this would explain for sure why my 71 mb save is down to only 20fps :) perhaps a console command to unload chunks more than x away from the player could be implemented so I can actually play this save again lol?
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: How many "chunks" are loaded?

Post by ficolas »

I think the game should unload the chunks, for multiplayer, it needs to be done if multiplayer will be public server based (I hope it is like so) and im sad that world gen will be so bad in my mod, becaise the player will be so near to the player, or I just had an idea xD, the worldgen wont be runned untill the player is near.

MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: How many "chunks" are loaded?

Post by MF- »

ficolas wrote:I think the game should unload the chunks, for multiplayer, it needs to be done if multiplayer will be public server based (I hope it is like so) and im sad that world gen will be so bad in my mod, becaise the player will be so near to the player, or I just had an idea xD, the worldgen wont be runned untill the player is near.
Agreed, there will be a need for chunkloading in the future.
On the other hand - I am not sure that unloading inactive chunks (those that have no running machinery) would improve the situation.

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: How many "chunks" are loaded?

Post by slpwnd »

MF- wrote:On the other hand - I am not sure that unloading inactive chunks (those that have no running machinery) would improve the situation.
Good point. I don't have the data however I would guess that unloading the chunks wouldn't help that much because there are mostly just fish and creepers there.

User avatar
Lukasecicek
Inserter
Inserter
Posts: 26
Joined: Mon Mar 11, 2013 9:42 am
Contact:

Re: How many "chunks" are loaded?

Post by Lukasecicek »

I have sort of solution for the performace, with the help of actual "factory" buildings. Will write it down into detail right after i get some sleep.

kovarex
Factorio Staff
Factorio Staff
Posts: 8194
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: How many "chunks" are loaded?

Post by kovarex »

The radius is up to 3 chunks far from the player (so 7X7 chunks around the player should be always there).
Chunk is 64X64 tiles.

Concerning the performance issues, there is lot of optimisations that can be done, and later, we can implement multithreaded game update as well, so don't worry the limits will get much bigger.
I don't know how does it work in your maps, but the results of our profiling showed, that most of the time of the update was spent in the factory.

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: How many "chunks" are loaded?

Post by FreeER »

so 49 chunks minimum (3 on each side and the chunk the player is in) at start. I'm assuming there is no way to currently tell if a chunk is unloaded yet (for instance you wanted to use game.createentity out at say x=5000 y=5000, or would the game load the chunk before it tried to create an entity there)? Not a huge issue if your doing something around the player since the world never UNloads right now :) Have you decided which update will include world gen possibilties?

edit: btw, just created a stone furnace at 5k, 5k and teleported to check it out. It created the furnace fine...I lagged on teleport and was pretty much instantly killed by creepers :) ah, what a sight to behold however :lol:

edit again: um, just wanted to recommend that you do NOT try teleporting to 50k, 50k...it literally took win 7 over five minutes just to tell me that factorio had stopped responding :) and ate 96% of my 6 GBs of ram + 76% of my swapfile (5.6 GB) lol, cpu was only about 25% but that could be because factorio isn't multi-threaded (yet ) :lol: This makes me wonder how chunk loading works when teleporting however, if it only loaded the 49 chunks around me at spawn and then the 49 chunks at 50k,50k it shouldn't have crashed like it did (at least I wouldn't think so).
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net

MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: How many "chunks" are loaded?

Post by MF- »

Here is a fun *hypothesis*:

Creeper spawners might be placed in the same way as items when you remove a chest (they explode around)
at 50k,50k there was a lot of spawners "in the chest that exploded".
So much that there is actually more spawners to be exploded around than the actual space.
And that would probably cause infinite terrain generation.

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: How many "chunks" are loaded?

Post by ficolas »

Ok so I can place entities far away, but the question is:
Why?
Because the chunk loads when the entity is placed?
or because the entity is placed in an unloaded chunk?

the first one let me do world gen, the second one doesnt, I need to clear the terrain by removing all entities there...

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: How many "chunks" are loaded?

Post by FreeER »

just try it and see what happens :) that's what I did (and almost regretted it when i teleported to 50k,50k lol)
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net

Post Reply

Return to “Modding help”