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

Added "similar structures" concept to blueprints. #3599

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

UnicodeSnowdude
Copy link

Work done

The new blueprint widget is awesome, but there's a problem that it's locked into a specific faction. I can't use my wind farm blueprint for Cortex because it has Armada turbines. There are similar issues for walls, claws/maws, llts, energy converters, con turrets, spambulatories etc. One solution is to have multiple blueprints, one for each faction, but this is cumbersome to have 3x as many blueprints which do not differ in purpose. This PR fixes that by adding logic to swap unbuildable structures with counterparts the selected constructors can build.

I determined if units are counterparts by their tags. If two units' tags differ only by the prefix, they're considered counterparts. i.e. "armX", "corX" and "legX" are considered to be counterparts to eachother (with the addition of legeconv being the legion counterpart to arm/cormakr.)

Test steps

  • Start a game as Armada. Create a blueprint of wind turbines (or walls, or maws, anything where there's a direct cortex/legion counterpart)
  • Start a new game as Cortex. Try to build the blueprint. It should have swapped all the Armada structures with their direct Cortex counterpart.
  • Optionally repeat the same thing as Legion.

This is my first time contributing directly to BAR. If there's any testing harness for widgets, or CI tests, I'm happy to add some, but I'm not aware of any.

And wind farm should just be a windfarm regardless of faction. Same with
build power, llts, popups, walls, etc.

This PR adds logic to the blueprints widget whereby if the selected
set of constructors cannot build a building in a blueprint, they'll see
if they can build their faction's equivalent building instead. This is
desired for things like windfarms or basic T1 defenses where the
difference between the factions is minimal.

I assumed buildings with the tag armX and corX and legX were all
counterparts to eachother.
@salinecitrine salinecitrine self-requested a review August 15, 2024 19:42
@sprunk
Copy link
Collaborator

sprunk commented Aug 15, 2024

Same as #3524? Except doesn't handle water (where Arm Floating X is also similar to Arm X)

@UnicodeSnowdude
Copy link
Author

Definitely looks to be more or less trying to accomplish the same thing. I will say, from a cursory look at the code, I prefer my modeling of "similar structures" over the faction-first modeling of the other PR just because factions really are emergent properties of the game configuration rather than fundamental to the game itself. I suspect such faction-first modeling could lead to issues when it comes to mixed-faction groups of constructors. Say a T1 Cortex Con and an Armada advanced con building a gantry with a bunch of con turrets (which is a pretty common scenario if the t2 you buy happens to be Armada, but you're Cortex).

I do grant that mine does not handle land vs water. Not sure how hard that would be to add. I suspect it may not be too difficult? Just combine the similar water units and their land counterparts into the same "similar structures set" then add some kind of terrain check when getting the modified blueprint.

In any event, you all seem to be well on your way and I'm looking forward to the feature making it into the game. Let me know if there's anything I can do.

@salinecitrine
Copy link
Collaborator

Definitely looks to be more or less trying to accomplish the same thing. I will say, from a cursory look at the code, I prefer my modeling of "similar structures" over the faction-first modeling of the other PR just because factions really are emergent properties of the game configuration rather than fundamental to the game itself. I suspect such faction-first modeling could lead to issues when it comes to mixed-faction groups of constructors. Say a T1 Cortex Con and an Armada advanced con building a gantry with a bunch of con turrets (which is a pretty common scenario if the t2 you buy happens to be Armada, but you're Cortex).

I do grant that mine does not handle land vs water. Not sure how hard that would be to add. I suspect it may not be too difficult? Just combine the similar water units and their land counterparts into the same "similar structures set" then add some kind of terrain check when getting the modified blueprint.

In any event, you all seem to be well on your way and I'm looking forward to the feature making it into the game. Let me know if there's anything I can do.

I do like your system of simply having groups of equivalent units, instead of explicitly tying them to a faction. My preference would be to modify my PR to use your approach instead.

I most likely won't be able to work on it for a few weeks; you're welcome to work on combining them if you're up for it.


One note is that it's still undecided if swapping factions (this and #3524), or filtering (#3557), or both is the solution we go with.

@WatchTheFort WatchTheFort marked this pull request as draft September 12, 2024 20:25
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.

3 participants