Game Development Community

Flexible A* Pathfinding System troubles

by Charlie Higdon · in Technical Issues · 01/15/2009 (11:51 am) · 13 replies

I recently tried installing the Flexible A* Pathfinding System, and I followed all instructions exactly. I copied it from the resource page yesterday, and noticed the DL wasn't on that page.

I thought I might have had it, and I did have the ZIP in a folder I created when I went nuts downloading resources before.

I'm hoping someone can help me with a problem or 2 I have. The last post in that resource is from April 2008, and with the way the site's still disorganized I doubt anyone's gonna be going to that resource in the next few days.

My problems are:

When I start the game, I do what the resource says,

"To add navigation points, open the mission editor creator. NavMesh objects are under Mission Objects / Mission. The properties are:
Interval - distance between points
XSize - number of points in x direction
YSize - number of points in y direction
Height - how far up or down the object will look to place points "

I get a box asking me to name it, I do, and nothing happens. In the console it says,"unable to instantiate non-conobject Navmesh"

Below that, not in error RED is "unable to find function readPaths".

When trying to add a Navmesh it creates another error in the console,

"Creator/newobject.cs , Line 1 parse error.
bjectBuilder.newobject = new NavMesh(mesh1){##}##;"

Anytime I try making a new navmesh i get the same error, changing navmesh name results only in a new navmesh name in the console error.

There is a file created called newObject.cs, which has the text,"
ObjectBuilderGui.newObject = new NavMesh(a2ra) {
};"

(a2ra) is replaced with whatever I name the mesh each time.

When I build the project I get
"========== Rebuild All: 6 succeeded, 1 failed, 12 skipped =========="

The log is really long and I'm a bit unsure what parts to paste here. Please help if you can.

#1
01/17/2009 (7:27 am)
Quote:When I build the project I get
"========== Rebuild All: 6 succeeded, 1 failed, 12 skipped =========="
Your build failed so the exe never got updated. And because of that, Navmehses and AStar have not been added to the engine yet, which explains your errors of the object's not existing or functions not being found.

What were the error messages you received? If its really long than it's likely it's just cycling through the same 3 errors or so about 100 times, so just look at the first few entires first.
#2
01/17/2009 (10:17 am)
Well, I did something wrong not sure what it was.

I did a rebuild solution again, launched the game, and it shut off my PC.

I deleted torque and reinstalled it.

I then replaced the aiplayer.cc and aiplayer.h with the new ones. I just dragged them to the folder and clicked yes to replace.

Next, I clicked the C:\Torque\TGE_1_5_2\engine\game folder in the explorer window of my VC2005 program.

I then clicked Project>Add Existing Item and browsed to the aStar.cc and aStar.h files, adding them to the project ( I hope that's the proper way.). I then clicked rebuild solution, and I got

"19>Torque Demo - 0 error(s), 0 warning(s)
========== Rebuild All: 7 succeeded, 0 failed, 12 skipped =========="

I figured, "ALRIGGGHTTT I GOT IT!!!!!".

Sadly I did not. The game launched, 0 script errors. I press F11, click World Editor, choose the MissionObjects>Mission>Navmesh, I give it a name, and nothing happens. I open the console, and I have

"creator/newobject.cs(0): unable to instantiate non-conobject class
NavMesh."

Annnnnnnd I'm stumped.
#3
01/17/2009 (12:49 pm)
Got it, with alot of help from Morrock in the IRC chat.

Now that I have NavMesh in the game...err what do I do? I have the stock barebones mission with kork running on his cirular path.

How do I put him on the navmesh?

Speak slowly please, I'm a layman when it comes to this.
#4
01/17/2009 (2:56 pm)
He no longer runs on the Path1 that he would when the game loads. He is no longer named Kork either. He is named 1546|NoPath or some other random number|nopath.

I changed nothing other than what was directed in the A* resource.
**EDIT**

I am now able to add a navmesh, build and write paths.

I just have 2 questions.

1. How do I get the bot to spawn/follow on it. What line or lines do I change/add in aiplayer.cs or aiplayer.cc for that to happen?

2. How do I get the navmesh to render inside and outside. I want bots to be able to chase me inside buildings?

I noticed on some of my buildings, the ones without doors, the mesh went inside, if it had a door it either left a blank square around the house or made paths up on the roof.

Some buildings it was on the second floor only. Can you have multiple navmeshes and make the bots go from one to another as they are near it?
#5
01/17/2009 (10:06 pm)
1) You need to give the bot a destination to move to. Get the bot's id (the number on his name tag), go into the console, and enter
[b]bot id[/b].findPathTo(Localclientconnection.player.getposition());
The bot should find a path to wherever the player is standing. It's a pretty basic example.

2) For the nodes on roof issue, try to lower the height field on the navmesh to 1.5 or something relatively small, and move the mesh down so that it's on and partly inside the floor. Build the paths and the nodes should be on the floor you want. As for the multiple navmeshes, the bot will be able to calculate a path to you, even if you're on a different navmesh (as long as there is a path, of course).
#6
01/18/2009 (9:29 am)
I think I'm more confused than before. *cry*
Wouldn't that make the bot follow me with or without a mesh?

He's set to spawn on path1 by default in aiplayer.cs. I tried changing the path to the path of the navmesh in mission editor, but he doesn't spawn when I do that.

I tried changing his name to the name of the navmesh, hoping that was why he became "NoPath" instead of "Kork". I understand how to get him to spawn on a path I've made by placing markers. Do I need to place markers on the navmesh that correspond to the path the bot follows by default?

Let's say, he follows "Path 1", do I simply move the "Path1" markers over the navmesh, and he'll use the navmesh to move around obstructions in his path?

#7
01/18/2009 (10:00 am)
Hmm...The navmesh just defines the walkable areas a bot can move around on, it isn't supposed to be a path you assign the bot to follow. Place a navmesh in the middle of your playing area (make it pretty big, 50x50 will do), and you should have a blue and green grid (make sure that you set $Pref::Astar::render to true in the console to see this). Every vertical green line is a place that the bot will know how to move to. Make sure that the bot is placed on this grid (as well as the player), and try the findpathto() example I gave before. He should figure out the best way to move from green line to green line to find the player.
#8
01/18/2009 (10:01 am)
To make him follow Path 1 with the AStar algorithm, change all instances of setMoveDestination([dest]) to findPathTo([dest]).
#9
01/18/2009 (10:44 am)
Thanks for getting me moving again. It works great.

I finally took the first node in path 1 and placed it over the navmesh. This is where he was spawning. I blew him up, and he did indeed spawn on the navmesh. I guess path1's first node is really an AIdrop Point. I dunno why I didnt think of that.

He follows all commands on the mesh. Still named PathNone for some reason, I can live with that, OMG HERE COMES PATHNONE!! HIDE!!!

Just one issue I can't figure out. I setup the mesh on the first floor of a multiroom building. He can run inside, and outside and into any room as instructed with no trouble. I placed a similiar mesh on the second floor, and if I put the bot on the second floor, it works great too.

I cannot get a mesh to build on my stairway however. It is roughly a 30 degree incline. I've tried rotating the mesh to match the slant, and decreasing the distance between nodes. It still fails.

Thanks for the advice from everyone so far, if anyone has ideas on the stairway please let me know.
#10
01/18/2009 (11:07 am)
Yeah, stairways are a challenge. The height variable is useful for this, make sure it is as tall as the stairway (but doesn't stick up into the ceiling). Rotating a navmesh on any axis (I think) does not work. You just have to play around with the settings, I guess.
#11
01/18/2009 (11:08 am)
To erase the name tag thing, I think there was something on the resource page that says how to get rid of that by erasing a #define. I'm trying to help out by memory, because I used to have this resource installed but I don't have it now.
#12
01/18/2009 (11:10 am)
Try setting your height higher and changing the clearance pref to be larager (in the resources page there is a bit about how to do this and what it does).
#13
08/04/2009 (9:53 pm)
hello Charlie may i ask a question?
i got a mistake when I press F11, click World Editor, choose the MissionObjects>Mission>Navmesh, I give it a name, and nothing happens. I open the console, and I have
Tried to get the object for item 99, which is not InspectorData!
Tried to get the object for item 106, which is not InspectorData!
Tried to get the object for item 106, which is not InspectorData!
editor/newObject.cs (0): Unable to instantiate non-conobject class NavMesh.
i dunno how got the Function i see have some same with ur Experience.
may u help me pls?