There has been some talk about how to do flight simulators or other simulations. Well, here is my contribution.
While others implement simplified, self-written flight dynamics I have chosen to go for as much realism as possible. By using JSBSim Flight Dynamics. This comes at a prize though: more realism means that it is more difficult to fly the plane (anyone has a pilot license? not me). So my choice is probably not the best one for making an easy-to-use shooter game.
Demo (Windows binaries):
Source code will follow as soon as I have figured out some legal issue. I had to make minimal modifications to the JSBSim source code, and now I have several option: release only my extension source with explanations on how to modify the JSBSim source, release my extension together with the modified source, or provide a download for the compiled static JSBSim libs.
The extension wraps most of the JSBSim API. But the demo utilizes only a small fraction of the functions. This is because the demo is intended to be just a proof of concept, and not full-featured flight simulator.
(1) Modify lines 30 and 31 of this script to change display size to whatever
you prefer. Default is 800x600 window mode.
(2) Run “ppython.exe demo.py” to start the demo.
(3) Press “e”. This will do the following things: set magnetos to “both”,
fuel mixture to 87 %, flaps to 32 %, throttle to 25 % and finally start
(4) Press Page-Up until throttle is at 100 %. (Page-Up/Down controls the
(5) Wait until the plane accelerates and finally takes off at around
110 fps. You don’t need to pull the joystick or do anything else. The
plane will take off all alone.
(6) At about 50 ft altitude press “f” to remove the flaps and reduce mixture
to 69 %.
(7) Use the joystick to steer the plane. Joystick axis 1 controls the
aileron, axis 2 controls the elevator and axis 4 controls the rudder.
(8) Have fun.
Compass code and texture stolen from Hypno’s Jungle engine (https://discourse.panda3d.org/viewtopic.php?t=2648).
What is missing for a full-featured flight simulator:
(1) Use more input key(buttons to control flaps, brakes, trim, …
(2) 2D/3D instrument panel with artificial horizon, altimeter, directional gyro, tachometer, turn coordinator, fuel gauge, …
(3) Implement a paging terrain system. Hint: JSBSim uses earth-centric coordinates for the simulation
(4) Write a game/simulation management, e.g. let the use choose between different airplanes, weather/light conditions, airports, …