Jump to content
  • entries
    10
  • comments
    21
  • views
    22,127

Entries in this blog

Good animation is all in the blend

I've being working on a locomotion/animation system that will provide nice results and gives good transitions from one stance/animation to the next. I was inspired by articles I read on the Internet and the Unity locomotion video. Luckily the person who did the Unity locomotion system posted his thesis on the Internet so I could read some of the concepts and then do futher study of the concepts from the internet.   The Unity system is highly mathimatical/analytical and because of this I have n

Chris Paulson

Chris Paulson

IK Animation

To get nice locomotion and not have NPC walking with feet stuck in the terrain or hovering in the air you need to place the feet to match the terrain, coping with slopes etc.   Leadwerks has forward kinematics but not inverse (which is needed to do this). Because of this I have written (with help) an IK solver.   Thanks to Tyler for supplying the code as a starting point.   Here's a video of it working: -   Here's the code (I actually ended up doing 2 solvers)   #include "IKSi

Chris Paulson

Chris Paulson

Accurate placement of gun in NPCs hand

Placing a rifle to sit in the hands of an NPC can be a bit of a fiddle so I thought I'd post the code.   The code relies on bones for accurate placement:-   Trigger bone Gun Butt/Rest bone Trigger hand Butt hand   I place config stuff like this in an XML file for easy editting, to read the XML I use a nice library tinyXML.   Ignore the bullet code as this is a temp hack I will tidy later.   Hope this helps.   PS   Thanks to Pixel Perfect for supplying gun model etc for my testi

Chris Paulson

Chris Paulson

Further work on path finding

Since my last update I have tried to get recast callable from within blitz to make it available for everyone. However I have failed as I have not got enough Blitz/C++/DLL skills. I'm hoping someone will offer some help.   I was unhappy how I handled dynamic movable objects as there was a chance the steering wouldn't avoid hitting them. Because of this I rewrote my interface to recast to use a tiled nav mesh, this means I could dynamically update a tile if a object moved in/out of a tile.   T

Chris Paulson

Chris Paulson

Moving without foot sliding

When your NPC moves it may move at different speeds, especially if you are using some sort of steering. This presents the problem of what speed should you play your walk/run animations. My solution is to analyse the animation and see how far the foot travels from start frame to end frame and when animating play the correct amount of frame(s) for the distance.   Here’s the code:-   #include "anim.h" void animItem::calcAnimDist( TEntity e, TEntity bone ) { TVec3 startPos; TVec3 newPos; TVe

Chris Paulson

Chris Paulson

Line Of Sight/Vision

For NPC AI to work they have to have simulated vision. This is done by using raycast/linepick.   My vision system does the following:-   Takes into account head position - using head bone Takes into account rotation of NPC spine bone (used for aiming) Build list of enemies in view range Takes into account FOV It looks through each of the ememies bones to see if any part of the enemy is visible. It returns location of the first bone found. This is to make sure enemies are still seen even

Chris Paulson

Chris Paulson

What a behviour code segment looks like behind the previous strange code

In a previous blog entry I showed a code sample of the behaviour tree. In the code below is the code that is fired for each behaviour.   The return status mean: -   RUNNING - Keep on running the behaviour FAILED - Exit this behaviour with error (has different effect depending on sequeance/selector/parallel node. COMPLETE - Exit this behaviour with complete (has different effect depending on sequeance/selector/parallel node.       #include "actor/include/action.h" #include <aliv

Chris Paulson

Chris Paulson

My leadwerks loader for recast

Here's the code that loads in the verticies to recast:-   Include:-   #ifndef MESHLOADER_SBX #define MESHLOADER_SBX #include "leo.h" #include "MeshLoaderObj.h" class rcMeshLoaderSBX : public rcMeshLoaderObj { public: TEntity scene; int vcap; int tcap; int nidx; rcMeshLoaderSBX() { vcap = 0; tcap = 0; scene = NULL;}; ~rcMeshLoaderSBX(); void addVertex(float x, float y, float z, int& cap) { rcMeshLoaderObj::addVertex( x, y, z, cap); } void addTriangle(int a, int b, int c, int&

Chris Paulson

Chris Paulson

The first toddler steps of AI

Youtube video of my AI.   Red line is path found by recast. White text is current behaviours running in behaviour tree.       Here's what the BT looks like (yes it is C++) alive::Node* moveToEnemy(std::string type = "walk") { return alive::TreeBuilder() .execute<ActionMoveToEnemy>() .type(type) .end(); } alive::Node* resetToStart() { return alive::TreeBuilder() .composite<alive::SequenceNode>() .execute<ActionCurrentMode>() .mode("resetToStart

Chris Paulson

Chris Paulson

Blog start

I haven't been blogging since I started with Leadwerks so this blog will be a bit of a catchup until now. Unlike most people working with Leadwerks I thought I'd ignore all the graphic eye candy as icing on the cake and concentrate on the importing matter of making things happen ie. AI   The bacis of AI is:-   Physics -------   Knowing whats bumped into what. This is already taken care of in Leadwerks.     Sight -----   NPC's need to have a sense of sight, this is mimicked by doing

Chris Paulson

Chris Paulson

×
×
  • Create New...