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 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, 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:

Last edited by qugengames on November 17th, 2018, 10:41 pm, edited 1 time in total.
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!
Posts: 1877
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:

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, there the player moves using RigidBody and is synchronized across client and server on PlayerIO
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.
Posts: 8
Joined: June 14th, 2019, 10:33 am

Return to C#