cinera_handmade.network/cmuratori/hero/code/code504.hmml

79 lines
7.3 KiB
Plaintext

[video output=day504 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Exploring Camera Interpolation Alternatives" vod_platform=youtube id=JlOPS70vROM annotator=Miblo]
[0:00][Recap and set the stage for the day][:camera :speech]
[0:48][Show our :camera transitions, noting our desire to follow a moving target][:run]
[3:04][Moving :Camera Target][:blackboard :mathematics]
[6:46][Interpolating :camera between unknown start and end locations][:blackboard :mathematics]
[14:32][Respecifying :camera room transitions as taking a constant time][:research]
[16:22][Change UpdateCameraForEntityMovement() to follow the player, but interpolate the :camera on room changes]
[16:50][Show the player-locked :camera behaviour][:run]
[18:13][Change UpdateCameraForEntityMovement() to interpolate the :camera between "large" distances, removing InRoom from game_camera]
[21:48][Try out our new distance-based (as opposed to room-based) :camera, finding weird behaviour on the stairs][:run]
[22:22][Investigate that weird :camera behaviour on the stairs][:research]
[24:22][Make UpdateCameraForEntityMovement() interpolate all :camera movements]
[25:38][Try out our interpolated :camera to again see the positional hiccough on the stairs][:run]
[26:18][Investigate our :camera's positional hiccough][:research]
[28:30][Enable UpdateCameraForEntityMovement() to restart :camera interpolation when the target changes]
[32:32][Try out our newly restarting :camera interpolation, to still see a positional hiccough][:run]
[33:39][Reduce the MaxDistancePerFrame() in UpdateCameraForEntityMovement(), and initialise the hero at the forest stairs][:camera]
[34:13][Take a closer look at our :camera's positional hiccough on the stairs][:run]
[34:34][Continue to investigate our :camera's positional hiccough][:research]
[36:00][Fix UpdateCameraForEntityMovement() to restart :camera interpolation if either the starting or ending positions move]
[36:22][See a :camera glitch on chunk boundaries][:run]
[36:45][Continue to investigate our :camera's positional hiccough][:research]
[37:47][Assert in UpdateCameraForEntityMovement() if we are not in a room][:camera]
[38:06][Happily fail to hit that assertion][:camera :run]
[38:16][Continue to investigate our :camera's positional hiccough][:research]
[39:17][Make UpdateCameraForEntityMovement() restart :camera interpolation more smoothly]
[44:12][Find that we've fixed the :camera's positional hiccough][:run]
[44:45][:Camera phases: Acceleration, Max Speed and Deceleration][:blackboard]
[46:59][Figuring out our options for getting the target velocity][:camera :"entity system" :research]
[49:00][Initialise the hero in her bedroom][:"procedural generation"]
[49:35][Show our current :camera easing][:run]
[49:43][Change UpdateCameraForEntityMovement() to base :camera interpolation on accelerations, rather than start and end positions]
[1:00:21][Differentiating between the acceleration and deceleration regions][:blackboard :camera]
[1:01:54][Make UpdateCameraForEntityMovement() compute the velocity in addition to the acceleration][:camera]
[1:06:02][Solving for our position along a three-phased :camera interpolation curve][:blackboard :mathematics]
[1:09:50][Solving for our position along a parabolic curve[ref
site=Wikipedia
page="Quadratic equation"
url=https://en.wikipedia.org/wiki/Quadratic_equation]][:blackboard :camera :mathematics]
[1:16:38][Parameterising our :camera interpolation on the "total curve length" and our "t along the curve"][:blackboard :mathematics]
[1:33:42][Change game_camera to contain our position, velocity and acceleration along the interpolation curve][:camera]
[1:36:12][Solving for our velocity and acceleration along an interpolation curve, knowing our position][:blackboard :camera :mathematics]
[1:39:57][Plug our equations into WolframAlpha[ref
site="Wolfram Alpha"
page="u=3*d*a*t*t+2*d*b*t+d*c, v=6*d*a*t+2*b*d for d,t"
url=https://www.wolframalpha.com/input/?i=u%3D3*d*a*t*t%2B2*d*b*t%2Bd*c,v%3D6*d*a*t%2B2*b*d+for+d,t]][:mathematics :research]
[1:44:21][Solving for our acceleration along a uniform curve based on our current velocity][:blackboard :mathematics]
[1:47:13][Remove dt and ddt from game_camera][:camera :mathematics]
[1:50:34][Storing and heuristically adjusting our length and t value from last frame][:camera :mathematics :speech]
[1:51:57][Begin to make UpdateCameraForEntityMovement() step along our :camera interpolation curve using the t and DeltaP from the last frame][:mathematics]
[2:00:00][Consider other options for :camera interpolation][:mathematics :speech]
[2:02:06][Make UpdateCameraForEntityMovement() update our velocity based on a curve rule][:camera :mathematics]
[2:08:18][Check out our :camera interpolation][:mathematics :run]
[2:08:49][Make UpdateCameraForEntityMovement() compute our :camera's velocity by mapping onto specified acceleration / deceleration curves][:mathematics]
[2:22:30][Find that our :camera interpolation sort of works][:mathematics :run]
[2:22:59][Change game_camera to store the ddP, and UpdateCameraForEntityMovement() to compute this as well as the dP][:camera :mathematics]
[2:25:59][See a hitch in our :camera][:run]
[2:27:03][Fix UpdateCameraForEntityMovement() to use the AccelRange to compute the ddP along the acceleration curve, and to lerp along the deceleration curve][:camera :mathematics]
[2:32:57][Try out our :camera][:run]
[2:33:18][Increase our acceleration and deceleration curve ranges in UpdateCameraForEntityMovement()][:camera :mathematics]
[2:34:28][Try out our :camera][:run]
[2:34:43][Make UpdateCameraForEntityMovement() update the :camera's P in the deceleration curve case][:mathematics]
[2:41:31][Consider solving for the deceleration curve from our current velocity to 0][:camera :mathematics :speech]
[2:44:27][Temporarily make UpdateCameraForEntityMovement() interpolate the :camera using a proportional derivative controller][:mathematics]
[2:55:11][Try out our proportional derivative controlled :camera][:mathematics :run]
[2:57:34][Blending the :camera focus range, for alpha clip and fogging purposes][:mathematics :speech]
[3:02:34][Synchronising that :camera focus][:mathematics :run]
[3:03:27][Make UpdateCameraForEntityMovement() include the :camera focus range in our proportional derivative controller][:mathematics]
[3:08:37][Try out our fully proportional derivative controlled :camera][:mathematics :run]
[3:11:21][Q&A][:speech]
[3:11:52][@paulmmh][Q: In episode 392 you thought about moving Molly Rocket to Linux. Are you still thinking about that? What about the lack of proper debuggers?]
[3:14:34][@sahfortv][Q: Is the plan to change the character facing direction when they move in a direction, or will that be mapped to a different key?]
[3:16:02][@reductum][Q: If there were a truly good (better than VS's) debugger for Linux, would that make Linux viable for gamedev?]
[3:16:33][@mint_spider][Q: It looks like the "average" sized room is currently too big to be seen without scrolling. Is that what we want in the end, or is it just that average room size is still undecided?]
[3:16:59][@rebelavalon][Q: I started watching at the beginning, and I'm up to episode 024. Did any code get released? Is any code public domain?]
[3:17:09][@fierydrake][Q: Did the updated speed get applied into the :camera for the fog / alpha interpolation?]
[3:17:14][Wrap it up][:speech]
[/video]