AI Pathfinding?

Does anyone know the “slightly modified A* algorithm” that MonkeyZone uses? I’m trying to get some basic AI working for the next version release of my game, and for this I want some sort of pathfinding. The algorithm/navigating library or whatever that MonkeyZone uses will probably work good.



PS: I have a plan to change the NavMesh that my AI’s load depending on whether or not they’re in a vehicle. If you want to know more about this game, I have a thread in the User Projects category. It’s called El Birth Contrablo/Lexicon. Any criticism or pointers are openly welcome! I aim to make the next release a major thing, and for this I want (at least semi) smart AI. I have LOTS of AI code already in place, but I have to hand program their paths. All I need is a good pathfinding algorithm or something good to get them moving correctly. Thanks in advance!

The AI libraries MZ uses are actually pretty self contained. The navigation mesh library is called nmgen, MZ uses it through a wrapper. As for the actual pathfinding, its using a Java port of a navigation mesh pathfinder that was in Game Programming Gems 2.

Would I be able to get my hands on the pathfinder? I already found and use nmgen, I just need a pathfinder.

I had asked a similar question a few days ago with no good reply but managed to find some sources and put it together.

Hopefully this will save you, and others, some trouble and make your development that much easier.

Below is a link to a source folder you will need to add to your project as a package.

https://www.dropbox.com/s/160rwgvmi0qj7yv/Pathfinder.zip



With that in your application (And navMesh generated) you can use something similar to this

[java]

import navmesh.NavMeshPathfinder;



public NavMeshPathfinder Pathfinder;

Pathfinder = new NavMeshPathfinder(scene.getNavMesh());

Pathfinder.setPosition(Origin);

Vector3f pos = Pathfinder.warpInside(Target);

Pathfinder.computePath(pos);

List<Vector3f> wpPositions = new ArrayList<Vector3f>();

for (Waypoint wp : Pathfinder.getPath().getWaypoints()){

wpPositions.add(wp.getPosition());

}[/java]



Good Luck!

MonkeyZone is open source? You can use the code as-is:

http://code.google.com/p/monkeyzone/

@constantine

Thanks! I’ll be trying that very soon!



@Momoko_Fan I knew that, and I thought I had downloaded MZ at some point but I couldn’t find it and figured I’d just ask around :stuck_out_tongue:

@vinexgames

Did you get anywhere with this? I’m trying to do the same thing and any help would be appreciated. :slight_smile:

I did but it was really buggy. I’m actually in the process of re-writing it. :confused:

http://www.critterai.org/ is a good place to start. It gets you the navigation mesh pathfinder code. Get the MonkeyZone code and find it’s NavMeshGenerator class and copy it, and you’ve got more or less usable AI. I couldn’t seem to get the whole map working right but I’m almost certain that was error and bad code on my part, not theirs. Hopefully you’ll have better luck with it. :slight_smile:

if you have any questions on the game programming gems code you can ask me, besides the navmesh code in monkeyzone does not properly write/load in the NavMesh class.