Skip to navigation

Aviator on the BBC Micro

Aliens attack Acornsville!

Planning an alien attack on civilisation

Aviator isn't just a flight simulator - it's also an alien simulator. If you fire the guns while on the runway, you activate "The Theme", the strangely titled arcade game that's bolted onto the simulation to make it feel a bit more like a game.

Actually, it's pretty good fun to hunt down aliens in a Spitfire, though it's devilishly difficult. Aliens start out spawning in the fields, where they feed until nicely fattened, at which point they sprout tentacles and start heading for the town of Acornsville, one at a time. The feeding stages are described in the deep dive on alien feeding and growth patterns; here we take a look at how the aliens attack the town.

Alien tactics and AI

It's fair to say that Aviator's alien AI is pretty basic. In Geoff Crammond's next game, Revs, the computer-controlled drivers would have some serious tactical chops, but Aviator is not in that league. If anything, it's much more related to the author's previous (and first) game, the excellent Space Invaders clone, Super Invaders.

The AlienInAcornsville routine takes care of alien invasion tactics. This routine applies invasion logic to the alien whose number is in the alienToMove variable, which gets set in part 3 of the UpdateAliens routine. By this point this alien is either in state 27 or state 28; the former state means it is either taking off or flying towards the town, while the latter state means it is descending onto the town.

Specifically, this is what the alien does when it's on the attack:

  • If the alien is in state 27 and the high byte of the alien's y-coordinate is less than 12 - so the alien's altitude in the y-coordinate is less than (12 0), or 3072 - then the alien is still low in the sky, and we are still on the ascent stage. In this case, we add 10 to the alien's y-coordinate and we're done for this iteration of the main loop.
  • If the alien is in state 27 and the high byte of the alien's y-coordinate is 12 or higher, then the alien is high enough to move towards the town. In this case, we check whether the alien has reached the town by checking its position against the town's longitude and latitude, and if it isn't there yet, we subtract the value of alienSpeed from one or both of the alien's x- and z-coordinates (we only subtract from an axis if we haven't yet reached the town along that axis). So the alien starts by flying southwest towards the town, until it reaches the town's longitude (in which case it starts heading due south towards the town) or it reaches the town's latitude (in which case it starts heading due west towards the town). If we move the alien along either axis, then we're done for this iteration of the main loop.
  • If the alien is in state 27 and it has reached both the town's longitude and the town's latitude, then it gets promoted to state 28, which means it is on its final descent. The descent is the same rate as the ascent, and we subtract 10 from the alien's y-coordinate on each iteration of the main loop. If the high byte of the alien's y-coordinate is less than 10 - so that's an altitude of less than (10 0), or 2560 - then the alien has reached the town and it's game over, and the message "TOO LATE!" flashes up on the screen.

Interestingly, the final descent gets halted if we kill an alien, even if we are miles from the town. Presumably the aliens have some kind of telepathic link, and the demise of its brethren gives the attacking alien pause for thought... though it doesn't grieve for long, as it resumes its descent as soon as the explosion is over.

As noted in the deep dive on alien feeding and growth patterns, the alienSpeed variable is increased by 4 when we destroy each wave of eight aliens. This starts out with a value of 10 for each new game, and increases to 14, then 18, and finally 22. As you can see above, this variable controls the speed at which the flying alien heads towards the town, so later waves are more than twice as fast as the initial wave.

And those are the aliens in Aviator: they're born, they gorge themselves, and they mindlessly lumber towards the town. They are completely predictable: no random numbers are used in any of the alien tactic routines. Randomness only kicks in when aliens explode, causing unpredictable turbulence and chaotic wireframe explosions; see the deep dive on explosions and turbulence for more details on the explosion process. In life, however, the aliens of Aviator are 100% predictable, and the only time they take any notice of their surroundings is when one of their clan tastes the sting of Spitfire bullet. In this, they are at least slightly more aware of their surroundings than their cannon-fodder friends from Super Invaders... but only just.