Flight Simulator
28 Oct 2020Game engines are interesting platforms to play with. Their ability to create simulations of reality pushes me to experiment with different models of the world. What would the world be like if gravity was a little wonky? Or how would everything appear if the sun emitted a very narrow spectrum of light? It plays into my fascination of speculative worlds and day dreaming, and makes my thoughts actionable. Game engines are also difficult to master, and require a mastery over code to truly make something spectacular. Unity and Unreal Engine, two of the biggest platforms require the user to have an in-depth knowledge of the C# programming language, which can get quite verbose. These engines are also behemoths, require a minimum of 5GB of space, and oodles of compute power to run smoothly. For someone who doesn't have a professional grade computer, they are often inaccessible.
The Godot game engine is a unique alternative to the regulars in the space. It only requires a total of 75MB, and not much is needed in way of computing power to experiment and play with it. It uses a scripting language, which is similar in structure to C#, but much simpler to work with. I've been wanting to get started with this game engine and understand how it works, and so I collected a few tutorials, downloaded the software and got cracking. I enjoy making physics simulations, primarily because its generative in nature, and it's fun to work with the constraints of physics-and break them! Flight simulators and racing games are my favourite genre of games. I remember diving into the code of Need for Speed: Hot Pursuit 2, to change gear rations, dampner rates, and modulate brake balance to see the effects it would have on the character of the vehicle. I could spend days doing nothing but constantantly tweaking tiny values to achieve a specific goal. The iterative process of the activity is meditative.
Flight simulators are very difficult to make, and it's no surprise that there aren't made as often. The closest I could hope to get to one within a span of a day is to create an arcade simulation, which would look and feel similar to a flight simulator, without any of the complex physics calculations. This seemed like an ideal goal to start learning Godot with. Sky Rogue, one the best games I've played in a long time uses a similar strategy.
Using tutorials from Indie Quest I started my Godot journey. As expected, it was initially quite challenging as I figured out the interface, and the structure of the software. Unlike Unity, Godot is quite barebones, and requires a far bit of understanding of the interface to create something very basic. But before I could write a line of code, I needed a plane. So I created one using Cinema4D.
Although the coding part wasn't so lengthy, with only a single script, the challenge was in putting everything together and troubleshooting the problems I was facing. At first my plane was completely skewed, with none of the controls responding. The scene was far too dark, and I couldn't figure out how to place objects in the scene.
It took some time, and after a fair bit of frustration, it started to come together. I figured out how to place elements, add lights, and get all the elements to line up properly. The code, although simple in it's logic took a bit of time to completely understand, in order to fix the strange issues. But soon, I got it working as intended!
Not everything was perfect thought. I really wanted to implement a keyboard and gamepad controller, but I couldn't quite figure it out. The trails also don't quite work so well disconnecting when the plane turns. The behaviour of the plane itself isn't as satisfying as I'd have liked it to be, with inconsistent controls on the outer envelopes.
But I'm happy to have started my journey into using Godot, and hopefully creating my own flight simulator down the line.