Something went wrong. Try again later

fobwashed

This user has not updated recently.

2818 388 76 606
Forum Posts Wiki Points Following Followers

Doors Doors Doors

Doors for days and days

I've been working on doors for the past week and half or so straight whilst also modifying and tweaking other areas like vision. . . Actually, I've completely rehauled the way my vision checks are ordered which make them work better, but slower. In any case, the focus of this update is doors -_-;;

Door Properties?

Something I've sort of noticed in games is that doors aren't really all that involved. In most cases, they are either impenetrable invisible walls to areas that aren't accessible or just a way of blocking progress until an objective is met or a key found. Apart from opening and closing, there doesn't seem to be all that much emphasis placed on their existence. Also, in isometric games, they have even further reduced properties. What I aim to do is have doors function as they would in the real world. First thing I need is for them to be able to operate and function like a real door which includes the following.

  1. Have an outside and an inside. The outside is considered to be the side of the door that requires a key to unlock.
  2. Optionally be a right handed or left handed door to control which way the door swings when opened.
  3. Have proper vision blocking properties. Doors when opened or closed should not be able to be seen through. This is done automatically in First Person and Third Person games but I have yet to see it done in an isometric top down game.
  4. Be locked and unlocked from the inside and require either a key or lock picking from the outside.
  5. Have the path that the door takes when opened or closed be taken into account. You cannot open a door that swings towards you without taking a step back and you also cannot magically close a door that is swung open away from you whilst standing outside (you can't close a door you can't reach).

As of now, I've tackled 1, 2, 3 and 4 and am currently working on the 5th step. While building out the door class, I've built in a way to take into account the area the door swings through when opened or closed but haven't yet implemented anything there yet because I still need to figure out how I want the player to be able to control which way they move when they are interacting with a door. Another reason why this door swing area is so important is that when you barracade a door by moving furniture in the door's path, the door shouldn't be able to just swing through it willy nilly.

Some Research

There's actually a whole lot of information out there on doors and things like building codes. Some small interesting examples I found are things like how in any commercially used building, exit doors always have to open towards the outside. This is so that if there's ever a situation where people are crowding the door to exit, they'll be able to push it open rather than all be stuck because it can't be pulled open due to people pushing from behind. Also, it turns out when doors are placed, they typically open so that the door is flush against a wall when in the open position for space reasons.

No Caption Provided

Notice how all the doors when opened are up against a wall. Maybe I'm just thick, but I never noticed this before and ever since I've been focusing on doors, I'm seeing this everywhere I go. Especially in smaller spaces such as bathrooms. Another small tidbit is that front doors to houses tend to almost always open towards the outside as well. Though the reason for this is because it's harder to break down a door in through the frame than it is in the direction that it opens. That's something I'll really have to take into account for door breaking scenarios that don't involve prying it open with a crowbar or some such nonsense =P

Implementation

So, once I decided that I needed to have doors that open in every which way and be shown in those open states as well, I had to figure out how many different states the doors would be in. So I whipped this up.

No Caption Provided

It's super crude but coupled with the excel file it's attached to, I had all the different properties of the door in it's open and closed states. I basically needed 12 different door states. (I think I'll eventually need to make doors that swing open a full 180 degrees instead of just the 90.) I worked it all out to where I actually only needed a very small amount of art assets to be able to draw a door in all these positions. It actually ended up being just this.

No Caption Provided

The back end of the frame, the front end of the frame and two door versions. One with the knob on either side. Armed with just these sprites, I could create doors in all 12 positions listed above =) The frame has to be split as shown because of the way the door needs to appear above the back part of the frame yet behind the front part of the frame and also to work properly with the stenciling I've got set up to create holes in the walls that can be seen through when rendering everything together.

Now that I had the damn things represented visually, I needed to figure out a way to get them to block vision properly. Br properly, I also mean that the player should be able to see through doors in the fashion you would in real life. For example, the door above has a window, so the player should be able to see into the room the door is placed on, and also through the window when the door is opened and the player is looking in that door's direction. Well, I won't get technical because I'm not sure I could really explain how I did it without first explaining the way my vision works in game, but I got it working as you can see in the video =P

I'll annotate the video eventually, but for now, you can see the various things I've been talking about at work. Doors that open in multiple directions. That can be locked and unlocked from the inside but not from the outside. Doors that can be seen through to a certain extent (the characters are placeholder and will be taller and proportional to the doors eventually.). Etc. . .

Still to be done

There's still a damn lot of work I need to put into the doors before they're complete but I feel I'm making decent progress. While I mull over how to allow the player to have full control over which direction they move in when opening and closing doors, I will be implementing double doors and sliding doors. The way the class is set up, they can also just straight up be windows so I may try putting one or two of those in to make sure they function properly. In any case, progress! It's been quite some time since I posted anything about what I've been working on, so I thought doors might be an interesting little bit to write up. Comments, questions and suggestions welcome =)

Mouse Look

Just a real quickie, Rastamen asked about mouse look, and it's in the game. Here's a short vid. Very short.

24 Comments