First steps in procedural generation

I’ve been doing some game development since the start of July, amidst all of the other things I’ve committed to do. At first I felt that I didn’t have enough material for a dedicated gamedev website (to date, I’ve finished one crappy game), but I found a promo code for Dreamhost (protip: it’s TEXTPATTERN) and so I’ve taken the plunge. Welcome! Pardon my dust.

Right now I’m working on the procedural generation of a room, which will lead into the procedural generation of a building, which will neatly segue into a game that has a nice mix of both random and non-random elements, all of which is created at run-time, is different between each game, and requires as little labour from me as possible.

While it’s commonplace to generate a landscape at run-time from random noise, it’s much less common to generate a building on-the-fly. Part of the reason is that the pseudorandom tools we use for terrain generation (like fractal Perlin noise) do a great job of modelling the random details of the natural world, but not so the ordered nature of the manmade world.

My idea for getting around this is to personally design a multitude of rooms in a variety of types and sizes (bedrooms, kitchens, living rooms and so on), and then randomly piece rooms together to form the superstructure.

This would be painstaking if I went by the obvious route and fired up a 3D modelling tool to make each room individually, but roguelikes have been doing this kind of thing for years, and I think that representing a room in ASCII is simple to design with, simple to parse, and high-information. So what I want to be able to do is fire up Notepad, input something like this:

#---#
|...|
|...|
|...|
|...|
|...|
#---#

And have a 3D structure pop out the other end. This is what I have after a few hours of programming a procedural room generator. The actual code is simple, but I had many small moments of confusion while writing it.

A 3D analog of the ASCII room, with placeholder primitives.

I can see why Notch went with cubes for Minecraft; much easier to procedurally generate stuff when you don’t have to worry about orientation! I originally used hashes for all of the walls, then switched to the hypens and pipes because they are more meaningful; instead of the arbitrary meaning of a # as wall, a – means an X-aligned wall, and a | means a Y-aligned wall.

I’m now thinking that having it more like this would be even more informative:

#___#
[...]
[...]
[...]
[...]
[...]
#---#

That way I can automatically grab and place the correct wall at the correct orientation without having to decide programatically where the wall is, what’s around it and so on.

Cowface

Tags:  

    

Nike Air Max classic Nike Free Run sale Nike Air Max kopen Nike Air Max shop Nike Air Max classic goedkoop Nike Air Max 90 goedkoop Nike Air Max 1 kopen Nike Air Max sale Nike Air Max 90 sale Nike Air Max kopen online