Mapshot

by palats

Generates a zoomable render of the whole map.

a month ago
1.0 - 1.1
3169

i Live update

1 year, 2 days ago

I am not familiar with the APIs, but is it possible to make a real-time live updating map similar to the Dynmap for Minecraft?

This should maybe be a separate mod and mimic the minimap instead, as taking screenshot wouldn't be possible.

1 year, 2 days ago

Long story short: unfortunately, no, it is not possible.

Dynmap works as it plugs into Minecraft javaclasses and thus has full access to everything. That is not the case with Factorio - mods have access only to a very specific APIs. In practice, there is no real way to communicate from outside Factorio to a mod dynamically, which makes any kind of dynamic map mostly a non-starter (that's also why things need to be pre-generated). I have some ideas of some hacky mechanisms to make it work, but I'm not sure that would give something really usable.

For the minimap - Factorio has no facility to export it. The Factorio binary has some options to export the map, but that's the bare geography, without anything (e.g., no trains), so it is not that useful.

10 months ago

To continue with this line of method, is it possible to have the script run periodically, but run sequentially to lessen the pausing of the game, or follow the character with a delay?
Or even remove the character(I doubt)?

10 months ago

The "continuous screenshotting" might be interesting. That risk making inconsistent results - e.g., one thing is visible at a zoom level which is different at another zoom level because only one of them has been refreshed recently. But it might not be the end of the world. There would also be the question of what to prioritize to refresh, but I can imagine a few options in practice.

Removing the character - you mean not having the character sprite visible? I don't see any obvious way to do so. But using character position to prioritize refresh of tiles can be imagined.

10 months ago

I don't mind inconsistencies, if it were rendering most of the time, and just updating tiles that changed it probably wouldn't be bad, however, depending on the size of your base, number of bots so on, it could get problematic, but dynamic updates may "freeze" less. :)
Either way, excellent mod.
Quick Q, how does one render to the same hashed folder every time? I'd rather not have to go back to the index and reload to see the new render of the map. :P

10 months ago

For the name of the folder - there are different levels. It roughly looks like: script-output/mapshot>/<savename>/d-<hash>:
- savename is the parameter you give the /mapshot command. If you don't specify one, it will use some hash, but it should be stable across multiple request for a given game (it is based on the generation parameters).
- d-<hash is not customizable, but it should not matter. In practice, the index.html is updated in the script-output/mapshot>/<savename> and thus should not require any knowledge about where the last tiles have been generated.

10 months ago

Hey Palats,

So when I am starting the exe, do I need to pass a command to recognize the name of the map export? Because mine loads with the sub folders as a list, no index.html that I can tell?

10 months ago

Ah yes indeed, when serving from the exe, there is no way to have a generic link. Opened https://github.com/Palats/mapshot/issues/6 to track that.

10 months ago

Might I expand that and suggest an autopurge option for older hashes of the exported maps? (Being that they can be multiple gigabytes.) :P

10 months ago

Autopurge would not be possible (mod don't allow for deletion), but having a garbage collection subcommand on the CLI would be possible indeed. Opened https://github.com/Palats/mapshot/issues/7 to not forget.

New response