yes I put this code to Esenthel forum here in July: http://www.esenthel.com/community/showthread.php?tid=5233 showing the bad performance of my previous laptop unsupporting SM 3.0 that is required for pssm.

but the main things are:

extending base character class and call it as Player:
Code:
STRUCT(Player , Game::Chr) // extend character class by defining a player class based on the character
//{
	virtual void create(Game::ObjParams &obj); // override default creation method to setup custom default animations after character creation
	virtual Bool update(); // here we'll update the player (please note that this is a virtual method)

	// formation data
	int row;
	int column;
	int arraynum;
};


assigning custom animation to the mesh on creation (the super::create line is calling the built in character initialization, the others are my extension codes):
Code:
void Player::create(Game::ObjParams &obj)
{
   super::create(obj); // call default creation
    
   sac.stand = &cskel.getSkelAnim("obj/chr/sergeant/idle.anim");
   sac.run = &cskel.getSkelAnim("obj/chr/sergeant/walk.anim");
   sac.walk = &cskel.getSkelAnim("obj/chr/sergeant/walk.anim");

   speed = 3;
   anim.speed = 1;
}


in the main update loop (Bool Update()) dealing with pathfinding in each frame (should be optimized):
Code:
if(Kb.bp(KB_ESC))return false;
   Physics.startSimulation().stopSimulation();
   int i;
   //------------------------------------------------------------------------------------------------
   // move leader of player group
   if(Ms.bp(0)) // on LMB pressed
   {
      Vec     pos, dir; ScreenToPosDir(Ms.pos(), pos, dir); // convert screen mouse position to world position and direction
      PhysHit phys_hit;
      if(Physics.ray(pos, dir*D.viewRange(), &phys_hit)) // if ray-test hit something
      {
          player[0].actionMoveTo(Vec(phys_hit.plane.pos.x, phys_hit.plane.pos.y, phys_hit.plane.pos.z)); // order character to

move to that location      
      }
   }
   //------------------------------------------------------------------------------------------------
   // player group movement
   Vec leaderpos = player[0].pos();
   for(i=1;i<100;i++)    
      player[i].actionMoveTo(Vec(leaderpos.x+player[i].column*2,leaderpos.y,leaderpos.z-player[i].row*2));
   for(i=0;i<100;i++)
      player[i].update();


and finally the render and draw cycles:
Code:
void Render()
{
	// world.cpp
	Game::World.draw(); // draw world (this is done outside of 'switch(Renderer())' because world automatically detects active rendering mode)
	//-------------------------------------
    int i;
	switch(Renderer())
    {
      case RM_PREPARE:
		  {         
			 for(i=0;i<100;i++)
				player[i].drawPrepare();
		  }break;
	  case RM_SHADOW:
		  {
			  for(i=0;i<100;i++)
				player[i].drawShadow();
		  }break;
    }
}
void Draw()
{
   Renderer(Render);

   D.text(0, 0.9f, S+"Fps "+Time.fps());
}


and everything works smoothly, not like in 3DGS, where as I progress further and further I find more and more bugs... I reported about 10 bugs within a year, most of them very disturbing and "it should work" category.


Free world editor for 3D Gamestudio: MapBuilder Editor