Giter Site home page Giter Site logo

Comments (4)

rcelyte avatar rcelyte commented on August 10, 2024

Would it be fine to just have GUIDs count up from zero, or do they need to remain unique across server restarts?

from beatuprcelyte.

roydejong avatar roydejong commented on August 10, 2024

It would be better if it was globally unique, so if there's another instance of BeatUpServer their session IDs don't overlap.

For context, each GUID is supposed to uniquely reflect a single gameplay session and their results, for example:
https://bssb.app/results/9e1efb8a-1b53-4526-ab5e-8c3aa39911ed

If you're able to do the equivalent of Guid.NewGuid that would be perfect.

from beatuprcelyte.

rcelyte avatar rcelyte commented on August 10, 2024

I can't really enforce globally unique IDs across different instances (including vanilla & BeatTogether). It would be much more reliable to additionally index them by master server hostname/address.

from beatuprcelyte.

roydejong avatar roydejong commented on August 10, 2024

I understand you can't 100% guarantee or enforce that, but the point of a randomly generated GUID is that the chance of overlap is effectively zero.

For context:

[..] the number of random version-4 UUIDs which need to be generated in order to have a 50% probability of at least one collision is 2.71 quintillion [..]

With an implementation that counts up, overlap is guaranteed and more likely to cause eventual conflicts even if I do index it by server address (example: if the server resets its counter).

It's a well accepted practice to treat randomly generated GUIDs as unique, and I think that's the most appropriate solution here.

from beatuprcelyte.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.