Page 1 of 3
Posted: Thu Mar 22, 2018 5:37 pm
I can't find much info on the navmesh tool. I have a bot in the nav area but not sure of any script commands I can give it to spawn, shoot, chase or hide. I saw a couple videos on setup and testing but nothing about how to use it in game.. any help or pointers ?
Posted: Thu Mar 22, 2018 6:10 pm
Originally the nevmesh was a 3rd party resource before the author was nice enough to open source it. Here's the original documentation on how it works.
http://yorkshirerifles.com/random/Walka ... tation.zip
Posted: Thu Mar 22, 2018 6:27 pm
Well you need to program the AI yourself, the navmesh is just for navigation, but you can use BadBehavior, it comes with a few example behaviors for AI players.
Posted: Fri Mar 23, 2018 12:43 am
Thanks for the reply. I will have a look at these things. I have developed my own AI system and thought the navmesh was a A* technology for moving the bots around.
Posted: Mon Jul 23, 2018 5:47 pm
I got the navmesh to build and I can run the bot around, works fine.
Question is I have an aiPlayer I created, how do I make this bot associate or know about the navmesh?
I call %bot.findNavMesh() and it returns -1 I note in the c++ the line
"Get the NavMesh object this AIPlayer is currently using" I dont see how to make my aiPlayer "use" this navmesh. How do I point my ai to the mesh?
Posted: Mon Jul 23, 2018 6:25 pm
Quote from code I use in Uebergame, it is a move command, that works with and without NavMesh, the Bot will check if a NavMesh is existing and if so uses the NavMesh and if not uses a fallback no-NavMesh navigation system.
I would recommend to use an AI system such as BadBot which I use, otherwise you have to code your AI yourself, which is not that hard for the basics, but a framework makes things easier.
Code: Select all
// moveTo command, %dest can be either a location or an object
function BadBot::moveTo(%obj, %dest, %slowDown)
%pos = isObject(%dest) ? %dest.getPosition() : %dest;
if ( %obj.getNavMesh() )
%obj.setPathDestination(%pos); //setPath uses navMesh
%obj.setMoveDestination(%pos); //old function wihtout navMesh
%obj.atDestination = false;
Fell free to rip off my implementation.
Posted: Tue Jul 24, 2018 1:48 pm
Well I got it mostly working. I discovered you have to do navmesh.build() when the game loads.
I notice in the navmesh description the line vehicles = "0"
I changed that to a 1 rebuild and the bots still collide with any vehicle. Any way around that ?
thanks for your help by the way, checked out your game, impressive...
Posted: Tue Jul 24, 2018 3:30 pm
You don't have to do navmesh.build or whatever, the navmesh is build in the navmesh editor and then saved to a file. The navMesh is not dynamic, it is build once and then used that way as rebuilding it would cost too many resources and take too long. Only thing you can do is rebuild parts of the navmesh, which can happen fast enough, I have seen this in a demo from the user @ Azaezel
in his game, where he used it to rebuild the navmesh around characters, so they do not get stuck. In my game I do not bother with it that much, since the bots are usually dead before they can get stuck, additionally I have a push function so you can push other players out of the way which helps also.
Posted: Tue Jul 24, 2018 11:18 pm
Ok starting to make more sense. I made the navmesh and it saves in my mission file is that what you mean? If so it wont work unless I do a build at load time. I can get in edit mode and tell my bot to follow me and it works fine but in game it tells me there is no valid mesh
Posted: Wed Jul 25, 2018 12:32 am
I have no idea what you did, the NavMesh works by default, you do not have to do anything, so if you broke it, you have to tell us how you broke it, or reset to a clean working build.