FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Tutorial 16 error

3 posters

Go down

Tutorial 16 error Empty Tutorial 16 error

Post  Madrayken Wed Mar 25, 2009 6:40 am

Just downloaded the latest SDK as of today, and tutorial 16 crashes.

if( _SIO2physic->state == SIO2_PHYSIC_PLAY )
{
float sub = _timestep / ( float )_pass;

The file is sio2_physic.cc and the error is EXC_BAD_ACCESS.

My Mac is:

Model Name: MacBook
Model Identifier: MacBook5,2
Processor Name: Intel Core 2 Duo
Processor Speed: 2 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 3 MB
Memory: 2 GB
Bus Speed: 1.07 GHz
Boot ROM Version: MB52.0088.B00
SMC Version: 1.38f5
Serial Number: W89090FW4R3
Sudden Motion Sensor:
State: Enabled

Madrayken

Posts : 8
Join date : 2009-03-25

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  sio2interactive Wed Mar 25, 2009 7:52 am

Have you try it on the device ? And can you tell me the value of _pass cuz it should be greater than 0 as well as _timestep...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  Madrayken Wed Mar 25, 2009 9:59 am

I don't have a full development account yet - only the SDK, so I've only tested on the emulator.

_pass == 2 by the way.

Madrayken

Posts : 8
Join date : 2009-03-25

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  sio2interactive Wed Mar 25, 2009 3:43 pm

_timestep?
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  sio2interactive Wed Mar 25, 2009 4:14 pm

Can someone confirm this issue can I double check both on the simulator & the device and tutorial16 work perfectly debug/release thumb on/off.

The only thing is I replace this block to have a better smooth animation since the new sio2PhysicRender execute full passes this smooth the soft body physic:

in EAGLview.mm

Code:


- (void)drawView {


   if( sio2->_SIO2window->_SIO2windowrender )
   {
      if( sio2->_SIO2physic )
      {
         // Use directly the Bullet API to step into the simulation
         sio2->_SIO2physic->_btSoftRigidDynamicsWorld->stepSimulation( sio2->_SIO2window->d_time, 2 );   
      }
         
      sio2->_SIO2window->_SIO2windowrender();

      sio2WindowSwapBuffers( sio2->_SIO2window );
   }

   
   glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
   [context presentRenderbuffer:GL_RENDERBUFFER_OES];
}



Tks in advance,

ps: The pass value should be set to 1
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial 16 error Empty Same issue with 1.3.5 and tutorial_16

Post  Francescu Wed Mar 25, 2009 11:07 pm

I can confirm there is some issue with tutorial_16 and SDK 1.3.5

If I try to use the bullet API as you suggested I get the same error as suggested on post #1
sio2->_SIO2physic->_btSoftRigidDynamicsWorld->stepSimulation( sio2->_SIO2window->d_time, 1 );
(tried with a pass of 1 or 2)

if I leave it with the default that is calling sio2PhysicRender() and I set a pass of 1 or 2, the soft bodies are pretty much going through the floor or one will show but will be badly rendered with lots of missing faces...

It is behaving better in 1.3.3 from what I can see on my system but 1.3.3 shows performance issue with physics rendering..

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  sio2interactive Thu Mar 26, 2009 1:53 am

Ok can you please tell me where it crash, and maybe try to use MallocDebug and Instruments to give me a bit more info on that on cuz over here everything is fine... I kinda don't know where to start Wink

Can you guys download back 1.3.5 (cuz I update it again this morning) and do the test again...

Cheers,
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial 16 error Empty Physics are not being played yet

Post  Francescu Thu Mar 26, 2009 1:00 pm

I have downloaded the latest 1.3.5 and ran it again - same issue

timestep (or sio2->_SIO2window->d_time) that is passed to stepSimulation() is 0 (zero).

But the problem is due to the fact that the physics haven't started playing yet and the 'state' is not yet set to PLAY when calling stepSimulation()

Could it be something to do with the speed of the CPU and people with faster machines getting into some kind of race condition...

If I test for the physics state before calling stepSimulation() then all is fine:
if( sio2->_SIO2physic->state == SIO2_PHYSIC_PLAY )

Romain, you already have that test in sio2PhysicRender()...

--francois

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  sio2interactive Thu Mar 26, 2009 4:25 pm

Try this:

Code:


void sio2PhysicRender( SIO2physic *_SIO2physic,
                 float     _timestep,
                 int        _pass )
{
   unsigned int i = 0;
   
   if( _SIO2physic->state == SIO2_PHYSIC_PLAY && _timestep && _pass )
   {
      float sub = _timestep / ( float )_pass;

      while( i != _pass )
      {
         _SIO2physic->_btSoftRigidDynamicsWorld->stepSimulation( sub, 0 );
         ++i;
      }
   }
}



Lemme know if it still crash by adding the extra checks.
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  Madrayken Thu Mar 26, 2009 4:46 pm

sio2interactive wrote:Try this:

Code:


void sio2PhysicRender( SIO2physic *_SIO2physic,
                 float     _timestep,
                 int        _pass )
{
   unsigned int i = 0;
   
   if( _SIO2physic->state == SIO2_PHYSIC_PLAY && _timestep && _pass )
   {
      float sub = _timestep / ( float )_pass;

      while( i != _pass )
      {
         _SIO2physic->_btSoftRigidDynamicsWorld->stepSimulation( sub, 0 );
         ++i;
      }
   }
}



Lemme know if it still crash by adding the extra checks.

Still a problem. I should have checked before, but it looks like _SIO2physic is unassigned. None of the variables contained in the struct are initialised, so the ->state value is invalid.

Placing a breakpoint in:

SIO2physic *sio2PhysicInit( char *_name )
{
>>> SIO2physic *_SIO2physic = ( SIO2physic * ) calloc( 1, sizeof( SIO2physic ) );
...
}

And the reason that's not set is that in Tutorial 16, debugging through the Main.mm:

int retVal = UIApplicationMain(argc, argv, nil, nil);

seems to leap straight to sio2PhysicRender(), bypassing templateLoading()!


Last edited by Madrayken on Thu Mar 26, 2009 5:02 pm; edited 3 times in total (Reason for editing : Further explanation)

Madrayken

Posts : 8
Join date : 2009-03-25

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  sio2interactive Thu Mar 26, 2009 4:59 pm

hummmm how's that possible can you please investigate a bit more cuz over here everything work flawless...

Also with SDK version you are using?? Me in still using 2.2.1
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  Madrayken Thu Mar 26, 2009 5:04 pm

sio2interactive wrote:hummmm how's that possible can you please investigate a bit more cuz over here everything work flawless...

Also with SDK version you are using?? Me in still using 2.2.1

Ooh - I'm using XCode 3.1.2. The simulator is v 2.2.1

Madrayken

Posts : 8
Join date : 2009-03-25

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  sio2interactive Thu Mar 26, 2009 5:11 pm

Ok this is weird... Here's what I got:

XCode: 3.1.2
SDK: 2.2.1
Device: iPod Touch 2gen 8G

From here I can't seems to be able to reproduce the bug...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  Madrayken Thu Mar 26, 2009 5:20 pm

sio2interactive wrote:Ok this is weird... Here's what I got:

XCode: 3.1.2
SDK: 2.2.1
Device: iPod Touch 2gen 8G

From here I can't seems to be able to reproduce the bug...

Oh dear. Seems like we have an impasse!

So far, every other tutorial file has worked. This one's just... dead. Do you have any idea why templateLoading() would ever be skipped? Missing resource? Corrupt SIO2 data file? My Mac having x386 architecture?

Madrayken

Posts : 8
Join date : 2009-03-25

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  Francescu Thu Mar 26, 2009 5:37 pm

Romain, I still think there should be a check to test the physic state before calling stepSimulation() like you do in sio2PhysicRender().
if( sio2->_SIO2physic->state == SIO2_PHYSIC_PLAY )
sio2->_SIO2physic->_btSoftRigidDynamicsWorld->stepSimulation( sio2->_SIO2window->d_time, 1 );

Without that check it won't work for me and causing BAD_ACCESS errors. With the check, everything is peachy...

I understand calling sio2PhysicRender() adds a call onto the stack and 1 more branching test _but_ not testing at all for the state might lead to particular situations on machines of different CPU speed (e.g. if physics haven't started yet)...

Just my 0.02 cents

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  sio2interactive Thu Mar 26, 2009 6:06 pm

Hummmmm please confirm that you have the following code in tutorial16 in EAGLview.mm

Code:

   if( sio2->_SIO2window->_SIO2windowrender )
   {
      if( sio2->_SIO2physic )
      {
         // Use directly the Bullet API to step into the simulation
         sio2->_SIO2physic->_btSoftRigidDynamicsWorld->stepSimulation( sio2->_SIO2window->d_time, 2 );   
      }
         
      sio2->_SIO2window->_SIO2windowrender();

      sio2WindowSwapBuffers( sio2->_SIO2window );
   }


I release a new version yesterday morning if you have downloaded 1.3.5 before yesterday please download again... a few mistake found their way up to the final package somehow... please download it again if you do not have the code above within tutorial16.

ps: Just call me ROm
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  Francescu Thu Mar 26, 2009 6:28 pm

Not sure if this was directed to me but I have just downloaded it again (like right now) and what I have in EAGLview.mm of tutorial 16 is a pass of 1, NOT 2.

sio2->_SIO2physic->_btSoftRigidDynamicsWorld->stepSimulation( sio2->_SIO2window->d_time, 1 );

otherwise the rest is the same...

Like I said before, if I put the state test before stepSimulation() it works very fine (even with a pass of 1)...no more issues...

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  sio2interactive Thu Mar 26, 2009 11:26 pm

All right guys tks to Francescu I manage to find the problem... its just really weird that the problem only shows up in tutorial16 cuz basically the whole SIO2 initialization is affected any please replace the sio2ExtractPath function with that one:

Code:


void sio2ExtractPath( char *_fname,
                 char *_ppath,
                 char *_aname )
{
   unsigned int s = sio2StringLen( _fname );
            
   char *curr_pos;
 
   curr_pos = strrchr( _fname, '/' );
   
   if( curr_pos )
   {
      memcpy( _ppath, _fname, s - sio2StringLen( curr_pos ) + 1 );
      
      if( _aname )
      { memcpy( _aname, ( curr_pos + 1 ), sio2StringLen( curr_pos ) ); }
   }
}


That should fix all the problems Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  Madrayken Fri Mar 27, 2009 1:58 am

Cool - that fixes the crash. But now the three gel boxes fall through the world. :-)

Madrayken

Posts : 8
Join date : 2009-03-25

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  sio2interactive Fri Mar 27, 2009 2:02 am

sio2->_SIO2physic->_btSoftRigidDynamicsWorld->stepSimulation( sio2->_SIO2window->d_time, 2 );
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  Francescu Fri Mar 27, 2009 10:19 am

Madrayken wrote:Cool - that fixes the crash. But now the three gel boxes fall through the world. :-)
That's interesting as it does not on my system (I use a pass of 1).
Does it do it on the device as well? I'm not sure you can test it as you mentioned you did not have an iDevice yet?

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  Madrayken Fri Mar 27, 2009 4:12 pm

Francescu wrote:
Madrayken wrote:Cool - that fixes the crash. But now the three gel boxes fall through the world. :-)
That's interesting as it does not on my system (I use a pass of 1).
Does it do it on the device as well? I'm not sure you can test it as you mentioned you did not have an iDevice yet?

Oh, I have one... I just haven't signed up for the developer program yet.

Madrayken

Posts : 8
Join date : 2009-03-25

Back to top Go down

Tutorial 16 error Empty Re: Tutorial 16 error

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum