This is the work-in-progress for a project simply called Torus. There’s actually not much game here, but I think it’s an interesting little project nonetheless. (When capturing video for this I noticed that I actually got around to calling this Torus Trap, but I never liked that much, so I doubt it would have stuck.) Note that there’s no build provided for this project, simply because in the state I left it, it isn’t actually worth playing.
Torus was one of the first projects I worked on when I started using XNA, and it many ways it shows. Perhaps the most notable thing about the game is how much of it is based on limitations and restrictions. I’ve mentioned before that I like a good restriction or two, and this is perhaps the clearest example I have.
First up – the entire premise of the game came about because I couldn’t do complex collision like meshes, or even non-axis aligned boxes. So the first limitation was that I’d only use circular or spherical collision (or anything I could extrapolate from these). Previously in C++ I’d worked on a project called Radius which was a little like Gyruss or Tempest with the player’s ship roaming the outise of a circle shooting inwards. So I decided to take that idea and then wrap it around another circle – and have the player roaming the inside of a torus. They’d be orbiting the circumference of a circle as before, but could also move this circle around a larger circle into and out of the screen. It’s hard to explain, so here’s a video of it in action.
The second limitation I had was that, at the time, I couldn’t find any example code for 3D particle effects in XNA. Basically I wouldn’t be able to make nice fiery transparent explosions. Without this I decided that I’d look at somehow cobbling together some kind of shattering using debris objects. I’m pretty sure with hindsight this would have looked awful, but I made the call and it led me to then decide that everything would be made of metal. That decision then informed pretty much all of the rest of the design.
As mentioned, the player was going to be moving around a circle – this then became a physical ring object. This ring then needed to move along the inside of a torus. I’m a big fan of machinery and intricate mechanisms, so I then decided to mount this ring on rollers that would transport it around the torus. An issue here was that the if the ring sat on top of the rollers it would either waste an awful lot of screen real estate, or the roillers would have to be small and unimposing. So instead I decided that the ring should pass through the rollers – this allowed them to be suitably chunky, made the engineering pleasingly elaborate, and also allowed the rollers to act like shields when the player was inside them. As an aside, the decision to use three rollers was an obvious one (three of anything is generally more interesting than four), but led to the knock on realisation later that this was getting fairly close to looking like Space Invaders wrapped around the inside of a doughnut.
With the ring and rollers requiring elaborate engineering, I then decided that the art style should head towards Steampunk, and this then provided the backstory for the game, and also the design for the HUD and front-end.
The backstory was going to be something along the lines of scientists trapping some kind of energy-based entity in a torus-shaped containment facility to extract energy from it – there would be farms built into the torus to do this. The trapped entity gets a bit miffed about this, and starts spawning enemies to attack the farms. The player then takes the role of a fighter defending the farms from the onslaught. The intention was that it would probably feel a bit like Defender, with enemies spawning around the torus and heading to the farms, with the player intercepting them before they did too much damage. Almost none of this was implemented, but I quite like the premise, and it would have allowed me to make even more over-engineered machinery, since the energy farms would need to retract into the wall of the torus to allow the ring to pass over them.
The HUD/front-end is perhaps my favourite bit of this project. With the game now being made of elaborate mechanisms it made sense that that should extend to the rest of the project, and so I made a nice mechanical heads-up-display, and front-end complete with iris door (this one needed work, but man, I do like an iris door). Scoring and lives weren’t implemented so the HUD currently spins through an automatic cycle to show itself off. Here’s a short video of the front end. I was planning on making this much more intricate, with many more moving parts
One thing to note about this is that I haven’t the first clue about using render targets in XNA, so that HUD is just hanging in space in front of the game elements so that it appears in the right place on camera. It’s a total fudge, but it worked so I ran with it. Here’s a final video with a couple of extra camera angles to show what’s actually going on.
Also of note from that video – the player isn’t actually moving along the torus – the torus and enemies are simply rotating around the axis of the torus. I’m pretty sure I first decided to do it this way because otherwise the lighting would change as the player moved, but it’s probably a good approach, because it simplifies the maths at the bit where the action is.
As you can see from the videos there’s very little in the way of gameplay here, and I think that’s largely down to the fact that it soon became clear it would probably be rubbish, quite frankly. I got the placeholder red sphere enemies in, and soon realised that actually aiming at them would be tricky due to having a 2D plane of influence in a 3D world (the elaborate grid suspended within the ring is to help aiming – if the enemy is embedded in the grid you can hit it, but that’s just a bodged remedy to a symptom, not a fix for the underlying problem). It also looks pretty poor, since at the time I had no knowledge of shaders, and was struggling to find example code that I could use. I think I only kept plugging away at this as long as I did because the engineering was fun, but shelving it was a smart move because making it look good was probably beyond my ability with XNA back then, and I suspect the underlying problems with the core game design would always have made this a tricky one to make fun. Most of the remaining design decisions would probably be taken to mitigate or counter the inherent weakness of not being able to aim very well (I’d already considered making the enemies into snakes (of spheres) – not because I wanted snakes, but because it would give the player a chance of actually hitting them reliably).
Having said that, I’m half tempted to drop the meshes for this into Unity and throw some nice metal shaders at them, just to see what they’d look like…