Page 1 of 1

[Poll] How many room numbers do you need?

Posted: Sun Jun 19, 2016 1:19 pm
by SlySven
The data type used inside Mudlet to store room ids is currently coded to be an "int" although we do not allow negative ones. I was looking to clean up some aspects of the Application and - as this data type need not necessarily be the same size on all platforms am looking to define it to something more explicit.

I was looking to use a 64-bit data type which would allow valid room numbers to be in the range 1 to 9,223,372,036,854,775,807 - however that might be a bit more than is necessary; if I instead choose a 32-bit data type (which will be more compact and possibly faster on some systems) this would restrict the range to be: 1 to 2,147,483,647. Given that my experiences with a map with only around 2.2 Million rooms (i.e. around one thousandths of the second value) suggests that over 4GByte of system memory is needed to hold a map of THAT size currently I am beginning to think that mayhaps the second smaller limit will be more than adequate. :D

Any thoughts - either way - anyone? :ugeek:

EDIT {2016-06-023} Humm, 64-bits won't work in Lua 5.1 as that larger value needs too many bits to store discrete integral values within the "double" floating point number UNLESS the additional LNUM patch is also compiled into the lua subsystem (see this Stack Exchange answer)...

The prototype code I came up with before I discovered this allowed me to create and use a room with an id of 9,012,345,678,901,234,567 but it was indistinguishable from a room number of 9,012,345,678,901,234,560 or 9,012,345,678,901,234,580...!