In 2012 I made some tank-control experiments[1] in Flash. The original goal was to smoothly drive a tank to any given location on the screen. But as I experimented, I also wanted to make it feel like you had some control over the driving system, especially on touch screens. And I wanted to watch NPC tanks to move to targets on the screen. I've missed having these experiments available so I decided to port some of them to HTML5.
Source: tank-control.js
There's a lot of duplicate copy/pasted code in the old project. I mostly ported #3, #6, #7.
- 1 was the initial prototype; it doesn't do much
- 2 is a monte carlo search, looking for ways to drive to the desired target
- 3 is the main demo, adding side zones where it only rotates and not move forward/back, and front/back zones where it will only move forward/back and not rotate
- 6 is removes the forward/back dead zones, and switches from the "three point turn" that 3 did to a single turn when going in reverse
- 7 is a slightly different "three point turn"
- 8 is like 6 but changes the rotation dead zones to be based on radius instead of angle
- 4 and 5 are mobile interfaces; 4 has a fixed control surface and 5 has a rotating control surface