OpenFactorioServerManager / factorio-server-manager

A tool to help manage Factorio multiplayer servers including mods and save games.
MIT License
561 stars 134 forks source link

new feature: map generator #276

Open jannaahs opened 3 years ago

jannaahs commented 3 years ago

The map generator replaces the possibility to create a save file with all possible settings you know from factorio.

grafik

Unfortunately there are some known issues related to the map template selection (default, island, death world, ... ). I wasn't sure how to map certain values so the template selection doesn't match the ingame templates. Therefore I have added some todo comments.

Open todo:

C0bai commented 3 years ago

Hey, i'm currently using the software to manage a server we're using. We have an issue though where we need the server to load the map as if it were loading on your own PC for the first time (showing the cutscene etc) but using a specific map seed generation. We're speedrunners and need to reload the same seed over and over for each run, unfortunately we're unable to use the save game feature as it requires a save made offline and uploaded and this doesn't count as it's not a 'fresh' run on the map. I see the map generator was added as a way to use the json file for map generation but i cannot for the life of me figure out how to use the --map gen json server commands anywhere - any ideas?

knoxfighter commented 3 years ago

Testing with Vanilla factorio:

Testing with Mods (all Angel's mods):

jannaahs commented 3 years ago

@C0bai please visit our discord server: https://discord.gg/SB647WmSbU

jannaahs commented 3 years ago

This looks like there is still plenty of work. I have to figure out how I can add the mod support. This might be complicated and complex.

Regarding the error message, I have created a new issue #287 since it happens on other views as well. I will fix it separately because it should not wait until the map generator is finished.

jannaahs commented 3 years ago

I'm not sure how we want to support modded ores. I have downloaded https://mods.factorio.com/mod/bobores and tried to figure out where I can get the information of the added ores.

Unfortunately, they're added with in a LUA file - one file for each ore. This means we have to generic parse all LUA files.

@knoxfighter do you have any idea how we can handle it?

In the end it's always possible to either not have a map generator or only for non-modded saves.

knoxfighter commented 3 years ago

@knoxfighter do you have any idea how we can handle it?

Yes, we can add LUA and read out the Mods by ourselves. I have some experience with that, cause of my factorio intellij plugin.

For now i would say, we should ignore mods. Just add a message on top, that with mods, that alter ores, the generation is broken. I will look into that sometime. Most mods will work, only some overhauls like Bobs, Angels or Industrial Revolution will break it.

EphDoering commented 2 years ago

To deal with mods it's probably a lot easier to just have factorio do the heavy lifting:

  1. start a game with default map gen.
  2. use RCON to send something like:/c game.write_file("map-gen-settings.json", game.table_to_json(game.player.surface.map_gen_settings))
  3. Close the game.
  4. Use the generated json file as a template to play with all the fancy modded resources. You only need to do steps 1-3 when the mods change.
knoxfighter commented 1 year ago

It is possible to get all data information with the startup parameter: --dump-data