It seems linked to a limit imposed on the number of bodies to be deleted on each cycle.
This limit is set to 6 currently (kMaxNodesToBeRemoved) in my implementation. Increasing this gives me more stability.
Code:
-(void) removeB2Body:(b2Body*)body
{
NSAssert( nukeCount < kMaxNodesToBeRemoved, @"LevelSVG: Increase the kMaxNodesToBeRemoved in GameConstants.h");
nuke[nukeCount++] = body;
}
stack:
Code:
#0 0x98d55ef6 in __kill ()
#1 0x98d55ee8 in kill$UNIX2003 ()
#2 0x98de862d in raise ()
#3 0x98dfe6e4 in abort ()
#4 0x98deb28c in __assert_rtn ()
#5 0x0003cfa2 in b2World::DestroyBody (this=0x7889200, b=0x69a4c80) at /Users/stephen/Documents/XCode/Cocos2d/LevelSVG-2010-08-11/libs/Box2D/Dynamics/b2World.cpp:109
#6 0x000216f7 in -[MachineGunBullet_1 update:] (self=0x66f2cd0, _cmd=0xe8f34, dt=28.2493877) at /Users/stephen/Documents/XCode/Cocos2d/LevelSVG-2010-08-11/Classes/MachineGunBullet_1.mm:373
#7 0x000a282d in -[CCScheduler tick:] (self=0x714dc30, _cmd=0xeb4cc, dt=28.2493877) at /Users/stephen/Documents/XCode/Cocos2d/LevelSVG-2010-08-11/libs/cocos2d/CCScheduler.m:550
#8 0x00066cb8 in -[CCDirector drawScene] (self=0x711a490, _cmd=0xeb108) at /Users/stephen/Documents/XCode/Cocos2d/LevelSVG-2010-08-11/libs/cocos2d/CCDirector.m:235
#9 0x0006a82c in -[CCDisplayLinkDirector preMainLoop:] (self=0x711a490, _cmd=0xeac3d, sender=0x714e560) at /Users/stephen/Documents/XCode/Cocos2d/LevelSVG-2010-08-11/libs/cocos2d/CCDirector.m:1212
#10 0x007f2ebe in CA::Display::DisplayLink::dispatch ()
#11 0x007f3003 in CA::Display::EmulatorDisplayLink::callback ()
#12 0x029e2d43 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#13 0x029e4384 in __CFRunLoopDoTimer ()
#14 0x02940d09 in __CFRunLoopRun ()
#15 0x02940280 in CFRunLoopRunSpecific ()
#16 0x029401a1 in CFRunLoopRunInMode ()
#17 0x03ea02c8 in GSEventRunModal ()
#18 0x03ea038d in GSEventRun ()
#19 0x00898b58 in UIApplicationMain ()
#20 0x0000367a in main (argc=1, argv=0xbfffeedc) at /Users/stephen/Documents/XCode/Cocos2d/LevelSVG-2010-08-11/main.m:13
so my best guess is, the assertion is failing
Code:
NSAssert( nukeCount < kMaxNodesToBeRemoved, @"LevelSVG: Increase the kMaxNodesToBeRemoved in GameConstants.h");
and so the next line
Code:
nuke[nukeCount++] = body;
is writing outside the bounds of the array, and causing SIGABRT.
So - as I don't know how many bodies will need to be in this array at run time, is the solution just to start with a value such as 20, but copy the array into a new larger array if the limit gets blown?
Regards
i