Future note: Well, this blog post is now called an “attempt” because (spoiler alert) below is me failing to properly make the feature I wanted. Oh well. I still feel I will document this as a “full day spent working on a feature”, it just happens that the feature I was doing needs to be partially redone.

Now that my tile wall tops work, I can worry about doors. Currently, the logic makes horizontal doors with a single wall piece look essentially broken:

Vertical doors are sort of okay (disregarding how they connect):

I don’t really know how to solve this algorithmicaly. Everything I think of just leads to more issues. My room logic is already convoluted enough. I can’t just change the room layout to have an extra wall, because rooms are rotated and this would mess it up in all directions. I can’t manually add wall pieces, because I don’t know what side is okay to expand walls towards (and both could be not okay).

I think the simplest I can do is just remove my room overlapping logic and have them aligned perfectly, that is, exactly adjacent to each other without any special overlap rules. This makes the doors “double”-doors, because now both rooms are providing door tiles:

This does mean that my removable door/floor logic for halls no longer works, because the tiles no longer overlap:

I have to make this work before I go further with doors. I have to change my logic from “replace replaceable wall/door tile with a floor” to replace (1) replacable tiles at the (2) edge of (3) similar neighbours with floors. (1) Replaceable tiles are the same as before — doors and floors for rooms I marked as such. (2) Edge tiles are the tile on the border of that room. And (3) similar neighbours are a hard-coded list of room designations that can “overlap” — currently, big and small halls and hubs. And that works out great:

All my rooms are now bigger by 1 tile though.

Now, my doors need to have a direction, specifically whether they are horizontal or vertical, so I can have different visuals for it. For that, I will make two additional tile definitions:

That means my rooms also need to have an editor to specify which direction the doors are, so that I don’t have to algorithmicaly determine this:

And so all the rooms specify which doors are which:

Except a tiny problem is that rooms can rotate. And the doors don’t actually “rotate”:

So I need to replace horizontal ones with vertical ones when the angle is 90° or 270° degrees (and vice versa). And that works fine (disregarding totally broken fog of war):

Now I can add tiles for wall “hinges” where doors seemingly connect to the side walls:

And this also works nicely with an extra sprite:

At this point, I am really questioning this double horizontal door logic, when my vertical doors are visually a single tile. May be I should have kept overlapping the room horizontally, just not vertically. But I really don’t want to go back to the whole overlap mess again.

In fact, at this point I spent a lot of time fixing and adjusting how a lot of things work due to these changes. I have now added way too many tile designations — different wall types, multiple door types (and that’s just one side of double-doors), door hinges.

I have added the requirement for several sprites I will need for double doors, and the doors need to match the wall type as well. And due to double doors, my fog of war is completely broken and needs ridiculous rulesets to properly flood-fill visible areas. And all my wall top troubles also translate to doors, except those also need to open. In short, I’ve already complicated it all beyond what I want and I haven’t even gotten to some of the trickier parts.

Unfortunately, I will need to go back to overlapping rooms and rethink my wall approach. I now believe the whole top and side wall separation was a mistake and I should have done this in the same tile, just make it “taller”. I will keep some of the above changes, but I will redo others.

Related Posts

MicroRogue DevDiary #53 – Tile door attempt
Tagged on:             

Leave a Reply

Your email address will not be published. Required fields are marked *