Commit Graph

26 Commits

Author SHA1 Message Date
mikko mononen
e2fd3455a9 StateTree: Allow tasks to request transitions
- Added ability for tasks to request transitions
- Added buffered transition requests
- Added callback method to FStateTreeTaskBase which is called during transition triggering
- Allow FStateTreeStateLink to be added to tasks and conditions (resolved automatically during compile)

#jira UE-174250
#preflight 63ca7ee8977c62635603afcb

[CL 23815873 by mikko mononen in ue5-main branch]
2023-01-23 12:48:04 -05:00
henrik karlsson
9183978e29 [Engine/Plugins]
* Removed includes (using IWYU) in private files

#preflight 63c79978ac35a0e9dabbe408
#rb none

[CL 23770038 by henrik karlsson in ue5-main branch]
2023-01-19 00:48:07 -05:00
mikko mononen
29f4ff63e1 StateTree: bump external data handly type to 16bits to not limit max nodes to 254.
#rb Mieszko.Zielinski
#preflight 63be8591d862fdd347408bef

[CL 23648546 by mikko mononen in ue5-main branch]
2023-01-11 12:44:01 -05:00
mikko mononen
ab3816dd30 StateTree: Added global tasks
- Added global tasks which are run at tree level similar to evals (will replace evals)
	- allows initial state selection to rely in calculated data (e.g. world conditions)
	- allows better reuse of existing logic
- Call evaluator stop in reverse order
- Use some uses of mutable instanced structs
- Copy bindings along with ST nodes
- Remove bindings when removing a ST node, so that undo can restore them

#rb Yoan.StAmant
#preflight 63bd2c7968068a8bd6395d2c

[CL 23632408 by mikko mononen in ue5-main branch]
2023-01-10 15:44:28 -05:00
mikko mononen
8baac28d95 StateTree: Compiler was using wrong array when validating conditions.
#rb trivial
#preflight 6391a04d5c5308d18cab2069

[CL 23444269 by mikko mononen in ue5-main branch]
2022-12-08 04:39:33 -05:00
mikko mononen
df359ce99e StateTree: Transition improvements
- Removed gated delay (transition will be delayed until it has been "pressed" for N seconds)
- Delay now triggers after the delay duration has passed (single trigger, not "pressed", works with events too)
- Added random variation for the delay
- Tick/Event transitions has precedence over completion transitions (that is, they are handled before completion transitions)
- Removed delay and blocking from completion transitions
- Small improvements for transitions UI

#rb Mieszko.Zielinski
#preflight 6389e0b435192facc1b95cdb

[CL 23371519 by mikko mononen in ue5-main branch]
2022-12-02 07:57:31 -05:00
mikko mononen
1c69b826cc StateTree: Added node validation during compilation
- Added a pass during compilation when node and instance data can be checked and adjusted by the node
- Changed blueprint based task to copy flags to the node in Compile()
- Changed relevant gameplay interaction tasks to check tags during Compile()

#rb Mieszko.Zielinski
#preflight 6377724cf514e1ded9a5ff44

[CL 23193668 by mikko mononen in ue5-main branch]
2022-11-18 08:38:31 -05:00
mikko mononen
f57006bb63 StateTree: Fix compilation of any enum bindings.
#jira UE-166050
#preflight 63564428ae33b04ec1bc45de
#rb Mieszko.Zielinski

[CL 22783245 by mikko mononen in ue5-main branch]
2022-10-26 13:01:21 -04:00
mikko mononen
a43fd72984 StateTree: Editor fixes
- Updated add button to new positive button style
- Change the add-state logic to add to root or subtrees if context is present (e.g. add after)
- Renamed UStateTreeState::LinkedState to LinkedSubtree to indicate what kind of state is expected
- Removed strong reference from the treeview (was preventing a StateTree asset being deleted)
- Fixed bad colors when renaming a state

#jira UE-151757, UE-151874, UE-163569, UE-150568
#rb Mieszko.Zielinski
#preflight 63369601f76de2d4d5977b94

[CL 22271644 by mikko mononen in ue5-main branch]
2022-09-30 11:31:57 -04:00
mikko mononen
ab1b7f80cf StateTree: fix test and empty parameters
- handle empty subtree parameters
- changed a compiler check() to an error
- fixed tests

#jira UE-164541
#rb Mieszko.Zielinski
#preflight 632c4e77671a1a24b5ff67a6

[CL 22163478 by mikko mononen in ue5-main branch]
2022-09-23 19:58:36 -04:00
mikko mononen
780e3d6ec2 StateTree: Handle optionally bound Input properties.
#jira UE-164450
#rb none

[CL 22112889 by mikko mononen in ue5-main branch]
2022-09-21 10:45:14 -04:00
mikko mononen
0d47d49765 StateTree: Context Objects
- Cleaned up Blueprint nodes from deprecated functions
- Added call guards for BP implemented events on BP nodes
- Renamed Named External Data to Context (Object/Data)
- Added automatic binding for Context objects
- Added UI visualization for Context properties and cleaned up the Input/Ouput visualization
- Added compiler errors for missing Input and Context properties

#jira UE-156544 UE-147509
#rb Stephen.Holmes

[CL 22084585 by mikko mononen in ue5-main branch]
2022-09-19 19:47:11 -04:00
mikko mononen
bbd34dd782 StateTree Events
- Added StateTree events, which allows e.g. transitions based on internal or external events
- Clarified transition nomenclature
- Update UI to support transition events
- BP support for events
- Renamed UStateTreeItemBase to UStateTreeNodeBase for consistency with FStateTreeNodeBase

#jira UE-156543
#rb Mieszko.Zielinski
#preflight 631077ef660db81edbd068ca

[CL 21738918 by mikko mononen in ue5-main branch]
2022-09-01 09:06:53 -04:00
mikko mononen
2a196bac7c StateTree:
- Changed existing conditions to use the simpler instance data getter
- Added UObject based conditions
- Renamed condition file for consistency

#rb Mieszko.Zielinski
#preflight 6304879ca45b007ea268d917

[CL 21512046 by mikko mononen in ue5-main branch]
2022-08-23 13:04:52 -04:00
mikko mononen
3e852502b6 StateTree: Fixed failing test and missing validation
- fail compilation if linking to non-subtree
- fixed crash in linker if subtree does not have parameters
- fixed subtree test (subtree state was missing type)

#jira UE-155893
#preflight 62d90fd3d54af4b9a2fc04c0

#ROBOMERGE-AUTHOR: mikko.mononen
#ROBOMERGE-SOURCE: CL 21198999 via CL 21199006 via CL 21199009
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)

[CL 21199538 by mikko mononen in ue5-main branch]
2022-07-21 08:19:56 -04:00
mikko mononen
841f7320c9 StateTree struct reference
- added functionality to allow to use property binding to get pointer to another struct property
- converted mass smart object and movement tasks to use struct ref

#jira none
#robomerge EngineMerge
#rb Yoan.StAmant
#preflight 62bc0d51e353c20ac23fbf39

[CL 20871790 by mikko mononen in ue5-main branch]
2022-06-29 04:52:18 -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
35cf1ec0cb [StateTree] NamedExternalDataDescs are now copied from schema to the StateTree at compilation. Schema derived classes need to override only one method to provide their descriptors.
#rnx
#rb mikko.mononen
#preflight 6274282203269096abd41d8f

[CL 20063572 by Yoan StAmant in ue5-main branch]
2022-05-05 15:58:09 -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
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
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
Yoan StAmant
b4f64a59e0 [StateTree] external data validation from schema supported types
- fixed external requirements set by StateTreeBrainComponent to find more specific actor classes first before defaulting on AActor
- added missing supported type FMassSharedFragment for MassStateTreeSchema
- moved StateTreeLinker to it own file and handle its potential failures
#rb mikko.mononen
#rnx
#preflight 624d98fd8e5ae00f0aca3123

[CL 19646871 by Yoan StAmant in ue5-main branch]
2022-04-06 10:04:05 -04:00