Sunday, November 25, 2007

Input Manager

Input manager is not the main thing you need but its certainly a thing you should have, and its not so complicated to do, so i created input manager class that will handle questions like:
IsMouseButtonGoingDown/Up? IsMouseBottunUp?
IsKeyGoingDown/Up? IsKeyDown?
the 'going' notation is to indicate that we want to know if specific action is about to be triggered, for example: if we want to know when specific key is pressed, we use IsKeyGoingDown, but if the key already pushed and we want to now when we released him we use IsKeyGoingUp, at last if we want to perform some action as long as the key is down we just use IsKeyDown (same for mouse functions).
the input manager uses directinput8 to communicate with hardware devices such keyboard, mouse, joystick (for now i'm using only keyboard and mouse devices).
i also add support for keyboard layout, which allow me to distinguish between different input languages, so now you can type in other languages besides english.
still, i need to match the right font file in order to see the right characters, but this is just a matter of exporting new font texture.

Saturday, November 24, 2007

Weapon Effects

i'v just finished setting weapons effects script.
i added muzzle flash effect per weapon, each weapon have its own muzzle flash effect.
for example: machinegun flashes different and more frequently than shotgun, shotgun also lives some smoke after the shot.
impact effect also added per weapon, each weapon bolt/projectile lives its own mark and create different effect.
for example: rocket effect is the most complicated, it creates smoke trails, fire trails, heat effect (because fire and smoke), sparks and rocket flash.
i also worked on weapon handling, when weapon clip is finished reload sequence is started so you cant shot until finished.
here is few screenshots:
reload and impact effect
note: the red color on the weapon is the gui that
shows how much bolts you have
shotgun - muzzle flash
machinegun - muzzle flash

Friday, November 23, 2007


hi, recently i have worked on game play, one of the things i'v added is hud (heads up display).
at the bottom of the screen you will see which weapon you are using, how much ammo left, health and armor, also when your are hit by something you will see red mark on the screen that will fade out.
the hud is based on the gui system i was worked on, while adding the hud i found couple of bugs in the gui system, some of them was critical, but i fixed them :).
until now, all gui rendering was handled by id3dxsprite interface, and gui elements didn't have full material like i'v used on 3d surface (they have just the texture so i could display it).
one of the changes i'v done was the removing of id3dxsprite interface from gui renderer and adding my own sprite renderer with specific gui shader.
i also removed the texture and add full material support like i'v used on 3d surfaces, so each 2d gui surface will support all the features on 3d surface material.

Saturday, November 10, 2007


i always liked the cut scene in games when you see few agents walking in a dark room and you see their flashlight moves.
flashlight is really cool effect i wanted to add long time but i always had something more important to add, last week i finally add it.
to polish this effect i added flashlight beam/volume to create the illusion of volume lighting, and last thing - every flashlight cast shadows.

flashlight volume/beam
correct order
top view - player flashlight is off so no shadow
top view - player flashlight cast shadow

Saturday, November 3, 2007

Soft Shadows continued

like all shadow map algorithms, VSM also suffer from something called light bleeding (instead of shadows you will see some light color pops at the middle), this is due to the fact that its a probabilistic algorithm.
when the variance over a filter region is high we probably see light bleeding artifacts, we more likely to see LB in scenes where depth complexity is high.
the good news is that VSM have a lot more advantages than disadvantages if we compare it to other pixel based shadows algorithm, also we can reduce the light bleeding issue by doing a smoothstep with the variance value and some threshold.
some of the advantages:
1. we can use mip maps on the "shadow map" texture (the variance map).
2. we can blur it like regular texture blurring (no pcf needed), and because of that we can use hardware filtering so as linear, anisotropic etc.
3. we can get good soft shadows a lot faster and smoother than using pcf.

i have added softness for both spot and point lights, point light is a little bit tricky :)
here is few screenshots:
no soft applied
with soft applied
no soft applied
with soft applied