Zemanzo / web-marbles

Aims to recreate Marble Racing from the ground up, as a fully web based game
https://playmarbl.es/
GNU General Public License v3.0
23 stars 12 forks source link

Non-unique UUIDs when loading a project #160

Open Zemanzo opened 5 years ago

Zemanzo commented 5 years ago

Expected behavior All IDs present in the editor are unique.

Actual behavior The IDs loaded from a project are not added to the lookup table that is kept internally, thus it would be possible to generate a duplicate ID.

Reproduction steps I mean, it's pretty damn hard to replicate this, but one day someone will come across this and flail their arms around yelling that our stuff is broken.
Anyway, you'd probably be best off by doing the following:

  1. Open the editor.
  2. Generate of a ton of objects.
  3. Save the project.
  4. Come back around the same time the next day (it's time based, yes).
  5. Load the project.
  6. Generate another object, and check its UUID matching another object that is loaded from the project file.

Workaround Reload the page and load your project again. Hope you're more lucky this time.

Additional context Add used IDs to the lookup in generateTinyUUID.js or think of something else fancy.