Sunday, April 5, 2009

Moving to Havok

hi
well, the day has come and i realize that nvidia physx isn't good enough for my game play physics, so i started to read havok physics sdk and i really like it, its not simple as physx but gives better control over things like character controller, ragdolls, ray casts etc.
why i'm doing it right now and not waiting after i release a demo?
the things is the physics is very important part of the game especially the character controller, so i prefer doing it before and have solid system than say: "i cant do it now, its a lot of work".
few things i found physx is very bad at:
1. filters, not enough and not general so i could filter collision detecting between objects and such, for example: i want to the bot to shot but i dont want it to collide with its ragdoll! i solved it via bits filtering but limit to only 32 bots.
2. character controller! smooth collision nice handling with different shapes (box, sphere, capsule) but very very bad in interacting other physics element, the thing is that this character controller (cct) is placed outside the physical system and perform sweep test against the world to do sliding and stairs handling.
so interacting with other rigid bodies is done via collision callback that tells you which bodies the cct collide with and allows you to add forces to do the pushing effect, but what about other rigid bodies that pushing the cct? well this is not possible! because the cct is a kinematic object which means its static! and have high priority over other none kinematic objects.
so doing moving platforms that allows the cct to stand and moving with them isn't possible! you can do it by doing dirty hacks and maybe you get the right results but it will jitter a lot and wont perform very well.
those are 2 things i can't compromise and because of them (mostly because the cct) i move to havok, which have great cct and let you chose the one which fits better to your game, they have rigid body cct and proxy cct which acts like physx cct (placed outside of the physical system and do sweep test and such), when you choose rigid body cct it means it part of the physical system and everything works! meaning you can push things, things can push you, moving platform become very easy to do.
they also have very generic filtering system and ragdoll support, they even have animation support which works with ragdoll physics and ik so you can do animation with ik and enable ragdoll physics when you want.
there alot of things i didn't mentioned but i think that if you need good physics system and you dont want to compromise you should select it very carfull or you end up changing it like me :)
so in two words: Havok Rocks!
cya until next time...

if you have any question feel free to ask http://orenk2k.forumotion.net/

Friday, March 27, 2009

Triggers in Action

hi, after i finished to update my system (installing and updating few things) i remembered that i said i will put some video to show triggers in action so i created a small map with a box attached to ceiling with few physics objects inside, so when i touch the trigger the box will be opened and the objects will fall down.
this is very simple example of using trigger_once (which trigger his targets only once), other triggers could be use at the same manner to achieve more complex behavior.


using triggers

if you have any question feel free to ask http://orenk2k.forumotion.net/

Saturday, March 21, 2009

Doing some maintenance

hi, this week i did some maintenance, something i want to do for a long time is to replace my hard disk, my current hdisk (old 80 gb) start to do some noises so i thought its time to replace it, so i buy new 320 gb and clone everything.
i thought i will be fast and simple but the new norton ghost is so bad, i just want to do simple task (as i did in the dos days) and they make it so hard, they change the option for cloning hdisk to copy hard drive option which allows you to clone only one partition at a time and not the whole hdisk as one unit.
so i searched for another app, and i found really good software 'Acronis True Image Home', this is the best app i found for doing the job, very easy to use and have a lot of options to backup things. anyway i use it and it work perfectly.
i also install source control software (which i didn't use until now), the project become very big with a lot of files and it become very complicate to control it, so i installed svn (which i also use it at work), i really like this software, very fast and relaible.
the last thing i did is to upgrade my dev system to vs2008, i was using vs2003 which wasn't so great, i hope the new one will perform much better :)
thats it for now, bye

Wednesday, March 11, 2009

Triggers

hi, long time i didn't post anything, i'v been busy at work and also wanted to try few techniques and to read few articles from gpu gems 3 and gpg 7, i'm going to get a new copy of ai game programming wisdom 4 which will complete my series so i'm really looking forward to read it.
anyway, after checking some new methods on the graphics side (deferred methods) i wanted to get on with the gameplay so i decided to add new triggers to support interesting level design stuff.
background on triggers for those who are not familiar with it.
trigger is a convex volume which triggers an event when game entity (player, bots, projectiles etc) touches it.
simple example for using triggers: you place a door and want it to be opened only if you get nearer, so you place a trigger around the door but make it a little bit bigger so you will touch the trigger before you touch the door, you set the target of the trigger to be the door so when you touch it it will send a 'trigger' message to the door.
each trigger have basic attributes:
1) target - name of the entity that will be triggered when we touch the trigger, we can set multiple targets.
2) message - message to desplay when triggered
3) delay - amount of time between the touching and the actual triggering
there are few more relative to trigger type.
the triggers i'v added so far:
1) trigger_once - triggers only once, when it is triggered you can't trigger it again, can be used to destroy a bridge after you pass on it.
2) trigger_multiple - triggers multiple times, you can set wait time before the trigger will be trigger again when touched.
3) trigger_hurt - apply damage when touched, can set damage amount.
thats the main idea of triggers, i'v few more to add and there is cool stuff you can make with them.
next time i hope i will finish the rest and upload some video to show some action.
bye
as always if you have any question feel free to ask http://orenk2k.forumotion.net/

Sunday, February 15, 2009

Custom Deformation

hi, quick update about new feature i'v added into material system called custom deform.
this feature allow you to create specific deformation on a geometry batch.
by saying specific i mean that you define 3 functions/expressions (anything you want), to define the deformation on x,y,z component of each vertex in the batch.
for example:
here is a material definition for sin wave deformation:
materialTestDeform
{
deform custom 0, sin(time+VertexIndex), 0
}
ok, what this simple material does to any geometry using it, is applying a sin wave deformation on each vertex on the y component. (the x,z component doesn't do anything as its 0)
time - internal keyword returning game time in ms
VertexIndex - internal keyword returning current vertex index of the vertex we are going to deform.
i could also use it to do some old scholl water deformation (using height map) by doing something like this:
materialWaterDeform
{
deform custom 0, heightMapTexture[256*VertexPos.y+256*VertexPos.x], 0
}
heightMapTexture - is the dynamic 256x256 height map texture
VertexPos.x/y/z - internal keyword returning current vertex component of the vertex we are going to deform.
this is just a few examples of using this new feature (you probably wont apply this water deformation as its not fast enough and could be done faster using the gpu)
because this deformation is based on the functions you define (its not constant), this could not be done in the gpu so its take some cpu time.
thats all for now.
if you have any question feel free to ask http://orenk2k.forumotion.net/

Wednesday, February 4, 2009

Forum For All

hi
i decided to open a forum to discus my engine programming and game development in general.
the main idea of the forum is to be the place to ask questions and hopefully get answers :)
it also contain game design area which allow you to share you work and show what you got, the main idea of this section is to get in contact with some talented users who would like to help with new models, animations, level design etc.
i still post news here but if you have any questions about something (new or old), i would like you to ask it in the forum, so enjoy and cya in the forum :)
forum address:
http://orenk2k.forumotion.net/

Sunday, January 25, 2009

Improving Shadows System Continued

hi, last post i let you think on answer to some question about shadow updating scheme.
in short, the problem was that if dynamic entity gets into influence area of the light it means the light needs to update his shadow map, but this turns to be very intensive if this area contains lots of detail models which is static (read the last post to get the details and comments...)
ok, so the solution to this problem could be one of:
(1) two shadow maps for each light
(2) stay with one shadow map per light but...
(3) other
lets check those options:
(1) two shadow maps for each lights is the way to go but still raise some problems:
a. more memory (twice), if the light taken 1.5 mb per cube shadow map, now it will take 3mb!,
not so good as the reason i use shadow cache system is to maximize shadows cound and minimize the memory used by them.
b. we need to merge those shadow maps to get final one so we could use it when rendering, so we need another shadow maps for this! still the merging process isn't for free so i think you get the idea way this option isn't so good.
(2) here i stay with one shadow map per light but i use another shadow map which will be shared for all lights, this second shadow map will only used for dynamic geometry, so the unique shadow map per light stay ONLY for static geometry and the shared one ONLY for dynamic geometry.
so the memory issue solved, what about the merging? well, instead of merging those shadow maps in cpu, we merge them on gpu.
sound good but that means we need another shadow map right? not necessity, what i do is binding those shadow maps and merge them inside ps, and then i compute shadow map as usual. so instead of using the value sampled from one shadow map, i use the merged sample.
this method saved the need for another shadow map and the extra pass for merging them.
(3) other? nothing i see now, but maybe you could think of something?...
in practice its work very well and the performance gain is huge.
here is two screenshots show the results using this method:

using both static & dynamic shadows

using only static shadows

i see those screenshots but what is so special about them? its just shadow maps...
well yes and no, the first screenshot shows simple scene with few static geometry and one dynamic pickup item (armor), the only shadow map that is being updated is the dynamic shadow map, so what you see is the result of merging two shadow maps in the ps, so you can see both static and dynamic shadows.
the second screenshot shows the same scene but this time we picked up this item, so the resulting shadow map taken only from the static shadow map (dynamic one is empty!)