ID:2177034
 
(See the best response by Kaiochao.)
Code:
Nothing here but us ferrets!


Problem description:
Forgive me if it is the wrong place to post this, but there's a curious question that I've been wondering about for the longest time.

Are there any future plans to:
Remove the 1GB limit? (Thinking of the future of my project)
Remove the limit on atoms? (Again, thinking of the future)
Remove the need for scientific notation for numbers above 999,999/use 32 bit integers? (Funny story about this one; I was making a platinum/gold/silver/copper currency system with 100 coins equaling 1 of the next tier. Then I tried implementing an Everquest-style currency changing system. Above 200 plat, everything went south and it really got disastrous at higher values! Of course I have another approach that should prevent that, but it's still an interesting question nonetheless)

It'd be interesting to hear your response!
If you're hitting size limits, consider using multiple smaller servers instead of one insanely large server. I'm pretty sure most MMOs do this.

Scientific notation is the default conversion from numbers (with at least 6 digits iirc) to text. Use num2text() to convert without scientific notation.
In response to Kaiochao
Kaiochao wrote:
If you're hitting size limits, consider using multiple smaller servers instead of one insanely large server. I'm pretty sure most MMOs do this.

Scientific notation is the default conversion from numbers (with at least 6 digits iirc) to text. Use num2text() to convert without scientific notation.

You can have multiple Dream Daemon instances communicate with another?! I mean I know it was possible but it seemed that it wouldn't work; MMOs separated into zones typically disconnect from the old zone server and connect to the new zone server. From what I know BYOND doesn't allow for you to do that; the furthest you could get was you can disconnect from the same server instance but reconnect to the same server instance only (perhaps due to the requirement to play an ad before the game starts most of the time?). If there are methods to do this then do give me the details!

Now as for the scientific notation, I've been hitting issues and nasty surprises when I get into numbers bigger than 999,999. I found that there is actually number/precision(?) loss when numbers get high and I figured it was because of some scientific notation conversion or...something.

For instance,

if (123456000000 > 99999999)


will always return FALSE--Oh wait.

(Aaaaand I just realized my folly with that statement as SOON as I finished typing that up; that method I used when there are big numbers actually does go over the 32 bit max integer of 4294967296 so weird things are bound to happen--like it giving you a number that has a decimal point in it that is effectively smaller than the number you supplied. So that in essence is my derp right there. Leaving it here though since other people may find it useful to know).

This one though is the weird one that got me as it does not go over the 32-bit maximum integer and I was wondering if there's a 24-bit limit instead.
Each platinum piece is worth 100 gold, each gold piece is worth 100 silver, and each silver piece is worth 100 copper. At 300 plat and 17 gold, you would get a total of 300,170,000 (or (300 * 1,000,000) + (17 * 10,000) ).

BYOND instead gives me a total of 300169984; you can bet this had me triple-checking my code. This also was still below the 32-bit limit (but not below the 24-bit number threshold but I think Ter13 said the number limit was somewhat shy of that. Oddly enough 300,000,000 will provide the correct result but anything in between that and 200,000,000 or 400,000,000 will not work).


Edit: Hoooooooly cow, okay. I think I may have found a bug.
This code:

if (total > 99999999) total = 99999999


will actually set total to 100000000. Setting the number to 9999999 will have no issues, however.
Best response
You can transfer clients between worlds using link().
You can communicate between worlds using world.Export() to send text and/or a file, world.Topic() to receive text, and world.Import() to receive a file.

All numbers in BYOND are represented in 32-bit floating-point, not as integers. This means that the best representation of 9.9999999E7 is a string of 32 binary digits (bits) that actually represents 1E8. There's no bug.

There are libraries to handle arbitrary-size numbers if you really need to, but it's probably easier to just work with gold, silver, and copper in a way where you can never have 100 copper or silver. You shouldn't ever have to convert all your gold and silver into copper in the code (players aren't going to want to look at how many equivalent copper coins they have, and neither should be programmer), so you shouldn't be encountering numbers that large (until the player manages to get over a billion gold pieces, in which case, you might want to balance the economy better, or introduce a larger denomination).
In response to Kaiochao
Kaiochao wrote:
You can transfer clients between worlds using link().
You can communicate between worlds using world.Export() to send text and/or a file, world.Topic() to receive text, and world.Import() to receive a file.

Holy shit. So a server browser should be pretty easy to code up. :O
In response to Kaiochao
Kaiochao wrote:
You can transfer clients between worlds using link().
You can communicate between worlds using world.Export() to send text and/or a file, world.Topic() to receive text, and world.Import() to receive a file.

All numbers in BYOND are represented in 32-bit floating-point, not as integers. This means that the best representation of 9.9999999E7 is a string of 32 binary digits (bits) that actually represents 1E8. There's no bug.

There are libraries to handle arbitrary-size numbers if you really need to, but it's probably easier to just work with gold, silver, and copper in a way where you can never have 100 copper or silver. You shouldn't ever have to convert all your gold and silver into copper in the code (players aren't going to want to look at how many equivalent copper coins they have, and neither should be programmer), so you shouldn't be encountering numbers that large (until the player manages to get over a billion gold pieces, in which case, you might want to balance the economy better, or introduce a larger denomination).

Well holy wow. Did a quick test of the link proc, and it does work. Sadly, link does not work for clients connected via Command() (read: third-party MUD clients; I'm making a MUD as well). That may be a wee bit problematic... The only workaround I can think of in that case would be to design a structure that would bounce topics and exports between worlds and have people connect to a central "hub" world and manage information through that.

This is going to get nuts.
Yeah, link() won't work for people on telnet clients, but it does work for Dream Seeker.

Regarding the number thing with scientific notation: numbers converted to text typically just use a basic printf() behind the scenes, so they tend to use scientific notation if they have more than 6 significant figures. However numerical accuracy falls past a certain point, because BYOND uses 32-bit floating point numbers. If you have a stat like gold or something that could get into the range where integers are no longer accurately represented in single-precision floating point, then I would recommend switching to a big number system. Popisfizzy did some work on a big number library.
In response to Kaiochao
Kaiochao wrote:
You can transfer clients between worlds using link().
You can communicate between worlds using world.Export() to send text and/or a file, world.Topic() to receive text, and world.Import() to receive a file.

Huh. I already knew this was possible but never realized it was that simple.