Author Topic: Ideas for generally better procedural algorithms and procedural content  (Read 11202 times)

Trystan

  • Rogueliker
  • ***
  • Posts: 164
  • Karma: +0/-0
    • View Profile
    • my blog
Here's a few ideas about how to improve the replayability, diversity, and unexpectedness of procedurally generated levels. These ideas have all been tested in my latest roguelike (*) and I think they can apply to any procedurally generated level or world since they're not so much about specific algorithms as they are about changing existing algorithms.


Tweak the variables. Before you generate a level or world, semi-randomize the variables you use to create it. This is the easiest way I can think of changing how the level is built.

For example, if you use one of the "place a room or corridor until the map is full" algorithms, then you can change how often you add corridors and how full a map needs to be until it's considered full. A level with corridorChance = 98% and isConsideredFullPercent = 33 will make a sewer-like level with a bunch of corridors but a level with corridorChance = 10% and isConsideredFullPercent = 90 will make a level that is cram packed with rooms. You may find that certain values make the kind of levels you like best but adding some variation can surprise you and hopefully change the experience of whoever is playing. So, sticking with the same example, instead of hard coding corridorChance = 25% and isConsideredFullPercent = 25, try it with corridorChance = [20% to 80%] and isConsideredFullPercent = 50 + [-25 to 25].

You could try tweaking variables for the likelihood of magic items, traps, out of depth monsters, huge rooms, poisonous traps and creatures, puzzles, piles of gold, how much gold is in each pile, pretty much anything really really.


Tweak the lists. I guess this is technically a subclass of tweaking the variables, but I think this technique is different enough to stand out on it's own. Basically; if your algorithms include collections of things to chose from, try changing those collections before you run the algorithms.

For example; if you have a list of room types that are randomly assigned to each room in a level, then try changing the list before you generate each level: remove a few types so they don't appear on this level and add duplicates of some types so they are more likely to appear. I image this like having a deck of options and by removing some options and having others appear more or less often than others, you can change how likely those options are. So, instead of saying your DwarfFortress level has 2 stockpile rooms, 2 trap rooms, 6 houses, 2 empty rooms, tweak the list so you may end up with variations like:
  4 stockpile rooms, 4 trap rooms, 2 houses, 2 empty rooms
  3 stockpile rooms, 3 trap rooms, 3 houses 3 workshop rooms
  2 stockpile rooms, 2 trap rooms 4 empty rooms, 2 workshop rooms
  2 stockpile rooms, 2 houses, 2 empty rooms, 4 workshop rooms
  6 trap rooms, 2 houses, 2 empty rooms, 2 workshop rooms

If you have an even larger starting list then you can come up with even more variety. By removing items from your collections you also ensure that the player will need to play several times before they see everything. These lists don't need to just be room types either - they could be lists of loot, creatures, room shapes, alters, or practically anything you can think of.


Add explicit variations. This is a generalization of the other two. It adds the most flexibility but also involves the most work for the developer and possibly the player since they may need to know what variations are in play. For this technique, create a list of explicit changes to the core game and add a few at random. These changes can be small or large (undead get 1 extra hp vs undead get 50 extra hp), specific or general (followers of Cthulhu gain 5 attack when underground vs all creatures regenerate 1 additional hp per turn). Simply pick a few, or a lot, and add them. Some of the combinations may be wildly unfair but as long as there are ways of mitigating most misfortunes, it should always be fair enough. Perhaps.

A neat side effect of this is that it's sort of like having to identify items in that the player will have to identify what the rules are since they may be different from one game to another.


These are some general ways that I've tried to improve the procedural algorithms I've used. What do you think of them? What ways have you used or thought of?



(*) My latest roguelike was Pugnacious Wizards 2. The rogue basin page is at http://roguebasin.roguelikedevelopment.org/index.php?title=Pugnacious_Wizards_2 and I have a blog post that explains how these were implemented in the game at http://trystans.blogspot.com/2013/10/worldgen-and-dungeon-variations-in.html.

NON

  • Rogueliker
  • ***
  • Posts: 349
  • Karma: +0/-0
    • View Profile
    • Infra Arcana
    • Email
Re: Ideas for generally better procedural algorithms and procedural content
« Reply #1 on: October 07, 2013, 07:00:29 AM »
Add explicit variations. This is a generalization of the other two. It adds the most flexibility but also involves the most work for the developer and possibly the player since they may need to know what variations are in play. For this technique, create a list of explicit changes to the core game and add a few at random. These changes can be small or large (undead get 1 extra hp vs undead get 50 extra hp), specific or general (followers of Cthulhu gain 5 attack when underground vs all creatures regenerate 1 additional hp per turn). Simply pick a few, or a lot, and add them. Some of the combinations may be wildly unfair but as long as there are ways of mitigating most misfortunes, it should always be fair enough. Perhaps.

A neat side effect of this is that it's sort of like having to identify items in that the player will have to identify what the rules are since they may be different from one game to another.
I like this idea. Sounds like it's inspired by Arkham Horror (various monsters (usually cultists) gets a different bonus depending on which which god you will fight, and also depending on certain conditions such as weather effects).

I wonder how you would make the player understand that an effect like this is in play though. If you just give Cultists 8 hp instead of 6 on a certain level, most would never notice this (especially if your attack damage is randomized). And displaying a message about this would be very metagamey. "There is an altar to Hastur on this level, the Cultists here are tougher." ... seems a little weird. How would the player character know this?
Happy is the tomb where no wizard hath lain and happy the town at night whose wizards are all ashes.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Ideas for generally better procedural algorithms and procedural content
« Reply #2 on: October 07, 2013, 07:46:34 AM »
I think what you are trying to say is that procedural generation can have too simple rules which always produce predictable results. To break that you need to create surprises. Anything that breaks the typical rules of creation process and gives the player a new, unexpected experience.

Trystan

  • Rogueliker
  • ***
  • Posts: 164
  • Karma: +0/-0
    • View Profile
    • my blog
Re: Ideas for generally better procedural algorithms and procedural content
« Reply #3 on: October 07, 2013, 02:38:12 PM »
I wonder how you would make the player understand that an effect like this is in play though. ... How would the player character know this?

You're right - small things aren't very noticeable. What I did is to change the subtitle of the game, which is always visible at the top of the screen, based on what variations were picked. So one game may be called "Pugnacious Wizards 2: Of portals and archers." and the next could be "Pugnacious Wizards 2: Swords, armor, fire, and traps.". That works ok for such a small roguelike but probably would be odd for a larger one. The idea still needs some work because I'm not sure what the best way to do it is.

Vanguard

  • Rogueliker
  • ***
  • Posts: 1112
  • Karma: +0/-0
    • View Profile
Re: Ideas for generally better procedural algorithms and procedural content
« Reply #4 on: October 07, 2013, 09:49:41 PM »
I think the best procedural content makes heavy use of hand-made content.

Good examples are Spelunky, where the stages are made from hand-made chunks that are then put together procedurally.  Or KlingonRL, where every time you play you have a chance of running into special events and situations.

E:

Or the puzzle rooms in Brogue.
« Last Edit: October 07, 2013, 11:42:17 PM by Vanguard »

guest509

  • Guest
Re: Ideas for generally better procedural algorithms and procedural content
« Reply #5 on: October 09, 2013, 01:14:51 AM »
I agree with Van...space whales go a long way to spicing things up...:-)

Trystan

  • Rogueliker
  • ***
  • Posts: 164
  • Karma: +0/-0
    • View Profile
    • my blog
Re: Ideas for generally better procedural algorithms and procedural content
« Reply #6 on: October 09, 2013, 01:39:41 AM »
Yeah, rare encounters are cool. That's a big part of what can be done with the techniques I mentioned.

For example, in my latest roguelike each room has about a 1% chance of being a "super" version of it's normal theme. So the "empty room" theme is just an empty room but the super version is completely full of skeletons - every single non-wall tile. Since each game has 81 rooms and 12 or so themes, that means you need to fully explore 15 games before you see it (12 themes / [1% of 81] = 14.8 ). So a room full of skeletons is, by any reasonable definition, a rare encounter. But the rare chance is randomly tweaked, and sometimes the empty room theme isn't in the list of themes, or it may be in there several times. And one of the variants makes rare things ten times more likely. Another variant makes skeletons come back to life in only a few turns. Another gives them far more health and damage.

So rare encounters are cool and work well with having more varied content.

guest509

  • Guest
Re: Ideas for generally better procedural algorithms and procedural content
« Reply #7 on: October 09, 2013, 03:06:47 AM »
Cool. I was calling it 'frequent rares'. Rare events should be frequent, but they do not repeat often.

It's important to remember why procedural generation is important. It allows for variety. If it's basically the same game each time I think the technique is being under utilized. Still a fun game, but more can be done to provide different challenges each play through.

 Like solitaire, for example. It's different each time, sure, but it's still the same each time. You know?

Like you don't play solitaire because of the variety of the rare events. Poker has that though due to the player interactions, and it's those odd moments that are super great.

Vanguard

  • Rogueliker
  • ***
  • Posts: 1112
  • Karma: +0/-0
    • View Profile
Re: Ideas for generally better procedural algorithms and procedural content
« Reply #8 on: October 10, 2013, 01:23:00 PM »
The most important part of procedural content (and static content) is that it needs to make you care.  If the full extent of your stage generator's capabilities is that it can make either 5x5 or 7x7 rooms, you have failed.    If the same tactics are consistently effective in whatever situations your enemy spawning system creates, you have failed.  Just like in static level design, you need to ensure that your game's content is meaningfully different between playthroughs.

If I'm playing an easy RPG, it isn't exciting to earn a new power or find a stronger weapon, because the game is already easy and I don't need either of those to accomplish my goals.  They don't open up any new possibilities.  For the same reasons, I don't care if I'm using a sword with 171 attack power and find a sword with 173 attack power.  It's better, sure, but not by enough to make a difference in practical terms.

Don't create an enemy type with 5% more health and 5% less attack power than an existing type.  Don't make a forest area and a dungeon area play the same way.  Don't make axes and swords slight variations on the same concept.  Be bold!  Everything should have its own purpose and its own personality.

Special events, or frequent rares, or whatever you want to call them, are good for a number of reasons.  They let you create situations that clearly don't follow the same rules the rest of the game has established.  They can allow developers to break their game's balancing patterns without handing complete control over to the RNG.  Artifacts are a good example of this - they're essentially special events in item form.  Even if special encounters don't make any mechanical difference at all, they can still make your game's world feel a bit more mysterious and alive.

guest509

  • Guest
Re: Ideas for generally better procedural algorithms and procedural content
« Reply #9 on: October 14, 2013, 03:48:07 AM »
Oh yes, the architecture is largely cosmetic/thematic (too a point) it's the filling of the dungeon that's important.

I think that's why it's hard to make a good procedural side scroller, because the actual orientation is so important in side scrollers. Probably just as important as the content, or perhaps in a sidescroller the orientation and location of blocks is an integral part of the 'content' because jumps and terrain become part of the puzzle, part of what needs to be beaten. Much more so than top down anyway.

Gr3yling

  • Rogueliker
  • ***
  • Posts: 168
  • Karma: +0/-0
    • View Profile
    • Email
Re: Ideas for generally better procedural algorithms and procedural content
« Reply #10 on: October 16, 2013, 02:01:12 AM »
You're right - small things aren't very noticeable. What I did is to change the subtitle of the game, which is always visible at the top of the screen, based on what variations were picked. So one game may be called "Pugnacious Wizards 2: Of portals and archers." and the next could be "Pugnacious Wizards 2: Swords, armor, fire, and traps.". That works ok for such a small roguelike but probably would be odd for a larger one. The idea still needs some work because I'm not sure what the best way to do it is.

That's a really creative solution.  I like that.

It's weird because I mainly play ADOM, and in that game "metagamey" observations made by your character are so ubiquitous that they are often completely taken for granted.  And somehow that completely works. 

For instance, so-called "tension rooms" contain many, many duplicates of a particular creature type (say, goblins) and presumably are meant to be the lair of a particular tribe of monster.  They are called tension rooms because entering the level containing them generates the message "you feel a certain tension."

There are a number of these coded messages to players that you run into semi-regularly.  And it's quite cool.  The only thing I might change about that is to make their appearance dependent on the PC's perception attribute.

I do think it is work pointing out that dungeon encounters can be about more than just changing the number and type of monsters in a room.  Rooms can have themes that includes items and monsters-an armory could be populated only by heavily armored creatures and animated armors and have a high chance of spawning armor type equipment.

Other themed room ideas include:  Encountering a traveling merchant,  danger rooms with doors that seal until monsters are defeated like in Zelda, a statuary which contains gorgons and the stone versions of monsters they have petrified, an antimagic room where spells cannot be cast and or MP is drained, or a room of misery, where damage dealt by all creatures and the PC is increased.  Some of these are copied from other games, but you get the idea.
« Last Edit: October 16, 2013, 03:35:10 AM by Gr3yling »