Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dependency tracking for blueprints #6668

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented Feb 19, 2025

Issue

Reloading merge blueprints requires a full restart of the session because:

  • The engine does unexpected things with nil fields in blueprints, which merge blueprints have plenty of.
  • The load order from initial blueprint loading may have an impact if multiple mods merge into the same fields in the same bp. Reloading blueprints only reloads the changed blueprint, so load order is ignored completely.
  • A variety of lua code edits blueprint values based on other blueprint values. If a merge blueprint is reloaded, the nil case is used instead of whatever it should be when loading the full stack of edits. Some examples are mesh blueprints being reassigned and target check intervals being changed.

Check out the commit where the debug blueprints are added to see more details.

Description of the proposed changes

On the initial loading, track which file changed what blueprint id, and when reloading a file, run all the files that changed the bp in the appropriate order.
I think this is the only way to solve the given issues as there is unfixable engine behavior involved, using __blueprints does not respect load order (and allows for recursion), and fixing all the Lua would involve far more complexity.

Testing done on the proposed changes

Check out the commit before the debug blueprints are removed.
Reloading the debug blueprints does what is expected of load order and the unit functions correctly ingame. None of the issues commented in the debug blueprints occur.

Additional Context

I was running into these issues while writing the SACU rebalance mod.

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

Update ZmergeTestB.bp
This makes blueprint reloading much easier, as there is no need to worry about engine behavior for nil blueprint fields when reloading a merge blueprint (which has a lot of nil fields). Merge bps have particular difficulty with weapons and meshes, where the existing bp fields are used to determine other parts of the blueprint (and during a reload, those other parts will get replaced by the standard `nil` replacement).
@lL1l1 lL1l1 added area: sim Area that is affected by the Simulation of the Game feature: mod compatibility related to FAF compatibility with mods labels Feb 19, 2025
@lL1l1 lL1l1 force-pushed the feature/track-bp-dependencies branch from 1d99a02 to b8f0583 Compare February 19, 2025 09:21
@lL1l1 lL1l1 marked this pull request as ready for review February 19, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: sim Area that is affected by the Simulation of the Game feature: mod compatibility related to FAF compatibility with mods
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant