Jump to content

UI Mod - Bigger Perk Tree


Amineri

Recommended Posts

Well my suggestion was rather creating 5 regular classes and make psi abilities non selectable, I may attempt that in time, I guess the matter would be finding what checks are based on this psi amp item and what are based on psi class. I agree that psi perks could be tweaked, mind fray is so powerful, it stacks with suppression and poison if available, it's a pity when your psi soldier is the machinegunner...
Link to comment
Share on other sites

  • Replies 193
  • Created
  • Last Reply

Top Posters In This Topic

So, I've been digging around looking at the upk files where the perks are assigned, trying to free up more space to define more perks.

 

The smallest code I've been able to come up with uses switch/case statements. Here's some example code:

 

 

 

switch(branch) // 11 bytes
case 1: // 5 bytes -- 33 bytes for entire case
switch(option) // 11 bytes
case 0: // 4 bytes
return 44 // 3 bytes
case 1: // 4 bytes
return 44 // 3 bytes
default: // 3 bytes
case 2: // 5 bytes -- 41 bytes for entire case
switch(option) // 11 bytes
case 0: // 4 bytes
return 10 // 3 bytes
case 1: // 4 bytes
return 48 // 3 bytes
case 2: // 5 bytes
return 48 // 3 bytes
default: // 3 bytes

 

This frees up enough space to explicitly assign 3 3-perk choices and 4 2-perk choices.

 

The reason for the explicit assignments (the function will return 0 if the perk isn't defined) is that I plan on using this to control whether the icon is displayed. So, if a modder wanted only to have 2 perk choices at every level, setting some of the perk choices to 0 would prevent the ability icon from even displaying in the perk tree UI. (otherwise the "?" unknown ability icon will be displayed)

 

My current UI version supplies 2 3-perk choices, so I'm thinking of just moving forward with that.

 

Any feedback on which two levels should get the 3-perk choice? It's customizable per mod, but only by changing the sprite itself, which means re-byte-packing the matrix translation values into 14-bit spaces -- not a completely trivial operation.

Link to comment
Share on other sites

I've also been making some strided in cleaning up the psi tree.

 

1) The class+psi (the regular class icon, but with the purple background) will be displayed on the psi tree UI screen if the unit has psi abilities, instead of the vanilla's generic psi icon.

 

2) Suppressing the rank icon (making it "invisible")

 

3) Adding ability to customize the labels for each rank column (what they are called in the game)

 

-----------

 

Combined with the ability to not display icons if the selector function returns zero, I believe this will allow the regular tree to be used for psi tree operations (and will allow future versions of the mod to allow for additional choices, either for additional psi levels or for other uses)

Link to comment
Share on other sites

Amineri, forgive me if you've already mentioned this, but what is the theoretical maximum number of perks you could squeeze into the perk UI of the AS scripts?

 

I think I remember you saying somewhere that the UPK edits would be limited to only 4 additional perks, but if that wasn't a limitation, how many extra would editing the UI allow, bearing in mind AS scripts seem to be more flexible with regards to function sizes etc?

 

I've looked at the perk tree in the UPK and think I might have an idea to overcome the small allocated space in the UPK, but I don't know for sure yet. I'll have to do some testing and use my brain for once, which will undoubtedly hurt! :smile:

Link to comment
Share on other sites

Whoops, I kind of answered that in the UI editing thread.

 

Really I'm only limited by the amount of space that I can find in the SWF file.

 

The existing icon placeobject2 declarations take 309 bytes. I freed up 105 bytes by shortening the "promotionBracket" label to just "p" (it occurs 7 times, 7*15 = 105). This was how I freed up enough space to add the previous 4 ability icons.

 

However, I've just found that the Environment script package closely follows the perk tree sprite definitions. There are a bunch of debug text strings in there that I can steal bytes from with no consequence... up to 350 additional bytes.

 

This means I have 309 + 105 + 350 = 764 bytes I could use to put ability-icon declarations into. Since each one takes 26 bytes, that would allow up to 29 icons. That's easily 4 icons per row. I'm thinking that it is a bit of overkill to put that many icons in, however ... anyone have a desire for up to 4 perk choices per level?

 

-----------------------------------

 

Setting icons:

 

Each icon is labeled by a text tag "icon" + col + "_" + row

 

Each Placeobject2 command to put a generic icon position into place is 26 bytes. The icon is added via the command:

 

AS_SetAbilityIcon(int column, int Row, string iconLabel, bool isHighlighted)

 

column corresponds to the character level (currently 0 to 6)

row is the choice within the level

iconLabel -- I'm not sure where how this gets managed -- you seem ahead of me here

isHighlighted -- is used to indicate perks that have already been selected

 

If AS_SetAbilityIcon is not called, then the space for the ability icon remains blank.

register2._visible=true;

is set at the very end of AS_SetAbilityIcon

 

This means that a simple conditional in UISoldierPromotion.UpdateAbilityData

if(perk > 0)

before calling AS_SetAbilityIcon will prevent the icon from being displayed at all. This should allow for customization of the NUMBER of perk choices in addition to the type at each level.

 

The current checks are:

if(column >= SoldierRank)
{
AS_SetAbilityIcon(column, Row, "unknown", m_kSoldier.HasPerk(perk));
}
// End:0x2EA
else
{
AS_SetAbilityIcon(column, Row, class'UIUtilities'.static.GetPerkIconLabel(perk, GetMgr().perkMgr()), m_kSoldier.HasPerk(perk));
}

 

This is why the game displays a blank "?" icon for unassigned perks and perks above the soldiers current level currently. This mod would make perks above the soldier's level invisible instead.

 

That's the plan, anyhow.

Link to comment
Share on other sites

Quote

I'm thinking that it is a bit of overkill to put that many icons in, however ... anyone have a desire for up to 4 perk choices per level?

It's easier to ignore a capability on the UI display than it is to add one. Four choices per rank would mean the ability to select an ignored choice offered earlier at a later rank, in addition to 'new' perks. So it opens up choice flexibility during the strategy phase as a result of experience. You could even think of it as allowing four build trees instead of two. If you can afford the space without limiting other feature possibilities, include it. Perhaps later the ability to adjust the icon display to accommodate the number of icons actually present by ignoring the empty ones will become feasible.

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

Hmmm...

 

Well, I went the other way. By limiting myself to three ability icons, I was able to NOT alter the promotionBracket calls, which simplified the change (it will it quicker and easier to fix the mod when a patch comes out).

 

The other thought I had when limiting to three ("limiting" ...) was that with three, if only one ability choice is desired, it can remain centered. With four, a choice of one would have to be offcenter. It's purely an aesthetic consideration, it's true :smile:

 

You can also see below that with the full set of 21 ability icons the display is getting pretty busy. I considered moving the icons further to the left and spacing them out a bit more, but that could start to conflict with longer rank labels, if people mod those. Choices, choices ...

 

Here is a screenshot showing the layout and placement of all 21 ability icons in the perk selection UI. Keep in mind that in order to not break the Psi tree, I'm planning on using the same sprite for the Psi tree (this will also give a modder the option to have up to three perk choices for Psi abilities as well). With the three existing ranks of psi ability, this gives the option for for "additional" ranks in that UI. This could be used to grant additional perks at certain levels, or to expand the number of psi ranks.

 

http://wiki.tesnexus.com/images/7/7f/Perk_Tree_Mod_Three_Perks.jpg

 

 

This doesn't include the upk changes necessary to suppress the display of ability icons. This is just a test shot showing the layout and placement of the icons.

 

Clearly having duplicate icons and "?" unknown icons mixed in is a big mess ^_^

Link to comment
Share on other sites

NEXT STEP:

 

The next steps are:

 

1) Alter UISoldierPromotion.UpdateAbilityData to only call AS_SetAbilityIcon if the Perk Manager returns a perk value greater than 0. This will allow for dynamic selection of the number of perks displayed through the UI.

 

2) Alter the check for allowing a perk choice at a level. Currently the game only allows a choice at a level if no perk at that level is already granted to the soldier. This conflicts with:

a) Listing the same perk more than once in the perk tree (giving the player a "second chance" to select a perk)

b) Equipping items that also require perks activated in order to be usable (Smoke Grenades, Battlescanners, etc)

This change will have to explicitly store which ranks perk choices have been made for, instead of checking HasPerk()

 

3) Clean up the Psi tree presentation when using the expanded sprite. This includes:

a) Properly displaying a Psi+class icon in the upper left corner

b) Hiding the rank icons on the left-hand side

c) Hiding / modifying the rank labels

Edited by Amineri
Link to comment
Share on other sites

My initial re-write of UISoldierPromotion.UpdateAbilityData (including the new promotion-tracking system and the dynamic suppression of ability icons) is around 400 bytes smaller than the original

 

Original = 1033 bytes

New = 640 bytes

 

This gives me a lot of space to play around with to add additional functionality. Given thus, I'm thinking about what I could do with the extra four slots available in the Psi tree. I'm thinking that they could be used for selectable stat increases.

 

I'm thinking that the choices could be based on class, with 2 or 3 options at up to four different levels. For balance, you could decrease the amount of stat-increase that the soldiers receive automatically as the level, and instead provide the player with some choices as to which stats to increase.

 

For example, with snipers you could trade off the additional hit point vs increased aim. I'm not sure how I would make this easily configurable without hex edits to the function, or how I'd get icons and descriptive text to show up, but I thought I'd float the idea out there to see what people think of the idea.

 

I'm still working on fixing up the new level-tracking system and the larger psi-tree display, so I doubt I'd put anything in with selectable stat increases any time soon.

 

Just seeing all those empty bytes makes my fingers twitch, though ! :O

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...