Commit Graph

154 Commits

Author SHA1 Message Date
christopher waters
2285d21e63 Removing TaskGraphInterfaces.h include from CoreDelegates.h
[CL 23836502 by christopher waters in ue5-main branch]
2023-01-24 15:07:59 -05:00
bob tellez
6e7878c698 #StateTree Downgrade warning to display for now
[FYI] mikko.mononen
#preflight trivial

[CL 23827147 by bob tellez in ue5-main branch]
2023-01-24 00:27:06 -05:00
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
fb1a0fad3d StateTree: Fix mutable uses of instanced structs and struct views.
#jira UE-172049
#rb Mieszko.Zielinski
#preflight 63c002ab577437afe6358e84

[CL 23662521 by mikko mononen in ue5-main branch]
2023-01-12 09:45:58 -05:00
mikko mononen
57a0d8a492 StateTree: More graceful handling of GetStateTreeRunStatus()
- Calling GetStateTreeRunStatus() on unintialized instance is not error anymore, returns failed
- Made UStateTreeComponent::GetStateTreeRunStatus() to return failed instead of unset to be consistent with FStateTreeExecutionContext
- Allow to access execution state directly from instance data without exec context
- Do no crete exec context in UStateTreeComponent when sending events

#jira UE-173207
#preflight 63bfec4af02e72c08cab1811

[CL 23661828 by mikko mononen in ue5-main branch]
2023-01-12 09:00:45 -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
d30ad5127b State Tree: new node picker
- added class picker style new node picker with search box and categories

#rb Mieszko.Zielinski
#preflight 63be76206e6e8d4662c637fb

[CL 23643504 by mikko mononen in ue5-main branch]
2023-01-11 05:08:00 -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
foobit
7c8f7ac6fe PR #9830: [StateTree] StateTreeComponent.GetStateTreeRunStatus method and status delegate (Contributed by foobit)
#rb Mikko.Mononen
#preflight 639c374143330e63e5bb8fd0

[CL 23536754 by foobit in ue5-main branch]
2022-12-16 05:45:13 -05:00
johan torp
146b21d3d4 GC reachability optimizations. ~1.5x speedup and ~2.5MB memory saved for an internal title.
List of optimizations and changes:
* Token stream structure
    * Split token stream into strong-only and a mixed (weak+strong) stream
    * Split token stream into a builder and a tighter view class which reduces sizeof(UClass)
    * Implemented ref-counted token stream view sharing
    * Removed Class and Outer from token stream
    * Allow empty token streams (enabled by removing Class/Outer) to avoid touching token stream data
    * Placed ARO (AddReferencedObjects) last to reduce per object cache thrashing, improve control flow predicability and avoid reading the last EndOfPointer and EndOfStream tokens
    * FPrefetchingObjectIterator that bring in Class/Outer, class' tokenstream view and the first token data ahead of time
    * Decode token bitfield once and ahead of time
* Reference queues and batch processing
    * Introduced bounded queues: ref arrays -> unvalidated refs -> validated (non-null / non-permanent) refs
    * Split all these queues for killable vs immutable references
    * Stack-living references still handled synchronously. With removal of Class/Outer (prefetched ahead of time) few instances remain outside of ARO calls.
    * Outer queues hold 32 items and get flushed when full.
* AddReferencedObjects (ARO) optimizations
    * Misc optimizations in many ARO implementations
    * New FReferenceCollector API to queue up ARO references (AddStableReference), old sync API (HandleObjectReference) still available
    * New AddPropertyReferences traversal that replaces SerializeBin and PropertyValueIterator
        * 4.5x faster than PropertyValueIterator
        * Uses CLASSCAST dispatch instead of virtual SerializeItem dispatch.
        * Step towards new unified token stream replacement shared by class token processing, structs and ARO
    * Replaced StructUtil::AddReferencedObjects with AddPropertyReferences traversal, ~8x speedup and collects more references for CitySample
* Parallelism
    * Single long-running task per worker
    * Improved work-stealing / load-balancing, workers can steal full blocks, ARO calls and initial references
    * Queue up slow ARO calls to improve load balancing and avoid late stragglers. Motivated by certain ARO calls taking over 2ms for a few specific objects.
    * Kick tasks manually to avoid ParallelFor end synchronization
* FGCObject
    * Initial reference collector runs in parallel with mark phase
    * New FGCObject constructor API (AddStableNativeReferencesOnly) to opt-in to initial reference collection, used by StreamableManager
    * Same constructor API allows FGCObjects to defer registration until they become active (RegisterLater), reduces number of active GCObjects
* Reduced memory usage
    * Allocate reached objects in scratch pages (FWorkBlock) and reuse processed blocks, instead of swapping two big TArray<UObject*> per worker
    * Reduced sizeof(UClass)
    * Shareable token streams
* Misc optimizations
    * New API to test if an object is in the permanent object pool. Old API read two global pointers for every visited reference.
    * Fixed signed integer usage in GUObjectArray lookup that led to bad codegen
    * FPropertyIterator optimizations
    * SerializeBin optimizations
* Other changes
    * Moved many helpers into UE::GC namespace
    * Replaced TFastReferenceCollector API with simplified CollectReferences call. Needed to break this API  any way.
    * Introduced FGCInternals to avoid forward-declaring TFastReferenceCollector and depend on the options enum in common headers
    * Moved and outlined code from GarbageCollection.h / FastReferenceCollector.h to GarbageCollection.cpp
    * Moved GC History and Garbage Reference Tracking into a synchronous TDebugReachabilityProcessor
    * Removed PersistentGarbage flag since it wasn't used in practice
    * Improved const correctness

#rb robert.millar,robert.manuszewski,pj.kack
#preflight 63945bf45624e6da5ec85f88
#jira UE-169791

[CL 23475562 by johan torp in ue5-main branch]
2022-12-11 23:21:18 -05:00
mikko mononen
a41a8c85f8 StateTree: extend when BP nodes can send events
- cache event queue for the whole active duration of the nodes
- this allows events to be sent outside tick (e.g. from delegate callbacks)

#preflight 638deb98c0652bbec2df9368

[CL 23389834 by mikko mononen in ue5-main branch]
2022-12-05 09:16:37 -05:00
mikko mononen
fe252a1f95 StructUtils: Renamed FInstancedStructArray to FInstancedStructContainer
#jira UE-170863
#rb Mieszko.Zielinski
#preflight 638debbb7e0feab0b7da3359

[CL 23389832 by mikko mononen in ue5-main branch]
2022-12-05 09:16:27 -05:00
mikko mononen
d2a74f6f7c StateTree: Fix missing include.
#rb trivial
#preflight 638dac9a976b1644cb0efe80

[CL 23388195 by mikko mononen in ue5-main branch]
2022-12-05 05:01:48 -05:00
mikko mononen
de58b75795 StateTree: Be more resilient when loading out of date BP data
- Try to convert to latest version when duplicating data
- Convert property binding source/target classes to latest version on link
- Handle BP reference replace in instanced structs

#rb Mieszko.Zielinski
#preflight 638d97e0303395f6c97629fd

[CL 23387730 by mikko mononen in ue5-main branch]
2022-12-05 03:19:45 -05:00
Stephen Holmes
2f18773caa Addressing the remaining AI numeric conversion issues.
#jira UE-166285
#review
#preflight 638a031b35192facc1c0fd77

[CL 23372606 by Stephen Holmes in ue5-main branch]
2022-12-02 10:07:29 -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
Victov
b7ba597b60 PR #9823: Fix a problem in StateTreeConditions where GetWorld is null (Contributed by Victov)
#rb Mikko.Mononen
#preflight 6389b69b0e4613faed0c2ee9

[CL 23370655 by Victov in ue5-main branch]
2022-12-02 05:18:07 -05:00
mikko mononen
1cc286a596 StateTree: Add indirection to FStateTreeInstanceData so that it can be bitwise relocated.
#rb Mieszko.Zielinski
#preflight 63872b0d3377450900b579a6

[CL 23325782 by mikko mononen in ue5-main branch]
2022-11-30 07:17:26 -05:00
Matt Peters
2d5975f362 IncrementalCooking - Add DeclareConstructClasses to types that need it.
#rb Zousar.Shaker
#rnx
#preflight 63811e084004f73f62dee973

[CL 23268593 by Matt Peters in ue5-main branch]
2022-11-25 15:40:13 -05:00
mikko mononen
e450d18a9f StateTree Fixes and Improvements
- Use hierarchical GamplayTag match when matchin transition event tags
- When returning succeed/failed fomr a subtree, handle it as if the linked state was completed
- Call Stop() before initializing the instance data on Start() to avoid the instance data to be overritten by Stop()
- Early out Stop() if the tree is not running
- Fixed failed transition not setting OutTransition.CurrentActiveStates correctly

#preflight 637e12ee8b12eb83a71bb694

[CL 23248889 by mikko mononen in ue5-main branch]
2022-11-23 09:22:14 -05:00
bryan sefcik
4b8a83790a Updated to use UE_INLINE_GENERATED_CPP_BY_NAME.
#jira
#preflight 637c388f170bc34a93587526

[CL 23244381 by bryan sefcik in ue5-main branch]
2022-11-22 20:17:33 -05:00
mikko mononen
2c797f2adb StateTree: Changed completion transitions to trigger at the state that was first completed.
- record the first completed state on EnterState() and TickTasks()
- returning succeeded on any node in EnterState() now behaves the same as returning succeeded on Tick()

#rb Mieszko.Zielinski
#preflight 637caf2df514e1ded9f280e4

[CL 23233890 by mikko mononen in ue5-main branch]
2022-11-22 08:13:54 -05:00
mikko mononen
ef58f44983 StateTree: Fix BP task execution
- Added explicit bShouldCallTick and not make the tick based on of the event is implemented
- This fixes the cases where we are using the BP task class to implement UObject based tasks in C++

#preflight 637c9ea3170bc34a9370bb0b

[CL 23233007 by mikko mononen in ue5-main branch]
2022-11-22 06:18:24 -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