Tuesday, October 8, 2013

Dev Log: Horror Text Adventure #23

Why was I doing things the crazy way I've been doing?

I keep abstracting out the way the world works because in my mind the world is not truly in 3D space the way, say, an FPS is.  But it makes far more sense to give each room an xyz coordinate set.  Now I'm no longer creating rooms within rooms, and creating an inefficient "snaky" form of maze.  Instead, I just create rooms with an xyz, and on creation of each room, change one of those coordinates by one, plus or minus.  Then check to see if I'm accidentally overlapping rooms, and make corrections with recursion.

That part's all set now.  And with that proper world gen in place, I have much more easily set up barriers.  Now barriers aren't created when the room is created, but is instead a separate process because rooms need to know who their neighbors are before barriers can be made, and if their neighbor hasn't been made yet, it would need to be corrected anyway.

Right now I've made it so if a room has a neighbor in a particular direction, there is a passage between them.  If it doesn't, there is a wall.  This is of course too simple for my goal, but for now I'm doing it that way so I can see at a glance what the structure of the world is.  It actually doesn't work out too bad.  It seems like any given room has at least a couple of walls, and some rooms at the edges are dead ends.  This is exactly what I want, and it was decently easy to get it that way.

This is far less convoluted now and nicely top-down, instead of the sideways structure I had before.  I think it's bug-free, too, so I can start moving on to other things.  Maybe I'll add some fluff text, or perhaps I'll tackle doors next.  The doors, especially locked ones, will require a bit of thinking.  Adding doors is easy; it's locking them and putting the keys on the right side that's the tricky part.

No comments:

Post a Comment