Born some months before the 80´s started, back in those days where C64 and Amiga ruled the world. After first gaming experiences with Atari, Gameboy and the almighty x286 i quickly began to learn programming. First in Basic, Turbo Pascal and a little C++, later i learned the fun and creative experience that GameEngines offered like the AdventureGameStudio or UDK. After some years of modding for several games like Neverwinter Nights, Mount and Blade i felt in love with Unity3D. Between all those i made a living as juggler and physical artist aswell as some short (but intense) career as musician in a experimental mediaval/folk band.
Its quite a while since my last post, and lots of stuff happened inbetween. We finally got accepted by a real publisher with our first game and now my team-mates take over with marketing etc.
While the first game was more a proof to ourselves that we are able to do a complete development cycle, beginning from scratch up to finalizing and publishing it - the second one is now getting into more interesting realms.
I was always quite fascinated from procedural content generation (PCG) in general, and some of the fruits of my early experiments are shown in some older posts at my wordpress blog.
The new project is making heavy use of some PCG techniques. Namely map generation and word/sentence generators. While both are often used and well known, i wanted to go a bit further and test out some ideas.
The main issue during out last game was that our Designer created game-content like texts and stats/balance - i had to hardcode them into the scripts. This was a bad aproach cause it basicly doubled the time needed for it.
Now i tried to develop some tools to outsource this data from the game. This not only allows for a quicked development but also makes the game moddable. I choosed XML for this, cause its rather easy to use complex data-structures with it, without the need to re-invent the wheel with developing our own data-formats (and scripting exporter/importer algorithms).
Now, you may wonder what this have to do with PCG.
Well, lets take as example the word/sentence Generator:
Word / Sentence Generator
Generators like that work quite simple. Lets say we want to come up with a bunch of names that all sound nordish. An easy way to do this is to analyze nordish names and get a list of syllables that make up those names.
A simple formula would be: Beginning syllable + middle syllable + ending syllable = name
Depending on the data for those syllables you can produce a large amount of names that all sound quite believable.
Alffdanr Jakobhjalsen, Aris Rasberg, Fenrir Sorenhauser, Svadildorr Leonbak, Gudnarr Leonhaugen, Sleipbrandr Herhjallum, Fentoppr Hagerickbak, Hallki Skjeggeardgen
A more complex example would be descriptions for items, or book-descriptions. Basicly you try to make up rules that tell how the sentence is made up of different pieces. In general its the same concept like with the names, just more complex.
After developing the base concepts of this generator i tested it with setting up a simple sentence for a book-review. The output is something like the following:
This roll published by Alfris Hauthonvik is muddled mostly due to uninspiring features.
This writing is totally senseless mostly due to the totally lack of content.
This writing from the known writer Eijotr Lundgen is very easy to understand despite the really great crafted content.
This atlas is reasonable clear thanks to the very great done organization.
This book is totally senseless.
This work written by the well known writer Hallfrodr Harbak is interesting.
This text from the writer Ganfari Sorenrickvik is hard to understand thanks to the totally uninspiring diagrams.
This book published by the unknown writer Favnir Anter is quite clear.
The quality of the sentences differs, sometimes its coming up with strange or amuzing curiositys, but in most cases it already giving pretty good results.
Now the great part about this is that both examples are done with the same generator. To be able to allow this i came up with a simply ruleset wich you describe in XMLs.
An example XML dataset looks like this:
(for some reasons, i cant post XML code blocks here, in case you want to see the full XML code you can read the original blogpost here: Abhuva.wordpress.com )
This ruleset have an ID wich is used to reference this specific rule (#DWARVNAME#), and it have a list of rules wich are basicly strings that hold a number of elements, each seperated by a commata.
Those strings get parsed by the engine to "deconstruct" the rules and get the seperated elements. I mainly did this to avoid unneccesary complex XML structures. The number at the end of each rule is describing the chance that this rule gets applied at all.
This simple trick already allows for quite some variations.
Instead of all the time having 3 syllables added together, its easy to describe a ruleset here wich often only uses 2 syllables, but sometimes uses 3.
The above ruleset could output names like:
Bomli, Thrazamil, Aghal etc...
Another quite important thing is the option to reference other rules in those elements. To seperate normal content and rule-references correctly i suspect that each rule-ID is beginning with a # sign.
The process of generating the final words/sentences is recursiv. It would be of course quite easy now to "script\" infinite loops". To avoid this i count the number of recursion steps the algorithm takes, and just break out if i get over a hardcoded limit.
The last thing i implemented for now is the option to save the output of a generator in a variable and be able to use that variable in the rules.
With this simple setup we are already able to make up quite some complex generators for different use. Some example:
(Again, this isnt the correct code as this sites dont let me post it, you can see the correct XML code on my blog if you are interested: Abhuva.wordpress.com )
A ,:100 <!-- here we begin actually building the text -->
small ,ugly ,tiny ,crude ,greedy ,funny ,:50
dwarf ,guy ,person ,:100
called ,named ,known as ,with the name ,:100
met a , was a friend of , travelled together with ,:100
a person , someone ,a guy ,:100
called ,named ,known as ,with the name ,:100
The special new functionality here is the command !1 and ?1, wich basicly saves and loads into the variable slot 1. Currently i am providing 20 slots wich should be more than enough for quite some complex setups. They can be also used to pass things from within the game, so it would be quite easy to construct sentences that mention the name of the player for example.
The above example isnt the complete ruleset, i am calling the ruleset #DWARVNAME_FULL#, saving the output in slot1, calling it again (and getting another result), saving that in slot2, after this basic setup i begin to construct the simple sentence. This is just an example i wrote for our game-designer to show off how all elements are working together - its not used in the actual game.
With this simple tool, the players could mod their own name-variants, item-descriptions and so on. At the moment its more a proof of concept and still in early experimentation phase, so we havent decided how its actually linked to the game and how much freedom we give to players in respect to modding.
Well, enough text for today, stay tuned for more insights into our use of PCG techniques for our new game.
Feel free to visit our company´s site for news : www.zatobo.com
or check out our first game : Indiedb.com
No blogs were found matching the criteria specified. We suggest you try the blog list with no filter applied, to browse all available.Join now to share your own content, and encourage our community to get involved and engaged.
A group dedicated to indie and standalone game development.
Tabula Rasa is currently a one man dev team (sharing thoughts, scripts and other stuff with some friends on various forums). I am doing mostly level-design...
We are a small entrepreneurial company of indie game developers working on our first title. Our team has a mutual love of the media of games, and having...
No groups were found matching the criteria specified. We suggest you try the group list with no filter applied, to browse all available. Start a group and help us achieve our mission of showcasing the best content from all developers.