Plan for David
by David Laurie · 11/15/2004 (6:08 am) · 6 comments
Although this was my first Game In a Day, I'd already done other stuff like speedmodding for Quake, although they were mainly only over 1-2 hours or so. Still, GID turned out to be a little different...
At some point beforehand, I'd considered making a procedural vector game. Gameplay would go on forever by automatically creating new enemies and slowly upping the difficulty, and graphics would be all simple and retro looking, yet still 3D. So when I decided to take part in the up and coming GID, this was the only idea I really had in mind. I sort of had this vision of a bunch of shooting going on between glowy line-drawn objects between two reflective planes. I also hoped to have the game play music, and respond to beat detection by changing colours and the like.
I already had a simple engine to hand, which I had made in late 2003, in C++ using SDL to deal with graphics and input. It was originally intended for a space sim, and featured a sphere based physics system and renderer with a massive view range. There was no networking in place, making it ideal for the vector game. All I would really have to do would be to add procedural models and simple AI.
So first I made superficial changes to the models, experimenting with line and polygon drawing, and implemented two grid planes, drawn by lines - lots of lines. I had experimented with drawing them as textured polygons to reduce the vertex count, but these didn't look so good. However you can see in the screenshots that I reduced the radius of the plane to which you were closest, which while helping speed was actually intended to look more visually correct.

Next, I spent ages implementing reflection. That was actually the most time consuming task of the day, as I was playing around trying to get the matrices right by trial and error. At first it worked only for the static object at the origin, but finally it worked globally.

After all that, I decided to conform to the slightly cowish theme of GID7, and used Drew Hitchcock's cow model for the spaceship. My engine could already load a stripped down version of the .obj format, so shortly the game featured a cow flying between two reflective planes. I also changed from using a model for the sphere to a subdivided tetrahedron, although it didn't seem to subdivide as evenly as I thought.

Then, I moved on to the procedural models. I originally thought of having 3D spirograph patterns as models, as they could change pattern to indicate changes in AI behaviour. But I didn't really know how to go about that, and it was getting late and I didn't feel like trying to work out how. Instead, I thought of doing objects that arced lightning down to either plane. After searching around on the net I figured out how to draw bezier curves, and put that into the model code, along with per vertex randomization.

By that time I'd done about 10 hours work, so I left it there and went and got a beer and watched TV before going to sleep. When I got up the following morning, I set about adding lasers, which was a bit tricky because up until that point the engine had never had to delete objects from the simulation. It wasn't too hard to do, and before long...

For some reason I had removed depth sorting, so I wasted about 6 hours trying various methods before going back to the original engine's implementation, which was all mainly so that I could add the reflections of the planes themselves to the reflections, making them look a little more convincing. I also got the lightning thing to roam about the place a bit, but was too lazy to figure out why they weren't behaving exactly as I'd imagined, as they were good enough. I'd also tidied up the lightning model a bit.

Finally, I added turrets, which were really just hemispheres stuck to the planes. Originally I thought they'd be good just as 'houses' or something, but I decided to make them shoot so that there'd be a variety of different badguys. I'd already made the lightning things shootable. I was getting tired by this time, and had somehow managed to create a crash bug, so I decided to round everything off as it was and release the game. A full rebuild in Dev-C++ must have cured the bug, and there was just about enough there to make a game of it.

Also not shown in the screenie, I added depth fog to the models in the level, to match the fadeout of the grid. I'd spent 21 hours coding.
The final game: LaserCow
(readme included in download)
At some point beforehand, I'd considered making a procedural vector game. Gameplay would go on forever by automatically creating new enemies and slowly upping the difficulty, and graphics would be all simple and retro looking, yet still 3D. So when I decided to take part in the up and coming GID, this was the only idea I really had in mind. I sort of had this vision of a bunch of shooting going on between glowy line-drawn objects between two reflective planes. I also hoped to have the game play music, and respond to beat detection by changing colours and the like.
I already had a simple engine to hand, which I had made in late 2003, in C++ using SDL to deal with graphics and input. It was originally intended for a space sim, and featured a sphere based physics system and renderer with a massive view range. There was no networking in place, making it ideal for the vector game. All I would really have to do would be to add procedural models and simple AI.
So first I made superficial changes to the models, experimenting with line and polygon drawing, and implemented two grid planes, drawn by lines - lots of lines. I had experimented with drawing them as textured polygons to reduce the vertex count, but these didn't look so good. However you can see in the screenshots that I reduced the radius of the plane to which you were closest, which while helping speed was actually intended to look more visually correct.

Next, I spent ages implementing reflection. That was actually the most time consuming task of the day, as I was playing around trying to get the matrices right by trial and error. At first it worked only for the static object at the origin, but finally it worked globally.

After all that, I decided to conform to the slightly cowish theme of GID7, and used Drew Hitchcock's cow model for the spaceship. My engine could already load a stripped down version of the .obj format, so shortly the game featured a cow flying between two reflective planes. I also changed from using a model for the sphere to a subdivided tetrahedron, although it didn't seem to subdivide as evenly as I thought.

Then, I moved on to the procedural models. I originally thought of having 3D spirograph patterns as models, as they could change pattern to indicate changes in AI behaviour. But I didn't really know how to go about that, and it was getting late and I didn't feel like trying to work out how. Instead, I thought of doing objects that arced lightning down to either plane. After searching around on the net I figured out how to draw bezier curves, and put that into the model code, along with per vertex randomization.

By that time I'd done about 10 hours work, so I left it there and went and got a beer and watched TV before going to sleep. When I got up the following morning, I set about adding lasers, which was a bit tricky because up until that point the engine had never had to delete objects from the simulation. It wasn't too hard to do, and before long...

For some reason I had removed depth sorting, so I wasted about 6 hours trying various methods before going back to the original engine's implementation, which was all mainly so that I could add the reflections of the planes themselves to the reflections, making them look a little more convincing. I also got the lightning thing to roam about the place a bit, but was too lazy to figure out why they weren't behaving exactly as I'd imagined, as they were good enough. I'd also tidied up the lightning model a bit.

Finally, I added turrets, which were really just hemispheres stuck to the planes. Originally I thought they'd be good just as 'houses' or something, but I decided to make them shoot so that there'd be a variety of different badguys. I'd already made the lightning things shootable. I was getting tired by this time, and had somehow managed to create a crash bug, so I decided to round everything off as it was and release the game. A full rebuild in Dev-C++ must have cured the bug, and there was just about enough there to make a game of it.

Also not shown in the screenie, I added depth fog to the models in the level, to match the fadeout of the grid. I'd spent 21 hours coding.
The final game: LaserCow
(readme included in download)
About the author
#2
11/15/2004 (8:51 am)
Very cool David, fantastic considering how quick you put it together. Works perfectly here. Very well done, the reflections look really good, as do the lightning streamers.
#3
I'm glad someone liked my cow :)
11/15/2004 (9:56 am)
This is a really cool game. It makes me want to go back and finish my vector engine.I'm glad someone liked my cow :)
#4
11/15/2004 (11:17 am)
Yeh, this is one of my favourites. Nice work.
#5
11/15/2004 (1:28 pm)
Excellent game, like the whole vector idea.
#6
Ted, what graphics card do you have? This sounds like a return of a problem I had coding with voodoo2s - geforce cards were a little more strict about the order of gl calls, so on most other peoples computers my graphics would mess up.
Anyways, there's a few more things I'd like to do with the game - tidy code, fix bugs, add a ui, scoring, score table, dying, improve ai, new enemies, and progression of levels.
I like how GID has helped me set goals with this - it's shown me that I was capable of coding the game any time, it was just a case of committing myself to completing so much in a given amount of time. I think it's natural that it's harder to motivate oneself, but easier when there's some expectation from other people.
11/16/2004 (10:43 am)
Wow, thank's for all the feedback :DTed, what graphics card do you have? This sounds like a return of a problem I had coding with voodoo2s - geforce cards were a little more strict about the order of gl calls, so on most other peoples computers my graphics would mess up.
Anyways, there's a few more things I'd like to do with the game - tidy code, fix bugs, add a ui, scoring, score table, dying, improve ai, new enemies, and progression of levels.
I like how GID has helped me set goals with this - it's shown me that I was capable of coding the game any time, it was just a case of committing myself to completing so much in a given amount of time. I think it's natural that it's harder to motivate oneself, but easier when there's some expectation from other people.

Torque 3D Owner Ted Southard