Game Development Community

add path to mission

by Ferdinand Stewart · in Torque 3D Professional · 03/19/2012 (10:59 am) · 6 replies

How do I add a path to the mission using C++.

I'm trying to add a path to the mission through code.
The only class I could find was Torque::Path and I can't seem to add markers to it.

I haven't been able to find anything in the forums or the documents.
Anything would be appreciated. a link, code snippet, documentation.

#1
03/19/2012 (1:04 pm)
I'm confused as to what you are actually wanting since adding a path to the mission doesn't make any sense to me, especially within the engine's source code.
#2
03/19/2012 (10:37 pm)
Adding a path is usually done through the World Editor by adding the Path object and then adding markers, all of which is stored as data in the level file (.mis). You then have code, usually Torque Script but can possibly be in C++, that interacts with the data -- most commonly a travel route for a bot or a camera.
#3
03/20/2012 (6:41 am)
Good morning,

Thsnks for the help, I think I figured it out.
I'm trying to add A* Pathfinding. I started in script, but it's too slow. So now I'm trying to add it to the engine.

By the way, I've seen some post about nav mesh and recast floating around the forums, but the links are all dead and out of date. Are there any active links to these reasources?
#4
03/20/2012 (9:03 am)
Quote:
I'm trying to add A* Pathfinding.
Ah, then that's a totally different thing from the stock Path object.

Daniel Buckmaster's Recast Resource
#5
03/20/2012 (9:23 am)
Yeah, I was able to add the markers to a group, but the ai won't follow a group.

and, Many thaks for the link. I'm gonna pore over this and see if I can implement it.
#6
03/20/2012 (9:39 am)
The stock Path object needs a specific naming and simgroup nesting scheme in order for the stock AI script to be able to utilize. The AIManager code is commented out in the game scripts, so that would need to be turned on as well. See here.

Just keep in mind that the stock AI code will only give you a "dumb" bot who simply follows the path from point a to be to c, etc, and back to point a. It literally needs to be told step by step what to do if/when you give it tasks. Implementing A*, there are several Resources for it, or Daniel's Recast Resource is a good solution for navigation, but you're still going to need to write logic for the AI's actions.