mapshot
mapshot copied to clipboard
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:
- Your script takes a peek at a chunk that doesn't exist yet
- Factorio generates the piece of land that would usually be there, given the map seed which otherwise is mostly ignored
- The screenshot is taken
- 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
Thanks for the report and especially for providing an example!
I guess you refer to the area on the edge of the map along the water & the weird zone below Australia. I'm not sure why it renders those weird half generated areas. I've always seen them (even on simpler maps), but never got to investigate. It might be tricky to fix.
Factorio generation works per chunk (see map structure - a chunk is a bunch of factorio tiles)). And there is a way to know whether a chunk is generated. The mod uses that function to determine the rendering bounding box - i.e., which total rectangular area is going to be rendered. Then it renders for each zoom level a bunch of screenshots to cover that bounding box.
That's where there are 2 cases to cover:
-
A screenshot covers a mix of full chunks and unrendered chunks. It is likely to happen often, especially for very zoomed-out images. There is no good way out of that and the mod is dependent on the behavior of Factorio
take_screenshot
function. -
A screenshot covers only ungenerated chunks (but still in the bounding box). In that case, there might be something to do. That would require to verify which chunk are covered by a given picture, and verify their state. Might not be fast, but it sounds feasible. That would also require to replace the image by something so the UI is not lost - same story, feasible.
The thing I suspect is that fixing the second case would not be enough, as a lot of screenshots would still fall into the first case. Overall that would require trying a few things out, but I suspect that in the end it would not improve things much.
The case about partial generation is interesting - though if that was the case, it would mean that the next mapshot would have a better result, which I never noticed. Might do with some testing too to verify.
[I don't plan to work on that for now]