Making Flight Fun
When I started getting into game development culture back in highschool I read a story online that Shigeru Miyamoto and his team spent months building Mario's movement system for Mario 64. His goal was to make it fun to move Mario around an empty level. I'm not entirely sure how true that story is, but it's stuck with me. So with that out of the way let's talk about flight in Fly like a Dragon. In this post I'll be going over in depth how my system works, my reasoning behind using it, detailing upcoming changes, and trying to define points of weakness that I can improve in the future. There are three components to my flight system: Momentum, control, and animation.
Momentum
Momentum is arguably the most critical part of this whole puzzle. While making the dragon constantly powered gives some intensity, it reduces player engagement with flying itself. As a result, I feel that this solution would force the game to emphasize dogfighting more than I want it to. Removing all thrust, on the other hand, gives us a glider; the glide speed of a real glider is a function of glide angle with some constants (mass, drag coefficient, gravity) applied as well. Unfortunately that doesn't quite map to this game either. I want playing as the dragon to feel fast and powerful, while true glider controls are passive. The solution lies somewhere in the middle.
In real life, birds use their wings to power their flight. By combining exaggerated glider physics, giving the dragon less uphill deceleration than he'd actually have in real life, with manual flaps I think the flying system becomes very engaging. As of the first upload to Itch, acceleration while flying is calculated using the following logic:
Acceleration = (e^[-sin(Pitch)] - 1)^3 CurrentSpeed += Acceleration * Mass CurrentSpeed.clamp(0, MaxSpeed)
That first equation is a little unwieldy, so let's take a look at that in Desmos. Note that the function is clamped between -pi/2 and pi/2.
What this translates to is that the dragon gains momentum way more quickly while gliding down than he loses it while gliding up. The acceleration is multiplied by mass to scale it to worldspace, added to current speed, and finally the speed is clamped to max speed. The biggest strength of this system is that it's pretty fun. It's hard to slow down unless you really want to, but it still forces you to flap if you want to quickly reach areas right above you. It's also easy to tune. I can tweak the Acceleration function or replace it altogether, and I can play with Mass to squash or stretch the function.
I think the biggest trouble with this system is demonstrated by the last step. In real life, there's no 'clamp' on max speed; rather, drag increases proportionally to acceleration until an object reaches its maximum velocity. By adding a Deceleration function, the player may (or may not!) feel more in touch with the flight. On the other hand, having a hard clamp as max speed makes modifying it on the fly easy. That could make for some interesting mechanics, like jetstreams and crosswinds, a lot easier to implement. Or, if I end up building very large levels, traversal could be made faster on the fly.
Another problem is that acceleration to max speed is nearly instantaneous at high pitch. This could be addressed by reducing mass OR by modifying the equation to be less imbalanced.
Control
The dragon can pitch up or pitch down, yaw left or yaw right, and thrust. Thrust power is easy to modify as needed, and highly dependent on momentum for feel. He has a max speed, and if he zeroes out he will stop before he stalls and gradually regain speed. Tilting the dragon down causes him to rapidly gain speed, tilting him up causes him to slowly lose it.
The speed of his pitch/yaw turning is stored in a single variable. On keyboard and mouse, he changes at about 40 degrees per second. From what I've seen, players usually describe controls as too loose, tight, or too sharp. Even though I can recognize if a game is too loose, too sharp, or tight, I can't explain why I feel that way. I think understanding this is really important, so I'm gonna tuck that away in my background processing and see if that spits something out in a couple of weeks.
Animation
In movement based games, a good character animation serves to emphasize the movement that the player is making; ideally in a way that makes intuitive sense to our human brains. So, when Mario runs forward, his whole center of mass shifts forward, his legs and arms pump, his hips and chest twist opposite each other, and he slowly gains momentum. He also leans his whole body left and right to emphasize tight turns.
Let's break down what the dragon does and see if we can't apply some of those same principles. Our dragon can modify his pitch and yaw at will, and he can add to his speed by boosting. His speed passively changes based on his momentum. Right now, his speed is animated using this blendspace:
Those of you familiar with Irval will recognize this as WD_Fly. The nodes on the left and right just lean the dragon to the left and right. So, there are a couple of problems with using this blendspace in this game. The first is that it relies heavily on flapping animations; since flapping is done manually this doesn't really make sense. The second problem is that at top speed (which is where we spend most of our time) the animation just doesn't look very good. Finally, this blendspace doesn't account for pitch at all; I think that top speed blend would look really nice while we're diving. There's a couple of other solid animations that we could use to fill out a pitch/roll dependent blendspace. I should be able to blend the speed and pitch blendspaces and make a '3d' blendspace
With all that being said, his turning feels good. I combined the blendspace (which has slight roll during turning animations) with some code to roll the whole actor, which emphasizes the effect nicely. Increasing turn speed should also call for a greater maximum roll while turning, so that roll properly corresponds to the turn.
Right now, boosting is too exaggerated. The animation is really big, swings the dragon around, and lasts almost a full second. Since we're getting rid of some of the flapping animations in the speed/flying blendspace, we can probably use one of them as a new boost animation.
Okay we've about covered pitch, yaw, roll, and thrusting. All that's left is that I'd like to emphasize speed a little more. Batman Arkham Knight has some great trail effects off of the wingtips that show up when he's moving quickly. I think I could duplicate that with a little bit of work and maybe show it at 3/4 max speed and up.
Final Thoughts
Flying is by far the most important part of this game to me. This is probably the fourth time I've heavily modified it, and I'm sure it won't be the last. If you made it this far thank you! I hope you enjoyed reading my rambles, I'm looking forward to writing the next one.
Get Soar: Pillars of Tasneem
Soar: Pillars of Tasneem
Be a dragon-shifter. Explore the sky!
Status | Prototype |
Author | souhad |
Genre | Action, Platformer |
Tags | 3D, Atmospheric, Dragons, Low-poly, Relaxing, Singleplayer, Third Person, Unreal Engine |
More posts
- Update: Alpha 0.6Dec 22, 2020
- Update: Alpha 0.5.5Nov 08, 2020
- Update: Alpha 0.5.4Oct 25, 2020
- Update: Alpha 0.5.3Oct 18, 2020
- Update: Alpha 0.5.2Oct 12, 2020
- Weekly update: Combat designOct 05, 2020
- Update: Alpha 0.5.1Sep 27, 2020
- Update: Alpha 0.5- Combat! (Again)Sep 20, 2020
Leave a comment
Log in with itch.io to leave a comment.