Hello again! This last few weeks has seen me bouncing between several different tasks:
Streaming volumes for double-height rooms
There are a couple of areas of the manor that are double-height rooms, i.e. rooms that are two floors high: the main entrance hallway with its overlooking balcony, and the library with its upper floor accessed by a lift (that's an elevator for you US people). I wanted these to behave as though they were all one room, and not two floors - meaning no loading when you ascend or decend inside them - so I had to separate these out into their own scenes and add new streaming volumes to keep these loaded in whatever 'floor' height you are on.
Library lift
Related to this was the lift in the library, which was a damn pain to set up. Initially I tried to duplicate how I had created lifts in my Dungeon Paths project: attach the player character as a child of the lift, disable player control, move the lift, un-child the player and restore control. However, what happened was as soon as the lift reached the upper floor, Monica would instantly ping back to the ground floor. Oh, and click-moving and camera rotation was borked!
Turned out to be a combo of a bug and how the navmesh agent works. The bug was I wasn't properly clearing her 'move to' target on triggering the lift, so she was still trying to get to a position on the ground floor. However the other issue was the NavAgent component on her was staying on the ground floor, which was really odd as I would have expected it to move with the player character.
In any case, I solved it in the end by disabling the NavAgent while she was moving on the lift, then restoring it when it stopped - the NavAgent then seemed to understand it was meant to stay at the new floor height. I also stopped setting Monica as a child of the lift, because that was causing the camera bug - I think it was losing its link to her during this process.
Anyway, a whole load of effort just to make a character go up and down! Speaking of up and down...
Stairs
I noticed that as Monica moved up and down stairs, the stairs would ping into existence above her, and disappear under her feet as the previous floor was unloaded. This was obviously not ideal.
The fix was a simple level design solution - simply copy the stairs above and below into the current floor. So as you go up and down stairs, you see the flight of stairs above and below you, then when the floor you are on unloads, and the new one loads, a new set of stairs seamlessly appears in the exact same place so you don't know they have been swapped out.
Camera change
Now I had the floors, rooms and staircases streaming properly I was able to have a good walk around the manor and spotted the sheer number of walls getting in the way as I rotated the camera. Currently only the test room has the 'wall vanish' script on it, but even so I quickly realised how distracting and messy it would be to constantly have walls appearing and reappearing as you swung the camera about, cutting through rooms and stairs off to the side.
So I decided the simplest solution would be to change the game to use a fixed camera instead. While I will still need some walls to appear and disappear I now have much more control over the process, meaning it will look a lot better. Also, the rotating camera didn't have any gameplay purpose anyway, I just thought it would be cool, so I'm not losing any functionality by doing this. I can also control the player's eye a lot better with a fixed camera, which will make it easier to direct them around the manor.
Navmesh baking again and again and again
Good grief, the amount of tweaking to nav agent and navmesh settings and re-baking I've had to do to get a mesh that looks decent and works. Hopefully I won't have to touch this again, as there are so many options on both it makes it hard to determine what settings or range of settings is causing issues.
And after all that, I'm now busy sorting the code to make rooms appear/disappear when you open and close doors and enter or leave them. If you're outside a room you've never been in, it's just a black void. If you have been in the room, it will appear as a floorplan. Then when you enter it, the room will fully appear around you. At least that's the plan. Let's see what it looks like when you play it!
Tony.
0 comments