Skip to content

Conversation

@HEROgold
Copy link

@HEROgold HEROgold commented Jul 4, 2025

Closes #7

Currently this PR is able to generate the json structure related to blueprints

TODO: create save file with bp

Blueprint parsing with test
TODO: create save file with bp
@florishafkenscheid
Copy link
Owner

Hey, thanks for taking the initiative to start this draft PR! I really appreciate the enthusiasm for the 'blueprint from string' feature.
This is actually a feature that @abucnasty and I looked into as well, but we ran into some significant technical blockers that made us decide against pursuing it. I wanted to share our findings with you, as they might save you some time:

  1. Simulation-Only API: To generate a save from a blueprint, we'd need create_entities_from_blueprint_string(), which the API docs state can only be run from "simulations". This would require us to package and load a custom mod at runtime, which adds a lot of complexity that I want to avoid.
  2. Incomplete State Replication: Placing a blueprint doesn't copy the exact state of every entity. For example, if a benchmark requires belts to be fully back-pressured at the start, a blueprint can't replicate that initial state.
  3. Resource Dependency: Blueprints with mining drills are incompatible because they can't place the required ore patches, which limits the feature's usefulness for many common setups.

Because of these fundamental limitations in the Factorio API, I don't think this feature is currently feasible for BELT. If you see a way around these issues, I'm definitely open to discussion, but they seem pretty core to how the game works.
Given this, I think it's best we close this PR for now. Again, I really appreciate you jumping on this. I hope this doesn't discourage you, and I'd be keen to see you contribute to other open issues if you're interested. Thanks!

@HEROgold
Copy link
Author

HEROgold commented Jul 5, 2025

Thanks for the information!
I kept it as a draft exactly so I could aquire more information before actually submitting to it.

I'm not discouraged by this at all, as I don't mind a little challenge.
If I do manage to find workarounds or ways to solve the mentioned issues I will open up the Pr.

  1. If there'd be a way to parse a game's save file data then that could be used to generate save files. However I do suspect that would require at least a little bit of reverse engineering the save data formats. Or add a mod, but you prefer not to do that.

  2. I'm not entirely sure exactly what you mean by this point, however I do believe that using bp's with the mod editor extension's loader should work just fine.

  3. Should be resolved when issue 1 is resolved. As we could then generate a world full of ore patches before placing down any bp's.
    Scenario's could be temporarily loaded into factorio's scenario's directory. Factorio/data/base/scenario, this avoids the need for a mod that adds them.

Factorio does support the flag --mod-directory which would help, and this also pushes me to argue in favor of using mods for benchmarking, as it would solve problems 1. and 3. with a lot less effort.
BELT could even update the active mods (it's just a json file) before launching a benchmark so we can better manage what is needed for each benchmark.

I do understand the want to avoid mods, especially as runtime mods can (and probably will) impact ups if used. Even if the impact is minimal.

I'll put something together to try and see what's possible.

@florishafkenscheid
Copy link
Owner

Closed by #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Generate save file from a blueprint string

2 participants