About Store Forum Documentation Contact



Post Reply 
Problems with skeletons since last update
Author Message
Fex Offline
Gold Supporter

Post: #1
Problems with skeletons since last update
Ok firstly I tried to compile my game after the most recent EE update and every getSkelAnim call e.g:

Code:
SkelAnim        *rolling=null
...
rolling   =&skel.getSkelAnim("Obj/Siege/Catapult/rolling2.anim");

produces error C2101 .. & requires l-value, so I looked at it and said "well he must have changed the getSkelAnim to return the pointer" so I changed all of the calls to:

Code:
rolling   =skel.getSkelAnim("Obj/Siege/Catapult/rolling2.anim");

And yay it compiled, so I run it and:

Code:
Skeleton*  skeleton(                  )C {return _skeleton;}

Throws up an exception on app loading.

"Unhandled exception at 0x012ff57f in Client.exe: 0xC0000005: Access violation reading location 0x00000030."

Looking at the stack trace it occurs at this call:

Code:
skel.create(mesh->skeleton(), scaleflt);

where skel is:

Code:
class SiegeWeapon : BlendObject , Game.Kinematic
{
   CSkeleton        skel;
   SkelAnim        *rolling=null, *loading=null;
...

void create()
{

Game::ObjParamsPtr obj4=Game::Objs.ptrRequire(UID(3958158338, 1272394960, 148191386, 2257285045));
Game.ObjParams obj5= *obj4;
__super::create(obj5); //ugly
...

skel.create(mesh->skeleton(), scale.length()*0.8); //crash here on mesh->skeleton()
...
}

}

So is anyone else seeing stuff like this, looking at the change list I don't see anything done to skeletons/animations?
(This post was last modified: 12-20-2014 02:33 AM by Fex.)
12-20-2014 02:22 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Problems with skeletons since last update
Hi,

=&skel.getSkelAnim -> =skel.getSkelAnim
That's OK

as for
skel.create(mesh->skeleton(), scale.length()*0.8); //crash here on mesh->skeleton()
I don't see your mesh being initialized to anything, so perhaps you're relying on Game.Kinematic.create

you should always check for 'mesh!=null' before accessing pointers.
Here's the source for Game.Kinematic https://github.com/Esenthel/EsenthelEngi...ematic.cpp

There have been some changes, particularly to
void Kinematic::setUnsavedParams()
void Kinematic::create(ObjParams &obj)
the mesh is always taken from the 'base' which is 'base =obj.firstStored();'

I've just tested "02 - World" tutorial, replacing Game.Item with Game.Kinematic in the memory container for objects, and the Game.Kinematic works as expected.
12-21-2014 12:49 AM
Find all posts by this user Quote this message in a reply
Fex Offline
Gold Supporter

Post: #3
RE: Problems with skeletons since last update
Thanks for your reply Greg, I looked at your changes to Kinematic..

going from

mesh =obj.mesh ();

to

base =obj.firstStored();

in Kinematic::create seems to break the way I create the derived objects.

Code:
Game::ObjParamsPtr obj4=Game::Objs.ptrRequire(UID(82207790, 1135183605, 463827857, 3114706381));
       Game.ObjParams obj5= *obj4;
       __super::create(obj5); //Kinematic::create
       if(obj5.firstStored() == null)Exit("no first stored");

always exits "no first stored", I guess my object isn't in the cache, how do I force it into the cache?

If I manually set the base object like so, everything seems to be fine:

Code:
Game::ObjParamsPtr obj4=Game::Objs.ptrRequire(UID(82207790, 1135183605, 463827857, 3114706381));
       Game.ObjParams obj5= *obj4;
       obj5.base(obj4); //manually set the base object rather than rely on firstStored().
       __super::create(obj5); //Kinematic::create
       if(obj5.firstStored() == null)Exit("no first stored");

Which I'm all about quick and dirty code so this works for me, thanks for your help.

I should also remark that I also tried it on the "Basic App" tutorial with the Objects\Warrior that comes with the tutorial and this code works fine:

Code:
class Warrior : Game.Kinematic
{
   void create()
    {
       Game::ObjParamsPtr obj4=Game::Objs.ptrRequire(UID(2919624831, 1261075521, 753053852, 3651670215));
       Game.ObjParams obj5= *obj4;
       __super::create(obj5);
       if(obj5.firstStored() == null)Exit("no first stored");
    }
    
    
}
Warrior warrior;
/******************************************************************************/
void InitPre() // init before engine inits
{
   EE_INIT(); // call auto-generated function that will setup application name, load engine and project data
}
/******************************************************************************/
bool Init() // initialize after engine is ready
{
   // here when engine will be ready you can load your game data
   // return false when error occured
   warrior.create();
   return true;
}
/******************************************************************************/
void Shut() // shut down at exit
{
   // this is called when the engine is about to exit
}
/******************************************************************************/
bool Update() // main updating
{
   // here you have to process each frame update

   if(Kb.bp(KB_ESC))return false; // exit if escape on the keyboard pressed
   return true;                   // continue
}
/******************************************************************************/
void Draw() // main drawing
{
   // here you have to tell engine what to draw on the screen

   D.clear(TURQ); // clear screen to turquoise color
   D.text (0, 0, "Hello to Esenthel Engine !"); // display text at (0, 0) screen coordinates
}
/******************************************************************************/

The "no first stored" exit never happens. But if I copy my model from my project to the tutorial project and try to make my "wings" model run with the same code I get "no first stored" exit unless I manually set the base object. So I guess it is something with my model (it is from a converted EE 1.0 project, might be the root cause of these problems).

Also I sent you a PM with a link to a EsenthelProject that contains the wings model, your warrior model and the modded basic app. I know your busy, and this only seems to be affecting me, and I think I have a work around, so don't worry about it unless you are curious.
(This post was last modified: 12-21-2014 08:34 AM by Fex.)
12-21-2014 08:02 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Problems with skeletons since last update
Hello,

The issue is because you're copying the objparamsptr to objparams.

You should do this in either of following ways:
Code:
Game.ObjParamsPtr obj=UID(82207790, 1135183605, 463827857, 3114706381);
super.create(*obj);
or if you need to specify some custom params then:
Code:
Game.ObjParamsPtr obj=UID(82207790, 1135183605, 463827857, 3114706381);
Game.ObjParams temp;
temp.base(obj);
super.create(temp);
12-21-2014 11:32 AM
Find all posts by this user Quote this message in a reply
Fex Offline
Gold Supporter

Post: #5
RE: Problems with skeletons since last update
Thanks again,

Code:
Game.ObjParamsPtr obj=UID(82207790, 1135183605, 463827857, 3114706381);
super.create(*obj);

Is the right way to do it.
12-21-2014 11:36 PM
Find all posts by this user Quote this message in a reply
Post Reply