Commit Graph

29 Commits

Author SHA1 Message Date
Yoan StAmant
fabace42c8 [StateTree] log verbosity for Tick changed from Verbose to VeryVerbose to make it easier to prune logs and find transitions
#rnx
#rb trivial
#preflight skip

[CL 20467859 by Yoan StAmant in ue5-main branch]
2022-06-02 07:49:30 -04:00
mikko mononen
cd197fcb3e StateTree: refactored index types
- Changed FStateTreeHandle to FStateTreeStateHandle, used only for indexing states
- Added uint16 and uin8 index types, which can represent invalid index (aka INDEX_NONE)
- Changed indices that can be optional to the index types above
- Added validation and error loggic when index types overflow during compile
- Removed 2 indirections (in common case) and halved the memory usage of property copies

#jira none
#rb Mieszko.Zielinski
#preflight 6295d26e91004dd61ced370b

[CL 20434838 by mikko mononen in ue5-main branch]
2022-05-31 04:51:18 -04:00
mikko mononen
66e1f36595 StateTree: Changed runtime data to contain only active tasks
- Commented and cleaned up the members of UStateTree a bit
- Changed StateTree Node storage to FInstancedStructArray (contiguous memory)
- Changed StateTree SharedData to FInstancedStructArray
- Changed StateTree instance data to use FInstancedStructArray
- StateTree statistics shows estimated mem usage per state and max for tree (heaviest linked chain)
- Added explicit bLinked state for UStateTree
- Cleaned up UStateTree::ResetCompiled()/ResetLinked()
- Changed StateTree execution context to allocate task instance data on Start() and EnterState()
- StateTree tick uses execution order counters to access the instance data instead of compile time specific index

#jira  UE-153269
#rb Stephen.Holmes Yoan.StAmant
#preflight 628df39faf7a2e956bb45dc5

[CL 20361823 by mikko mononen in ue5-main branch]
2022-05-25 05:34:50 -04:00
mikko mononen
a841531c2b StateTree: moved evaluators global to tree
- Deprecated per state evaluators and moved them to global to the tree
- Tick evals once per Tick()
- Updated editor node customizations to work on UStateTreeEditorData
- Added separate detail customization for UStateTreeEditorData

#jira UE-147508
#rb Yoan.StAmant
#preflight 62820e55046b81bf93911605

[CL 20221385 by mikko mononen in ue5-main branch]
2022-05-16 05:13:27 -04:00
mikko mononen
97d82b0cb0 StateTree: shared instance data
- Separated condition instance data into a shared instance data (mutable but no persistent state)
- Made BP TestCondition() const, conditions should not hold state
- Added macro to define runtime data POD for faster init
- Added custom serialization version for UStateTree, older assets need recompile
- Updated memory reporting to be a bit more accurate, separated shared and unique data

#jira UE-147508
#rb Mieszko.Zielinski
#preflight 627b657d2d608c533b5cde15

[CL 20134929 by mikko mononen in ue5-main branch]
2022-05-11 04:04:58 -04:00
Yoan StAmant
9a7f402070 [StateTree] validate Parameter view index instead of using a check since trees need to be recompiled to set it but we don't want to force it to be able to use older asset.
#rnx
#rb none
#preflight 62750b15594b7a203155eb23

[CL 20074000 by Yoan StAmant in ue5-main branch]
2022-05-06 08:00:26 -04:00
Yoan StAmant
af7394cf27 [StateTree] replaced StateTreeParameters by InstancedPropertyBag
#rnx
#rb mikko.mononen
#preflight 6273ec0f03269096abc99574

[CL 20059078 by Yoan StAmant in ue5-main branch]
2022-05-05 12:02:47 -04:00
mikko mononen
90b9339cda StateTree fixes
- Fixed unset index check in UStateTree::Link() and FStateTreeExecutionContext
- Changed FStateTreeExecutionContext to call ExitState() from leaf-to-root
- Fixed handling of empty sources in FStateTreePropertyBindings::CopyTo()

#jira none
#review
#preflight 6273c1005b05fb4f601353b4

[CL 20056497 by mikko mononen in ue5-main branch]
2022-05-05 08:44:57 -04:00
mikko mononen
f6770cf154 StateTree: Parametrized states
- Added specific "subtree" states which can be linked to via a "linked" state
- Subtrees can only bind data back to the their root state (or tree "global" data)
- Added property bag based parameters to subtree and linked states
- Update (transient) property bag structs before resolving property paths
- Linked states reflect their parameters from the state they link to
- Added property binding to and from parameters
- Relaxed the property binding to fail if the source data is not available
- Allow enter conditions to bind to tasks, and fail the expression if trying to access unaccessible data
- Added icon for linked and subtree states
- Added source type for all binding source structs
- Added UStateTreeEditorData::VisitHierarchy to simplify iterating over all states

#jira UE-147507
#rb Yoan.StAmant
#preflight 626a47182d28b9d0f77223f5

[CL 19954567 by mikko mononen in ue5-main branch]
2022-04-28 03:54:07 -04:00
bob tellez
637948f95a #StateTree Make GetActiveStateName(s) available when WITH_STATETREE_DEBUG is 0
[FYI] mikko.mononen

#ROBOMERGE-AUTHOR: bob.tellez
#ROBOMERGE-SOURCE: CL 19952052 via CL 19952055
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 19953111 by bob tellez in ue5-main branch]
2022-04-28 02:19:09 -04:00
mikko mononen
44d3945983 StateTree: fix PVS warnings
- The 'TargetProperty' pointer was utilized before it was verified against nullpt
- The modification of the 'TreeDescIndex' variable is unsequenced relative to another operation on the same variable. This may lead to undefined behavior.

#jira UE-148951 UE-149238
#rb Mieszko.Zielinski
#preflight 625feaafdd47b4ad2167447e

[CL 19827521 by mikko mononen in ue5-main branch]
2022-04-20 07:19:18 -04:00
Yoan StAmant
c135ebcd95 [StateTree]
+ Added StateTree parameters usable for data bindings and that could be overriden on context initialization by a StateTreeReference
+ Added StateTreeReference struct to hold a reference to a StateTree asset along with a list of values to parameterized the tree.
+ Added named external data items that are defined bt the Schema and for which values must be provided at runtime through the execution context.
+ Added delegate OnPostCompile after successful compilation. The StateTreeReference listens to it to validate its parameters
+ EditorData now contains its own version of the schema and parameters. On successful compilation they are copied over the StateTree own properties.
#rnx
#rb mikko.mononen
#preflight 6255d281647ad886b3593cb0

[CL 19727363 by Yoan StAmant in ue5-main branch]
2022-04-12 15:55:39 -04:00
mikko mononen
b156e83342 StateTree: Renamed baker to compiler
#jira none
#rb Yoan.StAmant
#preflight 624c465da64871f1a10a2ee6

[CL 19624175 by mikko mononen in ue5-main branch]
2022-04-05 09:44:28 -04:00
mikko mononen
ef8889a1c4 StateTree: Added functionality to call and reuse a subtree
- Removed unnecessary checks for specific transition (handled in enter state logic)
- Added state type to StateTreeState, State, Group, or Linked
- StateTreeState property customization hides properties based on type
- Allow a state to link to another state
- Changed baker binding validation to handle linked states
- Added linked state handling in execution context
- Updated UI deal with linked states
- Updated gameplay debugger to deal with linked states
- Moved automatic Root state adding from Editor data to editor open (tests were broken due to extra root state)
- Fixed tests and added simple test for linked state
- Added meta to tag to state link to allow to select only direct states (no next, etc)
- Added counter to track state changes (mainly for debugging)

#jira UE-147509
#review
#preflight 624beb69637925b5d306d8e7

[CL 19621621 by mikko mononen in ue5-main branch]
2022-04-05 03:20:57 -04:00
Yoan StAmant
55e9970a99 [StateTree] misc trivial changes
- removed dependencies on someplugins (GameplayBehaviors, GameplayAbilities and SmartObjects)
#rnx
#rb none
#preflight 624b28c03a5a4c1622fb45ca

[CL 19612244 by Yoan StAmant in ue5-main branch]
2022-04-04 13:53:17 -04:00
mikko mononen
1e28b99891 StateTree: Condition expressions
#jira UE-146925
#review-19478890
- Added ability to combine conditions into expressions
- Added editor UI for the expressions
- Replaced condition description with a name (makes the expressions faster to skim)
#preflight 62417309361866e20ffa6320

[CL 19524558 by mikko mononen in ue5-main branch]
2022-03-28 04:48:50 -04:00
mikko mononen
49de6cb549 StateTree: Fix for instance data when compiling BP classes
- Moved instance object directly on FStateTreeInstanceData to make easier to access
- Internal instance data on FStateTreeExecutionContext is not property to simplify handling
- Link & resolve properties on UStateTree when objects are replaced (to refresh cached property pointers)
- Moved instance data initialization out from FStateTreeExecutionContext
#preflight 623b0bff10251d53d5823f3e

[CL 19477789 by mikko mononen in ue5-main branch]
2022-03-23 08:06:00 -04:00
mikko mononen
95cec28098 StateTree: Moved instance data out from framents
- Added new struct to hold instance data
- Removed on the fly created customs struct for storing the instance data
- The Mass StateTree instance data is not a fragment anymore
- Fixes crash when using StateTreeBrainComponent directly on actor
- Moved StateTree activation processor settings to Mass Behavior settings

#jira UE-133870
#rb Yoan.StAmant
#preflight 62178318db60b6b592190db8

[CL 19112506 by mikko mononen in ue5-main branch]
2022-02-24 08:19:23 -05:00
mikko mononen
dc6bc47087 StateTree improvements:
- EnterState() stops on failure, ExitState() handled symmetrically up to the last failed task
- Allow to run evaluators when reselecting a state after failed EnterState()

#jira none
#review-18351414
#robomerge 5.0
#preflight 61b1d3e2274068529fddcafe

[CL 18417260 by mikko mononen in ue5-main branch]
2021-12-09 05:26:00 -05:00
jon nabozny
0d5fc99c2a Prevent MassAI and StateTree from crashing when invalid StateTree assets are used.
Added a check to make usre StateTrees have valid instances, and prevented adding Mass Behavior subsystems when an ExecutionContext fails to initialize.

[FYI] [at]Julien.Marchand, [at]Mikko.Mononen
#jira UE-134972, UE-134977

#ROBOMERGE-AUTHOR: jon.nabozny
#ROBOMERGE-SOURCE: CL 18192097 via CL 18372150 via CL 18372271
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18372327 by jon nabozny in ue5-release-engine-test branch]
2021-12-03 15:35:57 -05:00
mikko mononen
11ea4b3fa0 StateTree: UObject and BP support
- connect GetWorld() of FStateTreeExecutionContext explicitly to the owner
- take MassSignalSubsystem as parameter to FMassStateTreeExecutionContext directly
- separated DataViewIndex (what others see) and InstanceIndex/bInstanceIsObject (where the pointert comes from) on StateTree items
- allow item instance to be a struct or object
- added editor support for both struct or object based instance
- added Blueprint base classes for Eval, Task and Condition
- Update UStateTreeBrainComponent

#jira UE-135723

#ROBOMERGE-AUTHOR: mikko.mononen
#ROBOMERGE-SOURCE: CL 18280804 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v895-18170469)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0

[CL 18280809 by mikko mononen in ue5-release-engine-test branch]
2021-11-24 04:26:29 -05:00
mikko mononen
4f7ae55361 StateTree: handle transitions after ticking tasks and evaluators
- changed at which stage transitions are handled
- updated the binding visibility of tasks and evaluators (transition conditions can see task data now)

#jira none
[REVIEW]
#preflight 619217e6e96ba28321d9e72e

#ROBOMERGE-AUTHOR: mikko.mononen
#ROBOMERGE-SOURCE: CL 18183493 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v895-18170469)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0

[CL 18183500 by mikko mononen in ue5-release-engine-test branch]
2021-11-15 03:46:57 -05:00
mikko mononen
24de01248c StateTree: allow task/evaluator/condition to have separate data for isntance and item in the tree.
- Changed conditions to use the same code structure as tasks and evals
- Tasks, Evaluators, and Conditions can have separate struct for instance and tree item
- Converted existing tasks/evals/conds to use the new setup
- Updated the UI to use the new setup
- Limited the property binding to only first level properties in the instance struct
- Removed StateTreeConditionItemDetails (uses the same details customization as tasks/evals)
- Removed bunch of old test tasks and evals

#jira UE-133870
#rb Yoan.StAmant

#ROBOMERGE-AUTHOR: mikko.mononen
#ROBOMERGE-SOURCE: CL 18165353 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v889-18060218)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0

[CL 18165377 by mikko mononen in ue5-release-engine-test branch]
2021-11-12 05:49:31 -05:00
yoan stamant
7aefe60674 Misc type conversion warning trivial fixes
#rb maxime.mercier
#preflight 618aa174cd591b516590f10c

#ROBOMERGE-AUTHOR: yoan.stamant
#ROBOMERGE-SOURCE: CL 18107621 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v889-18060218)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0

[CL 18107630 by yoan stamant in ue5-release-engine-test branch]
2021-11-09 12:24:26 -05:00
mikko mononen
8bb7c1edaf StateTree: calculate external item indices correctly
#jira none

#ROBOMERGE-AUTHOR: mikko.mononen
#ROBOMERGE-SOURCE: CL 18031381 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v885-17909292)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0

[CL 18031432 by mikko mononen in ue5-release-engine-test branch]
2021-11-03 07:03:18 -04:00