• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Procedural Content Generation

I ran across this article today, which is an interesting breakdown of the processes that go into PCG: So You Want To Build A Generator. I've been messing around with proc gen a lot recently and, while I've hit a large number of stumbling blocks on the way, I've become more and more fascinated by the way in which content can be created and tuned on the fly. Creating dungeons and over-world maps, piecing together weapons/spells/enemies, random drops, making or adjusting game art within the code itself, creating lore or names/places/etc on the fly, there's so much to learn. Of course, it doesn't replace everything, but a finely crafted generator can be a thing of beauty and can add so much replayability and novelty to a game.

Just wanted to have a discussion about some proc gen things that you guys have worked on and share ideas about the best way to go about it within the framework of Game Maker. Here's a few more links that drew me down the rabbit hole (though none are GM specific):

Equations for Organic Motion
Rooms and Mazes
Dungeon Building Algorithm (Frankly, the whole of Roguebasin is a great resource for dungeons and proc gen)
PCG Wiki
 
M

Mr Ed

Guest
Funnily enough, I've just implemented that exact rooms and mazes algorithm, in GML, for something I'm working on.
I (more or less) ported the code so that it generates the map into a ds_grid, then converts that to a tilemap, then builds a 3D (technically 2.5D, I suppose) mesh from that, with physics fixtures in the right places so you can run around and bump in to walls and whatnot.

Now I'm at the stage where I need to populate the dungeon with monsters, and make them chase you around. So thanks for the links, interesting stuff!
 

Yal

šŸ§ *penguin noises*
GMC Elder
I've dabbled a lot in PGC myself, but I'm not exactly good at it yet. I've learned a bunch of stuff along the way, though:
  • KISS (and the Unix philosophy, for that matter) applies even more than usual for code that does stuff on its own, so try to rather have multiple generators that does ONE thing and are independent over having one superalgorithm.
  • It's generally useful to try to be as top-down as possible no matter how you generate stuff in the end; for instance, you should store info whether a region is a ROOM or a CORRIDOR instead of just having a wall/not wall system - this makes it easier to know where it's OK to spawn stuff, and if you also have a list of where you put rooms and what sizes they are it's much faster to find a valid room cell if you need to spawn something in a room. And of course, if you also keep track of what type of room a room is (banquet hall, bedroom, dungeon cell, armory, courtyard etc) you can fill it with stuff much more intelligently, or have it influence its surroundings in meaningful ways. A lot of PGC stuff I've seen is bottom-up and tries to figure out what suits random chaos by analyzing regions, and that's usually wonky and pretty labor-intense.
  • Vaults are necessary but players easily spot when you reuse content (*cough* No Man's Sky *cough*). You can make things a lot less repetitive if you have multiple layers of randomization - for instance, randomly rotate or mirror vaults, add random props along the walls, have multiple versions of each vault prop (for instance spawn a random decoration instead of always a vase).
  • Make sure the randomness actually adds diversity to the game, if it always feels the same it might as well not use it. Some good ways to add diversity is to have randomization be parametric and basically vary the parameters - things like how big rooms are and how many rooms vs corridors there are is an example of this, but also how straight vs how erratic corridors are, or whether certain enemy types are favored over others. Have SOMETHING change over the course of the game to add diversity. When I made Raiden Hakusan, I started off with the randomly appearing groups of enemies as the only thing that would happen, and the game got too bland. After realizing that, I added "events" that would be part of each enemy wave (at certain thresholds), spawning different types of event-only enemies like groups of spiders or enemies moving in formations you need to dodge. They're still influenced by the random and difficulty-scaling parameters of the game so they scale like the normal enemies, but they break up the monotony because they're different.
  • Give the player some agency so they don't have to rely on the RNG. This is why a lot of roguelites/roguelikes has shops (Binding of Isaac, Dead Cells) that lets you alter your combat and movement abilities to adapt to the situation at hand, and it's also why Spelunky has bombs that lets you flat-out destroy walls to avoid tricky platform sections.
Hopefully this helps~
 
Top