Jump to content

Chris Paulson

Members
  • Posts

    134
  • Joined

  • Last visited

Posts posted by Chris Paulson

  1. You'll get different answers from people about speed and whether it matters depending on how far down the road of development they are.

     

    Beleive me once you got: -

    Pathfinding

    Motion graphs/blend trees

    AI (FSM, HFSM, BTs)

    Lots of physics

    IK animation

    Lots of line picks

    Agent Steering

    Cover maps

     

    etc (all the things you need to make a half decent game) you'll start noticing a BIG difference and you'll be looking to squeeze every ms you can.

     

    There is more to a game other than shaders, pretty lights, fluffy cloads and waves...

  2. True,

     

    but for a: -

     

    hip, knee, ankle, toe

     

    you are solving mutiple rotations which is where it gets tricky (for me at least).

     

    Hopefully in a couple of days I'll have it working and I'll post all the code.

  3. I thought I'd chuck my views to this.

     

    I spent several weeks investigating UDK as it's got so many more features than LE. However I came back to LE because I found myself banging my head against a brick wall in UDK and not having fun. I do the stuff in LE for fun, no other reason at the moment.

     

    If I was going to pick features from UDK I'd like to see in LE these would be them: -

     

    1) >5 terrain layers

    2) Fracture tool (having to do doing this by hand is a lot of work)

    3) Emitters (UDKs emitters are strong, LE's are weak in comparison)

    4) CSG (Useful for filling over gaps in levels)

     

    These things below I have done in LE but come as standard in UDK

     

    5) Navmesh (without this you have no AI starting point for a modern game)

    6) Locomotion

    7) Complex animation blending

     

    There's lots of other stuff in UDK that I'd like to see in LE but I don't won't to overload Josh and make him think I'm a whinging git.

  4. Thought I'd post a progress update on this as I'm still trying to get this to work...

     

    The quaternion class did need to convert to/from radian/degrees.

     

    The class needed a new method for converting the quaternion to eualer angles.

     

    I wish you could get/set quaternions in LE (at present there's only a get).

     

    Somewhere in the code there is a math error because it's not IK'ing properly.

     

    If anyone is best mates with Pythagoras or his brother Trig feel free to pitch in...

  5. Josh could probably answer this best but I'll have a go.

     

    My experience is also that occlusion culling is off on most things other than animated models. I believe you can turn it on with a function call. I haven't got the editor to hand but isn't there a new option for this to in the properties?

     

    I guess other things that might help are a combinations of: -

     

    DOF

    Merged into Fog

    With draw distance.

  6. I'm struggling to get this to work. My code is:-

     

    void ikRanger( TVec3 position, TModel npc )
    {
    
    TEntity lhip = FindChild( npc, "Frame3_figure_v05_Layer35");
    TEntity lknee = FindChild( npc, "R_Knee");
    TEntity lfoot = FindChild( npc, "R_Foot");
    
    Transform thip( lhip );
    Transform tknee( lknee );
    Transform tfoot( lfoot );
    
    vector<Transform> bones;
    
    bones.push_back( thip );
    bones.push_back( tknee );
    bones.push_back( tfoot );
    
    IKSimple iknpc;
    
    iknpc.Solve( bones, Vector3( position.X, position.Y, position.Z ));
    
    Vector3 rot = thip.localRotation.ToAngleAxis().Axis;
    RotateEntity( lhip, Vec3( rot.X, rot.Y, rot.Z ) );
    rot = tknee.localRotation.ToAngleAxis().Axis;
    RotateEntity( lknee, Vec3( rot.X, rot.Y, rot.Z ) );
    rot = tfoot.localRotation.ToAngleAxis().Axis;
    RotateEntity( lfoot, Vec3( rot.X, rot.Y, rot.Z ) );
    
    /*	RotateEntity( lhip, Vec3( rad2deg(rot.X), rad2deg(rot.Y), rad2deg(rot.Z) ) );
    rot = tknee.localRotation.ToAngleAxis().Axis;
    RotateEntity( lknee, Vec3( rad2deg(rot.X), rad2deg(rot.Y), rad2deg(rot.Z) ) );
    rot = tfoot.localRotation.ToAngleAxis().Axis;
    RotateEntity( lfoot, Vec3( rad2deg(rot.X), rad2deg(rot.Y), rad2deg(rot.Z) ) ); */
    }
    

     

    Is "thip.localRotation.ToAngleAxis().Axis" the correct thing to get back the rotations with?

     

    The transform class does: -

     

    	v = EntityRotation(entity,1);
    	this->rotation = Quaternion(Vector3(v.X,v.Y,v.Z));
    

     

     

    Isn't EntityRotation in degrees and Quaternion in rads? Should there not be a conversion?

     

     

    Pity thrown at someone as bad at maths as me would be appreciated.

  7. It isn't done, but this will IK solve hella-fast:

     

    I recognise that code.... :)

     

    Looks like your getting there before me. Your using classes like Vector3 etc where do they come from?

     

    Could I put my begging bowl out and ask for a code share...

  8. The good news:-

     

    I got a animated model moving it's limbs in sync with the physics bodies.

     

    The bad news:-

     

    I think this is a dead end as the physics solves the IK too slow and if you try to speed it up it oscillates. I think I need to write a proper IK solves, it will probably be easier than flogging the physics to death.

  9. After a lot of fiddling I have got this working.

     

    Here's a blitz example: -

     

    Strict
    
    Framework leadwerks.engine 
    
    Graphics 800,600
    
    RegisterAbstractPath AppDir
    'RegisterAbstractPath ".."
    
    If Not CreateWorld() RuntimeError "Failed to create world." 
    
    Local cam:TCamera=CreateCamera() 
    MoveEntity cam,Vec3(-0.2,0,-1) 
    
    'Local mesh:TMesh=CreateCube()
    'Local sphere:TMesh=CreateSphere()
    
    
    
    Local hip:TBody = CreateBodyPivot( )
    PositionEntity(hip,Vec3(0))
    Local thigh:TBody = CreateBodyBox( 0.001, 0.2, 0.001 )
    Local shin:TBody = CreateBodyBox( 0.001, 0.2, 0.001 )
    Local foot:TBody = CreateBodyBox( 0.08, 0.02, 0.001 )
    EntityType(thigh,1)
    EntityType(shin,1)
    EntityType(foot,1)
    Collisions(1,1,0)
    
    SetBodyDamping( thigh, 0, 0 )
    SetBodyDamping( shin, 0, 0 )
    SetBodyDamping( foot, 0, 0 )
    
    MoveEntity(hip,Vec3(0,0.1,0))
    MoveEntity(shin,Vec3(0,-0.2,0))
    MoveEntity(foot,Vec3(0,-0.3,0))
    SetBodyMass(thigh,10)
    SetBodyMass(shin,10)
    SetBodyMass(foot,10)
    SetBodyGravityMode( thigh,0)
    SetBodyGravityMode( shin,0)
    SetBodyGravityMode( foot,0)
    
    SetBodyFriction( thigh,0,0)
    SetBodyFriction( shin,0,0)
    SetBodyFriction( foot,0,0)
    
    
    
    Local knee:TBody = CreateBodyPivot( )
    MoveEntity(knee,Vec3(0,-0.1,0))
    EntityParent( knee, thigh )
    SetBodyDamping( knee, 0, 0 )
    
    Local kneeorb:TEntity = CreateSphere( 8, knee )
    ScaleEntity( kneeorb, Vec3(0.01) )
    
    Local ankle:TBody = CreateBodyPivot()
    MoveEntity(ankle,Vec3(0,-0.3,0),1)
    EntityParent( ankle, shin )
    'SetBodyMass(ankle,1)
    
    Local footorb:TEntity = CreateSphere( 8, ankle )
    PositionEntity(footorb, Vec3(0,-0.3,0),1)
    ScaleEntity( footorb, Vec3(0.01) )
    
    
    ''EntityParent( foot, shin )
    
    Local ballhip:TJoint = CreateJointBall( hip, thigh, Vec3(0,0.1,0) )
    SetBallJointLimits( ballhip, Vec3(0,0,0), 150, 1) 
    'Local ballhip:TJoint = CreateJointHinge( hip, thigh, Vec3(0,-0.1,0), Vec3(1,0,0) )
    'SetHingeJointLimits( ballhip, -90, 90 ) 
    
    
    Local ballknee:TJoint = CreateJointHinge( thigh, shin, Vec3(0,-0.1,0), Vec3(0,0,1) )
    SetHingeJointLimits( ballknee, -100, -5 ) 
    
    
    'Local ballknee:TJoint = CreateJointBall( thigh, shin, Vec3(0,-0.1,0) )
    Local ballankle:TJoint = CreateJointHinge( shin, foot, Vec3(0,-0.3,0), Vec3(0,0,1) )
    SetHingeJointLimits( ballankle, -40, 40 ) 
    
    SetJointCollisionMode(ballhip,0)
    SetJointCollisionMode(ballknee,0)
    SetJointCollisionMode(ballankle,0)
    Local position:TVec3
    Local lastposition:TVec3 = vec3(0,0,0)
    
    DebugPhysics(True)
    While Not KeyHit(KEY_ESCAPE) 
    
    position=CameraProject(cam,vec3(MouseX(),MouseY(),1))
    
    PositionEntity( foot, position)
    SetBodyVelocity(foot, vec3(0))
    
    ' This is needed to make stuff solve IK at decent speed
    lastposition = EntityPosition(footorb,1) 
    SetBodyVelocity(foot, vec3((position.x - lastposition.x) *5, (position.y - lastposition.y)*5, (position.z - lastposition.z)*5))
    lastposition = position
    
    UpdateWorld( AppSpeed() )
    '	UpdateWorld(100 )
    RenderWorld
    DrawText "Move the mouse around.",0,0
    Flip
    Wend
    

  10. Your right about the hinges etc.

     

    I'm struggling though, you can't get the rotation of a hinge/joint and you can't get it's position. If I do any of the mentioned calls LE GPFs. So I am having to try and work out these values which kind of defeats the object of using it as an easy replacement for an IK solver.

  11. I'm sure you could use a couple of static bodies for the feet, a static body for the pelvis, and a body with mass for the knees. Connect the knees to the pelvis with a ball joint with limits, and the feet to the knees with a hinge. Move the feet wherever you want them to be, and the knees will follow. Parent the knee bones to the knee bodies, and you have IK animation.

     

    Great idea however bit confused by combination of bodies etc. I would have thought: -

     

    Ball joint - parented to hip pivot

    Body box for thigh

    Ball joint for knee

    Body box for shin

    Hinge for ankle

    Body box for foot

     

    To give:-

     

    .

    |

    .

    |

    .-

     

     

    but I'm probably wrong as I haven't done this before.

  12. Hi,

     

    I've started looking a footplacement of an NPC so it's feet are on the ground instead of floating.

     

    I've tried modifying a foot bone position (using EntityPosition) believing LE had IK to sort out all the other bone positions/rotations, however what I saw was the mesh messed up.

     

    I'm I doing something wrong?

    Has LE really got IK?

  13. I beleive this is because the position of the controller changed in LE versions and the zero Y pos is the centre of the controller.

     

    If controller is 1.8 high do this:-

     

    pos = EntityPosition( controller, 1)

     

    PositionEntity(yourModel, vec3(pos.X, pos.Y - (1.8/2), pos.Z,1)

  14. I've thought about this for my own stuff and this is what I'd do:-

     

    Got message i've been hit by bullet

    Message contains location of bullet hit

     

    For each bone in my model

    work out with math fiddle closest bone in model to hit location

    next

     

    if bone is head then

    HEAD SHOT!

    endif

     

     

    Hopefully in a month or two I'll have a working example in C++.

     

    However it seems to me you prehaps deciding what colour to paint your hand built car before you've even tightened the first nut or done your first weld.... I'd try to get the basics done first.

  15. Very impressive Chris, very impressive indeed .. I overlooked it not being tidy, being somewhat "anti-neat" myself lol ..

     

    It was nice to see all that code you wrote (in klingon? :blink::lol: )

     

    Thanks - the alien (a++) stuff came from AIGamedev.com. Well worth going and reading a few articles to give yourself ideas how the pro's go about stuff.

  16. I do/did use Boost, but I prefer my own implementation, because it removes the overhead boost has from implementing for multiple platforms where I am using Windows exclusively. If you check out the boost hpp headers, you will see it uses Win32 critical sections for its mutex class on Windows.

     

    EDIT: Actually, better than anything are the Intel Threaded Building Blocks, especially if you are on an Intel architecture CPU. Not sure if AMD has an equivalent.

     

    I thought BOOST was multi platform and was going to be adopted as a ANSI standard?

×
×
  • Create New...