- Home /
How do I handle Pathfinding in Shoot Em Ups?
Hello,
I'm working on a top down Shmup. (Think Air Attack HD, Ikkaruga etc) In these games, enemies fly at you in waves. Usually, when they get to a certain point, they change their direction. In my current game, the enemies just translate in one direction. (left to right, or up and down) I have tried the math.pingpong function. It's okay, but it the behavior is not exactly what I had in mind.
So my question: How is enemy path finding usually handled in games like these? I imagine these enemies follow some type of paths
I found the Angry Ant A* pathfinding tutorial. I have not used it yet, but I feel it may be overkill. I also have found a few tutorials that allow the enemy AI to go between a few points. Again, I just imagine that this would be a huge hit on a computer's memory to have multiple entities checking waypoints every few minutes. Do these games use raycasting? (Disclaimer, I don't know much about raycasting...) Should I have the enemy check what his current world position is, and go in a different direction when he reaches a certain point?
I'll stop babbling, but can anyone point me in the correct way of thinking? Thanks in advance.
This video does a decent job of illustrating what I'm looking for. Note the red planes that spawn from the red cube. They seem to follow a path along the green cubes. I hate to ask, but what type of math is involved?
Answer by Skjalg · Feb 05, 2011 at 08:34 PM
Its mentioned in the video, but the math used is a Bezir Curve.
"All boxes have a purpose : one spawn point (what NPC load, how many..), one start point (first point of the path), a final point and one or two mid points. So to calculate the Bzier curve, three or four points are used."
http://en.wikipedia.org/wiki/B%C3%A9zier_curve
http://answers.unity3d.com/questions/5279/moving-an-object-along-a-bezier-curve
Thanks! This looks like a good resource. I'll check it out.