LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
292 stars 160 forks source link

Promotion Viewer - Expanded Utility #5117

Closed LoneGazebo closed 5 years ago

LoneGazebo commented 5 years ago

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:

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.

UndeadDevel commented 5 years ago

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):

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

ryanmusante commented 5 years ago

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

@UndeadDevel Are there similar issues on the upgrade tree?

LoneGazebo commented 5 years ago

@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

UndeadDevel commented 5 years ago

@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.

LoneGazebo commented 5 years ago

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

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

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

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.

UndeadDevel commented 5 years ago

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

LoneGazebo commented 5 years ago

Easier said than done.

UndeadDevel commented 5 years ago

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.

LoneGazebo commented 5 years ago

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

UndeadDevel commented 5 years ago

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.

LoneGazebo commented 5 years ago

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.

UndeadDevel commented 5 years ago

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.

LoneGazebo commented 5 years ago

It uses the promotion attribute 1

UndeadDevel commented 5 years ago

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 ?

LoneGazebo commented 5 years ago

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

MaximumRangeRequired

LoneGazebo commented 5 years ago

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

UndeadDevel commented 5 years ago

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).

UndeadDevel commented 5 years ago

@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?

LoneGazebo commented 5 years ago

Yes, just a graphical hook.

UndeadDevel commented 5 years ago

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.

LoneGazebo commented 5 years ago

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

UndeadDevel commented 5 years ago

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?

LoneGazebo commented 5 years ago

I don't think it does anything.

UndeadDevel commented 5 years ago

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:

LoneGazebo commented 5 years ago

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.

LoneGazebo commented 5 years ago

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.

UndeadDevel commented 5 years ago

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

LoneGazebo commented 5 years ago

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

LoneGazebo commented 5 years ago
local sMatchRank = "_[0-9I]+$"

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

  return (sPromotion:match(sMatchRank) ~= nil)
end
LoneGazebo commented 5 years ago

Telling you, that's precisely the issue.

LoneGazebo commented 5 years ago

I bet if you turn it into:

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

it'll work.

LoneGazebo commented 5 years ago

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

UndeadDevel commented 5 years ago

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:

LoneGazebo commented 5 years ago

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

UndeadDevel commented 5 years ago

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

UndeadDevel commented 5 years ago

Confirmed; Charge issue is solved. :+1:

UndeadDevel commented 5 years ago

@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?

LoneGazebo commented 5 years ago

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

ryanmusante commented 5 years ago

baileys

LoneGazebo commented 5 years ago

accurate

UndeadDevel commented 5 years ago

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:

LoneGazebo commented 5 years ago

language immersion can be stimulating!

ryanmusante commented 5 years ago

@UndeadDevel Corrected :)

UndeadDevel commented 5 years ago

@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.

UndeadDevel commented 5 years ago

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.

UndeadDevel commented 5 years ago

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.

LoneGazebo commented 5 years ago

I’ve got the changes, got busy with work yesterday and wasn’t able to push out the change. Yeah I’ll try to upload it in a bit for you.

LoneGazebo commented 5 years ago

Units.zip

LoneGazebo commented 5 years ago

Unzip and replace the files in ~\Documents\My Games\Sid Meier's Civilization 5\MODS(2) Community Balance Overhaul (v 13)\Balance Changes\Units

UndeadDevel commented 5 years ago

@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.

  2. 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).