Giter Club home page Giter Club logo

mapshot's People

Contributors

daniels1989 avatar kiwiz avatar palats avatar sakuro avatar soul-burn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mapshot's Issues

CMD window closes immediately on running mapshot.exe directly.

Hello!
I think this is a great mod, however, I am having trouble just viewing the default html file on windows.
It should be able to run seeing the code there, however, it is unable to load the mapshot.json due to the link being a file:/// rather than http://
I have tried editing the js file that is generated from however it isn't following my change.
I was wondering if you've tried this, or if this is not possible.

Timelapse feature

Absolutely love this mod, especially that you managed to do it without relying on external tools!
Would it be possible to implement a timelapse feature, like https://github.com/L0laapk3/FactorioMaps does?
Would be nice to have a map that allows easily switching between snapshots.

Idea for the future: Keeping track of chunks, so non-modified chunks can simply be reused. Probably not too easy though.

Better understanding

Hey Palats,

Just wanted to ask how you generate the whole map, excluding black tiles?
I would like to be able to zoom into all the ground around my base, and right to the edge of where the map is populated.
Is this possible?

Suggestion of Steam issue solution

When I try to launch mapshot to render a map for my save, this window appears:
image
and the program says: "Error: factorio exited early" even if I press OK.
Here is the log:

$ ./mapshot-linux render test --factorio_binary factorio_link/bin/x64/factorio --alsologtostderr --factorio_verbose
I1112 16:06:52.085064   28920 factorio.go:275] Path /opt/factorio does not exists, skipped
I1112 16:06:52.086357   28920 factorio.go:282] Found factorio data dir: /home/namerif/.factorio
I1112 16:06:52.086409   28920 factorio.go:275] Path /home/namerif/factorio does not exists, skipped
I1112 16:06:52.086433   28920 factorio.go:275] Path /home/namerif/Library/Application Support/factorio does not exists, skipped
I1112 16:06:52.086453   28920 factorio.go:289] Using Factorio data dir: /home/namerif/.factorio
I1112 16:06:52.086469   28920 factorio.go:275] Path /opt/factorio does not exists, skipped
I1112 16:06:52.086484   28920 factorio.go:282] Found factorio data dir: /home/namerif/.factorio
I1112 16:06:52.086497   28920 factorio.go:275] Path /home/namerif/factorio does not exists, skipped
I1112 16:06:52.086511   28920 factorio.go:275] Path /home/namerif/Library/Application Support/factorio does not exists, skipped
I1112 16:06:52.086520   28920 factorio.go:289] Using Factorio data dir: /home/namerif/.factorio
I1112 16:06:52.087334   28920 factorio.go:355] Factorio binary found: factorio_link/bin/x64/factorio
I1112 16:06:52.087355   28920 factorio.go:362] Using Factorio binary: factorio_link/bin/x64/factorio
I1112 16:06:52.087379   28920 render.go:105] runid: b7f357c9-88c2-4ca7-8a67-20b1b48000e5
I1112 16:06:52.087486   28920 root.go:30] temp dir: /tmp/mapshot3663988854
I1112 16:06:52.087517   28920 factorio.go:116] Looking for save "test"; test does not exists.
I1112 16:06:52.087534   28920 factorio.go:116] Looking for save "test"; test.zip does not exists.
I1112 16:06:52.087762   28920 factorio.go:110] Looking for save "test"; /home/namerif/.factorio/saves/test.zip exists.
Generating mapshot "test" using file /home/namerif/.factorio/saves/test.zip
I1112 16:06:52.093038   28920 render.go:125] copied save from "/home/namerif/.factorio/saves/test.zip" to "/tmp/mapshot3663988854/test.zip"
I1112 16:06:52.093567   28920 factorio.go:183] copying mod mod-list.json from /home/namerif/.factorio/mods/mod-list.json to /tmp/mapshot3663988854/mods/mod-list.json
I1112 16:06:52.094088   28920 factorio.go:206] created mod-list.json
I1112 16:06:52.095460   28920 render.go:141] mod created at "/tmp/mapshot3663988854/mods/mapshot"
I1112 16:06:52.095602   28920 render.go:94] overrides file created at "/tmp/mapshot3663988854/mods/mapshot/overrides.lua"
I1112 16:06:52.095627   28920 render.go:155] removed done-file "/home/namerif/.factorio/script-output/mapshot-done-b7f357c9-88c2-4ca7-8a67-20b1b48000e5": remove /home/namerif/.factorio/script-output/mapshot-done-b7f357c9-88c2-4ca7-8a67-20b1b48000e5: no such file or directory
Starting Factorio...
I1112 16:06:52.095716   28920 factorio.go:124] Running factorio with args: [--disable-audio --disable-prototype-history --load-game /tmp/mapshot3663988854/test.zip --mod-directory /tmp/mapshot3663988854/mods]
   0.000 Initializing Steam API.
Running Steam on linuxmint 20.1 64-bit
STEAM_RUNTIME is enabled automatically
Steam runtime environment up-to-date!
Steam client's requirements are satisfied
WARNING: Using default/fallback debugger launch
/home/namerif/.local/share/Steam/ubuntu12_32/steam steam://run/427520//%27--disable-audio%27%20%27--disable-prototype-history%27%20%27--load-game%27%20%27%2Ftmp%2Fmapshot3663988854%2Ftest.zip%27%20%27--mod-directory%27%20%27%2Ftmp%2Fmapshot3663988854%2Fmods%27
   0.000 Steam requires game restart, restarting...
I1112 16:07:01.323575   28920 factorio.go:151] Factorio returned: <nil>
I1112 16:07:01.324636   28920 root.go:37] temp dir "/tmp/mapshot3663988854" removed
Error: factorio exited early

OS: Linux Mint 20.1 Cinnamon x64
Steam installed from the official website

Garbage collection of old exported maps

Each mapshot is fairly large, so keep the number under control would make sense. We can imagine keeping (for example) just the last one for a given map (based on generation parameter).

Garbage collection cannot be done from the Factorio mod, as it is impossible to delete file. So, a subcommand of the CLI should do the trick.

Support listing saves versions from just the static files

Currently, listing available versions of a given serve is only available through mapshot serve subcommand - the list of available saves is obtained by scanning which mapshot.json exist and built the UI dynamically.

It might be possible to maintain static files able to generate a listing without using the serve command; the trick would be to use the append mode in write_file to maintain a listing. In practice, the approach would be:

  • When creating a mapshot, append basic info to a listing file - e.g., name of the version and maybe a timestamp or similar. The format of the listing file need to support basic appends - so that rules out clean json.
  • Create also a listing.html or similar.
  • That frontend would load up the listing file from javascript, parse it, and generate a simple list UI.

Notes:

  • This is likely that the listing UI would be different from the one in serve, as less information would be readily available from static files.
  • Unclear what the default behavior should be - maybe gate that behind a parameter or something.
  • The listing file should not contain too much data; otherwise it would grow fairly large, leading to problematic load times.
  • Whether to also do that across saves (e.g., maintaining a list of saves, not just the list of versions for a given save) might be interesting but has its own problem; e.g., people might not want to show what exists to everyone.

Dynamic render resolution

As of writing, the whole map is rendered at the same resolution levels. However:

  • Given that the area chosen is square, lots of space is not interesting, esp. those not containing any player structure.
  • Highly detailed area are costly to render and store, even if there is nothing interesting.

It would be interesting to explore having a more dynamic rendering - with limited resolution where there is nothing of interest and better resolution on player structure for example.

It might not be completely straightforward:

  • Detecting whether there is something of interest or not is doable, maybe even with some configurability. It might be expensive to query many parts of the map, but I suspect that Factorio is quite efficient here.
  • We would need to store which zone is rendered at which level of details. In JSON, it might end up being some amount of data, though we can probably manage something decent there.
  • That would probably require to convince Leaflet to use a mix of tiles for rendering (based on that information). Leaflet is relatively simple, that might make be tricky.

[Original suggestion from Soul-Burn on the mod page]

Option ‘disable-audio’ does not exist

I just got your Linux binary for my headless RHEL 8 Server and run into this error:

$ # xvfb-run ./mapshot render --factorio_datadir /opt/factorio/data/ --factorio_binary /opt/factorio/bin/x64/factorio /opt/factorio/saves/MPsave.zip --alsologtostderr --factorio_verbose
I1125 23:56:54.765740   24994 factorio.go:282] Found factorio data dir: /opt/factorio/data/
I1125 23:56:54.765955   24994 factorio.go:289] Using Factorio data dir: /opt/factorio/data/
I1125 23:56:54.765962   24994 factorio.go:282] Found factorio data dir: /opt/factorio/data/
I1125 23:56:54.765965   24994 factorio.go:289] Using Factorio data dir: /opt/factorio/data/
I1125 23:56:54.765972   24994 factorio.go:355] Factorio binary found: /opt/factorio/bin/x64/factorio
I1125 23:56:54.765974   24994 factorio.go:362] Using Factorio binary: /opt/factorio/bin/x64/factorio
I1125 23:56:54.765982   24994 render.go:105] runid: 566c1847-f44e-4c9b-acea-fc09e8b47511
I1125 23:56:54.766013   24994 root.go:30] temp dir: /tmp/mapshot3901792460
I1125 23:56:54.766021   24994 factorio.go:110] Looking for save "/opt/factorio/saves/MPsave.zip"; /opt/factorio/saves/MPsave.zip exists.
Generating mapshot "MPsave" using file /opt/factorio/saves/MPsave.zip
I1125 23:56:54.771201   24994 render.go:125] copied save from "/opt/factorio/saves/MPsave.zip" to "/tmp/mapshot3901792460/MPsave.zip"
I1125 23:56:54.771314   24994 factorio.go:183] copying mod mod-list.json from /opt/factorio/data/mods/mod-list.json to /tmp/mapshot3901792460/mods/mod-list.json
I1125 23:56:54.771391   24994 factorio.go:206] created mod-list.json
I1125 23:56:54.771761   24994 render.go:141] mod created at "/tmp/mapshot3901792460/mods/mapshot"
I1125 23:56:54.771843   24994 render.go:94] overrides file created at "/tmp/mapshot3901792460/mods/mapshot/overrides.lua"
I1125 23:56:54.771860   24994 render.go:155] removed done-file "/opt/factorio/data/script-output/mapshot-done-566c1847-f44e-4c9b-acea-fc09e8b47511": remove /opt/factorio/data/script-output/mapshot-done-566c1847-f44e-4c9b-acea-fc09e8b47511: no such file or directory
Starting Factorio...
I1125 23:56:54.771917   24994 factorio.go:124] Running factorio with args: [--disable-audio --disable-prototype-history --load-game /tmp/mapshot3901792460/MPsave.zip --mod-directory /tmp/mapshot3901792460/mods]
Option ‘disable-audio’ does not exist

Usage:
  factorio [OPTION...]

 General options:
  -h, --help                    display help
      --version                 show version information
  -v, --verbose                 enable verbose logging
  -c, --config PATH             config file to use
      --no-log-rotation         don't rotate log file
      --mod-directory PATH      Mod directory to use
      --check-unused-prototype-data
                                Print a warning for all prototype values that
                                were not accessed.
      --executable-path PATH    Override autodetected __PATH__executable.
                                Usually not needed except on very weird systems.

 Running options:
  -s, --map2scenario arg        map to scenario conversion
  -m, --scenario2map arg        scenario to map conversion
      --apply-update arg        immediately apply update package
      --create FILE             create a new map
      --map-gen-settings FILE   Map generation settings for use with
                                --create, --start-server-load-scenario or
                                --generate-map-preview. See
                                data/map-gen-settings.example.json
      --map-gen-seed SEED       Map generation seed for use with --create,
                                --start-server-load-scenario or
                                --generate-map-preview. Will override seed specified in map
                                gen settings
      --map-gen-seed-max SEED   Map generation seed for use with
                                --generate-map-preview to generate multiple previews using
                                every second seed in the interval from
                                map-gen-seed to map-gen-seed-max.
      --map-settings FILE       Map settings for use with --create or
                                --start-server-load-scenario. See
                                data/base/prototypes/map-settings.lua
      --preset arg              Name of the map generation preset to be used.
      --generate-map-preview PATH
                                Generate preview images of the map; PATH
                                should name a PNG file or end with a '/' or '\' to
                                indicate a directory.
      --generate-map-preview-random COUNT
                                Number of maps to generate with a random seed
                                using --generate-map-preview.
      --map-preview-size SCALE  Size (in pixels) of map preview (default:
                                1024)
      --map-preview-scale SCALE
                                Scale (meters per pixel) of map preview
                                (default: 1)
      --map-preview-offset X,Y  Offset of the center of the map, in meters
                                (default: 0,0)
      --noise-outputs TAG,TAG...
                                Indicate which variables of noise program to
                                output
      --slope-shading SHADEAMOUNT
                                Apply elevation shading to map preview
      --slope-shade-property SHADEPROP
                                Property to apply slope shading to (default:
                                elevation)
      --report-quantities PROTOTYPE,...
                                When generating map preview, report
                                approximate quantities of the named entity prototypes
      --threads THREADCOUNT     Number of threads to use when generating map
                                previews
      --disable-migration-window
                                Disables the gui that is shown when opening a
                                save with migrated content
      --instrument-mod arg      Name of a mod to enable Instrument Mode
      --start-server FILE       start a multiplayer server
      --start-server-load-scenario [MOD/]NAME
                                start a multiplayer server and load the
                                specified scenario. The scenario is looked for
                                inside the given mod. If no mod is given, it is
                                looked for in the top-level scenarios directory.
      --start-server-load-latest
                                start a multiplayer server and load the
                                latest available save
      --until-tick TICK         run a save until given map tick
      --benchmark FILE          load save and run benchmark
      --benchmark-ticks N       number of ticks for benchmarking. Default is
                                1000 (default: 1000)
      --benchmark-runs N        how often the number of ticks will be run,
                                map will reload after each run. Default is 1
                                (default: 1)
      --benchmark-verbose timings
                                comma separated list of timings to output
                                each tick. "all", "timestamp" as well as all
                                other values seen in the debug view are allowed
                                here. An empty string disabled verbose
                                benchmarking. (default: )
      --benchmark-sanitize      only output the final benchmark results
      --benchmark-ignore-paused
                                leaves the game paused if it was paused when
                                saved. By default the game is unpaused when a
                                benchmark starts.
      --output-perf-stats FILE  path of file to which rendering performance
                                statistics measurements should be saved.
                                Special tags {api}, {hw}, {time} and {tag} will be
                                replaced.

 Server options:
      --port N                  network port to use
      --bind ADDRESS[:PORT]     IP address (and optionally port) to bind to
      --rcon-port N             Port to use for RCON
      --rcon-bind ADDRESS:PORT  IP address and port to use for RCON
      --rcon-password PASSWORD  Password for RCON
      --server-settings FILE    Path to file with server settings. See
                                data/server-settings.example.json
      --use-server-whitelist    If the whitelist should be used.
      --use-authserver-bans     Verify that connecting players are not banned
                                from multiplayer and inform Factorio.com
                                about ban/unban commands.
      --server-whitelist FILE   Path to file with server whitelist.
      --server-banlist FILE     Path to file with server banlist.
      --server-adminlist FILE   Path to file with server adminlist.
      --console-log FILE        Path to file where a copy of the server's log
                                will be stored
      --server-id FILE          Path where server ID will be stored or read
                                from

I1125 23:56:54.776065   24994 factorio.go:151] Factorio returned: exit status 1
I1125 23:56:54.787064   24994 root.go:37] temp dir "/tmp/mapshot3901792460" removed
Error: factorio exited early: exit status 1

Factorio Version:

$# /opt/factorio/bin/x64/factorio --version
Version: 1.1.48 (build 59155, linux64, headless)
Binary version: 64
Map input version: 0.18.0-0
Map output version: 1.1.48-0

Can I fix that myself? I mean.. without recompiling. :)

Additional Layers

it would be really cool to have different layers that overlay on top of the main map, to display things like pollution and/or the power grid.
Doing this should be relatively easy by just reading the respective data in lua, and emitting SVG files that leaflet could display, although you would have to look up the specifics yourself.

Question on running in headless linux server using xvfb

My question is : Does the bad parameter opengl error actually prevent the program from running or it's just taking long to run?

Here is the command i use:

xvfb-run ./mapshot-linux render /opt/factorio/saves/_autosave1.zip --factorio_binary /home/kahdeg/factorio/factorio/bin/x64/factorio --alsologtostderr --factorio_verbose

Here is the log:
kahdeg@ubuntu-s-1vcpu-1gb-sgp1-01:~/factorio$ xvfb-run ./mapshot-linux render /opt/factorio/saves/_autosave1.zip --factorio_binary /home/kahdeg/factorio/factorio/bin/x64/factorio --alsologtostderr --factorio_verbose
I0710 17:55:55.415234 16550 factorio.go:282] Found factorio data dir: /opt/factorio
I0710 17:55:55.419056 16550 factorio.go:275] Path /home/kahdeg/.factorio does not exists, skipped
I0710 17:55:55.419230 16550 factorio.go:282] Found factorio data dir: /home/kahdeg/factorio
I0710 17:55:55.419331 16550 factorio.go:275] Path /home/kahdeg/Library/Application Support/factorio does not exists, skipped
I0710 17:55:55.419420 16550 factorio.go:289] Using Factorio data dir: /home/kahdeg/factorio
I0710 17:55:55.419507 16550 factorio.go:282] Found factorio data dir: /opt/factorio
I0710 17:55:55.419568 16550 factorio.go:275] Path /home/kahdeg/.factorio does not exists, skipped
I0710 17:55:55.419623 16550 factorio.go:282] Found factorio data dir: /home/kahdeg/factorio
I0710 17:55:55.419677 16550 factorio.go:275] Path /home/kahdeg/Library/Application Support/factorio does not exists, skipped
I0710 17:55:55.419728 16550 factorio.go:289] Using Factorio data dir: /home/kahdeg/factorio
I0710 17:55:55.419805 16550 factorio.go:355] Factorio binary found: /home/kahdeg/factorio/factorio/bin/x64/factorio
I0710 17:55:55.419860 16550 factorio.go:362] Using Factorio binary: /home/kahdeg/factorio/factorio/bin/x64/factorio
I0710 17:55:55.419945 16550 render.go:100] runid: 145cef61-79cb-4f3d-a4de-bb40b67b56c3
I0710 17:55:55.420055 16550 root.go:30] temp dir: /tmp/mapshot145082056
I0710 17:55:55.420124 16550 factorio.go:110] Looking for save "/opt/factorio/saves/_autosave1.zip"; /opt/factorio/saves/_autosave1.zip exists.
Generating mapshot "_autosave1" using file /opt/factorio/saves/_autosave1.zip
I0710 17:55:55.491328 16550 render.go:120] copied save from "/opt/factorio/saves/_autosave1.zip" to "/tmp/mapshot145082056/_autosave1.zip"
I0710 17:55:55.491751 16550 factorio.go:183] copying mod Aircraft from /home/kahdeg/factorio/mods/Aircraft_1.7.2.zip to /tmp/mapshot145082056/mods/Aircraft_1.7.2.zip
I0710 17:55:55.605142 16550 factorio.go:216] copied mod file "/home/kahdeg/factorio/mods/Aircraft_1.7.2.zip" to "/tmp/mapshot145082056/mods/Aircraft_1.7.2.zip"
I0710 17:55:55.605395 16550 factorio.go:183] copying mod AsphaltPaving from /home/kahdeg/factorio/mods/AsphaltPaving_1.3.1.zip to /tmp/mapshot145082056/mods/AsphaltPaving_1.3.1.zip
I0710 17:55:55.658041 16550 factorio.go:216] copied mod file "/home/kahdeg/factorio/mods/AsphaltPaving_1.3.1.zip" to "/tmp/mapshot145082056/mods/AsphaltPaving_1.3.1.zip"
I0710 17:55:55.658305 16550 factorio.go:183] copying mod PavementDriveAssistContinued from /home/kahdeg/factorio/mods/PavementDriveAssistContinued_3.0.1.zip to /tmp/mapshot145082056/mods/PavementDriveAssistContinued_3.0.1.zip
I0710 17:55:55.665668 16550 factorio.go:216] copied mod file "/home/kahdeg/factorio/mods/PavementDriveAssistContinued_3.0.1.zip" to "/tmp/mapshot145082056/mods/PavementDriveAssistContinued_3.0.1.zip"
I0710 17:55:55.665845 16550 factorio.go:183] copying mod Todo-List from /home/kahdeg/factorio/mods/Todo-List_19.2.0.zip to /tmp/mapshot145082056/mods/Todo-List_19.2.0.zip
I0710 17:55:55.672228 16550 factorio.go:216] copied mod file "/home/kahdeg/factorio/mods/Todo-List_19.2.0.zip" to "/tmp/mapshot145082056/mods/Todo-List_19.2.0.zip"
I0710 17:55:55.672249 16550 factorio.go:183] copying mod mod-list.json from /home/kahdeg/factorio/mods/mod-list.json to /tmp/mapshot145082056/mods/mod-list.json
I0710 17:55:55.674500 16550 factorio.go:206] created mod-list.json
I0710 17:55:55.680940 16550 render.go:136] mod created at "/tmp/mapshot145082056/mods/mapshot"
I0710 17:55:55.681245 16550 render.go:89] overrides file created at "/tmp/mapshot145082056/mods/mapshot/overrides.lua"I0710 17:55:55.681410 16550 render.go:151] removed done-file "/home/kahdeg/factorio/script-output/mapshot-done-145cef61-79cb-4f3d-a4de-bb40b67b56c3": remove /home/kahdeg/factorio/script-output/mapshot-done-145cef61-79cb-4f3d-a4de-bb40b67b56c3: no such file or directory
Starting Factorio...
I0710 17:55:55.681662 16550 factorio.go:124] Running factorio with args: [--disable-audio --disable-prototype-history --load-game /tmp/mapshot145082056/_autosave1.zip --mod-directory /tmp/mapshot145082056/mods]
0.000 2021-07-10 17:55:55; Factorio 1.1.35 (build 58756, linux64, full)

0.173 Operating system: Linux (Ubuntu 18.04)
0.173 Program arguments: "/home/kahdeg/factorio/factorio/bin/x64/factorio" "--disable-audio" "--disable-prototype-history" "--load-game" "/tmp/mapshot145082056/_autosave1.zip" "--mod-directory" "/tmp/mapshot145082056/mods"
0.173 Read data path: /home/kahdeg/factorio/factorio/data
0.173 Write data path: /home/kahdeg/factorio/factorio [7748/50668MB]
0.173 Binaries path: /home/kahdeg/factorio/factorio/bin
0.188 System info: [CPU: Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz, 1 core, RAM: 1993 MB]
0.188 Environment: DISPLAY=:99 WAYLAND_DISPLAY= DESKTOP_SESSION= XDG_SESSION_DESKTOP= XDG_CURRENT_DESKTOP= __GL_FSAA_MODE= __GL_LOG_MAX_ANISO= __GL_SYNC_TO_VBLANK= __GL_SORT_FBCONFIGS= __GL_YIELD=
0.189 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
0.331 Available displays: 1
0.331 [0]: screen - {[0,0], 640x480, SDL_PIXELFORMAT_RGB565, 0Hz}
0.380 Error Util.cpp:83: Failed to create OpenGL context: Could not create GL context: BadValue (integer parameter out of range for operation)

here i was waiting for about 1 minute then i manually CTRL+C the process

^C 70.653 Received SIGINT, shutting down
XIO: fatal IO error 4 (Interrupted system call) on X server ":99"
after 442 requests (61 known processed) with 0 events remaining.

Rich-text tags not rendered in station names

Station names using richtext icons are displayed with the raw [item=nullius-iron-ingot] etc. text, which makes them quite hard to read if those are heavily used.

image

I'm guessing this is a limitation of the mod API that doesn't let you directly save sprites to the output directory, but I wonder if it could be worked around somehow by rendering a spritesheet GUI of used icons and then screenshotting that? Or perhaps as a post-process command on the command-line tool that can copy the appropriate icons from the game mod files.

Should not include pictures of non-generated chunks

Thank you for the mod.

I generated a map of a savefile that was made using Factorio World and it looks like this: https://nixx.is-fantabulo.us/ultradeath/

As you can see, there are some monstrous blobs of land that shouldn't be there. In the regular save file that land is unexplored, so it's not generated.
My guess is:

  1. Your script takes a peek at a chunk that doesn't exist yet
  2. Factorio generates the piece of land that would usually be there, given the map seed which otherwise is mostly ignored
  3. The screenshot is taken
  4. the Factorio World script now tries to react and put the correct terrain there, but it's too late

The simplest solution I could think of would be to not attempt to look at chunks that don't exist.
However, I'm guessing that would result in bad cropping around the edges?

My next idea would be to figure out all the places we need to look at, look at them, give the game some time to generate the chunks fully, and then take the screenshots.

You can get the save yourself at https://nixx.is-fantabulo.us/UltraDeath.zip

Add delay on render to render flames

From Mazmot on Factorio forum:

Having an option to delay capturing will make nicer look & feel for furnaces.

In CLI version, this mod try to capture as soon as the save file loaded.
But stone/steel/electric furnaces don't start to firing at that timing.
So, the generated map looks weird because no flame on furnaces.
https://imgur.com/sRvYM3r

I modified a bit for myself: mazmot-is@df54564

Overall, it would indeed be nice to have better visual. I would like to keep the ability to also render without delay - it is more predictable and so on. A flag to set the delay could do the trick - though I wonder what the default should be between:

  • No delay by default, predictable, but worse visuals
  • Delay by default, better render, but a bit surprising (esp. if that's several seconds of extra delay).

I'll need to try things out a bit.

Can you also compile your releases to ARM architecture?

The file says it's a:
mapshot-linux13: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=uddLtPxdcvoAGXUXjLzN/18KPkQR-w3AkfEdyv7ZO/8woBqF8KCDZW7lw-YD2O/r5WVmHnTYn0RB8KU0AgZ, not stripped

Before creating #12 I was able to run it on my raspberry pi, but after an apt-get update I'm getting an error:
bash: ./mapshot-linux13: cannot execute binary file: Exec format error which is completetly makes sense, since raspi is an ARM architecture.
And you can't run an 64bit LSB executable on an ARM.

mapshot@raspberrypi:~ $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4
...

So my question is, will you able to provide an ARM compiled version with your releases?

Empty "tags" object

On line 84 of index.html
info.tags gets checked with an if(){} statement, in my case my tags object was empty like so

"tags":{}

The if(){} returns true because an empty JavaScript object is a truthy value. This causes the for loop on line 85 to throw an error because it can't iterate.

The fix (I think would be best) is to check for the length of keys in the object.

if (Object.keys(info.tags).length > 0) {
//
}

Headless, OpenGL context: Could not create GL context: BadValue

Hey,

I had a hard time running factorio with Xvfb on ubuntu, factorio keep crashing with the message

Failed to create OpenGL context: Could not create GL context: BadValue (integer parameter out of range for operation)

I found a workaround so i'm sharing it here.
You can fix the OpenGL context by installing VirtualGL
https://sourceforge.net/projects/virtualgl/files/

Then execute this script

#!/bin/bash

# Start Xvfb
Xvfb :0.0 -screen 0 1920x1080x24 -ac +extension GLX +render -noreset &

# Set display and run with vglrun (virtualgl), add your mapshot args here
DISPLAY=:0 vglrun ./mapshot-linux render <args>

echo "Killing Xvfb"
jobs
kill %1

Failed to run(linux nogui with xvfb+virtualgl) after 1.1.36 update.

Worked perfectly previously with 1.1.35 version, linux nogui with xvfb+virtualgl.
Using mapshot CLI mode.
It breaks after 1.1.36 update, settings unchanged, factorio mods unchanged, only factorio binaries and data folder replaced.

Additional Info:
Bio_Industries 1.1.10 was the last mod to load settings in normal startup sequence(w/o mapshot).
Seems after loading all mod settings factorio crashes.
Tried starting factorio 1.1.36 version with all original settings and mods in xvfb+virtualgl environment and no mapshot mod, it would start successfully.

mapshot version 0.0.13(latest)

Crash Log:


/* success log lines omitted */

0.877 Loading mod settings Bio_Industries 1.1.10 (settings.lua)
Factorio crashed. Generating symbolized stacktrace, please wait ...
Raw stacktrace: 0xd30617, 0xf0e88d, 0xb37939, 0xb603dc, 0xfb346f, 0xfb37ee, 0x19796b0, 0x8b125a, 0x10ca216, 0x10ca3b8, 0x111dfd5, 0x132148c, 0x133b0b9, 0x5c7051, 0, 0x5d743e
14.864 Warning Logger.cpp:526: Symbols.size() == 24, usedSize == 15
#0 0x0000000000f0e88d in std::__uniq_ptr_impl<LoggerFileWriteStream, std::default_delete >::_M_ptr() const at /home/build/gcc-9.2/include/c++/9.2.0/bits/unique_ptr.h:154
#1 0x0000000000b37939 in std::unique_ptr<LoggerFileWriteStream, std::default_delete >::get() const at /home/build/gcc-9.2/include/c++/9.2.0/bits/unique_ptr.h:353
#2 0x0000000000b603dc in std::unique_ptr<LoggerFileWriteStream, std::default_delete >::operator->() const at /home/build/gcc-9.2/include/c++/9.2.0/bits/unique_ptr.h:347
#3 0x0000000000fb346f in Logger::flush() at /tmp/factorio-build-Wo8XA6/src/Util/Logger.cpp:566
#4 0x0000000000fb37ee in Logger::logStacktrace(StackTraceInfo*) at /tmp/factorio-build-Wo8XA6/src/Util/Logger.cpp:552
#5 0x00000000019796b0 in Logging::flush() at /tmp/factorio-build-Wo8XA6/src/Util/Logging.cpp:69
#6 0x00000000008b125a in Logging::logAndAbortOrThrow(char const*, unsigned int, LogLevel, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) at /tmp/factorio-build-Wo8XA6/src/Util/Logging.cpp:103
#7 0x00000000010ca216 in Logging::logAndAbortOrThrow(char const*, unsigned int, LogLevel, char const*, ...) at /tmp/factorio-build-Wo8XA6/src/Util/Logging.cpp:93
#8 0x00000000010ca3b8 in ModManager::getActiveValidRequiredMod(std::basic_string_view<char, std::char_traits >) at /tmp/factorio-build-Wo8XA6/src/Data/ModManager.cpp:1286
#9 0x000000000111dfd5 in ModSettingPrototype::ModSettingPrototype(PropertyTree const&, ModSettingType, char const*) at /tmp/factorio-build-Wo8XA6/src/Data/ModSettings/ModSettingPrototype.cpp:12
#10 0x000000000132148c in BoolSettingPrototype::BoolSettingPrototype(PropertyTree const&, char const*) at /tmp/factorio-build-Wo8XA6/src/Data/ModSettings/BoolSettingPrototype.cpp:13
#11 0x000000000133b0b9 in BoolSettingPrototype::load(PropertyTree const&) at /tmp/factorio-build-Wo8XA6/src/Data/ModSettings/BoolSettingPrototype.cpp:45
#12 0x00000000005c7051 in PrototypeList::executeLoader(ModSettingPrototype* (*)(PropertyTree const&), PropertyTree const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) at /tmp/factorio-build-Wo8XA6/src/ID/PrototypeList.cpp:30
#13 (nil) in std::function<void (PropertyTree const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)>::operator()(PropertyTree const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) const at /home/build/gcc-9.2/include/c++/9.2.0/bits/std_function.h:690
#14 0x00000000005d743e in ModSettingsLoader::loadPrototypes(PropertyTree const&) at /tmp/factorio-build-Wo8XA6/src/Data/ModSettings/ModSettingsLoader.cpp:34
#15 (nil) in ModManager::loadModSettingsPrototypes(ModManager::LuaHistoryData&) at /tmp/factorio-build-Wo8XA6/src/Data/ModManager.cpp:798
#16 0x0000000001bad4e4 in ModManager::loadModSettingPrototypes(std::vector<ModID, std::allocator > const&, ModManager::LuaHistoryData&, bool) at /tmp/factorio-build-Wo8XA6/src/Data/ModManager.cpp:1004
#17 0x000000000000001f in ModManager::loadData(bool)::{lambda()#3}::operator()() const at /tmp/factorio-build-Wo8XA6/src/Data/ModManager.cpp:393
#18 0x0000000005ecbe10 in ModManager::loadData(bool) at /tmp/factorio-build-Wo8XA6/src/Data/ModManager.cpp:413
#19 0x0000000005ecbe10 in GlobalContext::init(bool, bool, bool, std::optional) at /tmp/factorio-build-Wo8XA6/src/GlobalContext.cpp:508
#20 0x0000000006fd1126 in MainLoop::run(Filesystem::Path const&, Filesystem::Path const&, bool, bool, std::function<void ()>, Filesystem::Path const&, MainLoop::HeavyMode) at /tmp/factorio-build-Wo8XA6/src/MainLoop.cpp:274 (discriminator 2)
#21 0x00007ffee2ea4860 in main at /tmp/factorio-build-Wo8XA6/src/Main.cpp:1141
#22 0x00000000ffffffff in ?? at ??:0
#23 0x8f5c28f5c28f5c29 in _start at ??:?
Stack trace logging done
28.673 Warning Logger.cpp:526: Symbols.size() == 19, usedSize == 14
28.673 Error ModManager.cpp:1286: Mod not found: void.
Logger::writeStacktrace skipped.
28.673 Error Util.cpp:97: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.
441.827 Received SIGINT, shutting down

Thanks for reading this issue, if you need any further information please let me know.

Always exits with error?

 108.343 Script @__mapshot__/control.lua:267: Unique ID: bfa07e93
 108.344 Script @__mapshot__/control.lua:278: Map ID: c580f963
 108.344 Script @__mapshot__/control.lua:70: Mapshot target mapshot/default/
 108.344 Script @__mapshot__/control.lua:71: Mapshot data target mapshot/default/d-bfa07e93/
 108.344 Script @__mapshot__/control.lua:72: Mapshot unique id bfa07e93
 108.344 Script @__mapshot__/control.lua:76: Available surface: 1 nauvis
 108.437 Script @__mapshot__/control.lua:235: Tile size 1024: 4 tiles to generate
 108.437 Script @__mapshot__/control.lua:235: Tile size 512: 4 tiles to generate
 108.438 Script @__mapshot__/control.lua:235: Tile size 256: 9 tiles to generate
 108.438 Script @__mapshot__/control.lua:235: Tile size 128: 16 tiles to generate
 108.439 Script @__mapshot__/control.lua:235: Tile size 64: 42 tiles to generate
 108.441 Script @__mapshot__/control.lua:117: Mapshot done at mapshot/default/d-bfa07e93/
 131.022 Script @__mapshot__/control.lua:307: marking as done @1236812
I1105 04:37:08.244170      41 render.go:194] done file "/opt/factorio/script-output/mapshot-done-126b3ace-8d5a-4e85-8df5-625d2e1c844e" now exists
I1105 04:37:08.244279      41 render.go:200] output at mapshot/default/d-bfa07e93/
Output: /opt/factorio/script-output/mapshot/default/d-bfa07e93
I1105 04:37:08.244380      41 factorio.go:139] interrupt requested
I1105 04:37:08.244389      41 render.go:205] removed done-file "/opt/factorio/script-output/mapshot-done-126b3ace-8d5a-4e85-8df5-625d2e1c844e": <nil>
 131.124 Received SIGINT, shutting down
 131.616 Quitting: signal.
 131.659 Info BlueprintShelf.cpp:720: Saving blueprint storage.
 131.899 Goodbye
I1105 04:37:09.067831      41 factorio.go:151] Factorio returned: exit status 255
I1105 04:37:09.180875      41 root.go:37] temp dir "/tmp/mapshot3171645376" removed
Error: error while running Factorio: exit status 255

This is being executed in A Context, but I've been struggling tonight with behavior parity between "executing in situ" and "manual invocation".

Detect which mod to load

In the implementation, mapshot render uses the list of mods from the current Factorio install. It means that the render can include or exclude some mods compared to what the save was using in reality. Ideally, mapshot render should get the list of mods used by the save and only activate those.

A save file does contain the list of mods which were in use at the moment the save was created - this is displayed in the UI. Unfortunately, this information is only contained in script.dat, which format is largely an implementation detail of Factorio. That makes it hard for mapshot render to find out which mod to activate or deactivate at the moment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.