Jump to content

April 2017 »

232425 26 272829
- - - - -

Procedural content generation: a practical approach

4: Adsense

Procedural generation sounds great at first. Generating infinit content, the dream of every designer (or nightmare if your job get obsolete). But the reality tells an other story. Once you start developing your own procedural content generation you will realize quite fast, that most of it is just boring. The issue is, that players want meaningful content, not just huge amount of random content, and getting meaning into procedural content is really hard.

But it depends on where the player seeks meaning, and this depends on the human nature, where we as human individual seek meaning.

Lets start with a forest. When you walk through a forest, the meaning of this forest could be a location where you can feel good and free, a safe habour, a place you know. There's a natural order in a forest, the distance between trees, the light which reaches the ground determines the vegetation, but most people will not count the leafs on the ground, because the forest arised in a random manner depending on some existing parameter (i.e. biome). This is something we can try to capture with procedural content generation quite easily.

On the other hand think about an university. A great campus, with many buildings, different field of research gathered in only one or two building complexes. The cafeteria, parking slots, means of transport are structured in certain ways, sometimes in a logical way, sometimes historically based. Even if it is easy to generate buildings, streets, parking slots etc. it will be hard to generate a meaningful combination of it to represent an university. This introduce two difficulties, first how to generate something which has been designed by humans and how to combine smaller meaningful parts into something greater without loosing the meaning. Think about a parking slot, which has the meaing of, yeah, park your car to reach your destination on foot. Generating the parking slot 25 km of your destination would loose any meaning, on the other hand adding a fast traffic connection between parking slot and target destination would introduce a meaning.

The first class of PCG, natural content like forest, terrain, islands is easy, but the second class of PCG, human designed content, needs more engineering.

A practical approach is to start with designed content and try to break it up and recombine it in a meaningful way. The trick is, to start with designed content and don't try to generate designed content first.

In our campus example we would divide the campus into different areas like parking slots, mensa, research complex, inhabitants, traffic stations etc. The second step would be to define rules of combinations, i.e. the parking slots should be near the research complex, the inhabitants needs a connecting to traffic stations etc. When done, pick a part and try to break it up in a similar way, i.e. the inhabitants, they could be made up of different building types, a supermarket, a small park etc. This way you break up your target content in a top-down manner, but sometimes it will really hard to break it up any further.

The rescue comes in form of templates, that are small, meaningful, designed pieces of content. That's it, don't try to break up everything, sometimes it is much better and easier to design a bag full of meaningful templates instead of generating complex, chaotic, meaningless content.

Implementation tips:
Implementation of the rules are the hardest part. Different content will require different rules which will eventually requires different algorithms and approaches, there's no best way to do it. But I found graphs really useful when recombining structured data. There're lot of graph algorithms (i.e. kruskal, dijkstra, A* etc) around which will help you to solve certain problems.

- use designed content in form of templates
- design rules of combinations
- work top-down, not bottom-up
- never loose the focus on meaning

Jul 09 2012 10:40 AM
You may have seen this site before, but Procedural World is a pretty interesting blog to read, if sparsely updated. He implements his templates as expressions in custom-built grammar. Pretty interesting to read back through some of it.
Jul 10 2012 12:10 AM
Yes, I already stumbled over his blog. That is really impressive work over there, though most is natural (terrain, vegetation). But his ruines/castles are really impressive too.

I think that most of his work has more or less an aesthetic reason. I try to combine procedural generation with game logic which introduce some interesting issues like:
- How to ensure that the player find important items ?
- How to ensure, that the key to the door is not behind the door ?
- How to ensure, that the harder parts of the level will be discovered after the easier parts and not vise-verse (level flow)?

I've solved the issues sofar, but not with pure procedural methods.

Nevertheless, I think that I will revisit L-grammar in the future, maybe it helps to solve some of my issues more elegant.
Jul 19 2012 09:33 AM
This was the main problem with my first edition of Archer Alec, the generated levels was more of a gimmick than a asset to the game.

"The trick is, to start with designed content and don't try to generate designed content first."
This was the main flaw when I started working on Archer Alec, I dove headfirst into random terrain generation and ignored key mechanics that should be in place.
And after about a month of working on it all I had was a terrain generator and a guy that shoots monsters on it, there were no goals that were meaningful.
So now restarting the project the goals are much more obvious and is coming along more smoothly.
Great read.
Jul 27 2012 04:59 AM
Thank you for this read, very good!

Note: GameDev.net moderates comments.