Inverse Kinematics + Mechs + MOAR WIN

Published November 19, 2009
Advertisement
HAI. I was going to hold off on this update - but I think this is so cool I have to show you right now :-o

I've been working on Inverse Kinematics, a fully-blown dynamic weather system [ rain, t-storms, clear, cloudy, overcast - more on that next update! ], I'm also finalizing the Beach Assault map...and a million other things from Squad AI programming to coding a beach shore rendering system. So much work...luckily I enjoy it more than anything [grin] [grin]

Inverse Kinematics / Physics based Mech Walking
A while ago I had a Mech model created for Warbots, only problem was the animation looked kinda "not cool" on uneven terrain. It looked so bad, it was reason enough to not include the walking mech in the game. btw...I wish I had more energy right now to type this - I've been coding for about 10-15 hours a day ... every day. I've spent the last 20-30 hours working on this system and I finalllly got it working - because I can't give up until a problem is solved hehe.

Basically instead of running through a pre-canned animation for the mech, I rigged up a new skeleton and coded a real-time animation system that would always align the Mech's feet in a proper position regardless of it's orientation [ within reason obviously ].

I'm working on an improved walking engine, and logic, so the robot knows where to set his feet optimally, when to change foot positions, also different run periods and speeds, and of course I want him to loose his balance when he gets hit with a rocket xD...that has to wait until tomorrow.

This stuff is all a work in progress...a day of work at this point, and it's already looking reaaaaally good in motion!

I'll let the debug/progress screenshots do the talking -
Note: self shadowing, and shadow casting is disabled on the mech, it'll look much better when I re-enable it, I had to code a special type of "robot object" to make all this work....*rambles on*







Here is a screenshot that details the re-rigging process I went through ... comparison between the 'static' animation skeleton and my dynamic physics based skeleton...


Jus' me 'n' my robot.
I need to add ninjas into this game...somehow...ninjas....


Beach shore blending effect...
So many games have rough transitions between beach and water. I coded up this system to sort of smooth it out. The foam is animated, etc. It's still a work in progress.



Progress on the Beach Assault map
I made major adjustments to the map. I made it so there is shadowing on all objects, the imposter view distance has been pushed out, I added rocks, I tweaked so many things. Mostly I added craters and more variation on the beach/sand area.





All the vehicles in the game...
Let me show you my polygons...


Also, since this wasn't posted directly in my previous entry, here is the ditty on AI from last time -
Quick Aside on AI: flocking evasion, targeting, objective/order evaluation
I've made some improvements in the last day or two on the human/squad artificial intelligence, as well as the robot's AI.

Here is some incomplete code/early data structure design, and some images of how it's looking ... no comments on the style please lol...I don't know why I'm even pasting this, I just feel like including some code in an update for once xD

//WO_ArtificialIntelligence.h, (c) 2009 Danny Green, Radioactive-Software.com#ifndef WO_ARTIFICIALINTELLIGENCE_H#define WO_ARTIFICIALINTELLIGENCE_H//ROBOTS#define MAX_AI_ROBOTS_PER_WORLD MAX_ROBOTS_PER_WORLD //total number of AI robots that can inbahit the world#define MAX_ORDERS_PER_ROBOT 5 //size of the robots's order stack / number of simutanious ordersenum RobotOrderType { 	ROBOT_ORDER_STOP_ALL, 	ROBOT_ORDER_IDLE, 	ROBOT_ORDER_MOVE, 	ROBOT_ORDER_ATTACK, 	ROBOT_ORDER_DEFEND, 	ROBOT_ORDER_PATROL, 	ROBOT_ORDER_WAIT_DELAY };enum RobotStatusType { 	ROBOT_STATUS_NONE, 	ROBOT_ORDER_ORDER};enum SimulatedPlayerType { 	PLAYER_TYPE_DEFENSIVE,	PLAYER_TYPE_OBJECTIVES,	PLAYER_TYPE_KILLS,	PLAYER_TYPE_AVERAGE};//The simulated AI players will just 'give orders' to the robots, this abstracts the interface to where it would be//very easy to add a 'RTS' command modestruct RobotOrder{ RobotOrderType m_OrderType; //ordinal type D3DXVECTOR3 m_Position; //position associated with the order char m_Priority; //if required [ determines if the robot will break and return fire if attacked ] char m_EnemySquadTarget; //if required char m_EnemyRobotTarget; //if required double m_TimeDuration; //how long the order should be carried out for};//Data structure for a simulated human playerstruct SimulatedPlayer{ bool m_IsSpawned; //If the simulated player is spawned. int m_GlobalIndex; //Global index of the robot, so it can share some data from the main robot array SimulatedPlayerType m_PlayerType; //The type of player  RobotOrder m_OrderStack; //List float m_SkillLevel;  //0.0 being n00b, 1.0 being god-like float m_fMovementSpeed; //Movement speed of the robot [ scalar ] int m_numNodesToLookAhead; //How far the pathfining should look ahead when setting a waypoint. D3DXQUATERNION m_LastOrientationQuat; //Previous orientation of the simulated player, used for blending D3DXMATRIX m_Orientation; //Orientation of the simulated player D3DXVECTOR3 m_TerrainNormal; //Terrain normal vector under the player RobotStatusType m_RobotStatus; //Robot's current status};//SOLDIERS / HUMANS#define NUM_SOLDIERS_PER_SQUAD 16#define MAX_ORDERS_PER_SQUAD 5 //size of the squad's order stack / number of simutanious orders#define MAX_SQUADS_PER_WORLD 1+(MAX_HUMANS_PER_WORLD/NUM_SOLDIERS_PER_SQUAD)enum SquadOrderType { 	SQUAD_ORDER_STOP_ALL, 	SQUAD_ORDER_IDLE, 	SQUAD_ORDER_MOVE, 	SQUAD_ORDER_ATTACK, 	SQUAD_ORDER_DEFEND, 	SQUAD_ORDER_PATROL, 	SQUAD_ORDER_WAIT_DELAY };enum SquadStatusType { 	SQUAD_STATUS_NONE, 	SQUAD_ORDER_ORDER};//The soldier squads be given orders by the computer, this abstracts the interface to where it would be very easy to add a 'RTS' command modestruct SquadOrder{ SquadOrderType m_OrderType; //ordinal type D3DXVECTOR3 m_Position; //position associated with the order char m_Priority; //if required [ determines if the squad will break and return fire if attacked ] char m_EnemySquadTarget; //if required char m_EnemyRobotTarget; //if required double m_TimeDuration; //how long the order should be carried out for};struct Squad{ //Orders SquadOrder m_OrderStack[MAX_ORDERS_PER_SQUAD]; char m_CurrentOrder; //Current order index //Soldier data int m_SoldierIndices[NUM_SOLDIERS_PER_SQUAD]; //Status / info char m_Team;  SquadStatusType m_Status;}; #endif


Red lines are 'threat' vectors, much more on this later...blue represents squad based objectives, and green lines indicate the soldiers resolved movement vector.

*EDIT - Note how flat the beach looks here, compared the the above screenshots.





Some showing Vehicle/Robot order completion.


- Dan
0 likes 3 comments

Comments

Moe
That looks pretty darn good!

EDIT: I suppose I should say a little more: I find it pretty impressive that you just one day say "hey, that walking robot doesn't look quite right. Maybe I'll code an inverse kinematics system so it's feet get properly planted on the ground". I suspect that if I were to try such a thing, I'd work on it for a few years, then eventually resort to using someone else's library.

Heck, think about it this way: You just did in a few days what would have taken the original Trespasser team a significant time to accomplish (Trespasser being the first game that comes to mind for using inverse kinematics on dinosaur models).
November 19, 2009 02:58 PM
dgreen02
Quote:Original post by Moe
That looks pretty darn good!

EDIT: I suppose I should say a little more: I find it pretty impressive that you just one day say "hey, that walking robot doesn't look quite right. Maybe I'll code an inverse kinematics system so it's feet get properly planted on the ground". I suspect that if I were to try such a thing, I'd work on it for a few years, then eventually resort to using someone else's library.

Heck, think about it this way: You just did in a few days what would have taken the original Trespasser team a significant time to accomplish (Trespasser being the first game that comes to mind for using inverse kinematics on dinosaur models).


Thanks :-D AH, trespasser, I remember being in the first person mode and looking down at the tat- on the boobs of the main character :-o I remember the arm system too now that you mention it - used to bunch up and contort in the funniest ways.

I use havok for physics but setting up IK w their ragdoll system would have taken way too much time for me to code, so I rolled my own.

November 19, 2009 05:44 PM
Boruki
I'm always really impressed with your work! And the addition of footsoldier NPCs hit close to an idea I'm working on, but struggling with quite a bit too. I'm curious on how you have so many animated characters on the screen at once? What kind of rendering/animation are you using for the characters? My only guess was a vertex list modified by the skeleton? Any ideas you can give me would be GREATLY appreciated!!

Edit: I read a bit more from an older post and saw the imposter system. I assume it's pretty similar to the sprites from Duke 3D/Doom? I guess the first question I have is how did you produce the imposter sets? Did you write something that ran through the animations from different angles and took screenshots? Or did you do it by hand? I guess each frame has some kind of "angle" variable so the game knows which set of frames to use?
December 13, 2009 02:34 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement