Saturday, April 9, 2016

X-Fire (2003)

I was recently encouraged to go back and look at a game I made with some uni friends in 2003.
Here I show it off and talk a bit about it.



You can try it out for your self here...


Back in the early 2000’s I was playing around with OpenGL and even managed to make a little racing game with uni mates called IdleTime. It just used light maps for the environments, and the cars had dynamic cube mapped reflections and stencil buffer shadows.


In 2001 I saw the first public showing of Doom 3 at Mac world.
https://youtu.be/Qj3dPyk7hPI
My mind was blown. I wanted to know how it was done. I remember thinking I may as well stop trying to be a graphics programmer because I'll never be able to do something like that.


Anyway, after much reading on every graphics forum I could find, I started to understand how it was done. I saved up my money and bought a GeForce-3 video card and started to play around with it.


Now, of course, the Doom 3 rendering pipeline is well documented. http://bfy.tw/5BfB
In fact you can even download the source code, so I won't go into how it works here. But once I had a little test bed running someone (I can’t remember who) had the idea to make a top down shooter where all the levels are made out of repeated tiles. So we got to work making it.


About a year later we had a demo of X-Fire.

Because all lights were dynamic we really wanted to show it off. We had swinging and flickering lights all around the levels, and a spot light attached to the end of the gun. Even the muzzle flash was a full light that cast shadows.


Every surface had a diffuse map, normal map and a monochrome specular mask. But the specular response was fixed. Looking back I wish I had a colour specular mask and a variable specular response. 

Also when I rendered the ambient pass I just used the diffuse texture. It would have been simple to use the normal map to look up into a cube map or something to stop it looking so flat in shadow. We got around this by having almost no ambient light, it helped with the ambiance anyway.

I should have had fill lights, cheaper lights that had no shadow or specular, so we could have filled in the darker spots in the level.



Game play wise, we only had one enemy type and two different weapons. Of course to turn this into a real game we would've had to expand on that. We had lots of ideas but we ran out of time to implement them.
Because of where the camera was you would potentially see enemy's in rooms that your character should not be able to see. But because there was almost no ambient light, most of the time to find an enemy you had to walk into a room and shine your light in there.


People kept asking us to add a first person mode. So we did, it was actually handy for debugging, allowing you to be able to get up close to problems. however, the game play and art was never designed for this and doesn't really hold up.

We did have two player co-op working over TCP-IP. It was a lot of fun. That's why there is another player character standing at the start of each level. If someone connects to your game, they control that player.


Because the levels were all tile based and Travis made us a nice tile set, we could make levels really quickly. Each level was just rearranging level pieces, so level load times where almost zero. I’m sure if we ever made a real game out of this we would have made more level sets of different environments. It would have been interesting to try and make an auto level generator, but we never had time. Plus it was a lot of fun making levels.

Because all the lighting was real time, you didn’t have to sit around waiting for levels to bake. You could edit levels live in the game. We didn’t hide this and encouraged people to snap pieces together and see what they could come up with.


Because all our lighting was dynamic all our geometry could be dynamic also. However, we never really exploited this. I always wanted to add physics objects to the game. It would have been cool to see objects get flung around the place as you unload your gun.

I would publish the source code, but its too embarrassing. The only thing anyone would learn is what NOT to do ;) But I'm happy to answer any questions about it.

Monday, August 12, 2013

AO good enough?

So here is the bounce lighting combined with the direct lighting.
Got to say I'm a little disappointed, after all that messing around I expected a lot more. There is some nice bounce lighting under the ships bridge coming off the deck. But apart from that it looks mostly like ambient occlusion.
I already have lots of ideas on how to make this better, but I'm keen to get back on to coding rift stuff. So this will have to do for now.

Wednesday, August 7, 2013

Lets bounce

Picked up a new GTX 770 so I felt the need to do some more GPU compute work. I had a go at computing some bounce lighting, this is what I've come up with so far. Its only one bounce and it takes about 24 hours to light 16384 X 16384 pixels. (Think I should stop blaming the hardware and write faster code). I think the sky maybe over influencing the final result. But we'll have to wait until I composite it in before we will know.


Thursday, February 28, 2013

Lawnmower man here we come

I have been reading and watching every thing I can on the Oculus Rift. I can't wait to get my hands (and eyes) on one.
But just because I have never seen one in the flesh doesn't mean I can't try and write code for it.

I had to guess at a lot of stereo properties, but hopefully I want give anyone a stroke.

If you check this video out on a head set please let me know how it looks. Am I even close?

Any way can't wait to play with the real thing, but until then I'll just have to dream.

Thursday, February 21, 2013

3D video test

Started playing around with capturing stereoscopic video and uploading it to YouTube. I used a VT with just AO in it because black and white looks a lot better when viewing with anaglyph glasses.

Looks like the video worked OK  But it doesn't work in HTML 5 mode, so I can't use my Nvidia glasses to view it.

Monday, February 4, 2013

Virtual Texture Demo 05

I have put another video of my Virtual Texture implementation up. This starts as a recap of what a Virtual Texture is then shows off my new decal system.

Tuesday, January 15, 2013

Virtual Texture Demo 04

So as promised here is a video showing off the new uv's and seamless Bilinear filtering. As a bonus I took the page cache size from 4K*4K to 8K*8K and tweaked the mip bias's.
Oh yeah the FPS can now easy hit over 200 and there is still tons of optimizing that can be done. This thing is crazy fast at run-time. :)

Friday, January 11, 2013

Not all GPU's are made equal

My mate Drew sent me a version of the model I've been using with much nicer UV's. So all the pixels are aligned and have a consistent uv density. Which is awesome, But it means I needed to compute all new lighting textures and I didn't want to wait two days like last time. So I installed windows on my Linux box and got it rendering. And I also got my laptop rendering too. But you can see from this data it wasn't really worth it.

ComputerGPUGflopsLight 268435456 pixels
Build(Linux Box)6600 GT47~386 hours
LaptopGT 620M269 ~64 hours
MainPCGTX 460907~22 hours

Any way here is what it looks like.

Hard to see from this image but trust me it looks a lot nicer. Once I fix up the bilinear filtering I'll post another video and you can see for your self.

But I really want to try a 32k * 32K texture next. Which would take about 8 days! So looks like I have some optimizing to do. Unless anyone has a render farm they are not using?

Wednesday, January 2, 2013

Virtual Texture Demo 03

Now you can see the new lighting in action. Plus now if I don't have a page loaded that we need. I just use a page that is further down the mip chain. Its much nicer then showing an invalid texture or having textures flicker until they are loaded in.

Saturday, December 29, 2012

All lit up

So here it is: shadows, ambient occlusion and diffuse all put together.
Note I tried to match the camera angles as best I could from the ambient occlusion images (here)
If it wasn't for those seams I'd be happy. I've had quite the adventure doing some GPGPU'ing to bake out all that lighting data. I should write it all up. But for now I'm off the the beach, To give my GPU a rest  ;)


Shadows

So baked out some shadows at 16k * 16k. It only took 17 hours. I need to spend some time optimizing or get my self a render farm :)

I know what you're thinking, because I'm thinking the same thing. So how does it all look when put together? Well my computer is working on that, should have the results in a matter of minutes.



Thursday, December 27, 2012

Took quite of bit of time

I wanted to get some lighting into my virtual texture demo. So I wrote a super simple GPU light-mapper. Well maybe I shouldn't have made it so simple. Because it took ~32 hours to bake out a 16K * 16K light-map.
Looks OK for a first try, but those seams are killing me. But wheels are in motion to get some nice UV's. Of course the next step is to bake in the diffuse textures as well.

Virtual Texture Demo

I have started playing around with my virtual texture demo again. I have two video blog posts about it here...
and here...
Right now I'am trying to bake out some nice lighting, with a simple lightmap renderer that I wrote that runs on the GPU. Its super slow right now. But I'll talk more about that later.

Tuesday, November 29, 2011

Doom3 source code

I got Doom3 compiling and running on my Mac thanks to this fork of the code...
https://github.com/Geenz/doom3.gpl
It really is a lot of fun poking around.
I think Doom3 was written to run on Geforce 3 GPU's (maybe even Geforce 2). So I was thinking it would be cool to take advantage of our new fancy pants GPU's and do some cool stuff.
First thing I did was add a vidmode for my monitor (1680X1050) could add some more common screen resolutions like 720p and 1080p.
I don't know if it is a Mac thing or not but it doesn't look like vsysnc is working, it would be good to sort that out.
I haven't tried it with a game pad yet, but would like to see it working nicely with an X360 controler.
Would like to add some better normal map compressing. Normal maps compressed with DXT1 look like crap. But most GPU's should have enough ram to load all the textures uncompressed now.
There is a lot of smoke and dust, could easy make them soft using the z-buffer.
I think all the skinning and shadow silhouette generation is done on the CPU, shouldn't be too hard to move then onto the GPU now.
Even though I'm not a big fan of SSAO it could be a good fit.
MSAA works fine in Doom3 but it might be fun to add FXAA.
And of course adding HDR and motion blur would really sex it up.

The real problem is finding the hours in the day to do all of this. Should really look around and see what other people are doing. I'm sure other people are thinking about the same things as me.

Monday, November 21, 2011

Xcode KeyBindings

Trying to make Xcode more like Visual Studio.
Work in progress...


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Menu Key Bindings</key>
<dict>
<key>Key Bindings</key>
<array>
<dict>
<key>Action</key>
<string>cut:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandID</key>
<string>Xcode.IDEKit.CmdDefinition.Cut</string>
<key>Group</key>
<string>Edit Menu</string>
<key>GroupID</key>
<string>Xcode.IDEKit.MenuDefinition.Main</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^x</string>
<key>Navigation</key>
<string>NO</string>
<key>Title</key>
<string>Cut</string>
</dict>
<dict>
<key>Action</key>
<string>copy:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandID</key>
<string>Xcode.IDEKit.CmdDefinition.Copy</string>
<key>Group</key>
<string>Edit Menu</string>
<key>GroupID</key>
<string>Xcode.IDEKit.MenuDefinition.Main</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^c</string>
<key>Navigation</key>
<string>NO</string>
<key>Title</key>
<string>Copy</string>
</dict>
<dict>
<key>Action</key>
<string>paste:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandID</key>
<string>Xcode.IDEKit.CmdDefinition.Paste</string>
<key>Group</key>
<string>Edit Menu</string>
<key>GroupID</key>
<string>Xcode.IDEKit.MenuDefinition.Main</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^v</string>
<key>Navigation</key>
<string>NO</string>
<key>Title</key>
<string>Paste</string>
</dict>
</array>
<key>Version</key>
<integer>3</integer>
</dict>
<key>Text Key Bindings</key>
<dict>
<key>Key Bindings</key>
<dict>
<key></key>
<array>
<string>moveToRightEndOfLineAndModifySelection:</string>
<string>moveToLeftEndOfLineAndModifySelection:</string>
<string>moveToRightEndOfLine:</string>
<string>moveToLeftEndOfLine:</string>
<string>selectToMark:</string>
<string>swapWithMark:</string>
<string>scrollToBeginningOfDocument:</string>
<string>scrollToEndOfDocument:</string>
</array>
<key>$@</key>
<string>moveToBeginningOfDocumentAndModifySelection:</string>
<key>$@</key>
<string>moveToEndOfDocumentAndModifySelection:</string>
<key>$@</key>
<string>moveWordBackwardAndModifySelection:</string>
<key>$@</key>
<string>moveWordForwardAndModifySelection:</string>
<key>$</key>
<string>moveToBeginningOfLineAndModifySelection:</string>
<key>$</key>
<string>moveToEndOfLineAndModifySelection:</string>
<key>@</key>
<string>moveWordLeft:</string>
<key>@</key>
<string>moveWordRight:</string>
<key>^~$B</key>
<string>moveWordBackwardAndModifySelection:</string>
<key>^~$F</key>
<string>moveWordForwardAndModifySelection:</string>
<key>~</key>
<string>moveWordLeft:</string>
<key>~</key>
<string>moveWordRight:</string>
<key>~</key>
<string>pageDown:</string>
<key></key>
<string>moveToBeginningOfLine:</string>
<key></key>
<string>moveToEndOfLine:</string>
</dict>
<key>Version</key>
<integer>3</integer>
</dict>
</dict>
</plist>

Tuesday, August 30, 2011

Source control will save you life one day

The light maps in IdleTime are extremely bad. In fact I'm not even sure you could call them light maps. Basically they just store the shadows. The UV densaty is a joke, there is no ambient occlusion, no bounce lighting, no nothing.

So whats this got to do with source control? Looking at the above screen shot I decided that I should fix the light maps. Long story short I can't find the code for the light mapper.
Obviously if you have more then one coder on a project source control makes total sence. But why use source control when there is only one programmer?

Lesson #3 for old me:
Always use source control. A part from the obvious, history. Having history will make your code a lot cleaner. I found that when making a big change to the code I would just comment out the old code and add the new code in. This gets very messy very fast. I've been using Perforce at home, they have a 2 (maybe 3) user version for free.


Sunday, August 21, 2011

Android IdleTime

Have been messing around with the Android SDK and I decided that I need some better test data. So I made a little exporter for the IdleTime car models.
Nothing too hardcore yet, just drawing a mesh with a texture. No lighting or anything.
Note it looks a lot less aliased on the phones display.


Wednesday, August 17, 2011

IdleTime is building and running

It only took an hour or two to get the code building again. Most of the time  was spent getting the code to compile with Visual C++ 2010 Express. Took another hour or two to track down a problem with the stencil shadows. For sum reason I was calling abs() on sum unsigned int's. On that note this ~10 year old code is scary. Turns out I have learn a thing or two about programming since then.

Lesson #1 for old me:
Use "Asserts". There is not one assert in the whole project. Making debugging a nightmare.

Lesson #2 for old me:
Clean up Warnings. The project had hundreds of warnings. Warnings can help you catch dumb code but you will not see the good ones with all that noise.



Sunday, August 14, 2011

So what are there games anyway?

Our web site is long gone, so you can't download these games any more. But as part of this project I want to get them building again, improve then a bit and put them back online.

The first game we made was Idle Time. After a bit of googleing I found this Flipcode image of the day we submitted...
http://www.flipcode.com/archives/10-28-2002.shtml

The next game we made was X-Fire. (I think some game match making software uses that name now). This was starting to feel like a real game but then I was hired by Bluetongue and I never really touched it since.
http://www.flipcode.com/archives/01-19-2004.shtml