Community-patch-dll: Promotion Viewer - Expanded Utility

Created on 28 Jan 2019  路  112Comments  路  Source: LoneGazebo/Community-Patch-DLL

To my UI modders out there...

I've tweaked Whoward's Promotion Tree UI mod a bit to get it working with CP, and to make it a little more functional. I would, however, like to see it's functionality expanded a bit more, namely:

  • Tightening up the length/height of the pipes a bit so it's not so big.
  • Adding a third section at the end that has all the other promotions for each combat class listed in buttons in a grid.

I know you all are better at LUA than I, so any assistance with this would be great.

Pinging my known warriors: @JFDaly, @TechpriestEnginseer, @Infixo

Cheers,
G

Mod zip:
UI - Promotion Tree (v 15).zip

It might end up being useful to us all, if we can make it a bit more functional.

Calling all Modders!

Most helpful comment

Hey, not cool! I have green skin just like my super original avatar...icon...thing :angry:

Also, it's really hard to do this stuff without knowing any of the languages involved or even SQL...I just found out that the reason one of my attempts to make Heli work failed was because one cannot actually use "IS" as "=" in SQL unless comparing with "NULL" :rofl:

All 112 comments

Just wanna add some info: there is already a more up to date version of the Promotion Tree mod, that works with VP and EUI: check it out.

That version is newer than the version you used as a base for your modifications; there are some smaller problems with it, however; I've been testing it and documenting the issues (I will be referencing the files from the version I linked, version 17):

  • late game naval units don't display all available promos in that mod; this is because the mod only supports 2 base promos per unit, and VP, by having added the "Air Defense" promo line to some late game units, has effectively added a third base promo (same goes for submarines and their Dreadnought line). A major rewrite of this mod would be necessary to fix this, since it lacks basics basic support for more than 2 base promotions in ~/UI/PromotionTree.lua
  • Helicopters don't seem to work with it; this is likely because the anchor promotions for Helicopters work in a special way; namely the Heli promos one can choose depend on promos the Heli has natively, like "Hovering Unit", which are likely filtered out in line 94 of file ~/LUA/PromotionUtils.lua
  • for ranged land units, the mod mixes promos that are specific to either mounted ranged or infantry ranged units and displays them for both.
  • for some reason the mod doesn't display the promo "Charge II", which unlocks through Charge I
  • unrelated to this mod: the Ironsides promo is listed as having Bombardment III as a prerequisite promo in the civilopedia but I think this is no longer supposed to be the case (?)

Anyway, if you guys could fix all these issues and ideally integrate the mod into VP that would be amazing!

https://forums.civfanatics.com/resources/ui-upgrade-tree.26685/

@UndeadDevel
Are there similar issues on the upgrade tree?

@UndeadDevel yeah, I've been incorporating bits of that mod into this one. Regarding those issues, yeah, that's problematic. We'd probably need a ground-up solution, unfortunately.

G

@ryanmusante Haven't noticed any problems but I wasn't testing that one in depth so much
@LoneGazebo the biggest problem seems to be the fact that it doesn't support more than 2 base promos per unit type (that seems to require the most rewriting). Since the tech tree can handle 3 outgoing connections from an item, it should be possible to do this with the promotion tree mod as well, though the buttons would need to be made smaller (trivial to do). The most difficult part would likely be rewriting ~/UI/PromotionTree.lua to implement this.

Tweaked a few things, added up to 4 base promotions.

  • Helicopters don't seem to work with it; this is likely because the anchor promotions for Helicopters work in a special way; namely the Heli promos one can choose depend on promos the Heli has natively, like "Hovering Unit", which are likely filtered out in line 94 of file ~/LUA/PromotionUtils.lua

Probably makes sense for the function to actually have a c++ list grabbed for helicopters, maybe...

  • for ranged land units, the mod mixes promos that are specific to either mounted ranged or infantry ranged units and displays them for both.

Easiest way to fix this is just to indicate 'mounted ranged only' in the description. Easier fix.

  • for some reason the mod doesn't display the promo "Charge II", which unlocks through Charge I

No idea.

UI - Promotion Tree (v 18).zip

Posting my latest here for anyone to look at/play with. We need to work on spacing for the buttons - the spacing method seems a bit...clunky? But maybe I'm just dense.

The base promotion thing needs to be done differently; that function was fundamentally designed for 2 base promos, not more. Adding more like you have won't scale properly and looks really bad overall (submarines are a good example of this with the current version, see image below).

Now, so far any 3rd promo line in VP was purely sequential, i.e. without branches, which makes a lot of sense since it's hard to get enough XP to fill out even two promo lines, let alone 3. I don't think I've ever completely "filled out" a unit's promotion tree in VP. In fact, personally, I think Air Defense lines on some late game units and the Dreadnought line on Submarines aren't really necessary; but if you want to keep them you could make fixing the Promotion Tree mod easy for you by setting the design for third promotion lines as purely sequential by definition, since luckily you're in the unique position to control what promotions are given to what units in VP. Defining it like that would allow you to rewrite the function such that it will draw the third promo line in a straight horizontal manner, since there will necessarily always be room in the middle if there are already two other promo lines, which will be branching off to the top and bottom.

For easier visualization:

promo_madness2

Easier said than done.

Well, would you be willing to define 3rd promo lines as purely sequential in VP?

If so, I could take a whack at implementing that sometime this week probably.

Unfortunately that鈥檚 not as easy as it sounds either, there are specific defines that rely on the current promotion order.

Well if you can't define it programmatically, you could define it in game design; after all, unless you abandon this project (or shuffle off this mortal coil, god forbid) your "ruling" when it comes to such a definition won't be disregarded anyhow. I also think that introducing branching into the third promo line, or more than 3 promo lines per unit type would be bad ideas anyway, because, as I've pointed out earlier, it is already almost impossible to fill out the existing promos in the game; that means we don't need more promos for lack of them and IMO we already have more than enough variability. Since this is a game design / balance question, however, should I maybe post this to the forum, or do you agree?

Anyway, I just hacked together what I've been talking about and I'm currently trying to make Helicopter promos work; here's how it looks now with my idea implemented:
shiny1

Also, for some reason the Armor Plating line for Carriers is missing dependencies; I suspect this is because when those promos were created, since they do the same thing anyway, it wasn't important to make them dependent on one another, but for the sake of this mod it would be nice if that were changed (i.e. make Armor Plating III have Armor Plating II as a required promo and that in turn have Armor Plating I as a required Promo). Otherwise it will look like this (making them mirror the Flight Deck promos would probably be best):
shiny_carriers

I'll post again when I fix Helicopters or decide that I can't fix them.

Nice work!

Since this is a game design / balance question, however, should I maybe post this to the forum, or do you agree?

Not exactly sure what you're talking about here?

Re: carriers, yeah I can adjust that in the CBO.

For helicopters, it'd probably be best to just ignore that in the loop - that combat class isn't even used IIRC.

Not exactly sure what you're talking about here?

Well you said you can't define the third promo line as being purely sequential programmatically, but in order for my modifications to work without issue I need this to be defined. In other words, if this modification is eventually included in VP you can't start branching the third promo lines later or it will break this mod for them. If you say that you won't branch them that's fine by me, I just wondered whether we should ask the community (probably not necessary, though...I mean it's pretty much a technicality).

Re: Helis, give me some time with them; the combat class is used for their native promos, but not for the ones the player can choose; those have the combat class "Archery Units" but they are selected for Helis by depending on the native Heli promos.

BTW looking at the mounted ranged / infantry ranged thing: how does the game know when to let the player choose Parthian Tactics, for example? I mean it requires Accuracy III and an Archery Unit, but that is true for both a Machine Gun and a Light Tank, for example; how does the game discriminate? We could use that way in the mod to stop mixing up the two in the promo tree.

It uses the promotion attribute 1

Okay here's what I've got so far:
It's basically the v17 version I linked above, with VP dependencies added in the modinfo file, the third promo line functionality added to PromotionTree.lua and some WIP modifications to PromotionUtils.lua (not functional yet; gonna need some time for making Helis work...probably within this week though).
UI - Promotion Tree (v 17).zip

It uses the promotion attribute 1

You mean MaximumRangeRequired = 1 ?

I don't know why github ate that, but yes,

MaximumRangeRequired

@UndeadDevel is that version merged with mine? Because I made some QOL changes to it, specifically for linking to the EUI menu.

No, because your version introduced some new issues, like the Promotion Tree not switching to the selected unit in some cases and because I've been using the v17 version and did all my testing there.

The modinfo file is merged though (includes VP Dependencies).

@LoneGazebo If by linking to the EUI menu you mean including it in the top right panel with EUI, then that already works with that version. Or do you mean something else by that?

Yes, just a graphical hook.

Try it out, should work with EUI.

I'll post again later this week on my progress with Helicopters and the mounted / infantry ranged thing.
Still no clue why Charge II doesn't display, though.

I wonder if it has anything to do with Charge I and II not being adjacent in the database?

In the UnitPromotions_UnitCombats table INSERTS you mean?

Formation_2 isn't next to Formation_1, either, but it displays as expected.

What does the OrderPriority attribute do, btw?

I don't think it does anything.

Okay I chased down all sorts of leads for the Charge issue...it _should_ work, everything seems to be okay but alas it doesn't; the next step would be to create a custom sandbox to test this in but that's just way too much effort for me.

Also, for some unknown reason the Carrier promos suddenly received their dependencies and now that part just works lol:

carriers_reloaded
The changes I made in the meantime shouldn't have done this and in the game I only entered Information Era in the meantime; I even loaded a save from Atomic but it worked there, as well; no idea why it was messed up before, but it works now :man_shrugging:

Lastly, I figured out why Helicopters don't work; this time for sure, I think. It's the last line in PromotionChanges.sql of VP that changes the Heli UnitCombatType to UNITCOMBAT_ARCHER, so you were right, it's regarded as an archery unit, but only because of VP.

So, that means archery units need special treatment in the mod: first, to filter out Helis and give them their special promo lines (I think I know how) and second to differentiate between the mounted and infantry units...this is what happens when you lump things together; eventually it will bite someone in the :butterfly: :stuck_out_tongue:

Helicopters were turned into archery units because of upgrade pathing, and because they were turned into a ranged unit and needed a corresponding ranged profile.

re: charge, try changing the name of the base promotion to Charge_I maybe? Might be using a truncated text search in the db.query. Otherwise no idea.

Well it works with Medic and Medic doesn't have that _I suffix, either, and also depends on Shock 2 just like Charge does.

Well, except he has an explicit check for MEDIC in the functions...

local sMatchRank = "_[0-9I]+$"

function IsRankedPromotion(sPromotion)
  if (sPromotion == "PROMOTION_MEDIC") then
    return true
  end

  return (sPromotion:match(sMatchRank) ~= nil)
end

Telling you, that's precisely the issue.

I bet if you turn it into:

if (sPromotion == "PROMOTION_MEDIC" or sPromotion == "PROMOTION_CHARGE") then

it'll work.

I'll drink a Bailey's on ice if I'm wrong.

lol you're probably right

Dayum; I've put it in the back of my mind that Medic has the exception there...forgot about it :rofl:

Yay I win. Oops I'm going to drink Bailey's anyways, LUA does this to me.

Such a harsh punishment! Do you really think you deserve that? :yum:

Confirmed; Charge issue is solved. :+1:

@LoneGazebo can I insert some UnitPromotions_UnitCombats into my VP (PromotionChanges.sql) and still load my old saves or will it break that or not apply the changes or something?

The promotion base can be reloaded that way, but the changes won't apply to promotions already in the game.

baileys

accurate

Hey, not cool! I have green skin just like my super original avatar...icon...thing :angry:

Also, it's really hard to do this stuff without knowing any of the languages involved or even SQL...I just found out that the reason one of my attempts to make Heli work failed was because one cannot actually use "IS" as "=" in SQL unless comparing with "NULL" :rofl:

language immersion can be stimulating!

@UndeadDevel Corrected :)

@LoneGazebo do you have a diagram or something showing what promos the Helicopter can actually get? I'm looking at a fresh unit right now and it seems it actually has 5 (!) base promos: the 3 base promos from the general Archery line (Accuracy, Barrage, Air Defense) and on top of that the (Hovering-Unit-dependent) Heli specific promos Mobility I and Bonus vs. Armored (25). I'd just like to have a complete picture of what the Heli can get so I know whether it's possible it to try and create a special case for it in the Promotion Tree and how to go about it.

Also...would you consider dropping the Air Defense line from Helis? I mean they are supposed to be vulnerable to air strikes anyway and it would reduce the number of base promos to 4, at least.

Okay correct me if I'm wrong but it seems that there are only 2 advanced Heli-only promos: Repair and Air Logistics, which both become available once choosing either the second Mobility or the second Bonus vs Armored, so this promo tree (see image) is actually correct, with respect to the Heli special promos only:

heli_promos
Now, as you can see there's another small issue that crept up: the name of the "Bonus vs Armored (25)" promo is too long and I don't wanna make too much of a special case out of this, so the easiest solution would be to choose a new name...like "Hunter Killer I" and "Hunter Killer II", if you like.

Then there's the issue of how to display all the promos for Helis, not just the Heli-specific ones; take a look at this:
promos_archery
As you can see, it is possible, at least space-wise, to fit the special Heli promos in the middle, which I'd have to use some magic for implementing, but I think I can do it. What is not possible, however, is having that AND the current third promo line (Air Defense); there's simply not enough room. And as I said in my previous post, Helis are supposed to be weak to air units anyway, so I really think that line should be dropped from them. I'll need a ruling from you @LoneGazebo on this, before I can proceed.

The last question would be whether to drop the Heli category and put all Archery units into one tree and then use tool tip labels to mark which units can use which promos (easier but not exactly elegant) or whether to add another category ("Mounted Archer" or something like that) for the Skirmisher-line-units and then to add filtration functionality to the mod, so each unit is actually shown the promos it can take (preferable). I might manage the latter, but, as I said, I'll need to know first whether you can remove the Air Defense line from Helicopters.
Edit: actually, it has to be the last solution, because the non-Heli Archery units still get that Air Defense promo line and for them it makes at least more sense; this means that displaying all promo lines for all Archery units isn't possible anyway. Still need confirmation on removing Air Defense for Helis, though.

I've made some good progress on implementing this in the manner I discussed but I need to know what the intended status is for the anti-air promos...if you can't push the Hotfix out today @LoneGazebo can you send me the relevant files (PromotionChanges.sql and PromotionChanges.xml) once they're ready? I'd like to work on finishing it this weekend.

I鈥檝e got the changes, got busy with work yesterday and wasn鈥檛 able to push out the change. Yeah I鈥檒l try to upload it in a bit for you.

Unzip and replace the files in ~DocumentsMy GamesSid Meier's Civilization 5MODS(2) Community Balance Overhaul (v 13)Balance ChangesUnits

@LoneGazebo Thanks, I see you've added Air Defense II and III, so I assume you intend on keeping that line.

There are still some issues:

  1. PROMOTION_INTERCEPTION_I is given to all the fighter type units and Carriers, but not to Destroyers (which get PROMOTION_INTERCEPTION_II), Missile Cruisers (which get PROMOTION_INTERCEPTION_IV) or the AA units (Anti-Aircraft Gun and Mobile SAM, which also get PROMOTION_INTERCEPTION_IV).
    I'm gonna assume that this isn't intended, correct? Because it means that AA units still only have a 20% chance to intercept without being able to level that skill. It also means that Destroyers can level their intercept skill while Missile Cruisers can't, even though they're the upgrade unit of the Destroyer.
  1. Do you intend on leaving the intercept chance increment at 20? This means no unit can get to 100% chance, is this intended?

There is a larger issue here as well, which is keeping me from finishing work on the mod, but I need to know first, whether this is another error or all intended (especially the stuff about AA units not getting PROMOTION_INTERCEPTION_I).

I didn't upload the entire mod to you, probably should have - all units that weren't starting at Interception_I now start at that, so it's fine.

And yes, 80% cap on intercept is intended.

Thanks.

Okay, there is a pretty big issue:
With the new anti-air promo lines added there are now 2 unit types which have 5 base promotions: Helicopters and the AA-Units (AA-Gun and Mobile SAM). This is problematic, because, while I can implement 4 base promos, at least as long as 2 of them don't branch, 5 base promos are simply too much; there is not enough space on the screen for that, which means I would have to completely rewrite the entire mod to make this possible, because I'd have to refit the buttons and the placement algorithms etc. such that in the end I'd be writing an entirely new mod from scratch.

So far I have almost completely implemented the ability to choose the "internal" VP combat classes (i.e. Helicopters are different from Skirmisher-type units and both are different from normal archer-type-units and so on) as well as the ability to have 4 basic promo lines, as long as 2 don't branch (as opposed to the 2-only requirement the original mod had).

I'll be honest with you: I'm not willing to rewrite the mod to allow for more than 4 basic promo lines. It's just way too much effort for something that I fundamentally disagree with and something I think the community is going to rebel against anyway, later on. It just doesn't make sense that e.g. an AA unit has to spend all it's starting levels to get a half decent intercept chance and then still has 2 large and 2 small lines to level through, which will never happen; no one is ever going to choose the Air Defense line on AA units, for example. Fighters are now also a mess as they get 2 separate promo lines for Interception and 1 line for sweeping, with the latter having more advanced promos, as well, causing a pretty startling imbalance. Furthermore, I think that units don't have to be able to specialize in all directions to begin with, since there is a reason why there are different unit types; some specialization through promos is good and needed but as with anything, too much is too much.
I could write much more about this but this isn't really the place for this discussion (should be done in the forums); the point, however, is that there are too many promo lines now because of these anti-air additions (Air Defense, which is completely new and Interceptor, which has been turned into a promo line) and that means the Promotion Tree mod basically has to be scrapped and rewritten from scratch to support them all (and God only knows how...it's just too much stuff going on), which I'm not willing to do.

Now, if you are willing to stick to a maximum of 4 basic promos per unit (we can discuss what to drop if you want input on that, but it's your mod, of course), with 2 of them being "simple" i.e. not branching, then I can have a working version of this mod with all the good stuff implemented ready within the next few days. However, in that case I'd need you to answer a technical question for me first:
How did you manage to have Stealth Bombers not be able to choose PROMOTION_EVASION_I ?
I know they get PROMOTION_EVASION_III, but it doesn't have any PrereqOrXs...there are also no special attributes on the unit that would allow filtering this out (except the name, I suppose) and the Stealth Bomber counts as a Bomber class unit so it should be able to choose this. Is this filtering done in LUA or the DLL and where exactly is it done? I need to know because the Promo Tree mod will have to do that same filtering.

Sorry for the wall of text but there was a lot to say.

Air Defense has been around for awhile, and the interception change is easy to work with because, hey, you can just give AA units more starting levels, that's easy. In my current testing, for example, AA guns get Interception I-II for free, and SAMs get I-III for free. The others shouldn't have more than I to start IMO.

Easiest solution for helis would be to make one of the 'starting' lines hide behind T1 promotions. Same for Air units.

Don't read too much into promotion decisions, late-game air promotions are still a WIP overall.

Stealth bombers are a special unittype IIRC - SpecialUnit_Stealth. I think that prohibits some types of promotions for them?

Okay that sounds better; might I suggest just putting the Air Defense line behind T1 promos, then? I think that would cause less problems than doing this with the other lines, except if you're willing to completely drop Air Defense from Helicopters (because their 3rd and 4th lines intertwine, so they can't be separated and need to stay base lines).
Actually, I think that it would be better to drop Air Defense from Helicopters and AA-Units both; then you don't need to hide anything behind Tier 1 (which would look a bit weird with a 3-promo-line t.b.h.) and Helis are supposed to be bad vs air strikes anyway and AA-Units already have a lot of anti air stuff.

But yeah, overall this is good, though. If we stay at max 4 base promo lines, with 2 not branching (the 3rd and 4th can link between the same tiers of each other, though; I am implementing that to support the Heli lines, just FYI in case you had plans with other units), it means I can finish the mod that way.

Re Stealth Bombers: I see; I should be able to work with it.

Well Helis and AA units are part of unitcombats that are already valid for the promotions, so we can't easily strip it from them (also it is a 'direct attack' element, unlike their other attributes). Just hiding it behind a T1 promotion for each seems easy enough.

Yes, you'd have to add some special attribute to them, kinda like with Stealth Bombers, or strip the relevant UnitCombat from the promotion and then give the promo to every single unit in those UnitCombats, except Helis and AA, individually.

Gross.

I don't think it's necessary, TBH. I'd rather just have Air_Defense_I with a bunch of prereqs on it as the filter.

Well, as long as it's not base it's fine for mod compatibility.

Also, can you please add Interceptor I to the Carrier UnitCombat? It shouldn't have any negative side effects and it would mean one less exception for me to handle.

And I am currently "defining" the VP special case units this way, let me know if you have a problem with any of that:

  • an AA unit is a Gunpowder unit that has PROMOTION_ANTI_AIR
  • a helicopter unit is an Archery unit that has type UNIT_HELICOPTER_GUNSHIP (since there's only one Heli unit type anyway and I'm not aware of any popular mods adding more Helicopter types)
  • a "mounted archer" unit is an Archery unit that has Range = 1

Lol okay another issue with your Air Defense, in case you planned to put it behind the T1s of both main promo lines for all UnitCombats that AD is eligible for: those are 14 PrereqOrXs, which I'm not sure is allowed; the Promotion Tree mod, for example only checks for 9; I can change that, of course, but who knows what other LUAs check for multiple PrereqOrX and don't go all the way to 14?

Well not every tier 1 needs it. Only the tier 1s for land melee, land range, sea melee

I'm not sure I understand that; from your code:
('PROMOTION_ANTIAIR_LAND_I', 'UNITCOMBAT_RECON'), ('PROMOTION_ANTIAIR_LAND_I', 'UNITCOMBAT_ARCHER'), ('PROMOTION_ANTIAIR_LAND_I', 'UNITCOMBAT_SIEGE'), ('PROMOTION_ANTIAIR_LAND_I', 'UNITCOMBAT_GUN'), ('PROMOTION_ANTIAIR_LAND_I', 'UNITCOMBAT_NAVALRANGED'), ('PROMOTION_ANTIAIR_LAND_I', 'UNITCOMBAT_NAVALMELEE'), ('PROMOTION_ANTIAIR_LAND_I', 'UNITCOMBAT_CARRIER'),
That's 7 UNITCOMBATs, each of which has 2 distinct, branching promo lines, which makes 7x2=14.

Or are you saying that you've now removed Air Defense from NAVALRANGED and CARRIER? That would still be 10 PrereqOrXs unless you only give AD to one promo line T1 instead of both for at least one of the remaining UNITCOMBATs, thus making it 9 and reducing the risk of breaking something.

Another issue:
Can you please make Interceptor consistent with Air Defense and Ambush with respect to Tech requirements? Currently you give it to the individual units, which is yet another exception and, frankly, these exceptions are both driving me crazy and making the code really ugly. You could link it to the "Replaceable Parts" Tech, since that is the prerequisite for both Flight (Triplane) and Ballistics (AA-Gun) and also implicitly covers the Carrier and Destroyer; it would, however, unlock Interceptor for Iron Clads once their owner gets to Replaceable Parts, but I don't think that's so bad, personally.
This would allow you to add Interceptor I to the appropriate UNITCOMBATs instead of having it unlock by targeting individual units (which is what you said "Gross" to when I suggested it for Air Defense).

Or, if you don't want to change it, how do you want the mod to handle the Interceptor? Display it anyway, even for units that can't take it or try filtering it out for them (exceptions, exceptions...) and what about the class mode; should it be displayed there but get some tool tip listing the units it's compatible with?

Not trying to be a PITA but since I'm writing these routines for the mod I need to know.

By interceptor do you mean air defense?

Re T1 promotions, not every unitcombat has unique starting promotions. Gun and Melee are largely the same for example. So all I need to do is remove _recon from the set and I can cover them all.

G

And another thing (sorry for the many posts, but I think this is the last exception):

Just like Interceptor I can be safely added to the Carrier UNITCOMBAT, you can add Air Supremacy I to the Fighter UNITCOMBAT, since all of them are supposed to get it (I checked).

Ahh GitHub wasn't updating; didn't see your responses. By "Interceptor I" I mean "PROMOTION_INTERCEPTION_1".

By "Air Supremacy I" I mean "PROMOTION_ANTI_AIR".

Re Air Defense: for now I'll just exclude it from displaying for Helicopters and AA-Units since I'm not sure what you mean. Once you push out the HotFix with the changes I'll see and tell you if there are problems with it.

Okay just to be perfectly clear on these issues, since it is probably getting confusing:

There are two separate issues now:
_1) easy:_ I need you to add
"PROMOTION_INTERCEPTION_1" to UNITCOMBAT_CARRIER and
"PROMOTION_ANTI_AIR" to UNITCOMBAT_FIGHTER

_2) more complex, concerning the way PROMOTION_INTERCEPTION__[x] is handled in the mod:
"PROMOTION_INTERCEPTION_[x]" used to not be a promotion line, which means it didn't have to be handled by the Promotion Tree mod, especially since the player couldn't choose it anyway.

With your change from the mid-January version it became a promo line the player can choose. What makes this line special is that it isn't given to all units of a UNITCOMBAT, but only to some individual ones, by giving them "PROMOTION_INTERCEPTION_1". This promotion itself isn't linked to any UNITCOMBATS (except fighters), which is what I suggested you do for Air Defense (which would also allow you to easily skip Helicopters and AA-Guns). It means that I would have to add a mechanism that checks if a unit already has a promotion, which might be problematic, but I'd have to test it to know for sure.
Then I noticed a second issue: PROMOTION_INTERCEPTION_1 does not have a Tech requirement, unlike Air Defense I (PROMOTION_ANTIAIR_LAND_I). So there is now a question of how PROMOTION_INTERCEPTION_1 should be presented to the player: should it always show for units belonging to the eligible UNITCOMBAT or only once the tech is unlocked? In the former case we'd need some sort of tool tip or something to explain to the player why he can't pick it yet and in the latter case there's the problem of yet another check (this time for Tech) and that the player won't find out about that promo line until late in the game, which means he can't plan for it. Furthermore, how is the unit class mode supposed to handle this? Same options, pretty much, but different context for the player.

So, in order to avoid this I suggested adding a Tech requirement (TECH_REPLACEABLE_PARTS) to PROMOTION_INTERCEPTION_1, just like there exists with Air Defense I (PROMOTION_ANTIAIR_LAND_I) and Ambush and others. That way you can add PROMOTION_INTERCEPTION_1 to all the relevant combat classes except UNITCOMBAT_GUN (and still give it to the AA-Units individually) and all I'd have to do is apply it for the AA-Units now, which already have the exception code in place and is easy, because all AA units get it (while for UNITCOMBAT_NAVALMELEE only some do).

So, let me know what you think; I'll be back at it tomorrow.

  1. Already done.

  2. It's trickier than that, because if I add the combat classes for Promotion_Interception_I etc. to all classes, than any unit in that class can pick up the promotion line. It needs to be an exclusive 'branch' for AA units. I think I can get around this with a DLL check for promotion that prevents units without 'airinterceptrange' from being able to take this (which makes sense - can't intercept if you have no intercept range).

Okay great; I assume it's possible to query that from LUA? Is it unit:GetAirInterceptRange()?

So, you will add that check in the DLL and then add PROMOTION_INTERCEPTION_1 to UNITCOMBATs GUN and NAVALMELEE (since it's already in CARRIER and FIGHTER), correct?

So I'll try to implement units being considered (instead of just their combat classes) in the deeper layers of the mod or I may just add another artificial unit class internally (Modern Naval Melee or something like that) and then define it as Naval Melee units that have that intercept range distinction. I think the latter would actually be easiest and it wouldn't beg the question of how to handle classes and thus doesn't require thinking about adding a tech requirement.

You wouldn't normally need to (it's a unit attrib, so unit.InterceptRange), but since someone added a promotion range attrib, I've exposed the class function to LUA: unit:GetAirInterceptRange() will work on the DLL below.

(2) Community Balance Overhaul (v 13).zip

CvGameCore_Expansion2.zip

Drop the DLL in your CP and overwrite your CBO. Should all work as needed.

Whoward handled tech requirements by ignoring it and simply adding a little beaker TT bubble on each promotion that required a tech.

Okay so I'm debugging a preliminary version...

I don't need the Tech Requirement on Interceptor I anymore, now that you added the ability to check for AirInterceptRange, so I removed it; I also removed PROMOTION_INTERCEPTION_I from UNITCOMBAT_GUN, because it's just easier that way since I already have exceptions in place for the AA units. Furthermore, I added PROMOTION_HELI_REPAIR to UNITCOMBAT_ARCHER, because that's where it belongs (the other one, Air Logistics, is already part of that unitcombat), so you should update those in your PromotionChanges files in CBO.
I also changed the definition of an AA unit to a Gunpowder Unit that has AirInterceptRange.

Question: can I add 3 new UnitCombats to the UnitCombatInfos table or will that mess stuff up in VP? They would only be used for the Promo Tree mod, of course.

The unitcombat infos table is hard coded and cannot be altered.

Best you could do would be to copy it to an array in lua and then add the extra ones there as a temporary set.

Ah I see; thx.

Seriously? I have to write out "and" instead of using && in lua if statements with multiple conditions?? lame :smile:

And apparently != doesn't exist either, but have to use ~=...
this debug session is gonna take a while :laughing:

Can we add some new text keys, please? The labels grow too long...
One for TXT_KEY_PROMOTION_HELI_AMBUSH_1 .... replace with a new text key that says something like "Tank Hunter I" for the PROMOTION_HELI_AMBUSH_1 description part...the Help part can still point to it, though.
One for TXT_KEY_PROMOTION_HELI_AMBUSH_2 .... replace with new key "Tank Hunter II"; the help part can still be left alone.
And one for TXT_KEY_PROMOTION_ANTI_FIGHTER .... replace with new key "Eagle Hunter" or something like that; the help part can be left alone again.

It just looks really ugly when the text exceeds the buttons.

Another (too) long text key (this is the last one):
TXT_KEY_PROMOTION_EVASION should be changed from "Evasion (reduced damage)" to simply "Evasion".

Making good progress but I doubt I'll finish today.

PROMOTION_ANTI_FIGHTER is missing an icon it seems, just FYI; no idea why.

What about naming from Promotion overhaul for VP?
https://github.com/adaneslavo/Promotion-Overhaul-for-VP/blob/master/Texts/TextChanges.sql

_Example from SQL HELI_AMBUSH_

UPDATE Language_en_US SET Text = 'Air-to-surface Missiles I' WHERE Tag = 'TXT_KEY_PROMOTION_HELI_AMBUSH_1';
UPDATE Language_en_US SET Text = 'Air-to-surface Missiles II' WHERE Tag = 'TXT_KEY_PROMOTION_HELI_AMBUSH_2';
--50
UPDATE Language_en_US SET Text = 'Flying Ace' WHERE Tag = 'TXT_KEY_PROMOTION_ANTI_FIGHTER';

@LoneGazebo Can you help me with an issue?
I'm trying to filter out promotions with the MaximumRangeRequired or MinimumRangeRequired attributes, which are only present on a few promos; I need to do this with an SQL query.

I've tried
SELECT p.Type FROM UnitPromotions p, UnitPromotions_UnitCombats c WHERE c.UnitCombatType = \"UNITCOMBAT_ARCHER\" AND c.PromotionType = p.Type AND p.PromotionPrereqOr1 IS NULL AND NOT p.CannotBeChosen AND p.MinimumRangeRequired IS NULL
unsuccessfully; I also tried
SELECT p.Type FROM UnitPromotions p, UnitPromotions_UnitCombats c WHERE c.UnitCombatType = \"UNITCOMBAT_ARCHER\" AND c.PromotionType = p.Type AND p.PromotionPrereqOr1 IS NULL AND NOT p.CannotBeChosen AND ISNULL(p.MinimumRangeRequired, 0) = 0
unsuccessfully; and I tried
SELECT p.Type FROM UnitPromotions p, UnitPromotions_UnitCombats c WHERE c.UnitCombatType = \"UNITCOMBAT_ARCHER\" AND c.PromotionType = p.Type AND p.PromotionPrereqOr1 IS NULL AND NOT p.CannotBeChosen AND IFNULL(p.MinimumRangeRequired, 0) = 0
unsuccessfully, but on that last one I at least got usable log messages:
[44154.039] Runtime Error: Failed to iterate table due to query error. Check Database.log for more details. in Lua.log
and [44154.039] no such column: p.MinimumRangeRequired in database.log

the weird thing is, "IS NULL" (what I first tried) works fine for the check with PromotionPrereqOr1...any ideas?

@ryanmusante those names are too long as well; the issue is the length of the promo names; it exceeds the promo button width in some cases, so we need shorter names.

I'll ping @JFDaly on this, he's a master at this kind of thing (I personally find debugging in a non-profiled environment to be far too time-consuming and trial-and-error-y)

G

Okay yeah nevermind I'm just a noob and made a silly mistake in another piece of code :roll_eyes:

@LoneGazebo are you going to integrate those text changes I requested into VP or should I include them in this mod component?

I'm almost done now, just have to add one more feature and polish it up.

What, explicitly, needs changing, again?

Everything all good now?

@LoneGazebo

  1. remove the Tech Requirement for PROMOTION_INTERCEPTION_I (again)
  2. remove PROMOTION_INTERCEPTION_I from UNITCOMBAT_GUN
  3. add PROMOTION_HELI_REPAIR to UNITCOMBAT_ARCHER
  4. give PROMOTION_ANTI_FIGHTER some icon since it's now displayed in the mod and the mod doesn't display the triangles so it has an empty icon there which looks weird

Create new Text Keys:

  1. text key for the description of PROMOTION_HELI_AMBUSH_1 (make it short, like "Tank Hunter I", for example, so it fits on the button; the Help text can still point to TXT_KEY_PROMOTION_HELI_AMBUSH_1
  2. text key for the description of PROMOTION_HELI_AMBUSH_2 (make it short, like "Tank Hunter II", for example, so it fits on the button; the Help text can still point to TXT_KEY_PROMOTION_HELI_AMBUSH_2
  3. text key for the description of PROMOTION_ANTI_FIGHTER (make it short, like "Eagle Hunter", for example, so it fits on the button; the Help text can still point to TXT_KEY_PROMOTION_ANTI_FIGHTER
  4. text key for the description of PROMOTION_EVASION (just call it "Evasion", for example, so it fits on the button; the Help text can still point to TXT_KEY_PROMOTION_EVASION

@JFDaly yeah all good, thx; was basically a typo I made...silly mistake

Alright done. Here's the CBO with the updates.

I intend to actually bundle this with the mod, if you're okay with it. I feel like it's too 'essential' to the game to not have a promotion browser. What do you think?

(2) Community Balance Overhaul (v 13).zip

Thank you very much!
Yes, of course, I'd thought that was the motivation behind creating this issue in the first place; I had planned to make Promotion Tree compatible with VP anyway, because I find it absolutely essential as well, and then I saw the creation of this issue so I jumped on it :smiley:
Integrating it by default is definitely the right move.

And as an aside, I should mention that testing this without some of my other mods active, in particular VP Promo Icons, is (almost) giving me eye cancer :wink:
Maybe you should look at integrating that by default as well, it makes the promotions just so much easier to look at and remember and gets rid of those pesky triangles for those promos that don't have icons assigned (https://forums.civfanatics.com/threads/vp-promo-icons.633731/).
I'm sure the creator would be delighted at such an inclusion.

I'd need to talk to him directly, see if he wants to do it or not.

It's user Asterix_Rage, he's soon going to release version 2.0 of that mod so he's definitely active right now; just PM him, I'm sure he'd be delighted!

Here are some screenshots of promo trees with and without VPPI (it's not up to date to the newest air promos yet but most ugly icons are replaced)...version 2.0 of his mod is nearing release. You can also see the tool tip additions I implemented, which come up only for the relevant unit types for Interceptor and the Evasion line.

As for finishing the mod, I just have to implement one more feature (dependent promos for the special Helicopter line) and it's done. I have some appointments soon, though, so it's gonna have to wait until tomorrow, probably.
There are also some TXT_KEYs missing as you can see in the screenshots, and you should probably rename the "Evasion I" to just "Evasion" because there already is a different promo with the name "Evasion I"; or maybe name it "Perseverance"? Since it's reducing interception damage...

Got some more requests / stuff to fix:
1) The Help texts for the PROMOTION_INTERCEPTION_I (-IV) promos are missing.
2) PROMOTION_HELI_REPAIR should have its PediaEntry attribute changed to TXT_KEY_PROMOTION_HELI_REPAIR so it can be found directly by players
3) Remove PROMOTION_HELI_REPAIR from UNITCOMBAT_ARCHER again; seems it was already associated with the Unitcombat and for some reason didn't show, so adding it now made it have a duplicate entry, which messes up my SQL queries.
4) Rapid Redeployment needs a shorter name (cuts off at the "m" currently).

You also may want to think about Helicopter promos, as they currently get Air Logistics (can attack twice) as well as regular Logistics (can attack twice, but -30% RCS) and March (heals every turn, -15% CS while defending) as well as Rapid Redeployment (does exactly the same).
But I guess this is one reason why you wanted to include the Promotion Tree mod in the first place; it'll be much easier to assess promo (im)balance with such a tool.

I'm almost done, just polishing and adding a little more functionality for the 3rd and 4th promo lines (Helicopters work but I wanna make it more flexible in case we add more promotions in there for other units as well).

I'm thinking about getting rid of the "Advanced Promotions" distinction...because VP has more promotions, the tree now often stretches beyond what can fit on the screen without scrolling horizontally. Also, the Helicopter promos Air Logistics and Rapid Redeployment technically count as "Advanced Promotions" within the scope of the mod so to be consistent I should push them out to the right, while instead I could push some of the "Advanced Promotions" left and thus lessen the total width of the tree if I got rid of the concept of advanced promos...see image:
promo_inconsistency2

And it's not like this concept is being observed 100% of the time by this mod (at least in VP) anyway:
promo_inconsistency

So yeah, I think I'll just get rid of that category and adjust the code a little to pull promos in so the tree can be a bit more condensed and has a better chance of fitting on the screen. If you have any major protestations against that, better voice them quick! I'll start work on this in an hour or two after I finish implementing another little thing.

I think that works for me, it's an unnecessary distinction.

Re: Heli Repair, we just need to make that a non-choosable promotion, it's redundant.

Okay good; I eliminated the unnecessary category and made the promos stick closer together so the trees don't get so wide (or tall, I suppose, since the tree is technically "lying down").
I'm just testing the latest (and I think last) changes and then I'll upload it; I've extended the functionality quite a bit so I think you'll like the freedom that brings in playing with new promo lines.

A few suggestions:
Do you really need Ambush to be associated with the melee unitcombat? It's linked to a fairly late Tech anyway (Combustion) so melee units won't ordinarily be able to take it and it just seems to unnecessarily lengthen the promo tree, see for yourself:
promo_scrolling

I don't think it's a good idea to make balance changes just because the layout algorithm of this tool isn't smart enough. Maybe i can help re-write it if it's too much work for you?

The tool can handle it fine, as you can see and I don't see how cutting promotions that won't be taken by the UnitCombat (especially in the case of melee and Ambush) is a balance change.
I'm almost done with it and then you can do whatever you want with my code but this was not at all a request to change balance in order to help the tool!

pulling the Medic promos up to the third base promo (instead of the second)?

is a balance change imo

Who picks Medic before completing either of the base promo lines with scouts??? Moving the scouting line would be a balance change, but that's not what I suggested; in fact, I elaborated that Medic is pretty useless for scouts no matter when you pick it. In any case, I made this "suggestion", which I explicitly called a suggestion and not a request, because I think it makes sense and is a QoL change, not because the tool can't handle it otherwise as you insinuated.

Sorry if the tone may be perceived as a big aggressive, it's not my intention, i try to be as neutral as possible, but i'm not a good English speaker/writer.

Who picks Medic before completing either of the base promo lines with scouts???

me? it's useful to have a good medic2 from "free" promotion from scouting.

You said previously for justification for a suggestion that "it just seems to unnecessarily lengthen the promo tree, see for yourself:". But with a different layout algorithm, it's possible to do the same without balance changes.

Also, promotion (balance) changes shouldn't be decided here but in https://forums.civfanatics.com/threads/going-for-gold-promotions.633603/

Moving the scouting line would be a balance change, but that's not what I suggested; in fact, I elaborated that Medic is pretty useless for scouts no matter when you pick it.

Your suggestion is "the medic promotion is useless" but it's not a balance suggestion???

not because the tool can't handle it otherwise as you insinuated.

Sorry, the pictures confused me.

I really appreciate the work you show here, and i don't want to bother you too much. I'm just really sad if balance changes occurs from gui-prettiness issues instead of balance concerns (discussed by the community in the forum).

Yeah I don鈥檛 want to touch the promotion tier set.

I have now deleted the Medic part from my previous post. I still don't think it's a balance change, because scouts aren't second line units IMO so they're not usually put into the position of healing other units, only themselves, and for that they have the Survivalism line, so it makes no sense for them to pick Medic.
But since you insist that it's a balance change I removed this suggestion, which, again, is not a request or necessary for the promo tree to work.

Now I'm not going to accept that removing Ambush from the melee unitcombat is a balance change. The last melee units can be built in early Renaissance, a full two eras before Combustion (the Tech unlocking Ambush) and Ambush is mostly useful against armored units, which means a significant number of opponents have to have those units, which are also unlocked at Combustion etc. etc., which means it's going to take another half era until it even begins to make sense to pick it.
But with this as well, it is just a suggestion, not a request and the mod works perfectly fine without implementing it. This does not have to be done and I am not requesting it! I am not trying to underhandedly force balance changes through in this thread so stop insinuating that I am!!!

Furthermore, the only way to compress the promo tree further is to either allow the dependant lines to selectively flip down, instead of always flipping up, which would only be possible in few cases, since I introduced extra base promo lines and densified the tree already, and it would also be a huge amount of extra effort and I doubt it would make the tree clearer for the player, especially with trees that are more crowded than the scouting tree, which is almost all trees, or restructure the tree by removing or moving dependent promotions, hence my suggestions. Now, this is not necessary to do, because the tree has scroll functionality and I already compressed it further as well as introduced additional base lines, which serve compression as well.

So you are essentially saying that I should STFU with my mere suggestions of moving some promos that won't be taken (Ambush for UNITCOMBAT_MELEE) and implement a mechanic that is might actually make the mod worse!

You then also misrepresent my arguments by taking something I said about Ambush and making it sound as if I said it about Medic, and then go on and misrepresent another statement: I never said Medic was useless, period. I said Medic was useless for scouts.

So yes, I do view your posts as offensive and I don't care for the BS "Sorry if the tone is perceived as aggressive" line. If you don't want to be perceived as aggressive then maybe you shouldn't misrepresent other people and shit on them after they spent hours trying to improve a piece of code.

I'm not even sure I want to release this anymore; maybe you should make your own modifications for the Promotion Tree Mod instead, how about that?!?

Woah dude. I don鈥檛 think we need to go to such extremes. I think just finish it up as-is and then prereq changes can be discussed on the forums, since they do ultimately affect balance.

This new promotion tree looks pretty good. I wasn't very happy with the current version (v17) because of the various problems, but still put it in my modpacks because a lot of beginners don't know the promotions (and the civilopedia isn't very practical). But this look far better than just bug fixes!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ilteroi picture ilteroi  路  7Comments

ilteroi picture ilteroi  路  7Comments

soeb80 picture soeb80  路  8Comments

ryanmusante picture ryanmusante  路  5Comments

dape6509 picture dape6509  路  5Comments