T3D space shooter prototype
by Guy Allard · 08/24/2012 (3:29 am) · 13 comments
I love SciFi and anything to do with space/physics/astronomy. I had some planet shaders kicking around that I made a few years ago for a TGEA demo, and was porting them over to T3D when I decided to see how tricky it would be to make a simple space shooter prototype with T3D.
Here's the result of 2 weeks effort. My dev machine isn't really up to scratch for this, so I couldn't capture good quality video, but hopefully this is good enough...
Features:
Starfield class
This is a procedural random starfield generator. Parameters control the color distribution, size distribution, and 'clustering' and of the stars. The stars are rendered as a combination of billboarded sprites and colored points. The billboarding is done with a custom shader. Missions can contain multiple starfields. The starfield is rendered after the skybox.
BackdropShape class
This is intended for shapes that are part of the background, shapes that are supposed to be far away and not interacted with. In this prototype, the planets and moon are backdrop shapes. In reality, the planets are only a few units in diameter, and are located a few units from the player. I created new render managers to handle the backdrop shapes, and this allowed me to render them after the sky and stars, but before the rest of the scene.
Planet shaders
The earth is rendered using a custom shader that implements a normal mapped surface, specular on the oceans and city lights on the dark side. The clouds are a separate normal mapped sphere slightly larger than the main planet. The atmosphere haze is a larger sphere rendered using a separate atmosphere shader.
Space dust
To give some feeling of speed when flying around, I used precipitation with zero velocity to represent dust particles that give a visual indication that you are moving.
Roids
I resurrected the fxShapeReplicator for this, as I wanted a way to generate asteroid fields procedurally, which the forest class isn't able to do. I fixed the phantom collision issue that the shape replicators suffer from, then modified it to allow me to place the shapes in an ellipsoidal, toroidal or cylindrical arrangement.
SpaceVehicle class
Based on the flying vehicle class with modified physics and controls to suit the space setting.
AISpaceVehicle class
Simple AI pilots that can fly to a destination, or follow and shoot at a target.
HUD
Based on the guiReticleHud resource. I added some extra stuff to display the approximate firing solution as a cross to give the player some guidance on where to aim. Also added an indicator to show the direction to the current target. The video doesn't show these too clearly :(
Ships and station
I borrowed some models from OOLITE to use as placeholders, notably Griff's ships as they were easy to convert and freely available.
Limitations
The big issue with developing a space game is always going to be floating point accuracy. T3D is really only able to support a playing area of +/- 5 to 10km in all directions before floating point precision errors begin to cause visual glitches and physics errors. There are ways around this, but none of them are trivial. I decided to ignore it, and keep the playing area small.
I think this shows that with a bit of work, T3D is more than capable of this kind of game. I'd like to take this further and add some kind of fast paced, team-based CTF gameplay with different ship classes and roles, but I doubt that I will ever find time for that.
Here's the result of 2 weeks effort. My dev machine isn't really up to scratch for this, so I couldn't capture good quality video, but hopefully this is good enough...
Features:
Starfield class
This is a procedural random starfield generator. Parameters control the color distribution, size distribution, and 'clustering' and of the stars. The stars are rendered as a combination of billboarded sprites and colored points. The billboarding is done with a custom shader. Missions can contain multiple starfields. The starfield is rendered after the skybox.
BackdropShape class
This is intended for shapes that are part of the background, shapes that are supposed to be far away and not interacted with. In this prototype, the planets and moon are backdrop shapes. In reality, the planets are only a few units in diameter, and are located a few units from the player. I created new render managers to handle the backdrop shapes, and this allowed me to render them after the sky and stars, but before the rest of the scene.
Planet shaders
The earth is rendered using a custom shader that implements a normal mapped surface, specular on the oceans and city lights on the dark side. The clouds are a separate normal mapped sphere slightly larger than the main planet. The atmosphere haze is a larger sphere rendered using a separate atmosphere shader.
Space dust
To give some feeling of speed when flying around, I used precipitation with zero velocity to represent dust particles that give a visual indication that you are moving.
Roids
I resurrected the fxShapeReplicator for this, as I wanted a way to generate asteroid fields procedurally, which the forest class isn't able to do. I fixed the phantom collision issue that the shape replicators suffer from, then modified it to allow me to place the shapes in an ellipsoidal, toroidal or cylindrical arrangement.
SpaceVehicle class
Based on the flying vehicle class with modified physics and controls to suit the space setting.
AISpaceVehicle class
Simple AI pilots that can fly to a destination, or follow and shoot at a target.
HUD
Based on the guiReticleHud resource. I added some extra stuff to display the approximate firing solution as a cross to give the player some guidance on where to aim. Also added an indicator to show the direction to the current target. The video doesn't show these too clearly :(
Ships and station
I borrowed some models from OOLITE to use as placeholders, notably Griff's ships as they were easy to convert and freely available.
Limitations
The big issue with developing a space game is always going to be floating point accuracy. T3D is really only able to support a playing area of +/- 5 to 10km in all directions before floating point precision errors begin to cause visual glitches and physics errors. There are ways around this, but none of them are trivial. I decided to ignore it, and keep the playing area small.
I think this shows that with a bit of work, T3D is more than capable of this kind of game. I'd like to take this further and add some kind of fast paced, team-based CTF gameplay with different ship classes and roles, but I doubt that I will ever find time for that.
#2
08/24/2012 (5:14 am)
Looks cool Guy. Lots of potential there. Maybe a pack ?
#3
Looks way better than a space MMORPG I played a while back. Good work!
08/24/2012 (7:22 am)
I told you guys again and again, stay the hell away from my rocks!Looks way better than a space MMORPG I played a while back. Good work!
#5
08/24/2012 (8:56 am)
This is fantastic. You should turn this into a pack.
#6
The basic idea would be stuff around the player would be sized normally and move at a normal speed, but after it gets outside a certain radius, it slows or stops moving, and instead just scales to give the perception of larger distances.
Set up right, you could simulate an area dozens of times bigger than the actual playable area by moving stuff around the player instead of just simply moving the player around a static zone.
Just an idea I had that may be worth consideration :)
08/24/2012 (9:08 am)
Depending on if you're planning on making it multiplayer or not, one way to get around the small playable area that forgoes streaming, or multiple zones would be to have a 'stretched' area.The basic idea would be stuff around the player would be sized normally and move at a normal speed, but after it gets outside a certain radius, it slows or stops moving, and instead just scales to give the perception of larger distances.
Set up right, you could simulate an area dozens of times bigger than the actual playable area by moving stuff around the player instead of just simply moving the player around a static zone.
Just an idea I had that may be worth consideration :)
#7
That's awesome ... is it just my wonky eyes or did I see shielding hits on the enemy ships?
I don't blame you ... ;)
08/24/2012 (9:28 am)
Descent: TorqueSpace: The Great SpaceWar
Somebody fund that!That's awesome ... is it just my wonky eyes or did I see shielding hits on the enemy ships?
Quote:
... floating point accuracy. I decided to ignore it ...
I don't blame you ... ;)
#8
Seriously, can you please release it? o.O
08/24/2012 (9:34 am)
Nice work Guy. Nice work indeed. If you turned this into a pack I'd grab it right now. As is.Seriously, can you please release it? o.O
#9
I forgot to mention that the video was recorded using basic lighting as advanced makes my system choke. With advanced lighting, the god-rays through the asteroid field look great.
@Steve, yes, there is a shield effect on the enemy ships when they are hit. It's just an ovoid around the ships that's textured with an animated translucent noise texture. This is normally hidden, and I use a short animation that toggles the visibility of the shield mesh when they are damaged.
@Jeff, that would be a workable option for single player. Another option would be to use a floating coordinate system and keep the player at (0,0,0) while moving everything else relative. However, multiplayer is what I was aiming for, and solutions for that are out of my league.
I wasn't planning to make a pack from this, it was just an experiment to see how well T3D would handle this kind of scenario. I'll have a think about how to release this. I would need replacement models for the ships before I could do that.
08/24/2012 (1:13 pm)
Thanks for the comments :)I forgot to mention that the video was recorded using basic lighting as advanced makes my system choke. With advanced lighting, the god-rays through the asteroid field look great.
@Steve, yes, there is a shield effect on the enemy ships when they are hit. It's just an ovoid around the ships that's textured with an animated translucent noise texture. This is normally hidden, and I use a short animation that toggles the visibility of the shield mesh when they are damaged.
@Jeff, that would be a workable option for single player. Another option would be to use a floating coordinate system and keep the player at (0,0,0) while moving everything else relative. However, multiplayer is what I was aiming for, and solutions for that are out of my league.
I wasn't planning to make a pack from this, it was just an experiment to see how well T3D would handle this kind of scenario. I'll have a think about how to release this. I would need replacement models for the ships before I could do that.
#10
08/24/2012 (8:45 pm)
Wow, that was awesome. Great work.
#11
Alternatively, if someone else wanted to have a crack at it, I'd be even happier doing some textures for them. I say we get a collaborative effort going, as this pack (were it to be released) would benefit quite a few of us I'd imagine. Me especially!
08/24/2012 (9:59 pm)
I'd be more than happy to 'model' a few basic ships for this. As long as those ships are all cubes. :DAlternatively, if someone else wanted to have a crack at it, I'd be even happier doing some textures for them. I say we get a collaborative effort going, as this pack (were it to be released) would benefit quite a few of us I'd imagine. Me especially!
#12
08/27/2012 (10:38 pm)
Absolutely stunning work Guy!
#13
09/12/2012 (1:31 pm)
so how do space games like vendetta online get around the playable "space" issue? no pun intended. I mean Vendetta and EVE seem to be almost infinite. 
Torque Owner David Robert Pemberton
www.deadlyassets.com