Hello!
This last couple of weeks has seen me get busy figuring out how to control the visibility of rooms and walls. As the player moves around the manor house I want the following to happen:
If there is a room on screen that the player has never been inside, then just display it as a black void
If there is a room on screen that the player has been inside, or at least the door has been opened, then display it as a floorplan
When the player is inside a room, obviously show that full room and hide the other rooms as per the rules above
Doors are always visible (so they will need to go in the root scene)
After some fiddling with assets so I could show/hide the right things I finally got to this stage:
I have expanded it to another room since I recorded the video above and sorted the first floor corridor too. That corridor was fun btw, as I had to use multiple overlapping trigger boxes to fit the odd shape of it, which meant the simple "is the player inside the room trigger" check wouldn't be enough as the player could well have left one trigger box, but still be inside another.
In the end I created a simple PlayMaker FSM that added 1 to an integer whenever the player entered one of the corridor trigger boxes, and deducted 1 when they left one. This meant that as long as they were moving inside the cluster of triggers, this value would always be at least 1, and would only hit 0 again when they completely left the area, and that was when I could trigger the room hiding code.
Also took me a week to find a very obvious bug in this, where disabling the walls updates the navmesh, meaning the AI thinks it can just walk through where the walls used to be! Duh... Instead I now just disable the mesh renderer, for the same effect but without the bug. Yay!
A Main Menu
I present to you the most boring screenshot you will see this week!
And that's all it is right now. I didn't yet have a main menu, and needed one, so I added an extra page/tab to the journal as I want that book to function as the 'hub' for all game actions. After all, it is Monicas' investigative journal and a key part of the gameplay, so it made sense to tie add the main menu here rather than having a completely separate screen.
Interactive Map Screen
This one took a lot more work than the Main Menu, that's for sure! There are five floors to the manor house, which conveniently fits the height of the journal UI page without any fiddling (almost like I planned it!), and you will be able to swap between a map of each floor showing only the rooms that you have been in. That last bit hasn't been done yet btw - those grey rooms below are just the basic floor collider box from a quick overhead screengrab.
While early in the game you have to explore the manor house on foot to find and talk to the suspects, get into new rooms, and examine items, later on I figured you will just want to quickly move between locations when e.g. you have discovered some new info in the basement and want to ask someone about it who happens to be on the top floor.
So, this being a fantasy world filled with magic, gives me the freedom to create a 'Magic Map'! Any room you have already been in can be clicked on, and you are instantly teleported there:
Climbing Stairs
The other thing I've been thinking about is how to navigate stairs. Showing and hiding overlapping flights of stairs while allowing the player to be able to click to move up and down has been a problem since I put the blockout together, so I had to come up with a solution.
And that solution is auto-climbing stairs! Flights of stairs will now be a clickable object, which will give the player the option to go up or down to the next floor, and the whole movement will be taken care of by the AI navigation. I have so far done a test with movement markers at the bottom and top of the main staircase and the character successfully moves up to the second floor. I still need to make the stairs clickable, add a UI element to select up/down/cancel, and fix a bug where the stair climbing animation is cancelled when the new floor loads in (I know what's causing this).
I've done a few other things as well, but this post is getting long, so I'll save them for another update. In the meantime I'm cracking on with getting the first 20 minutes of the game playable!
Tony.
0 comments