DSMatticus Want Make Vidya Gaem

Discussions and debates about video games

Moderator: Moderators

User avatar
Leress
Prince
Posts: 2770
Joined: Fri Mar 07, 2008 7:54 pm

Post by Leress »

Last edited by Leress on Sun Jan 10, 2016 9:12 pm, edited 1 time in total.
Koumei wrote:I'm just glad that Jill Stein stayed true to her homeopathic principles by trying to win with .2% of the vote. She just hasn't diluted it enough!
Koumei wrote:I am disappointed in Santorum: he should carry his dead election campaign to term!
Just a heads up... Your post is pregnant... When you miss that many periods it's just a given.
I want him to tongue-punch my box.
]
The divine in me says the divine in you should go fuck itself.
zeruslord
Knight-Baron
Posts: 601
Joined: Fri Mar 07, 2008 7:54 pm

Post by zeruslord »

The thing that needs to be true for a chunk is not that it can be generated without any information about other chunks, just that each stage of generation can be done with only information produced by earlier stages of other chunks. When you go to generate a chunk, you can produce the ground without looking at the full details of the ground of neighboring chunks. Then you look for the randomly generated special features in a specific order - probably biggest to smallest, with some discarding of incompatible features (if there's a castle, don't put a tree in it, that sort of thing), and some way of avoiding conflicts between features in the same tier without expanding the search area - one way to do this might be to check whether there are any in a certain bounding box (say, no castle with its northwest corner north of you or west of you that would overlap) and not place if there is one. Of course, now you are doing partial generation of a larger area (with more and more detail the closer it is to your chunk). Therefore, this needs to be repeatable - probably by having it be a function of the world seed plus the x-y coordinates. Also you might cache anything actually decided about neighboring chunks, but I'm not sure that's necessary.
DSMatticus
King
Posts: 5271
Joined: Thu Apr 14, 2011 5:32 am

Post by DSMatticus »

Those all touch on generating the landscape, but don't discuss generating (pseudo-)structures like trees and castles. It's a different problem - a block is just a point, and a point is guaranteed to occur in only one chunk. A castle is a 3d shape built out of blocks, and cannot be guaranteed to occur in only one chunk. Which introduces a new concern - coordinating world features across chunk boundaries. I know how games do the former, but have never really seen a gamedev blog about their approach to the latter.
Zeruslord wrote:The thing that needs to be true for a chunk is not that it can be generated without any information about other chunks, just that each stage of generation can be done with only information produced by earlier stages of other chunks. When you go to generate a chunk, you can produce the ground without looking at the full details of the ground of neighboring chunks. Then you look for the randomly generated special features in a specific order - probably biggest to smallest, with some discarding of incompatible features (if there's a castle, don't put a tree in it, that sort of thing), and some way of avoiding conflicts between features in the same tier without expanding the search area - one way to do this might be to check whether there are any in a certain bounding box (say, no castle with its northwest corner north of you or west of you that would overlap) and not place if there is one. Of course, now you are doing partial generation of a larger area (with more and more detail the closer it is to your chunk). Therefore, this needs to be repeatable - probably by having it be a function of the world seed plus the x-y coordinates. Also you might cache anything actually decided about neighboring chunks, but I'm not sure that's necessary.
You're more or less describing what I've suggested - to place structures into the world with a series of initial passes over a larger area than the one you're actually creating and rendering for the player to see. Whether or not to do that in advance and cache it or to just do it over and over at runtime probably wouldn't make much of a difference, depending on how big an area you've decided to sketch - that sort of preliminary work would be an absolutely trivial amount of comp time relative to generating the terrain itself.
User avatar
tussock
Prince
Posts: 2937
Joined: Sat Nov 07, 2009 4:28 am
Location: Online
Contact:

Post by tussock »

and cannot be guaranteed to occur in only one chunk
Just guarantee that they occur in the one chunk. So when randomly placing them, their bounding corners must be within the chunk, probably by a good few tiles so they don't inappropriately touch other similar features.

Trees meanwhile can edge right up to the neighbouring chunk, so you don't get natural corridors in your forests.

Angband used to generate levels in screen-size chunks, and the big special vaults just had code to make sure they could fit in their own chunk, as did all the smaller rooms, with corridors laid in last to ensure connectivity.
PC, SJW, anti-fascist, not being a dick, or working on it, he/him.
Post Reply