Closed marimelon closed 2 years ago
I'm not too familiar on how Factorio manages the difference surfaces in details, but that should be largely doable I imagine. Currently, the mod only generates for nauvis indeed. The take_screenshot calls allow to specify the surface to render, so it should be possible to do a render per surface. As far as I can tell, it is also possible to automatically list surface.
Some metadata would be needed in mapshot.json
files but that would be trivial. Some thoughts would be needed for exact UI, but the UI library used (leaflet) has support for multiple layers, so something should be doable (it would be a different base layers, which is different from overlays, but still).
[to be clear - I have no immediate plan to write this feature myself for now though]
/c for _, s in pairs(game.surfaces) do game.take_screenshot{surface = s, daytime = 1.0, path = s.name .. ".png" } end
This worked as expected after a bit of coaching from discord. I'll take a look at the mod code and see if it is beyond my noob lua skills to fix.
If you are on discord we could have a conversation. Otherwise, I'm looking at control.lua. There are a few things to be done I think.
mapshot
into two functions, one that deals with 'all' the data, and one that deals with a particular surfacegen_layer
to take the surface and use it in the take_screenshot
callThe simplest version of this would simply generate a uniquely named mapshot instance per layer per game. The more complex version would bundle up the layers for a single game into a flipbook of maps.
Ok, I started digging a bit in the code to remember the details, one thing led to another and now there is support for other surfaces in https://github.com/Palats/mapshot/tree/surfaces ( https://github.com/Palats/mapshot/commit/202364c880f807a42722c466dfeea88f653de411 ).
This is not in the main branch for now as I don't have anything to test it with - would you have by any chance a modded save with non default surfaces that you can give me for me to test?
Yes, I do. Sorry for the delay - real life happened. What's the best way to share some saves with you?
Also, is there an 'all' option?
For sharing the save - any file sharing thing like google drive, dropbox or microsoft onedrive would do the trick. If you prefer to not have a public link, you can send it to my mail (I've updated my github profile with it) - though in that case, please indicate whether it is fine or not to share screenshot of that save.
For the all
option - yeah, that would make sense. I might change the final approach a tiny bit, which will make it more natural to have a all
option.
Actually, with mod https://mods.factorio.com/mod/ParallelWorlds I can easily do some basic testing of multi-surfaces (without having to do a run with SpaceExploration that is :) .
Try this one:
https://drive.google.com/file/d/1PMYjI8orR1edLyavYDr6gJcPYYZGBj74/view?usp=sharing
Feel free to share anything about or from this save. Use it for screenshots for your mod for all I care. It should have several surfaces, each with something there to look at. The nauvis world also has a range of scales that seems to not work super well with the default map rendering settings - at some zooms it appears a bit too pixelated or blurry. I've not figured out exactly what setting tweaks will fix that though.
Thanks for the save! I have now a better version of the support for surfaces, which will render all surfaces by default. I haven't uploaded it yet, as I still need to update the viewer UI to allow switching between those.
(for the zoom level at which it is blurry - the default settings of mapshot are fairly conservative to avoid prohibitive rendering time, so the most zoom tiles are not that detailed. That can be changed by changing the tilemin
setting to a smaller value.)
Ok, so release 0.0.14 which I just uploaded should now render all surfaces by default and allow to switch between them in the viewer.
There might be some corner cases where some of the surfaces do not render - when I tried on the save provided in https://github.com/Palats/mapshot/issues/14#issuecomment-945119937 (which was very useful, thanks), some screenshots do not render it seems. I think that's because I do not have all the necessary mods installed, though I'm not 100% sure - there might be some way the surfaces are used in the mods that I do not understand.
It is possible that one or more of the special interstellar map views do magics rather than the usual map gen stuff, so I am not surprised that one or more of them may be entirely blank.
Can it support mods that use multiple surfaces, such as SpaceExploration?