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.

  • Del.icio.us
  • Digg
  • Technorati
  • Blinklist
  • Furl
  • Reddit
  • Facebook


Submit Your Comment

You are not logged in.


Flowing Malaya Skirtini -...
<strong><a href="http://www.bikinis-...
howelldickson @ 10:40am, 4 May 2015

New Arrival Toms Geometri...
<strong><a href="http://www.tomsshoe...
howelldickson @ 3:34pm, 3 May 2015

New Balance Outlet Store,...
<strong><a href="http://www.nbalance...
howelldickson @ 1:04pm, 3 May 2015

Timberland Mens 6 Inch Pr...
<strong><a href="http://www.saletimb...
howelldickson @ 2:56am, 3 May 2015

Replica Rolex Datejust II...
<strong><a href="http://www.highrepl...
howelldickson @ 2:19pm, 2 May 2015