Basic Dogfight Mode (0): Overview

If any of you have played Ace Combat: Assault Horizon, you'll know that you're forced into this thing called Dogfight Mode (DFM) every so often to take out enemy aces and such. I'm not gonna get into whether or not it was good for the series, but at the very least, it was different. It was something that I'd never seen before, and what's more, I was wondering how it could be programmed.

What I observed in the game was that there's this circle at the center of your HUD. When you're in DFM and your target is outside of that circle, your plane will yaw or pitch (never roll) towards your target until they're back in the circle, and that your speed will automatically adjust itself to maintain some distance between you and the plane you're chasing. Of course, if they get far enough out of the circle or far enough away from you, DFM will break automatically.

Knowing that, you could do the simple but very boring thing: compare your current heading to the direction to your chase target, and if the angle is past a certain threshold, then start yawing and pitching the plane towards the target. Speed up if they get too far, slow down if they get too close. Yeah, there's not too much ingenuity involved in that.

But there was another way which... probably wasn't the one that they went for. I first thought about programming DFM after going through a tutorial that taught me how to program chase cameras - that's the same sort of camera that follows your plane around in Ace Combat when you're in third-person view. When I finished that tutorial, the similarities between the two just came to me - the camera's got a position, a heading, and an up direction just like your plane after all. The theory goes that if you replaced the chase target with another plane (and not your plane), then replaced the camera with your plane, you'd have Dogfight Mode. Your plane would follow another just like the third-person chase camera followed your plane.

Thing is, I tried it this way, and uh... it doesn't really go over that well. A chase camera can do all sorts of zany repositioning - you don't actually see the camera, you just look out of it, and as long as the ride's smooth, there's nothing to fear. But when you see an actual object wigging out trying to get into position... well, toss that idea out the window.

I'll go over both of these starting with the simple adjusting-yaw-and-pitch way of doing things. I'll go over the chase camera method more from the viewpoint of making a chase camera, with a side of the funny things that happen when you slap that movement onto another object. I've gone over the more complicated math with the canvas rendering tutorial, to be honest.

Next Post:
Basic Dogfight Mode (1): Basic Yaw/Pitch Adjustments - Memories of Melon Pan