I think an octree version would work quite well - should have similar/same performance characteristics for accessing neighbors and the like, with the added benefit of making longer queries faster (since you can reject things based on the highest octree level with the largest volumes).
In any case, awesome system! Thanks a ton I am going to use this for the dragons in my game.
@MatzeOGH, @n00854180t - Great! It would make me really happy to see other games use this system.
Let me know if you face any setup issues.
@sivan - thanks, I hope you find it useful. I went through the same route, before I made it a plugin, this was deeply coupled with my own gameās classes and I had to refactor, rename and eliminate unwanted dependencies to make it a separate plugin module. Making the plugin itself was easier than Iād expected, I just used the UObject plugin under Engine\Plugins\Developer\UObjectPlugin as a template and that had me covered for the most part.
Oh my gosh ā¦ is this real ??? I want it. I used to create cheated paths (precalculated) for the AI when was need it to avoid obstacles but this ā¦ I need to test it. Thank you! One question: is the pawn aware of itĀ“s neighbours?
Not yet Iām afraid - not formally at least. You could override AddMovementInput for your pawn or implement my AddMovementInputCustom interface (either of which the āFlyToā node will use) with your own neighbor avoidance logic and depending on how complex your paths are this might be a viable strategy.
Another option is to use the dynamic collision repathing that I have for regular meshes (dynamic obstacles) for the neighbor pawns (by adding āPawnā to āObstacle Query Channelsā in the manager) but there are some messy complications with this:
It would recalculate paths each time an obstacle occupies it, which is great for regular obstacles but not very efficient for neighbors whoāre travelling along a similar path as you (because of potentially frequent recalculations of the entire query).
The system requires both pathfinding origin and destination to be in empty space and if not, it will reject the query. Now if we add āPawnā as a collision object type and your neighbor has reached the goal before you (thus occupying space around the goal) then your pathfinding query will simply fail with a message that the goal is invalid and cannot be reached!
In the sample project the bots often merge into each other because of lack of neighbor avoidance and also because their pawn collision is set to only overlap pawns instead of blocking them.
@ : thanks for the hints! I try to design my stuff to be game designer friendly, so I use e.g. data assets created from csv files for my RTS group formations (and other little blueprints derived from my C++ classes), but I think at the moment content in plugins is not supported, thus probably shipping the plugin with a sample project - as you did - is the best to show how to use a it.
Lol not reallyā¦ After years of benefiting from the system in the form of free open source software, free wikis, free tutorials, guides and forum support from so many people, not just in Unreal, but everywhere, you start to feel guilty that you havenāt given back anything to the system from which you took so much. If this plugin is used successfully by other games I would feel some relief in knowing that Iāve hopefully given something back.
Interesting idea. Just try modifying ADonNavigationManager::CanNavigateByCollisionProfile from this:
if (!CanNavigate(Volume))
return false;
to
if (!CanNavigate(Volume) || Volume->DynamicCollisionNotifyees.Num())
return false;
ā¦this might work. We are leveraging the fact that any active path solution will leave a trail of dynamic collision notifyees on the voxels.
Try it out if you need it, I wonāt get the time to test this myself any time soon and Iām also wary of implementing this as a formal solution because itās not very across usecases.
Eg: what happens if 10 bots need to travel through a narrow crevice where thereās only room for one bot to squeeze through! So if I implement this at the plugin level, all possible usecases need to be understood, performance profiled, tested, etc. Also, the āFly Toā node may be a better candidate for housing a full-blown neighbor avoidance solution as locomotion is its primary duty.
==
Neighbor Avoidance and Octree voxel solution (for supporting larger maps) are long-term features I would love to support some day, but expect at least 4-6 months before I can revisit this!
Iāll release bugfixes occasionally whenever I find them in my own game (which uses this plugin), but for now I need to focus on my personal project and canāt commit to new features. The source code is there for people to implement anything they like though!
v1.1 contains a major bugfix, make sure you download v1.1 of both plugin and samples if you plan to use this for your game.
Bugfix MSPaint-ed
Imagine a flying creature landing on a hard surface (eg: for resting) and then flying away. Because it squats on a red voxel, the system starts pathfinding from the closest green voxel instead (whose center becomes the āeffective originā). This bugfix ensures that the pawn travels to the effective origin first instead of directly traveling to the next segment (and thus bumping into something on the way!)
I understand that but my case is slightly different than this: a scene level with various obstacles (debris) in a open space and some bots trying to get to a some goals (distributed to each bot, by an AI, depending on the number of bots). WeĀ“re talking about dog fighting (Iāve just put it in a more complicated way :D) I also understand your position in giving the most cleaner solution so that every one could change it to itĀ“s needs and I am 100% with you!
I will like to bother you with one more question: is it possible to have more DON managers in one scene and if so can you pass from one manager to the other?
Thank you for your time.
Edit:
By the way, I watched the DoN The Nature Game ā 30 minute gameplay video! and itĀ“s amazing! And the Vivaldi is the best choice that could accompany your game presentation. I wish you make this nature sim as perfect as possible. The work youāve done is amazing.
Self-contained managers should work with a small fix for āFly Toā node to smartly lookup the right manager for a pawn instead of blindly using the first one (thatās how it works now). Iāll look into this in a week or two, should be an easy fix that will deliver great value. For people whoāre using direct API calls instead of the āFly Toā node you can just tell the API which manager to use yourself.
Again, each manager is self-contained; a pawn in one navigation zone can only pathfind within that zone. Inter-zone/Inter-Manager navigation could be a nice strategy to support large maps so I might investigate that mid-term. The Octree voxel approach suggested by others is probably a better long-term investment but it has āGiant time-sink, Developer beware!ā written all over it so Iāll instead try to support multiple zones for now.
Thanks a lot for checking out my game! I hope to make it an all-encompassing Nature Sim and as long as I can sustain development Iāll keep inching slowly towards that goal.
Steam Greenlight was supposed to happen last month but releasing this plugin took so much more energy than I expected that I couldnāt work on the game for almost a month at that time.
Vivaldiās music fuels both development and the promos! There is little doubt in my mind that some 300 years ago the inspiration for his Four Seasons Music draws from the same fountain that Iām tapping into today. Now whether my game ends up at least a wee bit as good as Vivaldiās compositions, only time will tell
I had to disable substance plugin to run, because I donāt have it.
First packaging failed because assets had too long names - fixed that.
Then I packaged 64 bit build for windows - build successfull.
When I try to launch packaged game, I recieve this message:
When Iām launching from standalone game or pie it works.
Can someone whoās also downloaded v1.1 confirm what @hamsterPL is seeing please?
That would be really helpful to narrow down the issue as Iām not able to reproduce it
Try this workaround:
Open the project, choose File -> āNew C++ classā, create any dummy class
Restart the editor.
Try packaging again.
This workaround has been suggested in the forums for Blueprint-only projects that need to use C++ plugins. Maybe it works for me because I have Visual Studio installed, really not sure.
Another thing - are you packing with build configuration of āDevelopmentā or āShippingā?
Both work for me, although shipping needs a workaround described in this answer hub post (without which it throws a āfailed to open descriptor fileā error).
Hmmā¦Iām not using anything substance related in this project at all! Thatās really odd.
Did it tell you which assets were problematic? None of the Epic content in the project (eg: the bots) seem to use the Susbtance plugin either. The Substance plugin is free in any case, but still Iām not sure why the project seems to need it.
Oh yeah, that file developed a CRC issue while I uploaded it, just a file corruption issue totally unrelated to Substance plugin.
I fixed that some time after your initial post by re-uploading v1.1 again. If you have the bandwidth to spare grab the latest upload (itās still called v1.1).
BTW the shipping workaround in the answer hub post can be very hard to find (itās a long thread) so Iāll just paraphrase it here:
Go to WindowsNoEditor\DonNavigationSamples\Binaries\Win64
Change DonNavigationSamples-Win64-Shipping.exe (or 32-bit equivalent) to DonNavigationSamples.exe.
Use that exe for launching instead of the exe under WindowsNoEditor (which will no longer work after applying this fix)
This workaround is not for the plugin load issue though; for that, the āAdd C++ classā workaround is the the best bet we have for now so try that first.
Ah! If adding a simple dummy class isnāt working then it makes me suspect environment issues unrelated to the project.
Can you post the āOutputā logs of Visual Studio instead of the error list? For Unreal projects Visual Studioās error list is not usually accurate, the compilation output from the Unreal Build Tool is what weāre really interested in here.
In the meantime, if someone else can try packaging and tell us how it goes that would really help! I think most people have the old v1 version (where packaging definitely wonāt work) so if anyone wants to give it a try make sure you download the latest version v1.1 first.
I downloaded the sample project from scratch, tested packaging and it just works for me (even without the C++ class workaround) so Iām beginning to suspect this is more environment related.