In Progress
2/14/08 - Chinese Checkers




Tron was one of the very first games I made back in seventh grade and all told I have probably re-written the game from scratch thirty times. Each time I re-made the game with slight differences (usually just improvements to the code, but occasionally improvements to the game itself as well). It got to the point, back when I was still using QBASIC, that I could pump out a bug-less version of the game in under half and hour.

The original versions of my game were actually three steps removed from the movie since I was making a clone of a game a friend of mine had made and his was based on the light cycle mode from the Commodore 64 game which was based on the movie. At the time neither of us had seen the movie Tron and until my friend explained where his game came from, I had never even heard of it. I did manage to see the movie a few years later and if you haven't then I suggest you check it out. So much of geek culture is based on the movie Tron that it would be a shame for anyone not to have seen it.

The program featured here is my most recent implementation of the game and is different from previous versions in a million little ways, most of which an outside observer wouldn't even notice, and one very important way. The big difference between this version and any previous versions is that this one can have computer controlled players. The AI is extremely basic and very easy to beat but, none the less, brings two very important features to the game. Firstly the AI allows you to play by yourself which was never a useful option before. Secondly, and more importantly, the addition of computer controlled players adds a level of randomness to the game which you just don't get when there are only humans playing. My friends and I spent hours and hours playing Tron in middle school and high school and at a certain point the game winds up playing out almost exactly the same way every time. With the addition of computer players however, the computer will force you to make different decisions than you otherwise might, the end result of which is to breathe new life into an old game.

You can find any number of light cycle games online, many of which have better graphics and better AI than mine and some of which offer online multiplayer. There was also a game called Tron 2.0 released by Monolith Productions in 2003 which featured a light cycle mode which could be played online and had all the production value that you would expect from a professionally built game. In short, my Tron is not the best Tron out there, but for me the amount of fun I have playing something that I created far outweighs the fun I have playing someone else's game.

About some of the decisions I made in the development of this game:
Q) How does the game determine when a light cycle hits something?
A) There are a number of ways to do this. One could store the whole screen in an array and flip each element to occupied as a light cycle passes through it. Then each time you move the game could simply test the element you are moving into to see if it is already occupied. You could also simply get the color value of the screen coordinate the light cycle is moving to and see if it is black or not. For this version of the game I chose to have each light cycle store an ever growing linked-list of points. Whenever a light cycle moves forward the game tests each list of points to see if any of them contain the point you are moving into. The border of the play arena is just another list of points and can be tested as if it were another player. In the past I have used other methods to determine whether or not a light cycle has hit anything but this time I made the decision I did because I was originally intending to include online multiplayer with this version and lists of points would have made my life much easier when it came time to correct the locations of players when they got out of sync due to network lag.

Q) Why is there no background image or something to make the game look more interesting?
A) When your character is the size of a single pixel and your objective is not to hit anything, having scenery makes the player's life much more difficult.

Q) How does the AI work?
A) The AI is extremely basic. Although it is a bit more complicated than this, essentially at each step the computer looks at the five pixels in front of itself. If any of these pixels are on any player's list of points then the computer player turns either left or right at random. The computer will never try to win by escaping the play arena.

Q) Why is there no online multiplayer?
A) I have attempted to implement online multiplayer in two earlier versions of Tron and found that it is extremely difficult to do well. Even the professional version of the game was plagued by false deaths caused by minor lag. To quote wikipedia, "...the vendor does not recommend that the light cycle mode be used over the Internet due to its generally high lag." The problem is pretty easy to see so I will explain it. Unlike most games, Tron requires per pixel accuracy at all times in the location of the players. If you think a player is located even one pixel off from where they really are the game can become very frustrating as you may collide with a wall you cannot see. Any amount of lag at all therefore becomes a nightmare for players and no matter how good your connection is you will have lag sometimes. Before beginning work on this game I actually sat down and worked out a complicated way of handling issues with lag but at best the game would still have been frustrating a decent amount of the time so eventually I scrapped the idea.