Shader sub-system rewrite + other random stuff

Published January 22, 2007
Advertisement
It's been a while since the last update...I've made a lot of progress [grin].

Mini Map
-----------------------
First off I have a new mini-map into the game for when you're controlling a gangster. You can zoom in/out with the middle mouse button. Vehicles, civilians, cops, gangsters, civs who want drugs, civs who have lots of money, building entrances, etc. all show up on the mini-map as a certain icon overlayed onto the city map.

Here are some screens - I'l probably add a FOV for your gangster to make it easier to see.



Server packet handling bug fixed
-----------------------
There was a server side 'logic' bug, that caused things to get backed up, and you'd see your commands being executed 4-5 seconds after you pressed the input key (since everything is now done server-side). I had experienced a similar problem when first coding the client.

My server side loop was looking like this (highly simplified [grin])

  While(IsServerRunning)  {   if(CheckForIncomingPacket() != NULL)   {    HandlePacket()   }   StepGameworld()  }


It needed to look like this...
  While(IsServerRunning)  {   While(CheckForIncomingPacket() != NULL)   {    HandlePacket()   }   StepGameworld()  }


The original way I was only handling 1 packet at most PER FRAME, server side. I'm amazed that it actually WORKED fine up until this point...without my noticing. Client side it made things unplayable, but I didn't notice this problem server side until I got 6 clients in a game, and the server was getting 6x30 input packets per second, it was MUCH more obvious. It was almost un-detectable with just 1-2 clients connected.


Final shader system re-write
-----------------------
Now this is the area I want to get some opinions on...and my main reason for finally posting a journal entry [grin]

I just sketched out the final setup for the 4 levels of shader detail & hardware requirements for the game, and I need you guys to look it over...

Quote:
Texture stage layout - A8R8G8B8 format (unless noted)
----------------------------------------
0 - Model texture, alpha component determines final transparency.
1 - Fog of war texture, projected over entire scene, alpha component not used.
2 - Shadow map texture, D3DFMT_R32F format.
3 - Dynamic lighting texture, projected over entire scene, alpha component is the height of the light source.
4 - Reflection map, determines reflectivity of each texel, alpha component not used.
5 - Luminance map, determines luminance (emissive) for each texel (at night only), alpha component not used.
6 - Cube map, scene reflection texture
7 - Not used. (far shadow map, blend between the two)?




Card requirements - (8 texture stages & PS 1.1 & VS 1.1)
----------------------------------------
- ATI Radeon 9600 +
- Nvidia Geforce FX5200 +

* If I can fit things into 6 texture stages, the game might run on Radeon 8500+ but would probably be way too slow.




Shader quality breakdown
----------------------------------------

Low - PS1.1 / VS1.1
-Standard diffuse lighting.
-Hardware skinning for animated models.
-No reflections on vehicle/buildings
-Fake human/vehicle shadows (blobs).
-No shadow maps (no shadows on static geometry).

Medium - PS1.4 / VS1.1
-Standard diffuse lighting w/specular.
-Hardware skinning for animated models.
-Cube map reflections on buildings/vehicles
-Fake human/vehicle shadows (blobs).
-No shadow maps (no shadows on static geometry).

High - PS2.0 / VS2.0
-Standard diffuse lighting w/specular.
-Hardware skinning for animated models.
-Cube map reflections on buildings/vehicles.
-Fake human/vehicle shadows (blobs).
-2 1024x1024 shadow map textures, for static geometry (far shadow map is updated once every 4-5 frames, covers entire city).
-2x2 PCF shadow map filtering.

Highest - PS2.0 / VS2.0
-Standard diffuse lighting w/specular.
-Cube map reflections on buildings/vehicles.
-Humans/vehicles cast shadows via shadow mapping.
-2 2048x2048 shadow map textures, for all geometry (far shadow map is updated once every 2-3 frames, covers entire city).
-3x3 PCF shadow filtering.


Keep in mind that shader detail is just one option...I've also got - FSAA, bloom, texture res, texture filtering, screen resolution, motion blur amount, view distance, etc.

In all the screenshots lately I've been using a mix of Medium and High quality, with a busted PS1.4 shadow map hackup. True shadow mapping didn't make the conversion from ASM ->HLSL yet...I'm doing that later tonight.

Early warehouse screenshots
-----------------------
Also, I guess I can't have a journal entry without at least one screenshot...I was browsing the net for reference pictures, and found this little ditty...I really like the way the rafters looked, so I wanted to re-create it in my game.



Here is how it looks in my game...This is one of my latest WIPs...the blue wall texture is temp, and has been replaced already. I also added 100s of crates stacked up throughout the warehouse...more screens later.



Alright, Time to get to work writing all these shaders,...thankfully they're mostly done except the shadow mapping, and some small other details. It will be good to get true shadow mapping back into the game....another update soon :-D

- Dan
0 likes 5 comments

Comments

HopeDagger
Quote: While(IsServerRunning)
{
if(CheckForIncomingPacket() != NULL)
{
HandlePacket()
}
StepGameworld()
}


Awesome. I'm glad I'm not the only one who has done this and later slapped myself around for it. [grin]
January 22, 2007 10:52 PM
Giallanon
I sugguest you set a limit to the number of packet you can handle per frame.
Something like this:


  While(IsServerRunning)
  {
   int nPacket=0;
   While(CheckForIncomingPacket() != NULL)
   {
    HandlePacket();
    nPacket
    if (nPacket++ > nMaxPaxket)
      break;
   }
   StepGameworld();
  }





January 23, 2007 03:33 AM
dgreen02
HopeDagger - Yeaaa, it was a slight mindfuck to say the least.

Giallanon - Good point...I'll add that check. Considering it was actually working handling 1 packet a frame, I don't think that should really be a problem. I can't think of a situation other than a DOS attack that I wouldn't want the server to process as many packets as possible, as soon as possible. I'll make another pass on the code looking out for Denial Of Service attacks, special situations, etc. Right now I'm shooting for 'functional & bug free' code [grin].

'preciate the comments guys :-D

- Dan
January 23, 2007 04:19 AM
blue_knight
The ceiling, rafters and lighting look really nice in the warehouse. Good job!
January 23, 2007 01:01 PM
Gaheris
Not much left that I can see! It's simply getting even better and better!
January 23, 2007 03:24 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement