Threedy

Members
  • Content Count

    21
  • Joined

  • Last visited

About Threedy

  • Rank
    Member

Recent Profile Visitors

903 profile views
  1. Hmm you're right. I most likely have messed up something there. Anyway, looking forward to your project and hopefully more updates!
  2. Well done! I tried this a couple years ago, but I ran cannon.js separately on the server (at that time I don't think there was any Babylon.js implementation on the server). I see that you are using Oimo.js which should perform a bit better than Cannon (with the cost of less features). At the time, once I had >6 clients joining, the game becomes very laggy (even including interpolation). I see that the same also happens in your demo. Do you have any plans to tackle this issue? I couldn't figure it out and thought that it was simply the physics engine . Looking forward for more updates!
  3. Thank you Deltakosh. That is actually a good idea. I haven't tried Emscripten versions yet (e.g. AmmoJS). I shall do this when I have time in the next few days! Thanks
  4. Hello there, For the record: I am posting this in BabylonJS since this is the best HTML5 3D game engine for the web and I'm questioning some of its physics engines and their use on the server. I was wondering what the state is regarding (JavaScript) 3D physics engines and the possibility of running the physics on the server (to make the server authoritative). The current state of physics engines seems to lack either performance or functionality. I have tried running CannonJS using NodeJS, and while it was OK for 4-5 clients, it became quite poor afterwards (even though I used simple and few geometry). Oimo.js doesn't have any collision callbacks as far as I've read, and Energy.js's release seems to be quite far away. Another question: it seems that the popular webgames you see on the web are being ''hijacked''. By that I mean that the client code is stolen and are being run on a different server where they make profit. This for instance happened with Agar.io. To counter this, you should preferably run a few things on the client and the majority of the other stuff on the server. However, if a game has physics, I imagine this wouldn't work out so well since it may stutter or feel unresponsive. Does anyone have knowledge of this or can share his/her experience?
  5. This may be a ridiculous simple question, but I can't figure this one out... I tried drawing a circle using the following function: drawCircle(x, y, radius) Where x and y are according to the documentation of Pixi: If I want to change the position later, I can use the: circle.position.x or circle.position.y method. If I set both at (2,2) (position.x = 2 and position.y = 2), I see that the position is different than the one I used to create the circle with: drawCircle(2,2,1). I then don't understand the API's ''the x,y coordinate of the center of the circle''.. Wouldn't that be the initial position of that circle anyway?
  6. Also wondering about this.. Only thing I could think of is to save the velocities at the start of the step and then on collision look up the velocity... You could try asking it as an issue on Github for the creator of p2, https://github.com/schteppe/p2.js/issues. Edit: what about this? http://stackoverflow.com/questions/23587975/detect-impact-force-in-phaser-with-p2js
  7. Hi there. I want to collide a ball A with another ball B in a zero gravity world. Both balls have the same mass and (max) restitution and stiffness. When A collides with B, I see that B's reaction is ''exaggerated'' and flies away, which is good for my purposes. However, I see that A is barely affected. I would prefer if A's reaction is also exaggerated and bounces back a lot rather than staying on basically the same area of the collision. Does anybody know what type of settings I have to change? contactMaterial.friction = 0.3; // Friction to use in the contact of these two materials. contactMaterial.restitution = 1.0; // Restitution (i.e. how bouncy it is!) to use in the contact of these two materials. contactMaterial.stiffness = 1e7; // Stiffness of the resulting ContactEquation that this ContactMaterial generate. contactMaterial.relaxation = 3; // Relaxation of the resulting ContactEquation that this ContactMaterial generate. contactMaterial.frictionStiffness = 1e7; // Stiffness of the resulting FrictionEquation that this ContactMaterial generate. contactMaterial.frictionRelaxation = 3; // Relaxation of the resulting FrictionEquation that this ContactMaterial generate. contactMaterial.surfaceVelocity = 0; // Will add surface velocity to this material. If bodyA rests on top if bodyB, and the surface velocity is positive, bodyA will slide to the right.
  8. A silly question, but I was wondering whether anyone has an idea of the performance of either (Box2D or p2) physics engine. I'm planning to also use one of these engines on the server side as an authoritative (node.js) as well as client side. I think it's easier to work with p2, but I'm not entirely convinced by its performance (especially on the server side). Any tips are greatly appreciated & welcome!
  9. It's not babylonjs related since I have tried adding only 250 boxes on Cannonjs only (so without Babylonjs, on the server). It then gave the lag. It could be something different I am probably missing though, with cannon. Perhaps I need to use some sort of copy regardless inside of Cannon I'm yet not aware of? I understand from another forum topic that the server loop on the client side and server side (in terms of physics) should be the same? So for cannon, let's say 1/60 as timestep?
  10. Good point. However, I tried running it only on the client with 240 static CannonJS boxes which is also slow. Most likely I am still doing something wrong though, since I have seen it perform better than that given some example demo's.
  11. Sorry to bump my own thread again. I have managed to follow Hen's advice and implemented CannonJS on the server (BabylonJS on the front-end which I have only used for the rendering, not it's CannonJS integration, which I implemented separately on the client like the server, and NodeJS/SocketIO). It seems that my current way of implementing cannonjs is the bottleneck so far (and I don't think there is a better Javascript 3D physics engine performance wise at the moment). It works fine for a few objects. But unfortunately, adding +- 400 boxes floating in the air, I would notice quite some lag for only 1 player at 1 game. Now imagine this for 4 game instances with 8 players on a single server. It would be impossible. Perhaps a 3D multiplayer physics browser game is a bit too ambitious at this time. Anyway, I would like to hear any other stories.
  12. Haha thanks for the comment guys. I managed to bump it down to 10 ticks Anyway, the current bottleneck seems to be the physics engine itself (CannonJS).When I add 400 boxes, only floating in the air, I notice quite a bit of lag (only for 1 player in 1 game). I'm pretty bummed out. Perhaps it was a bit too ambitious, a 3D realtime multiplayer physics browser game.
  13. I have am running a 3D multiplayer physics game where I currently send the input (4 keys, position: x,y,z and velocity x,y) to the clients (8 clients in total) 30 times a second. Is this considered to be a bit too much? Also, I assume changing (1) to (2) would decrease the size of data that is sent? (1) var keys = {l:true, r:true, u:true, d:true}; (2) var keys = {l:1, r:t1, u:1, d:1};
  14. Edit: Problem fixed. After some experimenting, I realized that the gravity should be passed like this: world.gravity = vector. Hi, I have the following simple example from the wiki page of Cannon JS... I expected the ball to fall, but it didn't and only prints ''Sphere position: 0,100,10''. Can anyone understand why? I then thought (based from the wiki) that I had to use Rigidbody (CANNON.RigidBody) but that wasn't recognized. Any tip is greatly appreciated.