On Sun, Sep 5, 2010 at 7:31 PM, Mikko Vartiainen <mvartiai...@gmail.com> wrote:
> Animation seems to be the big obstacle on 4x10 case. I made crude test
> (see below) with animations, and this alone changes completely
> unplayable game to about 10 fps game.

I made more refined test. Here we simply stop animation if character
is not visible. It makes a huge difference when there is lot a
characters.

-- 
Mikko
Index: src/character/character.h
===================================================================
--- src/character/character.h	(revision 8358)
+++ src/character/character.h	(working copy)
@@ -96,7 +96,6 @@
   Body* body;
 
 private:
-  bool MustBeDrawn() const;
   bool MustDrawLostEnergy() const;
   bool MustDrawEnergyBar() const;
   bool MustDrawName() const;
@@ -123,6 +122,7 @@
   bool ComputeHeightMovement(int & height);
 public:
 
+  bool MustBeDrawn() const;
   Character (Team& my_team, const std::string &name, Body *char_body);
   Character (const Character& acharacter);
   ~Character();
Index: src/character/body.cpp
===================================================================
--- src/character/body.cpp	(revision 8358)
+++ src/character/body.cpp	(working copy)
@@ -455,6 +455,7 @@
 
 void Body::Build()
 {
+
   // Increase frame number if needed
   unsigned int last_frame = current_frame;
 
@@ -498,7 +499,8 @@
 
   ResetMovement();
   ApplySqueleton();
-  ApplyMovement(current_mvt, current_frame);
+  if (owner->MustBeDrawn())
+    ApplyMovement(current_mvt, current_frame);
 
   int layersCount = (int)current_clothe->GetLayers().size();
 
@@ -530,7 +532,8 @@
   body_mvt.pos.y = GetSize().y - y_max + current_mvt->GetTestBottom();
   body_mvt.pos.x = ONE_HALF*(GetSize().x - skel_lst.front()->member->GetSprite().GetWidth());
   body_mvt.SetAngle(main_rotation_rad);
-  skel_lst.front()->member->ApplyMovement(body_mvt, skel_lst);
+  if (owner->MustBeDrawn())
+    skel_lst.front()->member->ApplyMovement(body_mvt, skel_lst);
 
   need_rebuild = false;
 }
_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à