Monday, October 19, 2015

A Space Shooter in Curses

Some of you who follow me may know that I have recently built a pretty nifty framework for working with terminals.  ANSI, ASCII, VT100, Windows Console, etc.  Its called Tcell, and located on github.  (Its a Go framework though.)  It offers many of the same features as curses, though it is most definitely not a clone of curses.

Anyway, I decided it should be possible to write a game in this framework, so I wrote one.

I give you Escape From Proxima 5, a 2D multi-axis scrolling space shooter written entirely in Go, designed to operate in your text terminal

The game is fairly primordial, but there is a playable level complete with enemies and hazards.   It's actually reasonably difficult to get past just this first level.

Mostly the idea here is that you can get a sense of what the game engine is capable of, and see Tcell in action.

As part of this, I wrote a pretty complete 2D game engine.  Its got rich sprite management with collision detection, palettes, an events subsystem, scrolling maps, and support for keyboards and mice.  Its also got pretty nice extensibility as assets are defined in YAML files that are converted and compiled into the program.  (I guess an asset editor needs to be written. :-)

The code is Apache 2 licensed, so feel free to borrow bits for your own projects.  I'd love to hear about it.

Anyway, I thought I'd post this here.  I made two videos.  The longer one, at about 3:30, shows most of the features of the game, animated sprites, some nice explosions, gravity effects, beam field effects, etc.



The second video shows what this looks like on less rich terminals -- say a VT100 with only 7-bit ASCII characters available.  The richer your locale, the nicer it will look.  But it falls down as gracefully as one can expect.


Btw, this framework is now basically design complete, so it should be super easy to product a lot of simples kinds of games -- for example a clone of Missile Command or Space Invaders should be doable in an afternoon.   What makes this game a little bigger is the number if different kinds of objects and object interactions we can have.

No comments: