We have a somewhat new problem to consider in our project.
Picture GGS as a 'cloud' of computers, where we can add and remove computers as we wish. Now consider adding a game client (player) on node A of the cloud. At the same time, add a new player on node B. These two players need to be distinctly identifiable from each other. This means, we can not simply give each player a pseudorandom number from 1-1000, or even a sequential number from 1-1000, because we will have clashes after a while.
To solve this, we first considered using Erlang's
make_ref() function, however, we encountered several issues with this:
- The refs are not really intended to be sent over network in binary form (or so it seems at least)
- When converted to binary, they are quite large
- According to [1], they are unique to "approximately 2^82 calls" - which is a bit vague.
So, looking beyond make_ref(), we found
UUIDs, which have more appealing properties:
- It is designed to be used over a network [2]
- It is designed to be used for objects with a long life [2]
We will proceed the project with UUIDs as out identifiers, both internally in the system, and externally towards the clients. If needed, we could even salt the UUIDs a bit, but I personally don't think we will need to.
References
- http://www.erlang.org/doc/man/erlang.html#make_ref-0
- http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt
No comments:
Post a Comment