Ams.js vs Box2d Benchmarks. strange finding

Discussion and feedback on Construct 2

Post » Sat Feb 14, 2015 6:03 pm

Hey everyone,


I did a benchmark test and posted the results on R0j0hound's chipmunk physics forum post.

These were made using a win7 i5 laptop.

The test, Box containing small bouncing balls with 100% elasticity... I continued to add balls until the cpu usage fluctuated to greater than 85%

Box2dWeb: 600
AMS.JS: 850
Chipmunk: 1400

Something to note here which is very important. AMS.JS Keeps low cpu usage and then once you cross a object count it sky rockets to 90-100% . AMS.JS seems to run an average lower cpu usage than regular Box2d web, but I am notice high cpu spikes. If ams.js spikes to be at where Box2d web runs or even above, I am not sure its benifits are worth it.

When I am making a game, I really prefer to have predictable results and right now ams.js has some unpredictability. If you end up using 500 objects and get frequent spikes, then game play could be affected in a variable way (slow, smooth,slow,smooth). If Ams spike to where box2d web runs at then you really can only safely use the same amount of objects. Does anyone have some knowledge of what is happening here?

Box2d is much more linear in its object count to cpu usage. Chipmunk starts to use more cpu as the balls settle (which they shouldn't be doing). The settling becomes more pronounced as the object count increases.
Image
B
32
S
11
G
2
Posts: 563
Reputation: 5,106

Post » Sat Feb 14, 2015 6:13 pm

I am unconvinced about the fruit asm.js promises to bear. I've spammed almost all of your threads about this @ruskul, I think - and here I go again! And I know Ashley doesn't believe my findings about asm.js not offering performance gains. I'll edit my physics test to compare cpu usage between the different engines.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
69
S
18
G
65
Posts: 2,195
Reputation: 41,465

Post » Sat Feb 14, 2015 7:13 pm

So here are the quick results. 1600 circular objects in zero gravity... It was obvious that chipmunk is the most demanding on the cpu. Regarding the other two physics engines, there is little difference between box2d and asm.js performance, IMO.

These tests were run on Chrome Version 40.0.2214.111 m using r195 and r196.2. r195 was way smoother as you can see when comparing its graphs with the number of the frequent number of large dt values that are apparent in the r196.2 fps graph....
You do not have the required permissions to view the files attached to this post.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
69
S
18
G
65
Posts: 2,195
Reputation: 41,465

Post » Sat Feb 14, 2015 8:10 pm

I still use Box2dWeb because of collision disabling which is a big part of my game. Curious when AMS.JS will get an update of this.
B
20
S
5
G
1
Posts: 102
Reputation: 1,706

Post » Sat Feb 14, 2015 10:54 pm

delaflaquita wrote:I still use Box2dWeb because of collision disabling which is a big part of my game. Curious when AMS.JS will get an update of this.

You can disable collision in asm.js from r196.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Sat Feb 14, 2015 11:26 pm

@delaflaquita - collision disabling is available as of the r196 and on.
Image
B
32
S
11
G
2
Posts: 563
Reputation: 5,106

Post » Sat Feb 14, 2015 11:29 pm

@Colludium - thats cool, I like your input. I like everyone's input. I think we have similar wants and desires for physics so it makes sense, lol.

Those benchmarks are interesting too. For whatever reason, in the test I did chipmunk was outperforming the others (not expected) but had a lower stability. I noticed on your tests chipmunk was not doing so well. I am curious at what would cause this. I was using gravity in my tests with elasticity at 100% to maintain perpetual movement. Friction was also 0.
Image
B
32
S
11
G
2
Posts: 563
Reputation: 5,106

Post » Sat Feb 14, 2015 11:59 pm

Cheers, @ruskul. I've attached the two versions of the test, in case anyone else is interested in tinkering with them. They're not commented because I'm lazy - all you have to do is select the correct physics engine, make sure the correct behavior is enabled/disabled and enable/disable the on-created group as appropriate.
You do not have the required permissions to view the files attached to this post.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
69
S
18
G
65
Posts: 2,195
Reputation: 41,465

Post » Sun Feb 15, 2015 12:07 am

So I noticed you have to restart construct to get the engine to change. You can't run a game, change from box2d to ams.js, and then re run it. It will still be whatever was selected on start up. I think.
Image
B
32
S
11
G
2
Posts: 563
Reputation: 5,106

Post » Sun Feb 15, 2015 12:16 am

You could do to change between chipmunk and native - just enable/disable the bahavior accordingly. However there's no way I'm aware of to change between box2d web and asm.js.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
69
S
18
G
65
Posts: 2,195
Reputation: 41,465

Next

Return to Construct 2 General

Who is online

Users browsing this forum: 2Dpysics, spartan05, zenox98 and 2 guests