Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: atom smash memory test..  (Read 10370 times)

MrGimp

  • Bay Watcher
    • View Profile
    • WMP Web Design
Re: atom smash memory test..
« Reply #15 on: May 27, 2009, 01:05:35 pm »

Quote
If you're still gonna do it, mod your dwarves with this:
[NOEAT][NOSLEEP][NODRINK][SPEED:1]
That'll get rid of all that unnecessary slacking going on.

You might also try using the correct tokens:

Code: [Select]
[NO_DRINK]
[NO_EAT]
[NO_SLEEP]

Just ribbin' ya, I'm a nice~guy~

But yeah that's a common mistake, underscores are important.

On the dwarf wiki some 'NO' tags have underscores, some dont.  I was under the impression that Toady and Tarn had just not been 100% consistent in a naming scheme for variable declarations.  Will it really work either way? 
Logged
Thus ends the official written history of the fortress known as Boatmurdered. May their tortured souls rest in peace.

Kindjie

  • Bay Watcher
    • View Profile
Re: atom smash memory test..
« Reply #16 on: May 27, 2009, 01:09:33 pm »

Don't you simple need to exceed the bit cycle, as in dumping over 36 000 somethng stones to get into the negativ's?

It's a lot more than 36000.  I've had as many as 80,000 at one time.

On Windows, int has a maximum value of 2147483647, unsigned int has a maximum value of 4294967295.

...Good luck. :P
Logged

Draco18s

  • Bay Watcher
    • View Profile
Re: atom smash memory test..
« Reply #17 on: May 27, 2009, 02:01:33 pm »

Don't you simple need to exceed the bit cycle, as in dumping over 36 000 somethng stones to get into the negativ's?

It's a lot more than 36000.  I've had as many as 80,000 at one time.

On Windows, int has a maximum value of 2147483647, unsigned int has a maximum value of 4294967295.

...Good luck. :P

But a rock isn't an integer (number of rocks, yes, in which case: good luck).
Logged

Noble Digger

  • Bay Watcher
    • View Profile
Re: atom smash memory test..
« Reply #18 on: May 27, 2009, 02:41:13 pm »

Quote
On the dwarf wiki some 'NO' tags have underscores, some dont.  I was under the impression that Toady and Tarn had just not been 100% consistent in a naming scheme for variable declarations.  Will it really work either way?

No, sorry for the confusion, they require you to use the correct tag as Toady created it. It just happens that these 3 tags all use NO_X instead of NOX.
Logged
quib·ble
1. To evade the truth or importance of an issue by raising trivial distinctions and objections.
2. To find fault or criticize for petty reasons; cavil.

Eagle

  • Bay Watcher
  • [LARGE_ROAMING]
    • View Profile
Re: atom smash memory test..
« Reply #19 on: May 27, 2009, 03:42:51 pm »

Quote
On the dwarf wiki some 'NO' tags have underscores, some dont.  I was under the impression that Toady and Tarn had just not been 100% consistent in a naming scheme for variable declarations.  Will it really work either way?

No, sorry for the confusion, they require you to use the correct tag as Toady created it. It just happens that these 3 tags all use NO_X instead of NOX.

Yeah, i know, i just hate underscore with a vengeance. Godsdammit, let me use proper spaces.

Kindjie

  • Bay Watcher
    • View Profile
Re: atom smash memory test..
« Reply #20 on: May 27, 2009, 04:35:44 pm »

Don't you simple need to exceed the bit cycle, as in dumping over 36 000 somethng stones to get into the negativ's?

It's a lot more than 36000.  I've had as many as 80,000 at one time.

On Windows, int has a maximum value of 2147483647, unsigned int has a maximum value of 4294967295.

...Good luck. :P

But a rock isn't an integer (number of rocks, yes, in which case: good luck).

I was replying to the post about using integer overflow to crash the game by manipulating the number of rocks. If the numbers of items are stored as integers, then you can do that by having 0x7FFFFFFF rocks and adding another, overflowing to the sign bit (actual behaviour is undefined, but this is a common way of handling it), resulting in a negative number of rocks (which makes no sense and will probably crash). If the game uses unsigned integers, then you'd need to get up to 0xFFFFFFFF rocks and add another, which will overflow to 0 according to the C++ standard.
Logged

Dae

  • Bay Watcher
    • View Profile
Re: atom smash memory test..
« Reply #21 on: May 27, 2009, 04:52:25 pm »

A well-designed program wouldn't crash on such a trivial thing. I honestly doubt DF will.
Logged

sneakey pete

  • Bay Watcher
    • View Profile
Re: atom smash memory test..
« Reply #22 on: May 27, 2009, 05:30:30 pm »

I also doubt DF would crash if there was a negative number of rocks.

Heck, in my fort there was schist -2789 (or something) away, always at the top of my list for constructions. Forbidding it fixed the problem! :P
Logged
Magma is overrated.

Kindjie

  • Bay Watcher
    • View Profile
Re: atom smash memory test..
« Reply #23 on: May 28, 2009, 12:49:16 pm »

A well-designed program wouldn't crash on such a trivial thing. I honestly doubt DF will.

You'd be surprised... Checking for overflow is non-trivial and would introduce a branch, which can be disastrous if you care about performance. If you're lucky the compiler will optimize it, but I usually leave any checks out in a release build and pray/check the math that it can't happen instead. Meaning, if you do have the patience to generate that many rocks you'll probably run into undefined behaviour, which might not make it crash. It could potentially do anything. Most compilers these days handle it rather gracefully by just wrapping to zero, however. :P
Logged

Alfador

  • Bay Watcher
  • Dangerous Lunatic
    • View Profile
Re: atom smash memory test..
« Reply #24 on: May 28, 2009, 04:20:41 pm »

How many rocks CAN you have available to mine out in a max size fortress? Keep in mind the absolutely insanely high cliffs some people have found...
Logged
This is a fox skull helmet. All craftsdwarfship is of the highest quality. It menaces with spikes of fox bone and is encircled with bands of fox leather. This item is haunted by the ghost of Alfador Angrorung the fox.

Eagle

  • Bay Watcher
  • [LARGE_ROAMING]
    • View Profile
Re: atom smash memory test..
« Reply #25 on: May 28, 2009, 04:28:51 pm »

Well, lets see:

16x16 embark

Each of those 1x1 is 48x48 tiles. Total of 589824 tiles. Then, a minimum of 15 z levels (for a perfectly flat embark). So, 8847360 tiles. Then, you have to take into account above ground cliffs (highest ive heard of was someone who had about 150 z's), extra underground z levels due to valleys, and the fact that miners sometimes dont leave a stone upon digging out the rock (when the miner skill is low).

So, the minimum you can have for a 16X16 embark is ~8847360 rocks, give or take some due to chasm/HFS/river/etc, then an almost infinite amount more stone based upon the cliffs in the area.

I think the most z levels you can get is by embarking using embark anywhere on a named peak, with a chasm nearby.

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: atom smash memory test..
« Reply #26 on: May 30, 2009, 12:54:49 pm »

What about mass tree farming for wood, an obsidian farms?
With an autoplayer script, leave the outside of the world walled in so to get to your fort, invaders must plunge 15+ z levels, and the trade depot has a bridge before the ramps(or a simple dump trap on the only access bridge) to add to the stuff you have...
Logged
Eh?
Eh!

Xinael

  • Bay Watcher
    • View Profile
Re: atom smash memory test..
« Reply #27 on: May 30, 2009, 02:25:59 pm »

RE: Overflowing the number of rocks variable.

I doubt there's a "number of rocks" variable that has a direct influence on much of anything. Rocks aren't just a number, they have all kinds of properties - location, material, forbidden, hidden, marked for dumping, hauled by someone, melting point, weight, etc etc etc. Those properties have to be stored in some kind of structure, so rocks can't just be stored in an integer. Probably the only thing you'd screw up is the UI trying to display the number of rocks.

Which isn't to say that a crash is impossible or that an overflow of some kind is either, but I doubt it'd work the way you're describing.
Logged

Draco18s

  • Bay Watcher
    • View Profile
Re: atom smash memory test..
« Reply #28 on: May 31, 2009, 01:47:32 am »

What about an obsidian farm?

That would allow you to create more rock en masse, so you could probably overflow the count, but I don't suggest ever scrolling over it in the stocks listing.  80,000 already takes 5 minutes.
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: atom smash memory test..
« Reply #29 on: May 31, 2009, 06:44:40 am »

It could use a linked list, or a doubly linked list, or some variant, as that would allow unlimited objects and easy removal and addition of them, although searching might be a bit slow, so it probably has some sorting mechanism...
Logged
Eh?
Eh!
Pages: 1 [2] 3