I created a Songoku racing game but i having a problem with performance with box2d
detail:
tile map 14400 x 896 pixel
less than 100 object with 4 dynamic body and rest all is static body
i load all texture in first menu screen(same splash screen)
ram used 1.5mb, texture memory 57mb
in desktop fps 60 but some time freeze(rare) it's 37 > 47
in lg g2 device(2gb ram, quad core 2.3 ghz) max is 58 fps and sometime 51 or 47 fps
i think problem with my code and cmt some code in onEnterFrame, but it's not help me
so i think problem is my world box2d with tile map
i using TiledAsWorldEditor of 1dot44mb
video here
map in acttach file
@ar2rsawseenp/s: sorry i bad english
Comments
Also what you can to (and maybe you are doing already) is to use pool for box2d bodies and fixtures, so you store them and reuse them, especially when you have similar or same figures to shot.
Creating and destroying any objects (especially box2d bodies) is inefficient, and you may experience small freezes on lua garbage collection times when there are too much memory to be deallocated.
Likes: DungDajHjep
i'm newbie in box2d, just only have 1,5 month experience
i fixed destroying many object by set object active = false but i need create a object when a player drop a "obstacle" and destroy it after.
i dont know how pool a body or fixture and re use it, u can give a link or tutorial ?
here's an example:
http://giderosmobile.com/forum/discussion/comment/36045#Comment_36045
only with box2d body you would also need to setActive(false) on destroy
and setActive(true) on create
Likes: DungDajHjep