Saturday, May 31, 2008

Ragdoll Physics

hi, long time without updates...
while shooting and killing bots i notice that something isn't right, something is missing - die animation or something like that.
so to fix that i thought i to create some new animation sets but that isn't perfect, so i decided to add ragdoll physics which have some drawbacks but is better then animation sets.
i added new script file like id does (.af files) which defines the physics bodies and properties also constraints between those bodies.
i also add new class that will read and manage the info and create the physics model from it.
after that i created two main functions:
1. setup physics bodies from current animation set - this is very useful function because you don't have to care about model pose and how to set physics from it, you just call this function and it will set the physics bodies to match current model animation.
2. set animation set from physics pose - used to alter model skeleton so everything applied to the physics bodies will change the visual model.
NOTE: when i setup physics bodies from skeleton i use T pose so it will be easy to setup physics bodies and constraints.
here is screenshot of ragdoll setup using T pose (red/green spheres is constraints)

Saturday, April 26, 2008

Jumping, Climbing, Crouching in Action

hi, as i promised from the last post, here is movie that shows the bot in action using the new areas features (showing crouching and jumping)



i also add the ability of climbing and crouching to the player.
note that the bot can also climb a ladder, i'm not showing it in the video because i dont have climbing animation and it looks like flying on it and not climbing.
also nice feature i added to collision system is the ability to know which type of material i collided with so for example: if a bolt hit a stone it will leave different mark if it hits liquid.

Tuesday, April 22, 2008

Jumping, Climbing, Crouching and more

hi
this is holidays time so i had some time to dig into some cool AI stuff, basically i added the ability to edit AI data in run-time with a mini AI editor.
what this means is that i can add special features between areas such as, jumping, climbing a ladder, teleporting etc.
here is a screen shot of the mini editing tool:

1. the red/green spheres on the edge is the start/end points of the jump feature
2. the right side shows me which features the area the mouse on support, this is marked by the floating green sphere.
few keys to do some basic stuff such as set start/end points, set current feature, reset and save the data.
next time i will upload movie that shows the bot in action.

Saturday, April 5, 2008

Console

hi, another post this weekend.
this time is the console, allows me to change engine variables (cvars) at runtime, such as AI params, renderer params etc.
support auto complete, history, keyboard and mouse wheel scrolling, not much to say - just a console.
here is a screenshot:

before execute shadowmapblur=1

after before execute shadowmapblur=1

Profiler Improvement

hi, this weekend i improve my profiler.
i have simple profiling that let me mark places in the code with PROFILER_BEGIN/END commands and then it shows me the results in a tree view.
while trying to profile some area in the renderer i found a bug in the timing, i cast the time value to dword while i should not.
i also added the feature which mark in red the worst time node in the tree and in orange the worst time leaf in the tree, this way i can see very clearly where the optimization needs to be.
one area i know for sure that needs to be optimize is make skinning. so here is a screenshot of the profiler shows you the results.

Sunday, March 23, 2008

Dynamic Obstacle Avodance Integration

hi, this task wasn't easy, a lot of tiny things that needed to be fix - as i said in my last post :)
but now i'm very pleased with the result, i can drop any number of dynamic obstacles in the scene and the bot/entity will navigate around them.
one very important thing is to make your bot move smoothly and try to take shortcuts when possible, if you wont do it your bot will move around obstacles edges while you can see for sure he can take shortcut, this will make him looks very unnatural and robotic.
here is some screenshots that shows the system in action:
NOTES:
* purple lines shows the from the precomputed ai data the bot aware of, this is convex area so the bot knows he can walk in straight line to any other point in that area.
* small green sphere, goal position the bot need to be at the end
* medium green sphere is the point the bot will move to on the path resulting from dynamic obstacles system, this point is the result of path smoothing. the yellow lines is the path around obstacles without smoothing.
* white boxes is dynamic obstacles (dynamic rigid bodies in debug mode), the green lines around them is the expanding edges of their box.

Simple scene (1 area) this is what the bot aware of

One obstacle added and path generated from the system

Few more added and you can see the new path generated

stress test - start of movement

stress test - middle of movement.
if you watch closely you can see the bot is not moving along the yellow lines and take shortcuts where possible, this can be seen from the bot direction toward medium green sphere.

Monday, March 3, 2008

Dynamic Obstacle Avoidance

Hi, after setting up some basics in my physics engine i realize that my AI system isn't aware of any dynamic object created from the physics engine so i started to think about some generic solution to solve the problem of dynamic avoidance.
until now, i had some basic dynamic obstacle avoidance inside my steering system that check against obstacles on the way and if it found some, it add avoidance forces so the agent while try to steer around the obstacle (works fine for the bots)
the main advantage of this system is that its very simple to implement and it very fast, the disadvantage is that it tries to steer around one obstacle at a time, so if you have few obstacles one after another, it will steer around the first and return, steer around the second and return and so on (does not look very smart), also it doesn't handle the case where few obstacles block our path, it doesn't find a path that goes a around them (if exists) it just tries to steer around the first on the way but end up bumping against them until they moved (and if they wont move you are stuck)
this is unacceptable when you can have a lot of dynamic objects that moves around and could block our path, so i started to build some generic solution to this problem.
the main idea is that i trace a line from my current position to my current goal position (path line), and any obstacle that founded in my way, added to a list of obstacles.
then i check this list against my path line and build "edges graph"/"path tree" from the bounding edges of intersected obstacles and my path line fractions.
this tree is just a graph containing all the combination paths from my current position to my current goal, so then i found the shortest path in the graph and save it as a local path around the obstacles.
of course this is just a brief of the algorithm, there is a lot of tiny things that you need to consider when creating the graph, and also how you can optimize it so you have only few edges to run the shortest path algorithm on.
after i finish the algorithm i had time only to test it against rigid bodies that i throw inside the scene and it really perform well (still need to add few things here and there), i didn't had time to integrate it into my AI system :(
no pictures/movies maybe next time...
BTW: i today i got game programming gems 7, so i have a lot of things to dig into :)