Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [AGK] UUID V4 PRNG

Author
Message
nachoz12341
1
Years of Service
User Offline
Joined: 18th Aug 2022
Location:
Posted: 22nd Nov 2023 18:16
Hello everyone, made this snippet for a multiplayer server system I was developing. It's pretty straight forward, generates a new UUID String according to the v4 spec

nachoz12341
1
Years of Service
User Offline
Joined: 18th Aug 2022
Location:
Posted: 22nd Nov 2023 18:31
UUID's are a great tool if you need a way to uniquely identify a resource. Let's say for example you have 100 different player defined types in a list, you can give them each a uuid to tell them apart and reference a specific instance. This approach relies entirely on pseudo random number generation and each individual bit is generated with a Random(0,1) call then converted to hex. Notice as well that we assign specific values in the same position everytime. This is because uuid's actually reserve a few bits to indicate what type of uuid it is.

Wanted to post my source for how this was generated: https://digitalbunker.dev/understanding-how-uuids-are-generated/
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Jan 2024 20:01
I think I asked you this on discord back in november, but what's the likely hood of generated a duplicate if this were run from multiple systems? Like if I wanted each client to generate an ID and submit that to the server.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda
Pixel-Perfect Collision

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Login to post a reply

Server time is: 2024-02-24 07:08:05
Your offset time is: 2024-02-24 07:08:05