Return to “Technical”


Re: How Procedural Generation works

Slymodi wrote:to my knowledge that is just mapping data, sort of like an array, but people like it better, I think just converting it to a certain base is better
As one might expect, it's deeply involved in hash tables, yes! :D There's more than one way to map one set of data to another. Change of base is certainly one that has some nice properties like speed and reproducibility. But a hash function (at least any good one) has the advantage that it doesn't care about the length of the input, whereas a change of base is actually going to want it to be quite short (until you mix in other tricks like doing a modulus over MAX_INT, but that's getting dangerously close to a (bad) hash function!). Also, two similar inputs should (again assuming a good hash function) produce very different results.

I won't speak to what people like better. There's a turf war going on at work between the windows guys and the linux guys, so I get quite enough of that type of conversation. :)

Re: How Procedural Generation works

I tend to disagree that slightly different seeds should produce vastly different outcomes (at least in PCG)

Because its very well possible that someone wants a similar universe to the one he just tried but doesnt want to continue searching for ages until he finds what he wants but just slightly the seed changes and something similar but not the same gets.

So i'd say the hash function deriving the seed in LT can be a "bad" hash that doesnt fluctuate wildly but changes smoothly over the input space

Re: How Procedural Generation works

I hadn't actually considered that angle! You'd have to choose the RNG method carefully. A Mersenne twister (a common PRNG algorithm) with similar initial seeds can yield similar numbers for a while, but diverges eventually. A purely-additive system would keep them kinda close. Usually people aren't trying to reduce apparent randomness! :)

Re: How Procedural Generation works

As was said earlier, random number generation is a small part of procedural content generation. It's like a recipe.

You have your ingredients:

1 random number.
random eggs
random butter
random milk
random flour

then you put your ingredients through a procedure:
Whisk random eggs a random amount of time
add random butter.
add random milk
add random flour
stir random ingredients a random number of times
place random mix in an oven for a random time.
output the result.

Outputting what you want depends on fine tuning your random functions. For example, you might have a recipe called 'yum' where random eggs are only of type 'elephant'
or you might have a type 'yuk' where oven time > 10 days. etc.

Re: How Procedural Generation works

Procedural generation is the art of creating random <insert content here> that feels natural, hand crafted, and cohesive. Minecraft terrain feels mostly like real terrain... different areas, some flat, some tall. It doesn't act like it's made from math, but it is.

How it works depends entirely on the type of content. The methods are as varied as the subjects available to college math and computer science combined. How it works can only be described in specific examples, because every type of content uses a different procedure.

Another way to look at procedural generation is creating art with math. It's fun with code, creation via abstraction.

Re: How Procedural Generation works

MyrddinE wrote:Procedural generation is the art of creating random <insert content here> that feels natural, hand crafted, and cohesive.
Pcg has nothing to do with feeling handcrafted, its often used this way, true, but PCG is in principle nothing more than a fancy word for "uses math to create stuff".

The only (semantic) difference to "random" generation is that PCG is often associated with being repeatable, so that one can recreate the same scenes on demand.
Usually this is archieved by using a seed value instead of using only srand(_time(0));

Online Now

Users browsing this forum: No registered users and 1 guest