• Register
Post news RSS Level Generator

A level generator has been added to the game to add more variety to levels!

Posted by on

The Story So Far

I waited a long time before implementing generated levels. It was a bit of a mistake, but to be fair, I wasn't sure how to work it. I kept thinking about it but I kept stumbling when starting. I was making two big mistakes.

The first would be solved with time. Four Realms is an odd duck of a game. I don't think until I hit alpha I had a great feel for how levels were setup and worked. But once I hit that stage I had the knowledge to break the levels in chunks.

The second would be solved by general game dev research. I kept approaching it as procedural level generation. Turns out, I don't really care about the procedural part. Instead I found this article detailing Spelunky level generation:


And that led to me realizing how to go about it for Four Realms.

How It's Done (Rooms)

Basically instead of creating and eroding terrain and speckling it with flora ala procedural. I just create rooms that simulate game levels and stack them together. Here you can see two of the rooms, 1800x1800 pixels.

Each room contains about 1/6 the stuff in a normal level. The generator grabs six of them and stitches them together. It's admittedly a "big brush", but I find this does pretty well for creating the good paths you find in Four Realms while still creating a random unique level.

Then the generator takes these pieces to and uses some heuristics to make each different for each realm. It skins each level appropriately to the realm and only uses rooms from the current and adjacent realms. Rooms are also broken into top and bottom categories.

There's some more random bits to it than that, but that's the essence of level generation in Four Realms.

Secret Entrances

The level generator was a bit buggy and needed more work than I hoped, but I did find time to add one new feature. Secret Rooms! Any creature that can see invisible objects will see through these and find new paths.

As always, thanks for reading. All feedback, questions, and suggestions are welcome!


InfiniteProductions - - 10 comments

Looks good, and great to have some randomness, look at Nuclear Throne: without so called procedural level, it would have been a quickly boring shoot'em up, with it, it's amazingly addictive !

Reply Good karma Bad karma+1 vote
hugebot Author
hugebot - - 68 comments

Thanks! Yeah this isn't technically procedural. You'll feel the difference. But it definitely adds way more replayability.

Reply Good karma+1 vote
spudkota - - 3 comments

Always loved odd ducks

Reply Good karma Bad karma+1 vote
hugebot Author
hugebot - - 68 comments

Thanks spudkota!

Reply Good karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.