Search Unity

  1. Unity 2019.4 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  3. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Feedback Fixed point number library for C#.

Discussion in 'Works In Progress' started by StormMuller, Mar 23, 2019.

  1. StormMuller

    StormMuller

    Joined:
    Jun 2, 2015
    Posts:
    12
    So I wanted to make an RTS and ran into the whole "deterministic lockstep" concept. Yossarian King has 2 great talks on the subject when creating Homeworld: Deserts of Kharak (Links in comments). Thing is I couldn't find any good fixed point libraries for C# so I decided to create one. Here's the github page. I'm posting it here for other's to use, learn from and possibly contribute to(because I know there are people way smarter than me at this).
     
    LazyGameDevZA and TonicMind like this.
  2. StormMuller

    StormMuller

    Joined:
    Jun 2, 2015
    Posts:
    12
  3. TonicMind

    TonicMind

    Joined:
    Nov 9, 2014
    Posts:
    1,211
    This is arguably pretty darn cool!
     
    StormMuller likes this.
  4. DinkyDev

    DinkyDev

    Joined:
    Jan 14, 2014
    Posts:
    31
    This is great. Thanks for sharing.

    I wonder if it's possible to create a fixed point math library that is Burst-friendly for extra fast processing. Perhaps fixed-point vector types too? What do you think?
     
    StormMuller likes this.
  5. StormMuller

    StormMuller

    Joined:
    Jun 2, 2015
    Posts:
    12
    I'll be honest, the new DOTS system is quite intimidating to me. So I haven't really used it yet. I saw that Unity's new multiplayer system, does support Lockstep out of the box.

    I'd be happy to work on the library again. I think fixed-point vector types could be quite easy to add.

    Any idea what I'd need to do to make the library burst-friendly?
     
  6. DinkyDev

    DinkyDev

    Joined:
    Jan 14, 2014
    Posts:
    31
    Ah yes... your goal was for lockstep, deterministic multiplayer - which Unity now appears to provide.

    I'm actually interested in fixed point math for deterministic, procedural generation - so that the same level/map/data gets generated on all platforms and processors from an initial seed.

    While I'm not entirely sure, it feels like it should be possible since the internal storage types for your classes are supported by Burst...

    But whether all your functions can be written in Burst friendly code, I don't know...

    EDIT:

    From this page: https://wiki.arcengames.com/index.p...y_Access_Starts!#So_Long.2C_Fixed-Int_Math.21

    They mentioned that moving away from Fixed Point Math, let them use SIMD optimised code in places - "This greatly improves the precision/accuracy, and in several cases also lets us use SIMD for actually better performance, too." Since this is what Burst is, it implies that maybe it can't all be made Burst friendly...
     
  7. spirachi77

    spirachi77

    Joined:
    Sep 26, 2017
    Posts:
    7
    I would love to use this! How so I implement this int unity 2019.3.15? And does it overwrite floats with fixed point values?
     
unityunity