Whats In A Game

"Space was like a big doughnut!"
Going back to my first game brought back a lot of good memories.  When I wrote 3D Space Wars on the Spectrum I was a programmer at an insurance broker. I used to type in the code on the Spectrum in the evenings using a little black and white television as a monitor.  My idea was to write a Space Invaders shoot em up type game but set it in a 3D scenario where you looked into the screen. I was one of the first to do this and was inspired by an old ZX81 3D maze game whre you were stalked by a TRex.  I suppose that was the forerunner of games like Doom.  3D Space Wars was simple , it had to be to fit in 16k. The screen took 6k so that left  a little under 10k for the program leaving room for a few important system things like the stack.  For simplicity I did not use real 3d space. The background just wrapped round  in the X and Y directions so the space was like a big doughnut . That meant I had no worries about complex 3D transformations. Press left and it scrolled left, press down and it just scrolled down.  The game presented the enemy in front of you so the acftion was immediate.  If you managed to kill a complete wave of enemies another one with a few more ships.    It was a classic design. If you plot the  danger on a graph it ramps up as the first wave gets closer  to a cresendo then you get a brief respite until the next wave arrives. This ramps up a little higher than the last wave. This then just repeats until  you are overwhelmed.   Even by the time 3D SpaceWars had finished selling players had bigger expectations of a game.  Games of a similar genre took the Space scenario to a different level. I always admired Elite and the amount they managed to pack into the game on a  32K  machine.

It was very exciting sending my first game to a few publishers. I chose three that used whole page adverts in the computer magazines.  I had interest from Silversoft and Hewson and went to see both of them. Silversoft were one of the first publishers to get games in  stores like Woolworths and Boots so had impressive sales figures. Hewson had his own tape duplication faclility and this convinced me that he would be the best option.  They gave me a list of wants and I took a few days off of work to get a new version together.  I waited until the first royalty figures came in and handed in my notice. I had a wife , a two year old son and a mortgage to pay for so it was a gamble to leaving a well paid job.  It was something I had wanted for a long time and I had a years wages saved up as a backup.   So the pressure was on me to come up with the next game. I started diligently at 9.00 each day  and worked  exactly the same hours as I the job I left.

"I can pursue whacky ideas like using the computer to build my graphics"
Its a lot different now.  I have a small rental income from the office that Graftgold used to use and this has allowed me to take early retirement.  I program just for fun  when the muse takes me. I often just keep going into the evening and through the night. When I get going time just seems to fly by.  I take my laptop with me and so can program anywhere  when I have time to kill.  This time around I sometimes feel I am more in a process of catching up with technology rather than pioneering.  Its what you do with it that is the most important thing though, it is a great feeling when you get an idea that is pushing the edge.  I am working in a non standard way on my own without a team or managers to restrict me. I can pursue whacky ideas like using the computer to build my graphics or dna like attributes to style my enemies.

Its a bit like trying to start an essay or draw a picture when you start a game. The have a blank page that can be anything. You have to take decisions to cut down the myriad options into a managable idea. That is really why I chose to choose my first program as a starting point.  It was a simple little scenario that would act as a focus.   I tend to start off designing and programming games in the same way.    Although I consider the design at the outset it gets major revisions as each of the prgramming stages is completed. This allows the game to use the best points of the bits already programmed rather than trying to force through a preconceived idea.

1. Get the player control working.
  This is the most important thing in a game. If its not fun to control it will never be a fun game.  The player control also defines the possiblities of things that can be done in the game so is a good starting point.  I find that once I have the player control working I can imagine the action and then make decisons about the game content which is the player interaction with other things in the game.  I played a few space games to see the pros and cons of various control modes. The viewpoint had to be first person 3d to match the original but I was undecided about whter to have to camera chase the player or give a cockpit view. Some games allow both and I know there are players who prefer either view. I decide not to decide and make it switchable. I also design in a fixed camera mode which is useless for the game but really useful for debugging the ship control.
2. Create an environment.
Space is a bit of a problem for a game as it is so big and  it is mostly empty. I quickly decide that it has to be space like but not an accurate simulation of the actual universe. Its like writing a novel you want "suspension of disbelief" not boring reality for a game.  The enormity of space  can be dealt with by dividing into smaller sectors and linking them together with some kind of faster than light travel.   I  opt for sub space tunnels connecting my sector spaces rather than giving the player unlimited warp drives. That way I can get more strategy in the game where the tunnels act as strategic routes.  I made a list of all the sorts of things that could be in a sector.  When you start a game you want to put everything in it.  At some point you have to filter out all but the best elements.  I decide not to include landing and exploring planets. I want to focus on the space action and in particular combat. The environment has to give you something to fight over. I like interaction with the environmant and this is limited by the lack of things in space.  I am going to need lots of asteroids, planetoids and  things built in space.  I

3. Populate The Environment
 I would like intelligent enemies that work to a plan and friendly forces to assist the player.   One of my design decisions is to   make the design work for single player or multi player, I might want to do an internet version. I have expertise in writing fast reliable socket rotuines that could come in handy.   I like to keep the environment population organic. That is it grows  and diminished  according to organic rules that are self balancing. To this end I decide the game and the player will populate the environment with stations and ships to get resources to pay for more ships etc.  I want it to be like like the US frontier in the ealry pioneering days set in Space.

I had played Battlestar Galactica online for a while despite being annoyed at the control mode. They did not have the 3d control right keeping the control relative to space rather than the players ship. If you flew upwards then tried to turn left or right  it was interpreted as turn the ship on the worlds up/down axis. The ship just rolled still facing upwards  instead of turning.  It would be really hard trying to build a ship that did that it would have to rotate its thrusters so they always pointed horizontally.  I actually mailed them  and gave them a few hints of how to do it properly. Its actually a lot harder than it sounds. When you add up 3D movement it does not commute. If you turn left and then up its not the same as turning up and left.  Its an interesting problem.  If you try to represent a 3d direction in 3 values you get into all sorts of difficulties. The values just do not move smoothly as the object changes direction.  Try looking up "Gimball Lock". Mechanisms such as robots or missile trackers with 3 freedoms of movement have to be aware that when they point towards one of there axis  they lose one of the freedoms of movement. The lunar module limited  pitch so the navigation system  did not  pass a critical point as the gyroscope   only had 3 axis of movement.   I found the maths of all this quite fascinating and spent ages  investigating and searching for solutions. Most sources say you just cannot use 3 angle values to define orientation in a game. I was keen to prove everybody wrong so spent ages working out how to do it.    One site advised to just use a 3d matrix but that itself has a few problems.   The nine values of a 3d matrix have redundant information. That is information is repeated within the 9 values. The instances of the elements of data can become a little out of kilter with repeated movement until an object looks distorted. So you have to periodically rebuild the matrix. Also its a lot easier to refer to individual angles. In the end I opted to show orientation as a vector for the axis along the spaceship and 1 angle which had to be carefully defined.  The vector was  a part of the 3d matrix and it was easy to build the rest of the matrix from this information.

In order to see how the spaceship moved I needed a backdrop.   In the original game I added a few star clusters in the background. In a moment of madness I though it would be cool to import astronomical data on  the nearest and biggest stars in the galaxy. This is readily available on the internet.  I adapted my  XML reader routines to parse comma separated Excel like data. I wrote a routine to create point sprites for each star in the correct colour and magnitude. I had 120 thousand stars that I could fly through at impossible speeds. The effect looked good but was too far fetched for the main game but I could give the view of these starts from anywhere in the galaxy.  I made up a skybox and projected the stars onto the skybox using the players location as the origin.  This also had the benefit of speeding the game up being far quicker than plotting 120,000  sprites and having  to clear the background to black.   I decided that I would add space dust later to make a more interesting sky like one of those long exposure Milky Way photographs. I needed to figure out how to make this view change from different viewpoints to match the revised star positions so left this for a while. 

About this time I had a call from Andrew  Hewson's son Robert who was keen to enlist my help in a Kickstarter project to produce a book  about Hewson Consultants.  I met up with Andrew Hewson who I had not seen for about twenty years. That bought about many memories  I readily agreed to help and signed loads of posters etc.  and produced  remixes of  a couple of my old Spectrum tunes  for a cd they were making to support the project.   That was fun, I made them quote rocky using a lot of electric guitar. I used to play in a rock band with Andrew Braybrook on bass guitar. We had a couple of numbers that were similar to some of my \spectrum tunes so I had a good base to start from.

 The next issue I faced was how realistic to make the control. In most space games and films  forward thrust relates to speed not to acceleration  as if there is friction in space.    There is no top speed in space until you reach relativistic speeds. This is a problem in a game , if you have spent 5 minutes thrusting it takes you 5 minutes to stop assuming you can apply full thrust in the opposite direction. To turn a corner you have to apply thrust to stop the movement in the original direction and to start movement in the new direction. So if you just have a big thruster on the back you have to use the ships direction to counter the original thrust. If you have played "Asteroids" you have experienced this. In a point of view game it would be annoying having to turn so you could not see where you were going.  The thing with a game is you can invent your own physics up to a point. People accept that spaceships drive like planes or cars undergoing friction. I want to make the game more space like so opt for an approach that is nearer true physics with a bit of artistic licence built in. I will have a range of engines that have different vectored thrust capabilities so you can have ships that are very floaty  or ones that feel a lot more like planes. I decide to make the ships user configurable so you can buy different bits and put them together to get a ship that suits its purpose.  I like the idea of constructing a ship from bits.  That can give the game a purpose to get money for more bits. Graphically this suits me too. If I can generate basic ship parts I can let the player be the graphics artist and build the bits. I scouted the internet to see if anyone was doing this and found Space Engineers. It was much more technical than what I was thinking I want it to be more using large preconstructed parts. I want the graphic look to be  like the international space station  rather than a far into the future streamlined look.   

I tried different parameters  for vectored  thrust. I put some enemy ships in to chase and at first  found it impossible to catch equally able ships in my sights. If it were single player I could just restrict the movement of the enemy to make it playable. I tried a few different algorithms until I hit on one that gave me a range of  control that worked.  That felt good, by changing a few values I could simulate big sluggish ships or little nimble ones.  All I needed was data for each part to give thrust, weight  , vectored thrust  etc. and I could calculate  the movement attributes.    I put in a basic collision system and some bullets so I could fly round and kill all the enemies. This was starting to be fun. I added loads of enemies and some friendly craft to try a huge space dogfight. This worked but was over surprisingly quickly.  I now needed to work on the environment to give all this a purpose.  It was time to revise the game design to account for all these new thoughts.


  1. This comment has been removed by the author.

  2. What a pleasure it is to read your blog, Steve. Moreover I would just like to say a huge thank you for creating probably the greatest games I have ever played. I am talking about Avalon and Dragontorc. You managed to combine the elements of arcade and adventure into a symbiotic whole that no other software designer – not Ultimate, not Gargoyle, no-one - even got close to. Dragontorc was the better game, only because of its larger scale and the positive tweaks you had made to the user interface, like the operation of the ‘Move’ spell. I will never forget the rush of heady excitement I felt learning that the five crowns upon which I had invested so much time and effort searching for, were to be destroyed. Have you ever considered revisiting Maroc again? I think the potential is huge for a multitude of adventures within the medieval landscape you had created. Indeed, a couple of years ago I was conversing with another programmer who was trying to do just that and we created many ideas for what a modern version of Avalon might look like. The link is here:
    In the end, I don’t think he was clear enough on what he actually wanted to do, a game or a piece of design software, that it fell by the wayside. I am sure from the responses I have read there are many people who remember the game and would be overjoyed to hear you had decided to revisit it. I am sure some kind of Kickstarter would have real appeal. Either way, really enjoying reading the blog.
    Kind regards

  3. Great blog, I love reading about what old Speccy programmers are doing these days. Could you do a post about how you designed the enemy ship AI? I had a go myself at creating a space game, but the enemy AI never seemed to work that well.


Post a Comment

Popular Posts