Skip to main content
GameDev.net gamedev.net
🔒 Locked

GUID Creation

Started by davidgi Oct 11, 2005 at 12:48 PM 3 replies 650+ views
Original Post
davidgi
davidgi
Anyone out there ever implemented a GUID (Globally Unique Identifier) generator? This is a globally unique 128-bit number that can be created on any machine such that it doesn't ever create duplicates. Or at least the probability that it will create a duplicate is astronomical. We need a function that will work on Xbox360. Thanks, Dave
Washu
Washu
Nope, always used UuidCreate or CoCreateGuid (both part of Win32). You might want to look into those functions to see if they are available.
In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
SunTzu
SunTzu
Edit - speaking too soon!
outRider
outRider
Use the date/time plus some manipulation. Don't just use date/time if you want persistent GUIDs as the chances of getting a unique ID are decreased because if the system loses power the date/time resets (on the Xbox anyway, don't know about the 360).

Try something like: 0xFFFFSMHDYYYYRRRR

TimeInSecsSinceBoot:Second:Minute:Hour:Day:Year:Random

and maybe throw in some XORS or something if needed. Time in secs since boot is probably the same function in the 360 SDK as it was in the Xbox SDK.
EliasAE
EliasAE
Maybe RFC 4122 will give you some information about how to implement GUIDs. It even has a sample implementation at the end, which you could use.

If people come up with their own non-standard algorithms, there is a greater chance of collisions.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.