Look who’s back! With corridors growing out of his face this time!
I reintegrated the Special Room code into the new corridor-supporting code base… sort of. It works just fine, but only so long as corridors can connect to any part of the room (e.g. rather than just doors). Given the way the BSP approach works, it’s not immediately clear to me how to make it work; in particular the case where the BSP tree pairs up the special room region with a region that is on the other side of the door. In that scenario, my digger gnome (who only know how to go straight or do one L-corner) can’t connect them. There are a few options that occurred to me – e.g.:
- Require that rooms have multiple exits on each edge (meh)
- Build rooms that have lots of floor around them; a variant of #1 above with its own issues, but might be okay…
- If it’s not possible to connect, then rotate the room until it is (better, but still meh). I’d eventually like to support rotating rooms anyways for variety, so this may not be too bad.
- Populate the entire BSP tree except for the special room, and then pick any room in the “right direction” and dig towards it, stopping at anything you find. Best solution, but I haven’t thought through if I can set up the BSP tree properly to work with this.
- implement a smarter Digger (eg A* based). Intriguing, but not yet…
Still, for now this’ll suffice. Here’s what it looks like with the crazy corridors approach; notice that the digger gnome is doing what it’s told, and is powering right through everything – the special room included – until it gets to its destination (that’s how the crazy corridors approach works). Obviously you’d want to wrap the special room in something that keeps diggers from going through it; however, I can’t just stop them (it would no longer gaurantee all rooms were connected), and don’t yet have a way to go around them. So; net result is that special rooms are back in … sort of.
And here’s the code: Code
Next up: Still not sure. Flying out on a red eye tomorrow night and doing extended family stuff until Monday – hopefully will be able to get some coding time in (but the posts may not be posted until Monday).