Loading saved world slow?

General discussion about the R.U.B.E editor
Post Reply
Eddy8555
Posts: 42
Joined: Sat Apr 27, 2013 3:01 pm

Loading saved world slow?

Post by Eddy8555 »

I'm using the Cocos2d sample loader for saving a world, and reloading it. The code is straightforward:

Code: Select all

-(void) loadSavedFile: (id) sender {
    NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
    NSString *fileName = [NSString stringWithFormat:@"%@/newWorld.json", documentsDirectory];
    [super loadWorld:nil andJsonFile:fileName];    
}
This works fine, but I'm noticing that when I have many bodies in the world (maybe over 50) it slows down, even considerably, and can take several seconds to reload.

Is there any rule of thumb for doing this right? Is it related to the size of the images? Anything else I should look for? Going over my code I can't see anything obvious, like calling it several times or something like that. It all looks clean. But slow :)
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Loading saved world slow?

Post by iforce2d »

50 bodies is not many really. How large/many are the images? What if you load the same scene without the images? You can turn off image exporting in the scene settings dialog for a quick check. You could also probably comment out something in the loading code, but I don't have it on me to check where that would be.
Post Reply