Sunday, July 19, 2009

Building Editor

hi
i'v thought it will be good to leave id tools (their editor) because the more the engine improved the more id editor doesn't give me good options to set the new properties the engine supports, for example, i want to create constraints and apply them to brushes or entities, until now i added new entity call constraint_hinge (for example) and then i added properties to this entity that the engine can parse and set constraint values, but the editor doesn't know its hinge constraint and can't show me the angles in the viewport, i was better if the editor could draw/show me the angles in a more friendly way so i know how to set them correctly without running the engine and testing it.
this i just an exampe, so i started to build an editor (i always wanted to, but there was important things to do before...) which will support all engine features and option to add generic porperties to each entity (just like id editor).
the editor isn't going to be like crysis editor, its more like ut editor which you build the level from scracth or more correcty, from basic objects, detail object could be added as well.
right now i setup the basic ui, viewports, tools toolbar and basic manipolation on brushes such as move, scale, rotate, multi selection, also supporting copy/paste system.
the 2d viewports support zooming and snap to grid option, the 3d viewport allow you to conrol a free camera with the mouse so you can view the scene from any angle.
still have to finish alot of things but its getting better each day i'm working on it.
next time i will work on it, i think i will add undo/redo system, without it i think the editor is useless ;)
btw: no its not C# its pure c++ with mfc! uses the new feature pack which is great...
here is a screenshot of how it looks so far:

Saturday, June 20, 2009

Havok Physics Demonstration

hi
its been a long time since i posted anything, this is because i didn't have time to work on the engine... (busy busy busy)
so here is the video of few physics elements using havok i said i will post:



few elements shown in the video:
1. better and smooth character controller (no jittering, smooth jumping), every character/bot have its own properties set using a script.
2. moving platform interacting with character controller, platform push everything on it, which means if something goes on the platform it will move.
3. dynamic bridge using limited hinge constraint, i added options to add constraints via editor so this bridge is a simple brush with hinge constraint at the bottom, when the character apply enough force on it, it will fall down.
4. smooth movement using fixed time step and interpolation, almost every physics engine (physx, bullet, havok, ode, newton etc...) have the option to use fixed time step (i use 1/60), but what this means is when appication dt goes down 1/60 you will notice slow motion and moon gravity effect because the physics simulation is updating in the right time step (which is 1/60), to overcome this we need to check for this situation and apply few interations and interpolate between last and new physics objects states if current dt is not multiple of physics dt (for more info see my post on fixed time step or ask on the forum)
if you have any question feel free to ask http://orenk2k.forumotion.net/

Sunday, May 3, 2009

Havok Integration Completed

hi
its been a while since i posted anything, i didn't had time to code so...
anyway, i'v finished to integrate havok physics and got rid of any nvidia physx, i must tell you that i'm pleased with the results, havok rocks!
few features added:
1) anything could be physical, entities, brushes, models etc, that means i can create houses, towers directly from the editor and make it interact/break to parts very easy.

2) using fixed time step, this is huge win because by default havok/physx runs great when doing the step in a fixed manner thats mean you need to choose your dt and step the simulation with it.
why you need this thing?
a quick example, lets say we are using dt=1/60, that means your game need to be run at 60 hz so the physics simulation will be fine, if your game runs for 30 hz that means you get slow motion physics or moon gravity effect, if you game runs at 120 hz that means your physics simulation get andernaline and runs twice as fast as you intended.
consoles does not have this issues as the run in a fixed tv hz 25/30/60, but in pc it doesn't, so to fix this fast, you can turn on vsync and everything will be fine (at least for hardware that support it), but this way your renderer is limited to 60 hz! not so good, so the ideal solution is to run the renderer at high hz as possible and the physics at fixed hz, so what you should do is
to simulate the physics engine considering your fixed and dynamic time step and perform one or more steps of the physics simulation to achive smooth motion, using interpolator.
in our example (dt=1/60) if the game run at 30 hz we should perform 2 physics updates, if the game run at 5 hz we should do more, if the game runs at 120 hz we should do on update per 0.5 updates, meaning one update per 2 frames.
to deal with this i use accumulator and interpolation factor, the accumulator used to know how much updates we should do (you should set max steps so you wont freeze the game when the steps goes to high) and the interpolation factor used to interpolate between prev and current states of the objects, used when game dt isn't multiple of our fixed dt (if for example we are running at 45 hz and not 60 hz, we should perform 1.5 updates, but we can't do 0.5 update, so instead we do 2 updates and use 0.5 as the interpolation factor).
if you want to know more details on the subject please ask at the forum...

3) character controller interaction with physical objects, moving platform moves the controllers, the controller blocks other physical objects, other physical objects can push the controller, characters can push other characters and more.

4) character motion properties set by the script, so each bot can have different abilities, jump height, movment speed etc.

5) ragdoll are much more stable, angles limits are set very easy via scripts, havok have greate contraint for doing shoulder joint limits.

i probably forget few things but those are the main features.
i already have some scenes that shows those in action, but as usual i prefered to code few min more than capture a movie :)
as usual, if you have any question feel free to ask http://orenk2k.forumotion.net/

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/