Page 1 of 1

Add multiple preview generation to the CLI

Posted: Fri May 17, 2019 10:01 am
by peet1993
Hi,

It would be neat being able to generate multiple previews without needing to setup/tear down factorio fully from the command line for every preview generated.
Examples how that feature could work:

Code: Select all

./factorio --generate-map-preview path/to/store/pics/ --generate-map-preview-count N // For random maps
./factorio --generate-map-preview path/to/store/pics/ --map-gen-seed 1,2,3,4 // For N specific seeds
For file names, the game can use the seed number and prepend ".png". Generating the same seed twice would just overwrite the file, which is not a problem because the result is the same anyways. If the previewcount argument or multiple seeds are given, "--generate-map-preview" would expect a directory instead of a filename.

Thanks in advance if you decide to implement this! :D

Greetings,
peet1993

Re: Add multiple preview generation to the CLI

Posted: Fri May 17, 2019 3:38 pm
by cactauz
Another idea would be to add the ability to specify a range of seeds ex:

Code: Select all

 // generates 1.png ... 999.png
 ./factorio --generate-map-preview path/to/store/pics/ --map-gen-seed-min 1 --map-gen-seed-max 999
+1 thanks if you implement this in any way!

Re: Add multiple preview generation to the CLI

Posted: Mon May 20, 2019 5:46 am
by Bilka
Okay, I added map-gen-seed-max which generates every second seed from map-gen-seed to map-gen-seed-max. I also added generate-map-preview-random, it generates random seeds for N number of times (if no max seed is given). In general, generate-map-preview now needs PATH instead of PNGFILE. The file is now always named after the seed.

Re: Add multiple preview generation to the CLI

Posted: Mon May 20, 2019 9:09 am
by peet1993
Thats amazing, thank you! Even better than I had wished for :D

Re: Add multiple preview generation to the CLI

Posted: Tue May 21, 2019 5:46 pm
by TOGoS
I wanted to keep the old behavior where --generate-map-preview's argument is treated as the filename (because I have a set of scripts that depends on the meaning of that argument being consistent across Factorio versions). So if you want the 'directory full of maps with different seeds' behavior, just make sure to end the paths provided to --generate-map-preview with a slash (as in peet1993's original suggestion).