DirectX 11 Minimal Flight Simulator Prototype aka “Minimal FlightSim”
This is my first prototype that I'm releasing this year (2013). I decided to refresh my DirectX and Direct3D programming skills by diving into DirectX 11 programming, since the last time I made anything with DirectX was back in 2010 (using DirectX 9.0c). I also wanted to learn DirectX 11 properly for work related purposes (and since flirting with DirectCompute GPGPU programming last year).
After reading the books “Beginning DirectX 11 Game Programming” [Sherrod, Jones 2012] and a a few refresher chapters from “Introduction to 3D Game Programming with DirectX 11” [Luna 2012], I decided to try my hand at making a small game prototype.
The two main goals for this prototype were to make a functional game using DirectX 11 and to do this using a minimal amount of 3D rendering. I chose to focus on better understanding/re-learning the core concepts of DirectX 11 and Win32 game programming, while at the same time developing core components that can be reused in another game or application. Some of these components include a quaternion based flight simulation specific camera model, basic font rendering, low level primitive rendering as well as basic 2D bitmap texture loading and rendering.
Even though the final prototype looks like a game from the 1980's (this was one of my other side goals – to make the game prototype look really old school, like the early Flight Simulator games), all of the rendering is done using the programmable graphics pipeline (along with the use of Shader Model 4.0). While this may seem like the classic example of over-engineering (e.g. using a titanium hammer to crack a walnut) - the developed game prototype provides a flexible framework that can easily be extended to support more sophisticated games or applications in the near future (such as the implementation of procedural terrain rendering and dynamic LOD scene management using tessellation and geometry shaders).
In terms of gameplay, Minimal Flightsim is a bare-bones flight simulator style game. The point of the game is for the player to take the aircraft off from the starting orange airfield, fly it and land it successfully on the designated green airfield on the other side of the grid. In order for the player to land successfully, they have to keep track of their speed, altitude, roll, pitch, yaw and landing gear control variables. In terms of flight dynamics, Minimal Flightsim implements an empirical flight simulation physics model, where the entire aircraft is treated as a single particle moving in 3D space (the implementation of a 3D rigid body dynamics system using inertia tensor calculations was neglected due to time constraints). The classic Implicit Euler numerical integration method is also implemented and used in order to update the linear and angular velocities of the aircraft every frame during the game. Additional basic features such as the ability for the aircraft to crash, go off course, stall and aircraft flap control are also implemented in the prototype. Another interesting game feature is that the implemented aircraft dynamics model does not have any sort of stabilization method for the yaw, pitch and roll operations. It is up to the user to balance the rotation values of the aircraft while it is in flight.
Finally, the numerical output of the flight control variables (speed, altitude, yaw, pitch, roll and the XY grid coordinates of the aircraft), is displayed via a secondary console window (where it is streamed and updated every frame). This was sort of a hack - as the console window output also gets cleared every frame, thus the variable output can get jittery. However for prototyping purposes this was a sufficient solution in my opinion.
I may work more on this prototype in the near future (but for now I'm releasing just this minimal functionality version). One interesting thing I would potentially want to look at is the implementation of a fuzzy logic autopilot system, that would be able to take off, fly and land the aircraft using an optimal flying control solution that is computed in real time. On a side note, if you are interested in modifying Minimal Flightsim, you can download the source code and use it freely for your projects (provided you give me credit and don't use it for commercial purposes).
Special thanks goes to the guy who runs http://www.rastertek.com – for providing the other only really useful DirectX 11 tutorials on the web.
In-game screenshot. Incredible graphics, I know.