Jump to content

Early test - C++ Physic engine port (emscripten)


Samuel Girardin
 Share

Recommended Posts

Hi ,

 

I'm back with a new cool experiment. I'm actually porting an open source cpp  physic engine library to js/typescript with emscripten/asm.js (it's not not bullet) . I'm on it since 5 days and here is my first result. It sounds promising, So here is a short video preview. Online demo soon ! I hope ...

 

https://www.youtube.com/watch?v=c-qPc61BmqY

 

 

sam

 

A new one : 

 

https://www.youtube.com/watch?v=BILt4V3CPJM

 

 

above the 2 first working demo 

Link to comment
Share on other sites

Thanks guys ! 

 

 

@temechon : Maybe, maybe not !

 

It's really the very beginning.For the moment I have only spheres and boxes working ! I think I did only 5% of the work. Another good thing, the js produced by emscripten is only 470 ko which is not too bad (for the whole framework).

I Come back soon with new videos !

Link to comment
Share on other sites

Very, very, very interesting! :) I love this topic.Great job as always.

 

I was thinking about doing something similar for a long time in order to compare the performance of the C++ lib ported via asm.js & our current oimo & cannon JS libs. I would be very interested in a direct comparison between a scene using oimo & your C++ lib on the performance level. I'm also curious about the final size of the lib produced by EMScripten and also the performance on non asm.js browser (Chrome & mobile browsers). Indeed, only Firefox & Edge are currently supporting asm.js.

 

Are you using simd.js also in the output generated? It could be very useful for the performance also.

Link to comment
Share on other sites

;) For the moment  edge (asm enable) is between 10 and 20% faster than chrome (asm part). I did a simulation during one minute. Edge is at an average of 8ms per frame, chrome at 10. 

 

About simd.js I read that emscritpen is not really ready yet, asm simd  code seems to be still slow. And the c++ lib I port  doesn't use parallelism.  

 

As I said my lib file is 493ko (not sure, but it will stay like this, all the c++ file are already compiled). 

 

For a test it would be interesting, even if we can t reproduce the exact same test scene. 

 

New demo soon, testing  joint-hinge  now !

Link to comment
Share on other sites

Hi, 

 

Promise ! This is my last video post ! I'm really having fun with this lib.. In fact I  waste time by playing with it. It works very well, even if you need a good processor when you try to simulate a lot of object (>500).

 

@david my lib is now 570 ko (100 ko more..).

 

So next time it will be live demo !

 

https://www.youtube.com/watch?v=nLYuYuGOaLg 

 

 

https://www.youtube.com/watch?v=G22VO5r3oSY&spfreload=10

 

Link to comment
Share on other sites

Can't await to play around with it - especially to try out functions to apply forces and how it reacts to higher end-speeds - both things neither Oimo nor Cannon are convincing yet.

 

Does it have atmospheric pressure, so things on a planet surface would react like you expect them to do (loosing speed when moving, flying curved lines when spinning etc.)?

Link to comment
Share on other sites

Hey Wingy - you don't like it like it is at the moment, that you can switch the physic engines, but if you leave it blank it's Oimo? Why not suggest one for beginners, but keeping it open for more - kind of how it is now?

Link to comment
Share on other sites

That's fine, of course, as long as it remains that way.  I just don't want to commit to one, at the cost of forsaking any others or any future systems.  I saw two comments in this thread mentioning "new default"... and I don't think that should be a concern.  Maybe YOU can tell ME why those two posts showed up.  Apparently there is some kind of concern about which physics engine "wins" the coveted "default" title/position?

Link to comment
Share on other sites

No plugin? Wingunt, whether a motor default or not, This does not really matter, it's just to make sure Babylon uses the best physics engine by default. This is of course not a major concern. what would be really great is the plugin.

 

So we shall see not integrate into Babylon if Samuel does not create the plugin of integration Babylon.  :(

Link to comment
Share on other sites

Sam, I wasn't talking about you.  All you did is show us some experiments and tests you are doing.  It's the pile of hoopla that happened afterwards... that caught my attention.

 

If I/we could harness that "parade" and use that energy to get either/any of our current physics engines... to work on heightMaps/terrains, I would be tickled to death.

 

Am I wrong?  Which PE's are currently doing heightMaps?  Oimo and Cannon.  Which webGL framework has never had a heightMap physics demo?  BabylonJS.

 

(It is my opinion that we lose TONS of fans... to "the other guys"... just because we can't do heightMap physics.)

 

I'm hoping... that once this parade of "let's change physics engines" gets done, someone can start working-on activating the physics features that we ALREADY HAVE and are not using/implementing. 

 

If I'm being out-of-line, someone set me straight, I can take it.  Feel free to use The Wingnut Chronicles if you want to avoid derailing Sam's thread.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...