Reset map revealed

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Malcomn
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Feb 11, 2017 9:39 pm
Contact:

Reset map revealed

Post by Malcomn »

I've messed up code to reveal the map, and now it's too big and I'm having perfomance issues.

Have any code to revert this map reveal?

Image
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5286
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Reset map revealed

Post by Klonan »

Malcomn wrote:I've messed up code to reveal the map, and now it's too big and I'm having perfomance issues.

Have any code to revert this map reveal?

Image

Nope
Mehve
Filter Inserter
Filter Inserter
Posts: 318
Joined: Sat Aug 06, 2016 9:12 pm
Contact:

Re: Reset map revealed

Post by Mehve »

You can use the map seed to get the exact same layout in another game, for what that's worth.
User avatar
StoneLegion
Filter Inserter
Filter Inserter
Posts: 687
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: Reset map revealed

Post by StoneLegion »

Sorry to pop this up again. Why is it lagging? If it's all shutdown it should not lag and this seems to be more of a performance issue / bug if that is the case.
mewtwoEX
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Dec 14, 2017 3:41 am
Contact:

Re: Reset map revealed

Post by mewtwoEX »

This thread popped up when I was doing a search for this main topic. I eventually found the solution in the WIKI. Reproduced below for other people who stumble here.
In answer to the "why is it slow" question, with all those biters to calculate every tick, it certainly would run slow even with no user buildings made.
If much of the map is revealed, it increases the size of the save file. The following command cancels the generation of all chunks that are currently queued for generation and removes chunks outside a 32 chunks radius around 0,0. Note that this will remove player entities if there are any on these chunks.

Code: Select all

/c local surface = game.player.surface;
game.player.force.cancel_charting(surface); 
local chunk_radius = 32;
for chunk in surface.get_chunks() do
  if (chunk.x < -chunk_radius or chunk.x > chunk_radius or chunk.y < -chunk_radius or chunk.y > chunk_radius) then
    surface.delete_chunk(chunk)
  end
end
Reference https://wiki.factorio.com/Console#World_Manipulation
Jap2.0
Smart Inserter
Smart Inserter
Posts: 2379
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Reset map revealed

Post by Jap2.0 »

mewtwoEX wrote:This thread popped up when I was doing a search for this main topic. I eventually found the solution in the WIKI. Reproduced below for other people who stumble here.
In answer to the "why is it slow" question, with all those biters to calculate every tick, it certainly would run slow even with no user buildings made.
If much of the map is revealed, it increases the size of the save file. The following command cancels the generation of all chunks that are currently queued for generation and removes chunks outside a 32 chunks radius around 0,0. Note that this will remove player entities if there are any on these chunks.

Code: Select all

/c local surface = game.player.surface;
game.player.force.cancel_charting(surface); 
local chunk_radius = 32;
for chunk in surface.get_chunks() do
  if (chunk.x < -chunk_radius or chunk.x > chunk_radius or chunk.y < -chunk_radius or chunk.y > chunk_radius) then
    surface.delete_chunk(chunk)
  end
end
Reference https://wiki.factorio.com/Console#World_Manipulation
I assume most, if not all of those biters are inactive, so they should take up very little processing time.
There are 10 types of people: those who get this joke and those who don't.
Post Reply

Return to “Gameplay Help”