credomane / FactorioMods_FactorioMaps

Jeroon's Factorio Maps mod
http://www.factorioforums.com/14582
47 stars 7 forks source link

Can't generate map on large maps #25

Closed jahands closed 6 years ago

jahands commented 6 years ago

On large maps it only creates a single zoom level. The index.html shows this:

CustomMapType.prototype.minZoom = 2;
CustomMapType.prototype.maxZoom = 2;

Any way to fix this?

jahands commented 6 years ago

I saw there was a thread that it happens when using coordinates >4096

jahands commented 6 years ago

Here is a map where this is an issue: https://dl.jha.sh/github/2018/06/05/kxb9b/FactorioMMO-Reddit-June-Community-Map.zip

jahands commented 6 years ago

Looks like this fixes it: local resolutionArray = {8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768} on https://github.com/credomane/FactorioMods_FactorioMaps/blob/master/fm/generateMap.lua#L25

jahands commented 6 years ago

FYI - despite this change I can only generate maps up to 8192x8192 before it crashes (after hitting like 20GB of RAM).

jahands commented 6 years ago

Okay I figured out a solution to it crashing. For large maps, I add a check to only generate screenshots if z is > minZoomLevel like so:

    for z = minZoomLevel, maxZoomLevel, 1 do  -- max and min zoomlevels
        if z >= minZoomLevel+1 then -- add +X for larger maps
            for y = 0, numVScreenshots - 1 do

The game is not entirely consistent on when you need to do this. Usually 8192x8192 maps seem to be fine without this, but on some maps I've found much smaller maps have issues too.