PathOfBuilding-PoE2 icon indicating copy to clipboard operation
PathOfBuilding-PoE2 copied to clipboard

Add new feature for automatic attribute allocation

Open majochem opened this issue 3 months ago • 6 comments

Description of the problem being solved:

I was getting a bit annoyed by having to micro-manage attributes when planning out passive trees, so I added the option for some automation.

Until now assignment of attributes for travel nodes worked like this:

  1. You select attribute via pop-up
  2. You hold one of three hotkeys to force an attribute
  3. If you allocate more than one node, it allocates all attribute nodes in the path to your last selected attribute

I found that inconvenient because I would have to keep track of how many attributes I have vs. how many I needed. Especially on triple attribute builds, it felt pretty tedious.

Feature Description

Now there is a new menu button called "Auto Attribute Config" (I'm open to better naming suggestions) on the bottom of the tree tab and it looks like this: image

image

Copied explanation from help.txt:

You can enable the automatic allocation of attributes via the "Auto Attribute Config" button at the bottom of the "Tree" menu section. Each configuration is saved per tree. So if you have multiple trees, each will have its configuration values.

Weights: If enabled, attribute travel nodes will automatically be assigned to Strength / Dexterity / Intelligence according to your configured "weight" values. E.g. values of Str: 1 / Dex: 1 / Int: 2, would result in roughly 25% of the attribute nodes being assigned to Strength and Dexterity and 50% to Intelligence. By default, attributes gained from items and other small passive nodes are taken into account when calculating the actual vs. desired attribute ratios.

Max Value: If a "Max Value" is entered and the "Limit to Max?" checkbox is ticked, no more nodes will be allocated to that attribute, once the maximum value is reached

Attribute Requirements: For ease of use, the "Use Attribute Requirements" checkbox can be ticked. This will result in weights automatically being based on current attribute requirements from gems and gear.

Item Mods: If you want your attribute allocation to be gear-agnostic, you can tick the "Ignore Attribute Requirements" checkbox. Any attribute bonuses gained from equipment will then not be taken into account during allocation. Note: This does not affect modifiers to attribute requirements found on gear.

Other Functionality:

  • Saved Auto Attribute Config values are written to and retrieved from the XML

  • Added hint about new automatic allocation to ModifyAttributePopup image

  • Added hint about active automatic attribute allocation when hovering over attribute nodes (in case user is loading someone else's build and confused what's happening) image

  • Added information about Auto Attribute Config to the help.txt

  • Added tab navigation to the Auto Attribute Config pop-up to easily switch between attributes

Steps taken to verify a working solution:

Test cases

  • [x] Basic Popup
    • [x] Opens and closes correctly
    • [x] Works in different window ratios
    • [x] option controls only enabled if main enabled box is checked
  • [x] Item mods
    • [x] Correctly accounted for (BASE, INC, and MORE)
    • [x] Ignored if desired
  • [x] Use Attribute Requirements
    • [x] Calculated correctly
    • [x] Updated when requirements change, both for calculation and in popup display
    • [x] Modification of weight values disabled, if using requirements
  • [x] Special Jewels
    • [x] Timeless jewels
      • No mods affecting attributes afaik?
    • [x] Time-lost jewels
      • [x] %increased effect of notables/small passives is taken into account for attribute totals
    • [x] Intuitive leap likes
      • [x] From Nothing
      • [x] Controlled Metamorphosis
      • [x] Auto allocation works
      • [x] Manual allocation (hotkey or right click swap works)
    • [x] Against The Darkness
      • [x] %attribute mods correctly accounted for
  • [x] Alt Pathing (via holding shift)
    • [x] auto allocation works
    • [x] non-attribute-passive mods are correctly accounted for
  • [x] Saving Config
    • [x] One Tree
    • [x] Multiple Trees
    • [x] Enable "Save" on config change
  • [x] Loading Config
    • [x] One Tree
    • [x] Multiple Trees
    • [x] No existing config
    • [x] Works if calcsTab.mainOutput doesn't exist yet
  • [x] Weapon Swap passives (*) * "Works", but weapon swap passive functionality is still buggy in itself
  • [x] Hotkeys
    • [x] "1/2/3" & "S/D/I" still works
    • [x] Right click attribute swap still works
  • [x] Undo States work
  • [x] Reset Tree Behavior
    • [x] Result: Config does not get reset (intended)
  • [x] Import Behavior
    • Importing from build code with config, correctly imports config
    • Importing via build code without config sets it to nothing (overwriting if one exists, but I think that's fine?)
    • Importing from account keeps current config unchanged

Limitations:

  • The automation only works for attribute nodes that are on the currently allocated path. So, if you allocate some small passives that e.g. provide "+x to all attributes" that will be taken into account when allocating the attribute travel nodes on the path there, however, if you allocate the travel nodes first, then the "+x to all attributes" nodes afterwards, it will not recalculate already allocated nodes, which can lead to slight deviations from the target ratio. I think it's a negligible edge case though, and I'd rather implement a manual "reallocate all attribute nodes" button in the future, than dealing with the performance impact of going over the entire tree, any time you allocate a node that affects attributes in any way.

Link to a build that showcases this PR:

Test Build with some relevant test items

majochem avatar Oct 07 '25 14:10 majochem

Couple issues I found, hopefully not user error here. This is on a fresh build with no weights set.

First one, the Limit to Max for strength doesn't seem to work. Intelligence and Dexterity properly cap.

Second one is related to first. If I set a max to Int (or Dex), once it hits that max, it seems to pick Strength much more than the other one. Almost like it defaults to Strength instead of using the weights on the other two. With all 3 set to 0 weight, I'd assume they should scale equally. This also happens with all three set to a weight of 1 instead of blank 0. image image

Blitz54 avatar Oct 09 '25 10:10 Blitz54

Thanks for testing. Can confirm, not user error.

I think it has something to do with "Strength" acting as a default fallback, if no attribute can be determined (I copied that behavior from the previous attribute logic). In equal weight scenarios it will therefore usually pick Strength first, but it should only happen on the first node and that's definitely not the case here.

I'll look into it

majochem avatar Oct 09 '25 10:10 majochem

Fixed the max value for Strength bug, but found another issue with ratios not being properly affected, once max values are reached, so I'm converting to draft again for the moment.

majochem avatar Oct 09 '25 11:10 majochem

Confirmed previous issues are fixed.

Out of scope for this PR, but in game every support gem requires 5 of the same colour attribute. So I actually need 25 Dex in game to use the 5 green support gems I have equipped.

image image

Blitz54 avatar Oct 09 '25 19:10 Blitz54

Actually found another bug while using it myself. It's fixed now, but I marked the PR as draft again and will give it a few more days of testing with real builds.

majochem avatar Oct 13 '25 13:10 majochem

Tested a bit more with my own characters, as well as some imported poe2.ninja characters, and it seems to work fine. Also added the behavior for imports to the PR description. Marking as ready for review again.

majochem avatar Oct 17 '25 11:10 majochem