Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: stagger generation  (Read 931 times)

Karakzon

  • Bay Watcher
  • [ethics:give a shit?: denied]
    • View Profile
stagger generation
« on: April 24, 2011, 05:02:08 pm »

very simple: when in adventure mode, and fortress mode, the generation of z level layers down is staggerd. ie: you only generate when you reach within 5 z levels of it, even though youll still see the number of layers etc.

that way: in dwarf fortress mode: you can stick to the surface and not get a fps issure from things underground.
in adventure mode: same thing, altho in adventure mode it would probably be wise to just generate when 3 z levels from the layer, since on flat plains your very close to caverns.

why? just saves some memory and FPS. may be a small amount, but everything that speeds up the game is worth looking at. also means people with slower machines can park ontop of 100 z level maps etc and not have issues with a large embark area. at least so long as they dont dig too far down.

what do you lot think?
Logged
I am Dyslexic. No its not going to change any time soon.
Bolts of Exsanguination THE terrifying glacier export, get yours today!

stabbymcstabstab

  • Bay Watcher
  • OW SNAP!
    • View Profile
Re: stagger generation
« Reply #1 on: April 24, 2011, 07:05:52 pm »

I dont know much about programming but im pretty sure this would take a crap load of time for toady to make and the fps drain to generate it would be horrible and the game would probaly freeze but the idea is good just not possible
Logged
Long Live Arst- United Forenia!
"Wanna be a better liberal? Go get shot in the fuckin' face."
Contemplate why we have a sociopathic necrophiliac RAPIST sadomasochist bipolar monster in our ranks, also find some cheese.

DrKillPatient

  • Bay Watcher
  • The yak falls infinitely
    • View Profile
Re: stagger generation
« Reply #2 on: April 24, 2011, 07:32:57 pm »

As in, anything >5 Zlevels below the player's view isn't calculated? That would equal roughly the equivalent of the current cavern-generating code every time you moved down a few levels I think.
Logged
"Frankly, if you're hanging out with people who tell you to use v.begin() instead of &v[0], you need to rethink your social circle."
    Scott Meyers, Effective STL

I've written bash scripts to make using DF easier under Linux!

sockless

  • Bay Watcher
    • View Profile
Re: stagger generation
« Reply #3 on: April 24, 2011, 09:37:56 pm »

Pathfinding in caverns and HFS doesn't start until you breach them. So your suggestion doesn't do anything to make things faster, in fact it would slow the game down.
Logged
Iv seen people who haven't had a redheaded person in their family for quite a while, and then out of nowhere two out of three of their children have red hair.
What color was the mailman's hair?

noodle0117

  • Bay Watcher
  • I wonder what would happen if I pull it.
    • View Profile
Re: stagger generation
« Reply #4 on: April 24, 2011, 11:20:35 pm »

only problem would be when two people generate the exact same world with the exact same seed and go on the exact same embark location...
and their maps don't match
Logged

Karakzon

  • Bay Watcher
  • [ethics:give a shit?: denied]
    • View Profile
Re: stagger generation
« Reply #5 on: April 25, 2011, 02:14:28 am »

righto :)

i didnt know much abot the codeing myself, nice to know that it wouldnt work. thanks.
Logged
I am Dyslexic. No its not going to change any time soon.
Bolts of Exsanguination THE terrifying glacier export, get yours today!

Dutchling

  • Bay Watcher
  • Ridin' with Biden
    • View Profile
Re: stagger generation
« Reply #6 on: April 25, 2011, 06:35:15 am »

Pathfinding in caverns and HFS doesn't start until you breach them. So your suggestion doesn't do anything to make things faster, in fact it would slow the game down.

It will improve speed by a LOT. Try generating a world with just 5 or less layers beneath the surface and you'll be able to have an embark 3x the size you normally can.

Still it is a very bad idea because if you use this feature to have a larger embark size you'll be screwed if you want to dig down because FPS will permanently suck, so imp a pretty useless feature from what I can tell.
Logged

Urist McAddict

  • Bay Watcher
    • View Profile
Re: stagger generation
« Reply #7 on: April 25, 2011, 07:15:57 am »

I don't quite think that's impossible or that things wouldn't match... In Caravan Arc, the cities have definite number of population and buildings, BUT they only get drawn when you're in distance, so the calculations would take place before, but drawing it would be something that would happen as soon as you breach ground, for instance, when you pushed one level further, it would slow down for a sec and be back right up after drawing, that would suck for ppl who like to run for caves and magma sea, but for more patient (those who play it slower or newbies) players it would give a little boost without the fps horror =P
Whatever, my coding skill is below dabbling
But makes enough sense to me,
Logged

benas424

  • Bay Watcher
  • [MUSIC_DEPENDENT]
    • View Profile
Re: stagger generation
« Reply #8 on: May 01, 2011, 03:02:06 pm »

only problem would be when two people generate the exact same world with the exact same seed and go on the exact same embark location...
and their maps don't match

All random generations with the same seed will produce the same result. The RNGs aren't actually random. Except ones that rely on some hardware (like getting the numbers/seed from cosmic microwave background radiation), so the problem you mentioned does not exist.
Logged

Demicus

  • Bay Watcher
  • The formless enigma
    • View Profile
Re: stagger generation
« Reply #9 on: May 02, 2011, 04:57:02 pm »

only problem would be when two people generate the exact same world with the exact same seed and go on the exact same embark location...
and their maps don't match

All random generations with the same seed will produce the same result. The RNGs aren't actually random. Except ones that rely on some hardware (like getting the numbers/seed from cosmic microwave background radiation), so the problem you mentioned does not exist.

Problem would exist. True RNGs aren't actually random, but each time the RNG is called, the previous number is dumped into the the algorithm to produce the next number. So with a given seed and a given RNG, you would get a certain list of numbers. Now, the reason you get the same world everytime with a certain seed is because World Gen pulls the numbers from the list in a given order every time. If you only generate the top few layers, then you'll end up with a surface map that always looks the same for a given seed, but when you generate the next set of layers in-game, you won't be guaranteed that the next number from the RNG will be the same for every player, because general play would hit the RNG for numbers as well, for combat and such and the fact that I believe the in-game RNG is seeded differently everytime you start the game. But even if you maintained a separate storage for the world generation RNG, then you still have the problem of that next number being the one used regardless of where you embark.
Logged
All shall embrace the unquenchable flame
Dwarf Fortress: The weak shall be culled, so the strong can have nicer socks.

JanusTwoface

  • Bay Watcher
  • murbleblarg
    • View Profile
    • jverkamp.com
Re: stagger generation
« Reply #10 on: May 02, 2011, 05:07:30 pm »

Problem would exist. True RNGs aren't actually random, but each time the RNG is called, the previous number is dumped into the the algorithm to produce the next number. So with a given seed and a given RNG, you would get a certain list of numbers. Now, the reason you get the same world everytime with a certain seed is because World Gen pulls the numbers from the list in a given order every time. If you only generate the top few layers, then you'll end up with a surface map that always looks the same for a given seed, but when you generate the next set of layers in-game, you won't be guaranteed that the next number from the RNG will be the same for every player, because general play would hit the RNG for numbers as well, for combat and such and the fact that I believe the in-game RNG is seeded differently everytime you start the game. But even if you maintained a separate storage for the world generation RNG, then you still have the problem of that next number being the one used regardless of where you embark.

If you really want to, you can work around this. Just about every psuedo-random number generator that I've worked with has a seed value (the same value that is stored already with world generation) that controls where the list of 'random' numbers starts. Generally, this is set with something like the system clock, but if you want you can specify a value manually.

Basically, you can use a global PRNG that generates a "random" number for each embark. That in turn is used as the seed for a PRNG for that embark site. It can then be used to generate a sequence of PRNGs for different tasks such as terrain generation and pathing and the like. So no matter which site you want to embark on, the same seed can be generated from scratch without actually having to store any additional information.
Logged
You may think I'm crazy / And I think you may be right
But life is ever so much more fun / If you are the crazy one

My blog: Photography, Programming, Writing
Novels: A Sea of Stars, Confession

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: stagger generation
« Reply #11 on: May 02, 2011, 05:31:52 pm »

Actually, there are problems in other ways than you think.

I remember discovering in 40d that if you make a save, and embark on a given size of embark on the same area, you would get the exact same embark every time, as one would expect...  but if you changed the size of the embark, even just to make the embark smaller over the same embark tiles, but just a smaller area, you would wind up with completely different layers and mineral veins and stagnant pool locations.

The RNG is used for each of these things, so simply revealing different things in a different order changes the outcome of the RNG.

The same random number is being stretched over a larger area, making more calls, which means that when it gets to the same thing, it's already a different number.

In fact, people did experiments where changing the raws to alter something fairly minor, like reactions, would result in completely different world geographies, even though there was nothing in reactions that would have an impact upon the very first thing the game generates.



To get back to the real topic, though...

This wouldn't really help much, anyway.  The existence of layer data doesn't slow the game down in any significant way. 

What WOULD help is not actually running the caverns until they are revealed.  There's no need to have giant cave spiders running wild down there until dwarves are actually capable of running into them. 

The HFS already doesn't generate the clowns until you open up the passage.  That saves the FPS of having all those creatures. 
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

stabbymcstabstab

  • Bay Watcher
  • OW SNAP!
    • View Profile
Re: stagger generation
« Reply #12 on: May 03, 2011, 02:00:56 pm »

actullay kohaku there are clowns in the circus wondering using runesmith and dfreval i found this out there just like badgers or bunnies wondering randomly form map edge to map edge
Logged
Long Live Arst- United Forenia!
"Wanna be a better liberal? Go get shot in the fuckin' face."
Contemplate why we have a sociopathic necrophiliac RAPIST sadomasochist bipolar monster in our ranks, also find some cheese.