asik / FixedMath.Net

Fixed point math C# library
Other
591 stars 126 forks source link

FixedMath.Net with Net 3.5 (Unity3D) #7

Closed mrwellmann closed 8 years ago

mrwellmann commented 8 years ago

I'm trying to use the Fix64 in a Unity game project. Unity supports only .NET 2.0/3.5 era functionality. So I changed the project to .NET 3.5. After commented out unused "using System.Numerics" and "using System.Threading.Tasks" it was only "MethodImplOptions.AggressiveInlining" which was not available for .NET 3.5. After running the tests only the Sin() of Fix8 failed. So Fix64 seems to be working on .NET 3.5.

Do you think there might be any problems even the tests run through? Will the missing "MethodImplOptions.AggressiveInlining" be a big performance issue?

Thanks for your work! I keep you updated on the progress if your interested :-)

Cheers, Markus

asik commented 8 years ago

I think there should be no issue. It's been a while but I think I put most of these inlining attributes "just in case". There is some timing code in the unit tests which you could use for comparison testing but it's not very accurate.

I'm thinking of cleaning up the code and making this into a nuget package. Game programming is definitely a major use case for this, and compatibility with Unity would be important, so thanks for bringing that up.

Could you describe what your use case is for this library and why Single/Double/Decimal don't fit the bill? Multiplayer determinism I suppose? Just curious.

mrwellmann commented 8 years ago

It's for multiplayer multiplatfom compatibility/determinism (^.^) It's a round based game where you can plan a few seconds of your move by choosing to (de)activate your Truster or weapon any time during those seconds. Players are able to scrub a slider similar to a video editing program, to see and edit their move.

I'm basically going to replace all floating point in the Farseer Physics Engine for this purpose. I hope this will turn out successful^^

Depending on how successful there will be soon a alpha coming out http://heart-of-scrap.com/alpha-invite/

johnyK commented 8 years ago

hey, last month I had exactly the same idea, I managed to integrate FixedMath to the Farseer physics, some math functions like pow, exp, log were added. Results are deterministic but dont expect amazing performance :) Release build for iOS had some amazing gains compared to debug. I am thinking to make it an asset for asset store, deterministic 2d physics is missing after all ;)

You can come in touch with me and be a alpha/beta tester if you want!

Regards, John

Sent from my iPhone

On 03 Jun 2016, at 10:16, mrwellmann notifications@github.com wrote:

It's for multiplayer multiplatfom compatibility/determinism (^.^) It's a round based game where you can plan a few seconds of your move by choosing to (de)activate your Truster or weapon any time during those seconds. Players are able to scrub a slider similar to a video editing program, to see and edit their move.

I'm basically going to replace all floating point in the Farseer Physics Engine for this purpose. I hope this will turn out successful^^

Depending on how successful there will be soon a alpha coming out http://heart-of-scrap.com/alpha-invite/

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

mrwellmann commented 8 years ago

It seems we modified our Farseer to some extend so I'd have to integrate that. My lead programmer isn't sure wich would be better. At least what I think your port to Fix64 will possibly be more reliable than mine. If it is okay for you I would check your implementation out and let you know which way we go. My lead said buying the asset woun't be a problem.

johnyK commented 8 years ago

I could give it to you in order to test it and tell me if it fits your game’s needs. Its not 100% complete as a final product and I needed a crash test (like your game) to check about the current state of the product.

You can add me in Skype:

jk.kamp2

On 03 Jun 2016, at 12:05, mrwellmann notifications@github.com wrote:

It seems we modified our Farseer to some extend so I'd have to integrate that. My lead programmer isn't sure wich would be better. At least what I think your port to Fix64 will possibly be more reliable than mine. If it is okay for you I would check your implementation out and let you know which way we go. My lead said buying the asset woun't be a problem.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/asik/FixedMath.Net/issues/7#issuecomment-223528516, or mute the thread https://github.com/notifications/unsubscribe/AArEPxwc7O4v1GZUZ_UPjlatJB5Nykivks5qH-4_gaJpZM4IsVK7.

asik commented 8 years ago

There's nothing actionable here so, closing.