Closed Fangrelle closed 2 years ago
I might setup the pathfinding process as an observer and make better use of tag switching.
Yeah, ill prob fix that, i think its more inline with ECS.
Awesome job making new statetree tasks/evals!!! And you even got the crowd actor BPs working!
A few initial questions after I skimmed it (I might be totally off the mark though so bear with me):
FZoneGraphPathTestFromFragment
has a TMap. We aren't really certain if putting dynamically sized things on fragments is okay or not. I guess it would be allocated outside? Thanks for takin a look, I haven't touched anything for a bit, but I am aware of 1,2 things with the ECS processors setup that I might want to change and fix. I ended up typing alot, some of this stuff is weird so i listed things.
TMap<int, int>
The TMap thing didn't even cross my mind, probably because I didn't realise anything was breaking when I ran it. The first thing that I think of would just be to externalize the values completely and have the fragment point to it, but that almost feels a bit wrong to me, mabye i could have like a TStaticArray
im not sure yet, if you know of an elegant way / the right place to stick them.
ZG Path
This one was wierd to understand the short answer is no. No pathfinding to a target.
Long answer is:
ZG follow takes a target location fragment, witch is basically only defines 1 Lane
+ LaneLink
(used to define interlane connections (right, left, dest handle, index: 5, ect...)) to the next lane. With the defualt setup the system has caching and a 1-2 lane combined range. This works fine for what they have currently, which is basically run away logic. The use of annotations (tags on lanes) indicate distubance
eg: UZoneGraphDisturbanceAnnotationBPLibrary
and then they create a mask of the tag (the filter parameter in the FindEscapeTarget
zone graph) and calculate a wieghted graph (CalculateEscapeGraph
) and then return a 1(1.5) lane length escape path, and return that for the FollowPath
to use, then after that if the character guy is still in the disturbance area just do it again.
There is a StateTree
Task
that i made that debug draws the current target location of the followpath target MSShowLanePositionTask
.
A Short: There is no logic for pathfinding for AI, the A is used for both pathfinding and debug. Long: There is an A pathfinder wrapper in the zonegraph that I connected to the find path proccessor i setup, any algoithem can be used, initially for testing I used a quick and lazy DFS algo, its still there and works, it can be uncommented (i might add a boolean for the DFS or something to switch just because the DFS is front and center and simple to skim and it makes it easier to focus on the Mass stuff without having to worry about diving into the wacky zonegraph wrapper of a generic templated A inside the engine to check for hidden stuff).
A default thing
A So with the A there is no current implementation in the AI behaviour for proper long range pathfinding (within the StateTree it self). However I did find a pathfinding implementation (the A wrapper used) that was in ZoneGraphTestingActor
its a defualt testing actor and you can actually see the A* if you drag 2 of them into a level set the OtherActor
values to point to each other and tick the show path box (move them around a bit the updating is funky).
The BP_MassAgentCrowdCharacter
the LODSync thing is not really functioning in the current thing, the LOD sync thing was internded for the kind of meta crowd character stuff, It should be fine to remove as there is already an LOD trait that deals with simple stuff like this. There are a couple other bits (some traits) that could be shaved off.
The MassNavigation
module has some avoidance, steering stuff, and it works with the other modules to create a kind of half, localized navigation with ZoneGraph anvigation (uses obstical grid) with a point based pathing system that is used to move along lanes.
I have messed around with the nav stuff in ue4 before, and I think it would actually be nice to link the defualt nav setup and ECS. There is a lot similar logic between the two nav systems traversal (grids (hashGrid), path linking, avoidance) and the actions would align well. I dont think thats a coincidental, prob based on it.
I havent looked deeper into StateTree stuff, but from what i can tell it looks like it could be done, I dont think it would be hard. But I do think I would take a lot of time, it sounds like a whole project, I wouldent be suprised if Epic intends on doing that exactly. The inbuilt AI stuff already has similar kinds of optimization to stuff in zone graph, and the state tree
Normal Nav mesh -> StateTree Plugin -> Mass StateTree stuff
Normal Navmesh AI:
I think definantly possible, would take a fair bit (mabye alot) of work though (normal nav interfaces can be frustrating to work with in my experience). Not something that I would do at the moment.
Honestly you've got me thinking about setting up the statetree with nav mesh now, not just to link up with stuff like ECS. But because the old Behaviour tree -> StateTree would be so nice...
Cancelling PR, haven't been able to update(time). There is some other relevant content.
I have closed PR, have not had time to update.
Initial draft PR for Pathfinding Example .cpp and .uassets.