notque
Artificially Intelligent
- Joined
- Nov 13, 2005
- Messages
- 2,165
Civilization 7 Behavior Tree System Architecture
Core database tables handle tree definition, node configuration, and data management. Direct and clean reference system.
Essential starting point. No tree exists without this.
Key Point: Always register tree first.
Main tree structure. Heavy integration with NodeDefinition and TreeData.
Flow Rule: JumpTo values must align with existing NodeIds.
Node configuration layer. Highly flexible, deeply integrated.
Critical: Every node needs matching TreeData entries.
Foundational type management.
Rule: Type mismatches break nodes silently.
Configuration requirements manager.
Key Point: Check Required and RequiredGroup flags.
Node structure control.
Core Rule: Respect MinChildren/MaxChildren.
Behavior definition center.
Critical: New nodes need NodeDefinition entries.
Real Talk: Complex trees need rigorous testing. Small changes ripple hard.
End Point: System's robust but unforgiving. Test thoroughly.
Core database tables handle tree definition, node configuration, and data management. Direct and clean reference system.
Base Structure
BehaviorTree
Essential starting point. No tree exists without this.
- TreeName: Primary key
- Must exist before any node references
- Handles trigger connections
Key Point: Always register tree first.
BehaviorTreeNode
Main tree structure. Heavy integration with NodeDefinition and TreeData.
- TreeName: Links to base tree
- NodeId: Sequential ordering
- JumpTo: Flow control, defaults 0
- NodeType: Links to definition
- PrimaryKey: Unique identifier
Flow Rule: JumpTo values must align with existing NodeIds.
TreeData
Node configuration layer. Highly flexible, deeply integrated.
- DefnId: Links to NodeDataDefinition
- NodeId: References BehaviorTreeNode
- Tag/DefaultData: Core configuration
- ParentTag: Data flow control
- UniqueId: System tracking
Critical: Every node needs matching TreeData entries.
Supporting Architecture
DataType System
Foundational type management.
- TypeName: String identifier
- DataId: Internal reference
Rule: Type mismatches break nodes silently.
NodeDataDefinition
Configuration requirements manager.
- Links NodeType to DataType
- Controls required fields
- Manages data flow direction
- Handles editor behavior
Key Point: Check Required and RequiredGroup flags.
ShapeDefinition
Node structure control.
- Sets child limits
- Enforces tree shape
- Controls node relationships
Core Rule: Respect MinChildren/MaxChildren.
NodeDefinition
Behavior definition center.
- NodeType primary key
- Links to ShapeDefinition
- Provides base description
Critical: New nodes need NodeDefinition entries.
Practical Implementation
Tree Building Steps
- Register in BehaviorTree
- Create node structure
- Add required TreeData
- Validate references
Error Prevention
- Check TreeName consistency
- Verify NodeId sequence
- Validate all references
- Test data flow
Performance Notes
- Minimize JumpTo usage
- Keep trees shallow
- Clean up unused nodes
- Monitor data chains
Real Talk: Complex trees need rigorous testing. Small changes ripple hard.
End Point: System's robust but unforgiving. Test thoroughly.
Last edited: