Return to “Technical”

Post

How Procedural Generation works

#1
I am without a doubt going to want to mess with this a huge amount but I want to actually have an idea of how procedural generation works before I were to get into it. I've only dealt with random generation for star systems and such before. could someone tell me exactly the basic principles and maybe some of the technical workings about how PG operates?
Post

Re: How Procedural Generation works

#2
it's like using algorithms to make things using a procedure, a pseudorandom element can be introduced into it, this also uses a procedure, it's basically just using procedures to make things at it's simplest form, hope this helps :)


EDIT::This belongs in Technical, please move this thread
~Sly
IVE BEEN OUT OF MY MIND A LONG TIME
Post

Re: How Procedural Generation works

#4
From the basic principle its not that different from the map generation of minecraft.

You have a seed value, and this seed value manipulates a random generator which also takes different envrionmental variables into account.

So for example your random generator uses the position in the world and then multiplies the number with the seed value.

This value then determines the stats of the planet at the position.

So for a given seed value there is always the same planet at the same position.

As the only independent variable is the seed.


The same basic methodology can be applied to everything else.

Dont take the semi-random value and use it to determine weapon stats or ship stats
Post

Re: How Procedural Generation works

#5
I understand the idea of how you use procedures to produce something but I'm more wondering how they can do this to produce a world or how exactly the seed looks (for instance the seeds for minecraft are really confusing like "oh1^&*^bbnckaiOP" but I don't know how that would work in the procedure whatsoever). are there any good indepth examples of an actual procedure used online?
Post

Re: How Procedural Generation works

#8
The Minecraft seed with all those symbols is just bits encoded as a string. As Cornflakes said: The seed is the initialization value for a (pseudo-) random generator, which always produces the same row of numbers given the same seed (since computers operate deterministic).

Now let's say you want to create a planet.
First you have to ask yourself: What properties do you want to generate ?
Size ? Planet type ? Color ? Elemental compositon ? Atmosphere ?

Let's keep it simple:
For the size you probably want to have a minimum size and a maximum size: planetSize = minSize + (maxSize - minSize) * randomNumberFromZeroToOne (from here: RN)
For the type of the planet, you probably have a list of all possible types. So: planetType = PLANET_TYPES[RN * PLANET_TYPES.length]
Color: red = RN, green = RN, blue = RN
etc.

Put it all together in a structure, that represents a planet in your game and voila: You got yourself a planet, generated by a single seed value (and some procedures, that use that number to generate other numbers, which are your planet parameters, or whatever).

Was that helpful, or did I just bore everybody to death ? If yes: Yay, more cake for me
Last edited by gartoks on Sun Aug 03, 2014 12:22 pm, edited 1 time in total.
Post

Re: How Procedural Generation works

#10
alright the conversion system makes sense and lowers the chance of someone putting something into the seed that isn't acceptable to...... 0% it seems. I'm kind of realizing how much bigger the field (calling it a field even if it isn't. I don't actually know) of procedural generation actually is than I originally thought. Has Josh ever released any content of some of his older, no longer used algorithms ever? I'd love making a few flow-charts out of them if given the chance to do so. like his old space station generation algorithm.
Post

Re: How Procedural Generation works

#12
gartoks wrote:The Minecraft seed with all those symbols is just bits encoded as a string. As Cornflakes said: The seed is the initialization value for a (pseudo-) random generator, which always produces the same row of numbers given the same seed (since computers operate deterministic).

Now let's say you want to create a planet.
First you have to ask yourself: What properties do you want to generate ?
Size ? Planet type ? Color ? Elemental compositon ? Atmosphere ?

Let's keep it simple:
For the size you probably want to have a minimum size and a maximum size: planetSize = minSize + (maxSize - minSize) * randomNumberFromZeroToOne (from here: RN)
For the type of the planet, you probably have a list of all possible types. So: planetType = PLANET_TYPES[RN * PLANET_TYPES.length]
Color: red = RN, green = RN, blue = RN
etc.

Put it all together in a structure, that represents a planet in your game and voila: You got yourself a planet, generated by a single seed value (and some procedures, that use that number to generate other numbers, which are your planet parameters, or whatever).

Was that helpful, or did I just bore everybody to death ? If yes: Yay, more cake for me
I actually produced something like this for an asteroids look alike I made last year for my programming class. it just didn't accept a seed. could the RN in this case be replaced with a seed for a procedural algorithm?
Post

Re: How Procedural Generation works

#13
Slymodi wrote:
Jasper Davis wrote:....Has Josh ever released any content of some of his older, no longer used algorithms ever? I'd love making a few flow-charts out of them if given the chance to do so. like his old space station generation algorithm.
not to my knowledge or else I would be all over them :lol:

~Sly
I hope that becomes a thing at some point. even if it is only after LT is officially released. I'd learn that stuff inside out.
Post

Re: How Procedural Generation works

#14
As I said: The seed is just a number(or series of bits) used to create pseudo random numbers.
You use it in some crazy math to create other numbers that are as "random" as you can make them.

Look for example at
http://www.codeproject.com/Articles/251 ... Generation

Every random number generator is initialized with a seed. In most cases, if you don't provide one, the current time stamp (or modification of it) is used. So there always is a seed.
Post

Re: How Procedural Generation works

#15
We had a good bash at this very subject back in March in the What is and what is not procedural content generation? thread.

I'll reiterate what I said there: "procedural content generation" is actually two things: the generation of random numbers within specific constraints, and code systems -- "procedures" -- understand how to render those carefully constrained numbers.

Proceduralism is an alternative to encoding all behaviors as programming code. Splitting the input data (and its randomized generation) from the display code makes it easier to change your number generation methods as well as to change your output rendering code -- as long as the input interface doesn't change, there's less chance of breakage.

Also, if you only need to distribute the rendering code (because users will generate their own numbers), it can be considerably smaller than a monolithic package containing both code and data. This is the theory behind the 64K demos -- their outputs were impressive despite their small size because they used procedural generation techniques.

So what I'm saying is that the random number generation part is important, but it's not "procedural content" all by itself -- for that, you also need the code that knows how to turn those carefully constrained numbers into images and sounds.

Online Now

Users browsing this forum: No registered users and 10 guests

cron