Hello once again everyone!
The game I am working on requires spaceships to have path finding and avoidance AI so they can fly around obstacles, not run into each other etc..
I've read through the API on everything navigation and I've come to the conclusion that Gameware Navigation that's implemented in Stingray is only capable of pathfinding on a plane. Is this correct?
I've got a few ideas on how I could accomplish the behaviour I want but I just have a couple of questions. In my mind 3D nav is not that much more difficult than navigating a plane, however it seems using traditional methods such as having nodes over a VERY large map would be a huge performance hit. I was thinking I could potentially have nodes at destinations the spaceship could fly between, however with a dynamically moving map as I would have in space with orbits and moving asteroids etc I believe this method would be out, unless when an object collided with a nav point it disabled it for use... but again I think it will lead to an expensive solution. This basically leaves me with raycasting and local avoidance.
My question! In the engine, how expensive is it when I call the ray cast function?
Any suggestions for navigating the depths of space?
Thanks!
Kaine
P.S Feel free to just answer my question about ray casts if you have no suggestions 🙂
Raycasts, like most calls, are not too heavy own their own but as they add up with many objects doing many calls each tick, it will become performance heavy. As far as a 3d space solution to navigation -- this is a good question. You could possibly do multiple planes of navigation a few meters z apart and have the npcs jump from plane to plane somehow ... or maybe there is a way to do 3d nav mesh that I am not aware of. I will reach out to the team and see who knows what. 🙂
Yeah. I guess I just have no base of reference for what is a considered a lot of calls, I guess it depends on what else is happening in the game.
That would be great if you could reach out, when you find the navigation guru, and if as I believe Gameware Navigation can't do flight navigation, could you ask them if they have any suggestions for me to look into? Different ideas are always good!
Cheers,
Kaine
Hi Dan,
I have some questions for this problem
1). Single, synchronous raycasts
local foundCollision, collisionPos, distance, normal, actor = stingray.PhysicsWorld.raycast(my_world, start, dir, "closest")
What is "start" parameter?
2). Multiple, asynchronous raycasts
local raycastObj = stingray.PhysicsWorld.make_raycast(my_world, my_raycast_callback, "all", "types", "statics") raycastObj:cast(start, dirA, length) raycastObj:cast(start, dirB, length) ...
What is "length" parameter?
Thanks
Deviros
"start" stand for the world space starting position of your raycast, "dir" for its direction (usually a normalized vector) and "length" for the maximum distance you want the raycast to look for. In effect, you can reason about raycast as behing a line segment in space. This will provide some spatial culling information to the physics engine, and therefore fastened the raycast call by only testing with the relevant geometry.
Navigation is actually 2d "and a half" in that you can add navigation graph to the navigation mesh. You can even use Navigation with a navigation graph only, and therefore leverage Navigation pathfinding in space if you provide it with a set of connected 3D graph vertices.
Albeit, if you are making a 3D space game, you may not even need that. If you are never going to navigate inside a huge space ship (think death star attack), then local avoidance might well be good enough. You may not take the "shortest' path, but you will reach the desired location nonetheless.
And if the ship navigates between solar system thru jump gates (or any clever sci-fi excuse for faster than light travel), then you can build a graph of jump point, and have your ship pathfind them for global navigation (using Navigation for instance).
Finally, if you have "death star attacks" sections, then you can build probably build a graph to navigate through the corridors. A little bit of extra work, I agree, but doable.
Oh, and to alleviate of your local avoidance raycast system, you might want to have a look at boids or any local steering system...
http://www.red3d.com/cwr/boids/
Hope this helps 🙂
Can't find what you're looking for? Ask the community or share your knowledge.