Blog Archive
I lost my old blog years ago. I know I had backups of the MySQL database and assets somewhere, but for the life of me, I can't find them. And since it's been well over a decade, I'll assume that they've probably moved on to the great database in the sky. Oh well. Such is the ephemeral nature of life.
Anyways, here's what I could cobble together from archive.org. It's missing the first entry announcing the project, but I was actually surprised by how much of the blog was in there.
TunnelTanks on Github
2014-05-26
Wow, it really has been over 3 years since my last post. Boy, how time flies... Let's see... the last time I posted, I was wondering if Valve would bring Portal 2 to Linux. Seems that they did. Actually, they did way, way more than that. Heh, good times, good times.
I'm sure I'll get back to this blog sooner or later, but until then, just a quick update: TunnelTanks (an SDL port of an old 1991 DOS game that I absolutely love, but haven't worked on in a while) is now on GitHub, at https://github.com/raydog/tunneltanks. This code contains a bunch of fixes, a few extra features, as well as the ability to compile for Android. (Insert oohs and ahhs here...)
Enjoy!
TunnelTanks 0.4
2010-12-08 01:31:21
Well, I've been pretty consistently working on TunnelTanks over the last two weeks, and I've actually gotten quite a bit done. Here's a summary of the changes, adapted from the CHANGELOG file:
- Switched from a custom python script for configuration to a CMake/CPack-based build/packaging system, which can build binary tar.bz2's, deb's, and rpm's.
- Improved Twitch's self-preservation instincts. He is now smart enough to try to return home when he is low on energy/health. ('Try' being the operative word. He can get stuck on level details...)
- All code is now managed by the Bazaar VCS.
- Made it possible for there to be multiple level generators, and added 2 new ones: 'simple' and 'maze'. The original one is named 'toast'. Better name coming soon. 😃
- Added fullscreen capabilities. Just run tunneltanks with
--fullscreento start that way, or hit 'F10' at any point to toggle into fullscreen. - Added a means for an AI to query the surrounding level. Twitch makes very basic use of this functionality, but it'll be far more useful for more complex AIs.
- With the
--largeCLA, you can have the level generators make even BIGGER maps. (1500x750 vs 1000x500, which is 2.25x more pixels!) - Improved command-line parsing. Just run with
--helpto see all the new options. - Many other bugfixes.
There's a lot of new stuff there, but my favorite is the ability to add new level generators. Here are some sample levels from the current set of built-in level generators:
This is a sample 'simple' maze:

This maze started out as a way to accurately mimic the level style of the original game, since the original game will generate a rock wall sort-of like this, and then sprinkle the outer border with random rock outcroppings. Sadly, all attempts to reasonably capture this style fell short, so I instead worked mostly on generating the rock border, so that the original game's "fight in the middle" mechanic could at least be preserved. Sadly, it'd be difficult to perfectly replicate the original game's level generator without the original game's source code, since it has lots of quirks that are unique to it...
The second maze generator is the 'maze' generator. This was probably the most fun level generator to work on. 😃

The maze generator uses a Randomized DFS maze-generator, or as it's called on http://www.astrolog.org/labyrnth/algrithm.htm, the "Recursive Backtracker." It's fast, it's effective, and I really like the mazes that it generates. And also, check that page out. That guy is a huge maze fan, and he really knows his maze generating techniques. Interesting read... 😃
And of course, we still have the 'toast' generator.

I only called that generator 'toast' since I couldn't think of a better name. If you have a better name, do feel free to tell me. 😃
That's about it. I am now keeping info on the project, including instructions on how to clone the Bazaar repository at this page
Since I changed to CMake, the build instructions have also changed to:
cmake . && make && ./tunneltanks
If you wish to install this project, you COULD do a make install, but it'd be far cooler to use the new packaging targets. For example, do a make package-deb to make a deb file, that can be installed through your package manager. (You can also do make package-tbz2 for binary tarballs, or make package-rpm for an rpm file.)
Enjoy! 😉
TunnelTanks 0.3
2010-11-25 02:40:50
Hey there, everyone! Happy Thanksgiving! I'm just about to nod off to sleep, but before I do, I just want to get one little blog post in...
Well, after a very, VERY long delay, I'm releasing TunnelTanks 0.3. You know TunnelTanks? That game I was working on several months ago? Before I got the Nexus One, which got me all interested in the Android Framework and the JNI? Ring any bells? No? Oh, well.
So, for the uninitiated, way back when, I was being all nostalgic about an old DOS game called Tunneler that my sister and I used to play on my mom's old IBM laptop. Well, after tinkering around with cave-generating functions, I decided to start writing this game for myself using SDL, and name the subsequent project TunnelTanks. So, after a long hiatus, I've rediscovered the source code directory, and got back to work. Here are some of the new features:

- Bases have been added, so every tank has a place that they can call home.
- Energy and health is now tracked by the game engine, allowing things to die. (Finally!) Also, both energy and health can be replenished at your base, but only energy can be replenished at enemy bases. (And slowly at that.)
- Fixed a noticeable bug, where small bits of the level could be erased by getting really close to something, and then turning towards dirt.
- Lots of code improvements, such as changing the level generator from the DDA algorithm to Bresenham's algorithm, which makes the program almost completely float-free! (The only thing left that uses a floating point variable is the single line of code that prints how long it took to render the level.)
- When a tank is low on power, its display will start glitching out.
- All tanks now have their own, unique color schemes. So, be sure to tell me if some of the colors are awkward... I am slightly colorblind, and my definition of a decent color match is often wildly different from everyone else's. 😃
- Other code cleanups, and bug fixes...
Sadly, our beloved Twitch AI isn't faring well in the new version... you see, poor Twitch has no concept of direction, no ability to see enemies, no means of checking its energy levels, and no self-preservation instincts whatsoever. So, most Twitches will wander off and die within the first few minutes. The Twitches who live are just lucky/stupid enough to not even be able to escape their bases. (Which is both sad and funny at the same time.) I plan on extending the controller API, so that a controller can get some more info on a tank, allowing for smarter AIs in the future. However, that's an adventure for another day.
And there we go! I hope to keep on this project more diligently in the coming weeks. The game controls are now:
- BLUE Tank: ASDW (movement) + LEFT CTRL (firing)
- GREEN Tank: Arrow Keys (movement) + '/' Key (firing)
The controls were changed to dodge hardware limits on my laptop keyboard. (Using Enter to fire with the green tank meant that you couldn't move up and left at the same time...)
To build, just do a simple:
./configure && make && ./tunneltanks
You will need a Python interpreter to configure, GNU Make to compile, and the SDL libraries to run, so be sure you have all of those.
Have fun! 😃
TunnelTanks 0.2 alpha
2010-03-17 17:32:08
Loads of changes in this release. There are now 8 tanks in the world, 2 of which are within your control. The rest of the tanks are controlled by the game's first AI. (Although the 'I' in 'AI' is being used VERY loosely...) The AI's name is Twitch, and its movement is entirely random. Not a serious AI, but it's fun to watch. 😃

Other things done:
- Shooting while digging will now let you travel through dirt at the same speed as if you were driving in an open area, like in the original game.
- Controller code has been abstracted into a newer API, which will make developing AIs and alternative control systems (like joystick or network controllers) easier.
- Fixed a bug where it's possible for a tank to be spawned in an area that can't be reached by tanks in other areas.
- Collision detection works so you can run into and shoot other tanks. Nobody dies yet, but that's coming soon. 😃
- The program now prints out the random seed that was chosen by the 'rand_seed' function. (Which uses both time() and /dev/urandom as sources.) You can then manually hand that seed back in via the command line, so that the level generator will generate the exact same level. This will be removed for the later versions, but it's currently useful for debugging...
- The 'Random Growth' phase of the level generator has been rewritten to use a more sophisticated algorithm, so that only cells that are up for consideration get processed. This has decreased the total time needed to make a level to .14 seconds. According to gprof, the next function that should be optimized is the smoothing operation, which currently takes ~50% of the total processing time. Here's to hope that we can get this thing to under 0.1 seconds!
Next up: Bases and health/energy. Then, maybe I'll take a legitimate swing at the AI, and not just a 'Twitch'... 😉
Controls:
- Blue Tank: ASDW + LCtrl
- Green Tank: Arrow Keys + Enter
- Red Tanks: AI controlled. Just watch. 😃
Source Code: tunneltanks2.tar.bz2
Tunnel Tanks Reloaded
2010-02-27 03:55:57
Here's another small update, because I feel like it.

The graphics part of the code has been abstracted, so that we can now have multiple viewing panes in a single window, and it will always center on a single tank object. Also, digging through dirt now takes longer than driving in the open, collision detection works great, and you can also fire bullets. Those bullets will hit dirt/other obstacles, and generate a neat little explosion effect at the point where the bullets hit.
However, it's time for some code cleanup, specifically with the window code. Currently, I have it so that the window will detect which parts of the visual has changed, and will only copy those pixels over. That's awesome, and I want to keep that, but I need to improve the way that the bullets/particle effects are drawn. Currently, they are viewed the same as other updates (like when the tank digs) but since effects are so small and so numerous, it leads to some pretty horrific inefficiencies...
Plus, I need to abstract the Tank's controlling mechanism away from the raw inputs, since I'm hoping that network or AI controllers can be all be treated identically by the game's logic... Big things planned... 😃
Next update will probably include source code... you know... after the code cleanup... 😉
Tunnel Tanks
2010-02-23 16:50:00
Next up: Collision detection, and then shooting.

Oh, and I'm thinking of naming the project "Tunnel Tanks" because I don't see a project out there named that. (Well, there is one, but it was only mentioned on 1 forum, and the website is 404-ing...)
Cave Generator: Part 3
2010-02-23 11:40:52
Just a quick update:
Ok, so the C code now generates 1000x500 sized maps, instead of the 600x500 that I was using earlier. (The original game generated 1000x500 maps...) Plus, the C code now generates color graphics, and can save those graphics to file, all thanks to SDL. (Plus, it only takes .37 sec to generate that huge map, which is good, but I think that it could be better... 😃 )
(Image broken: Sample level)
The code allows for zooming in, and drawing specific parts of the map, so I just need to start catching keyboard events, and throw a tank in there for this thing to be sort-of playable. 😃
Cave Generator: Part 2
2010-02-21 11:39:42
I rewrote the random cave thing in C, and... wow. I sometimes forget just how quick C is sometimes. I wrote this with painfully simple algorithms, that don't take advantage of some of the logical speedups used in the Python version, and it finishes in only 0.34 seconds. I'm pretty happy with that, but I may still fiddle with it later.
The code uses (hopefully) portable C89, so you should be able to compile it with no arguments. (However, adding -O2 is needed to get you the 0.34 completion time... else it takes around a second and a half...) Also, this program doesn't produce pretty output like the last. Instead, it takes the zero-dependency approach by printing its output in ASCII art.
Source Code (GPLv3)
Cave generator
2010-02-20 05:16:23
Well, my current project is at a standstill, cause I need to do some more planning, so I've decided to do a little bit of work towards that tunneler remake project I sort of mentioned in the last post.
First thing I wondered was: "How did Geoffrey Silverton generate those maps?" Indeed, they are real nice, and they rendered quick, even on the limited hardware of the time. However, the levels generated by the old DOS Tunneler are always very similar, with all obstacles cleanly placed along the outer borders. I wanted maps in my version to be larger and more labyrinthine. So, after a bunch of experimentation, I came up with an algorithm that generates fairly interesting maps with high precision. The algorithm is 3-phase:
- Tree Generation: A bunch of random points are placed on the screen. Then, we repeatedly make edges between the two closest points which are in disjoint sets. This will generate a non-intersecting, and fairly natural-looking, tree. We then draw this tree, so that the following phases have something to work with.
- Random Growth: We iterate over every point on the screen, and any point that is bordering a point that has already been set may then get set. Over many passes, the structure will grow, and will eventually cross some threshold (in this case 62%) where we end this phase. Also, I linearly reduce the probability of points getting set along the borders, so that we don't have have caverns colliding with the borders.
- Cellular Automata Smoothing: Using a slightly altered version of Conway's Game of Life, we smooth out the graph. The rules have been altered so that outlying points will die quickly, and so that the entire computation will converge to a solution.

This isn't the quickest algorithm out there, but it's quick enough. The current version is written in Python, and it takes 14 seconds to generate a new graph. (Most time is spent on the random growth stage.) Once I'm more comfortable with the performance of the algorithm, I'll code it up it C, and hopefully we'll have a nice-n-speedy cave generator.
Any thoughts, btw? This is my first attempt at a random level generator, so it's probably not the best solution out there... But if you can do better, I'd love to see it, and possibly include it as a level option in this Tunneler clone. 😃
Source Code (GPLv3)
