SANDBOX — this is a test environment. No servers are actually deployed and no real payments are charged.
Back to NxLabs

NxLabs / Factorio

Mapshot

PBy palats

Generates a zoomable render of the whole map.

Description

Mapshot for Factorio

*Mapshot* generates zoomable screenshots of Factorio maps - example.

They can be created in 2 ways:

  • Through a regular Factorio mod, providing an extra command to create a mapshot.
  • Through a CLI tool generating a mapshot of any saved game - without having to activate mods on your game. Factorio is used for rendering.

The generated zoomable screenshots can be explored through a web browser, using the CLI tool to serve them. As those mapshots are exported as static files (html, javascript, jpg), they can also be served through any HTTP server - see below.

Some simple layers are generated - currently it is possible to show train stations and map labels (chart tags).

*Warning: Generation can take quite a while. Factorio UI will appear frozen during that time; this is normal.*

See https://github.com/Palats/mapshot for more details.

Installing

The Factorio mod can be installed like any other mod from the Factorio UI.

The optional CLI is used for serving generated mapshots and generating mapshots from outside the game. The standalone binaries can be downloaded from https://github.com/Palats/mapshot/releases; then:

  • Linux: Mark as executable if needed and run - this is a standard command line tool.
  • Windows: For convenience, if the .exe file is launched directly from Explorer, it will automatically start the serving mode. Otherwise, you need a way to give the tool parameters - either by launching it from the cmd console, or by creating a shortcut (with extra parameters in the properties).
  • MacOS: A binary is provided ("darwin" version), but is completely untested as I have no access to a MacOS system.

An externally maintained package for Arch is also available, thanks to Sharparam.

Creating a mapshot

In Factorio

In the Factorio console, run:

/mapshot <name>

It will create a website in the Factorio script output directory, in a subdirectory called mapshot/<name>/. If <name> is not specified, a name based on the seed and current tick will be generated (modding API does not gives access to savename, hence no good default naming).

With the CLI

To generate a mapshot:

./mapshot render <savename>

where savename is the name of the save you want to render. It will not modify the file - specifically, despite mod usage, it will not impact achievements for example. This will run Factorio to generate the mapshot - let it run, it will shut it down when finished. As with the regular mod, the output will be somewhere in the script-output directory.

This commands takes the list of mods to load from the current active list in Factorio config - not the list of mods which were used when the save was created. This can lead to inconsistent renders; see https://github.com/Palats/mapshot/issues/20.

If your Factorio data dir or binary location are not detected automatically, you can specify them with --factorio_datadir and --factorio_binary. You can also override the rendering parameters - see CLI help for the specific flag names.

Steam version of Factorio is not supported for now - see https://github.com/Palats/mapshot/issues/21 for more details. If you have only a Steam version, you can still get a standalone version on factorio.com by linking your Steam account.

> [!WARNING] > Headless version of Factorio is not supported as it lacks the ability to render any image. > Most common symptom is Factorio failing with Option ‘disable-audio’ does not exist.

Parameters

You can tune parameters such as many layers to generate, their resolution and a few more details. Those parameters are:

  • ... in Factorio per-player mod settings interface (in the menu, settings/Mod settings/Per player).
  • ... command line arguments for the CLI.

Parameters:

  • _Area_ (area) : What to include in the mapshot. Options:
  • player [default]: Include all chunks containing entities belonging to the 'player' force.
  • entities: Include all chunks which contain at least one entity of some interest. This should capture the base in practice. When no entities are found, all chunks are rendered.
  • all: All chunks.
  • _Smallest tile size_ (tilemin) : Indicates the number of in-game units the most detailed layer should contain per generated tile. For example, if it is set to 256 while the "Tile Resolution" is 1024, it means that the most detailed layer will use 4 pixels (=1024/256) per in-game tile. Many assets in Factorio seem to allow for up to 64 pixels per game tile - so, to have the maximum resolution, you will want to have "Smallest tile size" set to 16 (=1024/64) - careful, that is slow.
  • _Largest tile size_ (tilemax) : Number of in-game units per generated tile for the least detailed layer. See tilemin for more details. Mapshot will generates all layers from tilemax to tilemin (included).
  • _Prefix to add to all generated filenames._ (prefix) : Mapshot will prefix all files it creates with that value. Factorio mods only allow writing within script-output subdirectory of Factorio data dir; the prefix is relative to that directory.
  • _Pixel size for generated tiles._ (resolution) : Size in pixels for the generated images. There is not a lot of reasons to change this value - if you want more or less details, change tilemin.
  • _Pixel size for generated tiles._ (jpgquality) : Compression quality for the generated image.
  • _Pixel size for generated tiles._ (minjpgquality) : Compression quality for the generated image when no player entities are present. If set to 0, do not render a tile at all; instead, the map rendering will fallback to a lower zoom level as needed.
  • _Surface name._ (surface) : Restrict w

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.