hey!
today i think im gonna start writing posts about recent dev activities in diary format.
i'll still have a few detailed rundown posts to do on stuff that's already been implemented for a while, but right now iiiiii wanna talk about stuff i just did instead.
(also cohost added embeds today and im excited to use one)
lets look at todays work
music is brave fencer musashi - village at night
the past few days i've been working on the workflow of setting up new rooms. there are a lot of steps in setting up a prerendered room in unity, and i wanted to make sure i could automate as much of it as possible before committing to this visual style. turns out... i was able to automate a lot!! it's really smooth now. i'll make a post about workflow stuff another time i think, but for now, lets talk about some stuff u can actually see in this video: Rooms and Views.
Room: stores data about a given, well, room. each one has its own little array of Views.
View: stores important data for displaying a certain camera angle within a Room, such as the prerendered image, the depth mask texture, the index of the camera to use in the scene, and the camera clipping distances the depth mask was rendered with.
example of a prerendered image and its matching depth mask texture.
the depth mask texture is what lets objects in 3d space render in front of or behind objects that only exist in the 2d render, such as Snowman Finalfantasyxiv.
i had all this stuff workin already, but in order to swap between views within a room, i was still pressin debug keys. today it was time to implement "view change triggers" - basically zones where, if you enter (or, optionally, exit) them, it'll automatically swap the current view to a different one in the room. So I Did That. pretty simple.
however!! i realized very quickly that the controls felt strange when moving between views. movement is based on the current camera angle - so when you press up on your gamepad or keyboard, you'll always move "up" in relation to the current camera angle. if you're moving between two views with drastically different camera angles, such as the first view change in the above video, "up" suddenly becomes a very different in-world direction!! if your views are set up poorly enough, a player might even end up walking back into the view they just came from before being able to react to the change and adjust their input direction to stay on course.
so!! the solution i ended up on (that i'm trying for now, at least) is thus: when the view changes, your movement direction will smoothly interpolate between a direction based on the previous view's camera angle and a direction based on the current view's camera angle over the course of about half a second. also, during that time, if you change your input direction manually (there's a little wiggle room here since analog input is less likely to stay Exactly the same for a long period of time) this interpolation will stop and you'll immediately move in your new input direction.
at about 30 seconds into the above video, you can see that i hold up on the keyboard (visible in the bottom right) when moving between views, and Mascha does a sort of automatic little smooth turn over half a second or so without me changing my input direction at all. that's the magic at work!!
anyway. the main thing i learned is that i need to be more thoughtful about drastic camera angle changes between views. but also ive now got a funny little fix that makes moving between views feel a lot more natural!
an aside: people give tank controls a lot of shit, but they actually sidestep this issue completely. with tank controls your character will always move forward based on their facing, which does not automatically change with camera angle. this means that while the player may still be prone to a brief moment of disorientation, the character will still be moving toward whatever direction it looked like they were moving toward before the view changed. makes sense why so many old prerendered bg based games used them! But I Doun't Whant To
oh yeah also you couldnt walk down slopes before today. so i added that. but also i made it slightly bad so we dont need to talk about it right now. ok see you later im tired of writing post
