Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determinism test expansion #42

Closed
RossNordby opened this issue Aug 17, 2018 · 5 comments
Closed

Determinism test expansion #42

RossNordby opened this issue Aug 17, 2018 · 5 comments

Comments

@RossNordby
Copy link
Member

The current test (DeterminismTest) is pretty weak. It covers the universally shared bookkeeping, but fails to capture many complex types.

Probably wise to allow it to evaluate any generic demo.

@ip
Copy link

ip commented Aug 17, 2018

Hi! I'm looking for some library for deterministic collision detection for my Unity game. I found the v. 1 fork of BEPUphysics which uses fixed-point math (via FixedMath.Net) but it seems to be abandoned.

It's interesting that you're actively developing version 2 now. Do you plan to support fixed-point determinism? I'm saying fixed-point, because this is probably the only way to reliably get the same results across all platforms.

My use case is following. I want to record game replays on the client side and replaying them on client and server side for these reasons:

  • validating replays on server, and then submitting a high-score from the server side, i.e. cheating protection
  • online gallery of user replays

Deterministic lock-step approach would allow me to store lots of replays, because I would only need to store inputs. I need collision detection only (kinematic bodies).

@RossNordby
Copy link
Member Author

RossNordby commented Aug 17, 2018

Cross platform determinism is something I'd like to do, but which I can't realistically devote the necessary time to for the short-medium term at least.

This would have to come after a move towards abstracted SIMD scalars. Right now, all SIMD math is implemented on top of Vector and friends which exposes a small shared set of features. For performance and functionality, I'd like to eventually implement some form of ScalarWide type on top of the newer low level intrinsics (https://github.com/dotnet/corefx/issues/22940). With that in place, I could create a fixed point implementation of scalars behind a compilation symbol.

Fixed point would require some more work beyond that, though- all the instances of non-SIMD floats would need to be swapped out too.

All of this requires some codegen improvements in the compiler so that the abstractions would be zero overhead without spewing ifdefs everywhere. That puts a lower bound on the timeline.

@ip
Copy link

ip commented Aug 17, 2018

A simpler and easier solution might be code generation (transpiling), like they do in web development (e.g. TypeScript to JavaScript, also popular in Golang community). Entitas ECS library uses this approach as well.

@RossNordby
Copy link
Member Author

That's an option I've considered occasionally, but it can introduce some tooling annoyances. The minimal effort and maximum usability path is just having a JIT or other compiler which is able to deal with structs (and ideally operators) with equivalent final assembly to a dedicated code generation pass.

Fortunately, this appears to be an area of focus in the CoreCLR/CoreRT and will probably be addressed before I get around to working on it anyway. Unity is a bit of an unknown, but there are even more issues there. (unless they swap to using the core runtimes wink wink nudge wiggly eyebrows come on you know you want to guys)

@RossNordby
Copy link
Member Author

Determinism test has been expanded and a whole bunch of bugs have been fixed as of 565713e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants