Simple Physics Library

I’ve been working on a Simple Physics Library, as the one built-in to JME, though excellent, is overkill for my needs. I wanted something that handled collisions and simple gravity and bouncing. I plan to use it in my forthcoming open-source multiplayer game, but for now here’s the source code for anyone who wants something like this.

Source code is here: https://bitbucket.org/SteveSmith16384/simplephysicsforjme

Video of HelloSimplePhysics in action: https://www.youtube.com/watch?v=hLJgE911qXE

9 Likes

Really cool! A simple jME-specific physics library could be really useful.

The video looks a bit like when you don’t see the other players physics in multiplayer though :wink: Like you keep shooting at the boxes and the wall but nothing really happens “on my screen” :smiley:

1 Like

It looks to me like spatials are your game objects?! I would not have any spatial thing in a physic system as it is then hard or cumbersome to us with in a ECS or server. Just shape, position and rotation. Just a thought.

1 Like

Thanks, glad you liked it.

There’s no multiplayer in this demo, it’s just to show bouncing, collision and gravity. The multiplayer game is coming soon, but things like lag-compensation and client-correction are making things as difficult as I thought they would be, which is to say “very”.

1 Like

This did cross my mind, as if I could detach it from JME-specific code it could be more generic and used elsewhere. This would mean writing my own collision detection code though (not hard, but…) and as it is, in my multiplayer game at least, I used a headless JME server and all my physical entities have a spatial attached to them. Suggestions welcome though. :slight_smile:

1 Like

And exactly why it’s great that we already have something that handles that for you.

3 Likes

yeah exactly, it saved me all the headache I would have had doing this myself from scratch (I guess I never ever would have start with a multiplayer game without). I took the more advanced sim-eth-es as a base and customized it to my need, a great example with a simple physic system in it ECS based, I mean how cool is that :slight_smile:

2 Likes

Ditto

1 Like