Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!






Next Project Please.

Posted by kseh, 23 September 2011 · 181 views

I haven't written in awhile. That's not as much of an apology as it is the explanation (excuse) for the lengthy rambling that follows where I figure it's necessary to go into detail about what I've been up to the past while

I haven't been in the mood to write those little flash game reviews for quite some time. I found that even keeping track of what I have played and when was keeping me from playing anything new let alone the prospect of writing up a paragraph or two. So since that was no longer fun I thought I'd move on to something else.

I'm one of those game programers that has that one major project always in the back of his head that's never going to be done. Actually, maybe it's more like two or three projects going on in there. Every now and then I'll get the notion to try and come up with some code to implement one particular feature or aspect of one of these projects. Something complex and challenging and something that seems like it'd be fun enough to spend some time tackling. That is the sort of thing I've been doing lately. And abandoning.

The first thing has been something to procedurally generate floor plans for houses. One of those grand ideas I have involves a city setting and although there's plenty of stuff out there on procedurally generating cities that I've been happy to ignore, I'm fixated on needing interiors of buildings. Places for characters to put possessions which may be of interest to other characters and in general places for events to take place. That sort of stuff I figure would be what drives whatever plot I'd come up with or otherwise have generated (everything has to be procedural you know). I thought about the designs I've seen for procedurally generating cities and figured that at some point I'll be looking into that as well. So I figured the direction I needed to go would be to assume that I would have some sort of terrain map that I'd somehow divide up into various sections of land. And that what I'd need to do is to find the largest rectangle that would fit in any given section while accounting for some margin of space between the section boundaries.

Lots of the work I do to trying to figure stuff out ends up with me plotting pixels to the screen. In this case, I had a 500 by 500 array in which I kept RGB values to to the screen. I initialized the array with values that when displayed a grey diamond shape. Anything that wasn't grey was out of bounds. Then, I went through the array one element at a time and for any element that was grey I would then see if the distances to the diamond edges would form a valid rectangle. If it did, I recorded the point and the length of the sides in vectors. When all of the array was checked, the vector was examined and the rectangle with the largest area was determined. I then set any points within that rectangle as out of bounds within the array. When the thing looped, you'd get a smaller and smaller rectangles in the area that was still in bounds until you had a nice symmetrical display. Sometimes the results wouldn't be what I'd expect (not perfectly symmetrical) but when I traced through everything, the code was doing exactly what it was supposed to.

Attached Image

The next step was to try and create partitions within each rectangle that I had defined. Those partitions would represent rooms. A little bit of refactoring was all that was needed to ensure that I could find smaller rectangles within the rectangles I had just defined. By then breaking any sense of organization the refactoring gave me, I was able to say that I wanted a certain percentage of the rectangle I had defined to be allocated as a particular room. That part worked great. What I didn't account for was any remainder of allocated space and using that remainder in some way that's fitting of a house floor plan.

Attached Image

This was where momentum on this project broke down. Not because it was hard to do but because I was getting bored and distracted. I think what happened was in an effort to maintain the desire to work on this project, I gave consideration to taking a map generated from a terrain generation project I had and use that to see how the rectangles would look and fit onto the various elevations on the map. I ran the terrain generator and I think my mind wandered. For one thing, mid-point displacement maps can sortta look like clouds. This reminded me of this journal entry, by Freeworld, showing some cool weather effects. I had taken a stab at that sort of thing myself once before but never got it working right. Thoughts of having an adventurer wandering terrain I had generated, and that terrain being shaped by the weather started to enter my head. I'm going to say that it was at that point the floor plan project had officially become derailed.

I was going to go on describing what all I have attempted with my weather simulation project but this post is getting quite long. The short story is that I think the weather project is going to be put to the side again as well. Although it's a better example of cellular automata than my first attempt, it's still doesn't look nearly as cool as the one in Freeworld's journal posting nor does anything flow quite right. But even then I'm wondering if it's going to have any practical use at all in any other project I might aim towards (might just be a sour grapes thing).

Anyways, I'm not sure exactly what project will be next to capture my focus. I find myself drifting towards some of the overly lofty and fanciful goals of a typical beginners despite knowing better. To be honest it's fun to dream of creating something big and impossible like I used to in those days when I didn't know better and then occasionally take a stab at it. Even if it misses. That sort of thing is why I found programming fun back in those days.




April 2015 »

S M T W T F S
    1 234
567891011
12131415161718
19202122232425
2627282930  

Recent Entries

Recent Comments

Latest Visitors

PARTNERS