UpgradeTreeDef - Grim-/Talented GitHub Wiki

UpgradeTreeNodeDef

The UpgradeTreeNodeDef is a fundamental building block in the talent tree system.

It represents individual nodes within a talent tree that players can interact with to gain upgrades and progress through different paths of development.

Structure

<Talented.UpgradeTreeNodeDef>
    <defName>NodeIdentifier</defName>
    <type>NodeType</type>
    <upgrades>
        <li>UpgradeDefReference</li>
    </upgrades>
    <sequential>true/false</sequential>
    <connections>
        <li>ConnectedNodeDefName</li>
    </connections>
    <hide>true/false</hide>
    <prerequisitesToShow></prerequisitesToShow>
</Talented.UpgradeTreeNodeDef>

Node Type

There are three distinct types of nodes in the system:

  1. Start Nodes (<type>Start</type>)

    • Represent the entry points of the talent tree
    • Can have multiple start nodes for different starting locations (experimental feature)
    • Must be properly connected to subsequent nodes in the tree
  2. Branch Nodes (<type>Branch</type>)

    • Special nodes that define the beginning of new branching paths
    • Hold information about newly formed branches in the talent tree
    • Used to create divergent progression paths
  3. Normal Nodes (<type>Normal</type>)

    • Standard nodes that make up the majority of the talent tree
    • Connect to other nodes to form progression paths
    • Not specialized like Start or Branch nodes

Upgrade System

Basic Structure

The upgrades field contains a list of UpgradeDef references that determine what benefits the player receives when investing talent points in the node:

<upgrades>
    <li>UpgradeDefOne</li>
    <li>UpgradeDefTwo</li>
    <li>UpgradeDefThree</li>
</upgrades>

Sequential vs Non-Sequential Upgrades

The sequential field determines how multiple upgrades in a single node are handled:

Sequential Mode (sequential>true</sequential>)

  • Upgrades replace previous ones as the node levels up
  • Only one upgrade is active at a time
  • Example: Basic → Advanced → Final, where each tier replaces the previous
<upgrades>
    <li>BasicMetabolismUpgrade</li>
    <li>AdvancedMetabolismUpgrade</li>
    <li>FinalMetabolismUpgrade</li>
</upgrades>
<sequential>true</sequential>

Non-Sequential Mode (sequential>false</sequential>)

  • Upgrades stack with each level
  • All previous upgrades remain active
  • Example: Level 3 would have all three upgrades active simultaneously
<upgrades>
    <li>BasicMetabolismUpgrade</li>
    <li>AdvancedMetabolismUpgrade</li>
    <li>FinalMetabolismUpgrade</li>
</upgrades>
<sequential>false</sequential>

Node Connections

The connections field defines how nodes link together in the talent tree:

<connections>
    <li>NodeDefName1</li>
    <li>NodeDefName2</li>
</connections>
  • Each connection represents a possible progression path
  • Multiple connections allow for branching paths
  • Connections are used for both visual representation and progression logic
  • It is very important these connections are set correctly.

Visibility Control

Nodes can be hidden or shown based on certain conditions:

<hide>false</hide>
<prerequisitesToShow>
    <!-- Add prerequisites here -->
</prerequisitesToShow>
  • The hide field determines if the node is visible by default
  • prerequisitesToShow can be used to define conditions for revealing the node

Best Practices

  1. Naming Convention

    • Use clear, descriptive defNames
    • Follow a consistent naming pattern for related nodes
  2. Tree Structure

    • Ensure all nodes are properly connected
    • Avoid creating isolated nodes or dead ends
    • Test all branching paths for proper progression
  3. Upgrade Design

    • Choose sequential vs non-sequential carefully based on intended progression
    • Balance upgrade power levels across different paths
    • Document upgrade effects clearly
  4. Performance Considerations

    • Minimize the number of prerequisite checks
    • Keep upgrade lists reasonably sized
    • Consider the impact of many simultaneous non-sequential upgrades
⚠️ **GitHub.com Fallback** ⚠️