Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Size limit  (Read 2927 times)

Dwarf4Explosives

  • Bay Watcher
  • Souls are tasty. Kinda like bacon.
    • View Profile
Size limit
« on: January 18, 2015, 09:39:51 am »

So, as many modders have found, there's a size limit (for creatures) of approximately 2 billion cubic centimeters. Is this a direct result of the way the game works, or is it a cap that Toady has placed there on purpose?
Logged
And yet another bit of proof that RNG is toying with us. We do 1984, it does animal farm
...why do your hydras have two more heads than mine? 
Does that mean male hydras... oh god dammit.

StupidElves

  • Bay Watcher
  • I coveted that wind, I suppose.
    • View Profile
Re: Size limit
« Reply #1 on: January 18, 2015, 10:02:30 am »

I think that this would be better suited in the modding section. But I do think that it is probably both.
Logged
Accidentally made over 5000 copper maces once. I have no idea how that happened.

GENERATION 29:
The first time you see this, copy it into your signature on any forum and add 1 to the generation. Social experiment.

Bloax

  • Bay Watcher
    • View Profile
Re: Size limit
« Reply #2 on: January 18, 2015, 10:18:18 am »

Two billion is just about 2^31, which would make it pretty much at the edge of 32-bit math - and also likely why everyone is seeing overflows when creatures get bigger than that, since 2^32 is 4.294967 billion.

If you want a reference on just how big two billion is, then it's a 12.59 meter cube - with humans being a 41.21 centimeter cube - or simply put a cube 30 times larger than a human.
Of course that's not stupendously huge, but it's still absolutely massive. (And mind you, that statue is only ~30 meters tall, so it's probably somewhere along 16 times larger than a human.)
« Last Edit: January 18, 2015, 10:26:02 am by Bloax »
Logged

oh_no

Dwarf4Explosives

  • Bay Watcher
  • Souls are tasty. Kinda like bacon.
    • View Profile
Re: Size limit
« Reply #3 on: January 18, 2015, 10:31:31 am »

So it's limited by the game mechanics then. That's what I thought. Too bad. I'm guessing that will change though if Toady ever figures out how to make DF 64-bit.
« Last Edit: January 18, 2015, 10:34:04 am by Dwarf4Explosives »
Logged
And yet another bit of proof that RNG is toying with us. We do 1984, it does animal farm
...why do your hydras have two more heads than mine? 
Does that mean male hydras... oh god dammit.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Size limit
« Reply #4 on: January 19, 2015, 01:58:45 am »

Having a 64-bit integer has nothing to do with your program itself being 32-bit.

utunnels

  • Bay Watcher
  • Axedwarf
    • View Profile
Re: Size limit
« Reply #5 on: January 19, 2015, 02:17:03 am »

Two billion is just about 2^31, which would make it pretty much at the edge of 32-bit math - and also likely why everyone is seeing overflows when creatures get bigger than that, since 2^32 is 4.294967 billion.

If you want a reference on just how big two billion is, then it's a 12.59 meter cube - with humans being a 41.21 centimeter cube - or simply put a cube 30 times larger than a human.
Of course that's not stupendously huge, but it's still absolutely massive. (And mind you, that statue is only ~30 meters tall, so it's probably somewhere along 16 times larger than a human.)

Which is about 28000 times bigger than a human in volume. Imagine a crowd of 28000 soldiers fighting a colossus this size?
Logged
The troglodyte head shakes The Troglodyte around by the head, tearing apart the head's muscle!

Risen Asteshdakas, Ghostly Recruit has risen and is haunting the fortress!

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
Re: Size limit
« Reply #6 on: January 19, 2015, 08:35:22 am »

It would be nice for there to be an integer cap to prevent overflow, so we wouldn't get things like semighostly giant sperms whales.

Dwarf4Explosives

  • Bay Watcher
  • Souls are tasty. Kinda like bacon.
    • View Profile
Re: Size limit
« Reply #7 on: January 19, 2015, 10:57:59 am »

Having a 64-bit integer has nothing to do with your program itself being 32-bit.
So is there a specific reason why Toady chose to use 32-bit math for size calculations? I don't know all that much about programming, to be honest.
Logged
And yet another bit of proof that RNG is toying with us. We do 1984, it does animal farm
...why do your hydras have two more heads than mine? 
Does that mean male hydras... oh god dammit.

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Size limit
« Reply #8 on: January 19, 2015, 11:11:06 am »

It would be nice for there to be an integer cap to prevent overflow, so we wouldn't get things like semighostly giant sperms whales.
C-like languages get their good runtime performance by not checking things like this.  You can allocate an array of ten items and reference the fifteenth without throwing in error.  Of course this can lead to Bad Things, but when the program is written "properly" then the lack of checks makes things run faster.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Uronym

  • Bay Watcher
    • View Profile
Re: Size limit
« Reply #9 on: January 19, 2015, 01:53:38 pm »

Having a 64-bit integer has nothing to do with your program itself being 32-bit.
So is there a specific reason why Toady chose to use 32-bit math for size calculations? I don't know all that much about programming, to be honest.

He probably wasn't thinking too hard about it. He probably thought it was quite large enough at the time. 32-bit is the standard size for integers, pretty much.
Logged
What I think we're saying is we need dwarves to riot and break things more often.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Size limit
« Reply #10 on: January 19, 2015, 04:34:47 pm »

Having a 64-bit integer has nothing to do with your program itself being 32-bit.
So is there a specific reason why Toady chose to use 32-bit math for size calculations? I don't know all that much about programming, to be honest.

probably something simple like "nah, it doesn't need to be a long long".

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: Size limit
« Reply #11 on: January 20, 2015, 07:12:31 am »

64-bit integer calculations on a 32-bit processor come with a significant performance penalty, particularly with multiplication* or division. Add to that the double memory cost, and you only use 64-bit numbers when you have to.

*multiplying 32-bit * 32-bit = 64-bit result is actually an instruction in x86, but 64-bit values actually in the multiply is bad

On a 64-bit processor (or using extensions like SSE that can natively handle 64-bit numbers) this is much less of an issue.
« Last Edit: January 20, 2015, 09:33:40 am by Thief^ »
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

TheDarkStar

  • Bay Watcher
    • View Profile
Re: Size limit
« Reply #12 on: January 20, 2015, 08:23:36 pm »

If you divided the size of everything by something (like 10 or 100), could you get bigger creatures?
Logged
Don't die; it's bad for your health!

it happened it happened it happen im so hyped to actually get attacked now

Uronym

  • Bay Watcher
    • View Profile
Re: Size limit
« Reply #13 on: January 20, 2015, 08:30:35 pm »

If you divided the size of everything by something (like 10 or 100), could you get bigger creatures?

Of course. It might mean a lot of changes in the code, though, depending on how he did it. Or not.
Logged
What I think we're saying is we need dwarves to riot and break things more often.

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: Size limit
« Reply #14 on: January 21, 2015, 05:29:52 am »

If you divided the size of everything by something (like 10 or 100), could you get bigger creatures?
You'd have to make sure that weights and strengths and densities were proportionally correct, but sure.
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.