Monday, March 12, 2012

Proving the Concept

Unfortunately, Real Life has not handed me a lot of time for programming in the last week; however, I seized a few moments this evening to try and get some kind of in-game view of the BGL-generated room layouts.

Since the algorithm I used generates a layout within a smaller coordinate plane than I'm using, I needed to stretch the space out somehow to make sure the rooms all fit.  My method for now is very simple: I maintain an integer offset as I'm placing rooms, adding it to both x and y.  Any time I try to place a room but find the desired spot unavailable, I just increment the offset and try again.  I think I'll probably have to go back and tighten this up a bit to make sure the rooms are iterated through in a particular order, but it seems to be basically working:


As you can see, the rooms are too close together, and the doors and halls are a complete mess.  I'm sure to be sorting that stuff out (again) for the next little while, especially since I've also disrupted things by changing the coordinate system from signed to unsigned, no doubt wreaking all sorts of subtle havoc.  Making everything unsigned was a mistake to begin with; I should have realized I'd want to be able to expand in any direction.  So far the problems seem minimal, though.  The level bounding box had been giving me headaches anyway, and tended to complicate hallway routing, so I can't say I'll be missing it much.  This does mean I'll have to put in scrolling exploration soon, to get to offscreen areas, but that'll be simple.

No comments:

Post a Comment