Page 1 of 1

Scenario: Reveal map at start?

Posted: Mon May 15, 2017 5:45 pm
by SilverB1rd
I'm working on a modified version of the wave defense scenario. I would like show the map the start of the game. I was trying different variants of the chart functions and the only one I was able to get working was

Code: Select all

script.on_init(function()
 ...
 game.forces["player"].chart(game.surfaces[1], {{-1024,-1024},{1024,1024}})
end)
Is there a cleaner way to reveal the map? I would have rather used something more generic like chart_all() but it did not seem have any effect during the on_init.

Klonan, any suggestions?

Re: Scenario: Reveal map at start?

Posted: Tue May 16, 2017 8:27 am
by Narc
In what way cleaner? LuaForce.chart_all will chart all generated chunks, like it says in the spec. It shouldn't cause the generation of chunks -- the game map can be very large and prohibitively expensive to generate entirely (or to retain on disk or in memory).

If your scenario map is fixed size, you already know what area to chart to reveal the whole thing, and doing it in on_init makes the most sense. This will also guarantee the entire map is generated on start (not that I've ever noticed Factorio worldgen speed).