100 bodies moving slow

Hi.

I've done a level of a game with about 50 bodies, and it works fine.

Now I've started making a second level for it with about 100 bodies, but everything appears to be in slow motion, like if the CPU is falling behind.

Does 100 bodies sound like a reasonable amount of bodies to make it look slow? Is there a way to add more bodies without them looking slow motion?

I have a Athlon XP 1.5GHz, 1 GB RAM box with Windows XP.

Thanks in advance.
- Are you stepping the box2d world inside an EnterFrame event handler? If so, you should consider updating the box2d world on a Timer, and separate it from your frame rendering. With every frame it's calculating new positions for every Body and it's slowing down your rendering of the display.

Here's a good read on separating your physics step from your display:

http://www.gaffer.org/game-physics/fix-your-timestep

- If you already have the Box2d world step on a Timer, maybe you have an exception? If you're continuously generating exceptions, that will slow you down.

100 bodies doesn't seem too crazy..
That was a pretty neat article, but I was wondering... interpolation is a great idea I hadn't thought of... but I was wondering... is there anyway to make Box2D do the interpolation?

Also, I am soon going to be doing Networked physics with Box2D... what is your advice (anyone who has advice)?
th317erd wrote:
Also, I am soon going to be doing Networked physics with Box2D... what is your advice (anyone who has advice)?

Advice? Make sure you're getting paid by the hour. 🙂 Seriously, though, we've discussed this several times and I don't think anyone has quite gotten it working yet with Box2d, let alone with the AS3 port; whether that's because it's actually very difficult to do or because nobody really needed it that badly, I'm not sure (never took a stab myself), but it's definitely not a quick add on. I'd suggest you read up on the methods people tend to use to do networked physics, there's a lot of information out there that can probably help you out.

Also, no, Box2d itself doesn't do the between frame interpolation, you'd have to set that up yourself.

Original thread: https://box2d.org/forum/viewtopic.php?t=1474