Forum C# [Contribution] 2D Physics library that totally works

[Contribution] 2D Physics library that totally works

Postby qugengames » October 22nd, 2018, 1:14 am

TLTR: 2D Physics engine that works in both PlayerIO servers and any game engine client, pure C# code without static variables, unsafe code, or dependency on third party libraries, will post the link once GitHub works again, but I want to see who is interested in this.

Hi, my name is Oscar and I'm an indie developer, I'm the creator of Nukes of Bastion (For those interested http://www.nukes-of-bastion.com/) for Android and PC a few months back.

First of all thank you to PlayerIO for letting the world use your infrastructure and multiplayer solution free for up to 500 players, that's great for indie developers, and sure lets you grow your capabilities once you grow with your game and incomes, it was a top feature that made my mind on choosing work with you.

Over the last few months I was looking for a 2D Physics library over the web that would work with PlayerIO.
As you may already know, in order to put C# code into PlayerIO it must not use unsafe code , use static variables, or have any kind of reference to other .DLL external libraries, which many Physics libraries will heavily use.

Not only that, but the general advise from the community and PlayerIO staff is to use client side Physics, which IMHO this is a rather non-commercial advise, but I don't want this to be the main point of discussion and rather focus on the contribution background.

I couldn't follow that advise because I wanted to simulate Physics on both the client and the server, but the server being authoritative so synchronization and prediction could be used to smooth gameplay and prevent cheating at the same time, of course, such topics are another discussion, and even for that, I have created a neat library solution that lets you code in a single file for it to be used at both client and server solutions making it easier to code a multiplayer game.

After hundred of painful hours trying to adapt different open source 2D Physics engines to work with PlayerIO, the outcomes would be libraries working on PlayerIO with wrong results, or libraries simply too dependent on unsafe code or third party libraries to be feasible to use.

Then, I found Jitter Physics 2D port https://github.com/mattleibow/jitterphysics/, it didn't use unsafe code and was not dependent in third party libraries for mathematics but rather use it's own C# code for what it required,

I spent several hours removing static variables and adapting code, and finally got it working.

If you are interested on using this 2D Physics library that works at both the server and client leave your comments, once GitHub works back again I will upload the code, my goal would be to start a contribution synergy as JitterPhysics developers have stopped working on this port, there is no documentation available and it would be great for PlayerIO community interested developers to have access to this port and contribute.

EDIT: Here you can find the source and collaborate: https://github.com/OscarITMX/PlayerIO-jitterphysics

Thanks
Last edited by qugengames on November 17th, 2018, 10:41 pm, edited 1 time in total.
qugengames
 
Posts: 36
Joined: April 24th, 2018, 11:19 pm

Re: [Contribution] 2D Physics library that totally works

Postby Henrik » November 3rd, 2018, 10:11 pm

Hey Oscar,

That is amazing work!
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: [Contribution] 2D Physics library that totally works

Postby qugengames » November 17th, 2018, 10:40 pm

Henrik wrote:Hey Oscar,

That is amazing work!


Hello Henrik!
I have uploaded the source:
https://github.com/OscarITMX/PlayerIO-jitterphysics

I'm still working in the documentation, but I'm already working in the game and integrated physics with PlayerIO :)
This is a video demonstration https://youtu.be/q-9gx7qKoJk, there the player moves using RigidBody and is synchronized across client and server on PlayerIO
qugengames
 
Posts: 36
Joined: April 24th, 2018, 11:19 pm

Re: [Contribution] 2D Physics library that totally works

Postby ruzippizur » February 28th, 2020, 2:10 am

This is great, thanks for sharing. It would be nice to have some basic examples.
ruzippizur
 
Posts: 8
Joined: June 14th, 2019, 10:33 am

Re: [Contribution] 2D Physics library that totally works

Postby lindagm123 » June 24th, 2022, 3:05 am

Thank you for sharing this useful information, I will definitely test it in the future subway surfers
lindagm123
 
Posts: 2
Joined: June 23rd, 2022, 5:02 am

Re: [Contribution] 2D Physics library that totally works

Postby gemmalyly » August 16th, 2022, 3:03 am

The library uses Box2D as its underlying physics engine, so all you need to do is set up your project, add Box2D.h, and then include the other headers in your code.
nerdle
gemmalyly
 
Posts: 2
Joined: August 16th, 2022, 3:01 am

Re: [Contribution] 2D Physics library that totally works

Postby Chris80 » August 17th, 2022, 8:07 am

I think it will be loved by many people including me, I also love this library. Thank you for sharing! fnf
Chris80
 
Posts: 1
Joined: August 17th, 2022, 7:59 am


Return to C#