I've been working on a vertical shooter and right now I'm tackling enemy A.I. using self constructed paths. I've got things working so that each enemy sets its next WP, the speed it should use to get there and if it should pause when reaching it.

The thing is that all the movements are strictly linear and as you may know, this is hardly the case for enemy movement in vertical shooters. So i was playing around trying to implement B�zier curves which i had some real problems with. Eventually i got it to work using to points in space and one control handle, a Quadratic B�zier curve.

The problem i have though is that the formula i got working isn't taking into account the enemy speed, but only moves along the curve by setting X/Y positions each tick. Secondly, this isn't time based animation taking into account the delta-time which will make the animation slower on slow machines. How can i implement a constant time based animation across a B�zier curve?

I'm still trying to find a solution to this and math is not my strong side. As i understand it, getting a constant speed through a Bezier curve is impossible but you could get pretty close by calculating the arc length?

The problem is that you can't have a Shoot em up without having some advanced patterns for the enemies and the only thing i can think of is using bezier curves. If anyone has any other suggestions that would be great ^^

So this is the way i solved the problem using a compromise. Since i was planing only to use full, half or quarter circles i did the following:

Calculate Quadratic B?zier movment between point a, b and c (b is the control handle)

x = (a.X*(1-t)^2 + b.X*2*(1-t)*t + c.X*t^2)

y = (a.Y*(1-t)^2 + b.Y*2*(1-t)*t + c.Y*t^2)

Calculate t for each frame while less than 1

t = (obj.speed * dt) /((abs(a.X - c.X) * 2) * pi * (90/360))

So far it seem to work really nice but i had to make a compromise because calculating the length of a more complex B?zier curve is way beyond my math knowledge. This is something that might bite me in the ass later if i decide to implement more complex enemy paths. We will see... ^^