Random Building Size
posted by Sylpher @ 12:30am, Sunday 10 August 2008.
I have my code base for making a roguelike mostly worked out. Nothing terribly impressive just the basics to create a screen buffer, and draw to it. I also have a class I called Structure to represent all buildings in the world as one generic class. I would like to eventually make it so it procedurally generates a structure, but for the time being I will have to settle with working on a random size generator.
Side Note: Structure might not be the best idea for a class name, so I am thinking about changing it to Building in future endeavors.
The method to draw a structure is little more than two loops which makes anything beyond a rectangle complicated. I have the class setup to set the height, width, etc.. properties in the constructor, but this makes working with it a little bit of a pain so I gave myself a Resize method, as well.
Passing Resize a couple values generated with rand() and its friends and I have a different sized room every time I launch the application. Not exactly the most advanced piece of software to ever be written, but I have a couple ideas of where I might go with it to make some slightly more complicated shapes.



In the future I will upload a build if I ever put something together worth messing with, but I figured screen shots were enough for this example.









Comments
Submit Your Comment
You are not logged in.