Tuesday, February 21, 2012

Skycrane

My game the little crane that could is still going strong, so I keep releasing updates for it. Lately, it has been very popular in Japan, not sure why. A lot of Japanese downloads, but the conversion rate in Japanese market is pretty low. Anyway, the next update will feature something special: a Skycrane.

Just like I did for the crane on wheels, I am taking the high road: a proper full blown physics simulation. This means that the forces of lift actually work on the rotor blades, where force leads to acceleration leads to velocity leads to movement. Also, the force that spins the main rotor causes the body of the helicopter to counter rotate, so I apply an anti-torque force with the tail rotor. Note that the tail rotor is not yet visualized in the image. Also missing are wheel struts and some sort of winch with hook that will enable the player to grab objects.

After implementing this elaborate and accurate simulation, I found out that controlling the helicopter was neigh impossible. It was simply too hard to steer due to oscillations and spiralling out of control. That is why I added two PID controllers that sit between the cyclic controller (joystick) and the control surfaces. They translate the player's intent into steering signals, 180 times per second. With PID control you can fix overshoots, oscillations and steady state errors by carefully tuning the proportional, integral and derivative constants. Now the Skycrane flies like a dream: it has nice, yet realistic handling characteristics.