Monday, March 15, 2010

What is PEGWARS?

Pegwars, or Political Economic and Galactic Warfare, is my hobby computer game that I've been writing since, um about October 1997. That's 12 years ago!

For anyone that has been around computer games a long time, the word ELITE should mean something to you. Something special. ELITE was the game that hooked me for life. Until ELITE, games were a fun curiosity, usually involving run and jumping a little man , llama or 'Horace' around 2D levels, requiring pixel-perfect accuracy and some bleepy soundtrack that these days is considered somewhat 'retro-cool'. ELITE was a full 3D (wireframe) space combat exploration and trading game, which involved 8 entire galaxies, alien races, missions and more. All of this on a 48K ZX Spectrum. For an 11 year old boy, that was quite something, and my mind was truly blown.

Ever since university and being able to write somewhat coherent code, I've been writing PEGWARS, my interpretation of this genre. It's my hobby project, and it is now in its 6th iteration. On the way down this merry merry path of late night coding, I've learnt about art, music, game programming and more; I've used it as a demo to get a job in the computer game industry, it's catapulted me into writing electronic music, and it's kept me learning all these years and given me something creative to do and a good reason to avoid television.

This blog is going to be my project diary of the PEGWARS project, a place to document the long-term development of a hobby computer game project.

Pegwars, v1. 2D

My first version of Pegwars, written using DirectDraw 2. Involves such fun as implemented transparencies by ORing colours directly into the framebuffer.

Went on a bit of a tangent in this version, this one had enemy AI that was trained using a Genetic Algorithm. Each enemy had a short DNA string that dictated what they would do given per-frame sensory input. I even had use of a bunch of computers at my workplace at the time to run evolutions of these DNA pilots overnight. Moral of this foray into GA's is, if you want to run many evolutions of something, don't make it a full graphical game - test their fitness in a simulated game environment. Otherwise the amount of time required to run just 100 generations of 100 pilots is going to be far too long and you'll get nowhere.

Pegwars, v2

My first 3D version of Pegwars, and this one was written entirely in software. As you can see, there's no texturing, some pretty crappy 3D models etc. This was a 3D layer on top of my 2D engine written for v1, thus this still involved a fully working 2D interface.

This version featured fully customisable spaceships, you drag and drop engines, thrusters, pulse lasers onto your 3D spaceship and then join the game. If you forgot to add Thrusters you couldn't go anywhere! And that was the gist of what Pegwars was all about - fully modular and customisable spaceships.

Pegwars, v3.

My first 3D accelerated version, written using GLIDE and then DirectX. This one featured fraggable spaceships, even down to the polygon level! Plus some more pretty bad programmer-art. I used this version for my demo to BigWorld Technology, and it got me a job in computer games, surely a dream come true :)

After this version I started to really learn about games programming and decided that I had it all wrong... time to start again

Pegwars, v4.

The first one featuring my new Relativity Engine. Didn't get too far on this before deciding to start again. But as you can, it certainly featured fully modular ships again, just look at all those thrusters...

The look is starting to get a little more refined, at least I had the FOV sorted out (no more egg-shaped suns or planets). The guys at BigWorld taught me a lot about writing computer games and it was now that I was starting to get the feeling that maybe I'd bitten off just a little too much. My advice to anyone beginning their own hobby computer game is, don't be too ambitious! It's possibly the worst idea in the world to begin writing your own entire universe simulation in your spare time. Which leads me to the next version of my game...

Pegwars, v5.

Also featured in the montage image in this post, v5 was the furthest I got and the best Pegwars yet!

In this version, you can literally fly down and land on any planet in the entire galaxy, then hop out in a motorbike or car and drive around! You could land on space stations, fight enemies and collect bounties, even advance your rank.

A really nice feature that just kind of fell out of this game was sunrise and sunsets :) You just fly down into the atmosphere of a planet, and start flying around it. Lo and behold, as you fly around the night time towards the sun, you slowly see the sun begin to rise, the atmosphere lighten up sunrise colours through the sky. You could keep flying around as the sun rose in the sky then slowly sets behind your spaceship.

This version took years of work and unfortunately it showed. The code started becoming unmaintanable, I could see huge inadequacies in the graphics engine design, and there was no scripting language. Everything was still being written in C++ and this bogged down the speed of developing any new part of the game. I wanted to do more with the graphics but the engine was too inflexible. I took this version of the game as an inspirational prototype and have begun work on an entirely new version of Pegwars, the current version that I am writing now. And this time, I am making no compromises.


  1. Awesome! So cool to see the Pegwars retrospective.

    I think you are absolutely right about training your GE spaceships in a simulated environment, but I remember watching those Proterozoic spaceships, zooming around in circles trying to kill each other, and thinking it was the coolest piece of AI ever.

  2. They were awesome hey :) Was a really fun time back then playing around with GAs, seeing the backwards ship that constantly turned and sprayed bullets, and the ones that just sat there, stoopid. I'd love to actually get some GA stuff working at some point, that and some fuzzy logic systems...

  3. Yeah. It is such a compelling idea. Artificial Life :)