[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Adding More Camera Behaviors" vod_platform=youtube id=4hDRp2VDeEU annotator=Miblo] [0:08][Recap and set the stage for the day] [1:48][Run the game to see how the camera is working and consider introducing the notion of camera movement while lingering] [5:59][handmade_sim_region.cpp: Begin to enable UpdateCameraForEntityMovement() to move the camera gradually towards a target] [7:15][A few words on the commonness in games of moving gradually to a target] [8:12][handmade_sim_region.cpp: Make UpdateCameraForEntityMovement() set the camera's target] [10:05][Run the game to see no camera movement] [10:37][handmade_sim_region.cpp: Enable UpdateCameraForEntityMovement() to snap the camera to its target] [14:05][Run the game to see the camera snap between locations] [14:19][handmade_sim_region.cpp: Enable UpdateCameraForEntityMovement() to gradually drive the camera from its current location to its target] [14:45][Run the game to see that camera interpolation in action] [15:05][Blackboard: Moving along a vector by a simplified rate] [21:19][Run the game to show the constant velocity of the camera] [21:47][Blackboard: Prentending that our velocity is encoded in the length of p] [24:02][Blackboard: Computing instantaneous velocity, without acceleration, using a resolved rate equation] [27:57][Run the game and determine to move the camera when lingering] [28:33][handmade_entity.h: Add CameraBehavior to the entity struct] [29:41][handmade_sim_region.cpp: Begin to enable UpdateCameraForEntityMovement() to handle camera behaviors] [30:35][handmade_world_mode.cpp: Make AddStandardRoom() generate a CollisionVolume near the hole to trigger camera movement] [34:22][Run the game and try triggering that CollisionVolume] [34:48][handmade_sim_region.cpp: Introduce the notion of a SpecialCamera, and make UpdateCameraForEntityMovement() handle it on a timer] [39:02][Run the game to try out the timed triggering] [39:54][handmade_sim_region.cpp: Enable UpdateCameraForEntityMovement() to zoom the SpecialCamera] [44:24][Run the game to see that timed camera movement with zoom, and tweak the movement] [46:58][handmade_sim_region.cpp: Make UpdateCameraForEntityMovement() only trigger the camera movement when the hero is not moving] [48:45][Run the game to try the camera, and determine to create a camera movement for the stairwell] [50:26][handmade_world_mode.cpp: Prevent AddStandardRoom() from randomising the stair positions] [58:25][Run the game to see our even stairwell, and tweak its dimensions] [1:04:22][handmade_world_mode.cpp: Enable AddStandardRoom() to generate the stair tiles separately from the hole generation] [1:06:33][Run the game to try out our wider stairwell, and tweak it] [1:10:34][handmade_world_mode.cpp: Define the two StairsCam CollisionVolumes in AddStandardRoom()] [1:17:31][Run the game and determine to create movement logic] [1:18:42][handmade_sim_region.cpp: Implement some velocity constraints for the SpecialCamera in UpdateCameraForEntityMovement()] [1:32:45][handmade_math.h: Introduce IsInRange()] [1:33:39][handmade_sim_region.cpp: Enable UpdateCameraForEntityMovement() to distinguish between a Player and an Area camera] [1:35:25][Run the game to try out those cameras] [1:36:03][handmade_entity.h: Introduce the notion of a CameraMinTime in entity] [1:37:16][Run the game to try out the timers] [1:37:37][handmade_world_mode.cpp: Set GeneralVelocityConstraints for the HoleCam and StairsCam] [1:42:14][Run the game to try triggering the StairsCam, and investigate the snapping] [1:48:53][handmade_world_mode.cpp: Determine to enable UpdateAndRenderWorld() to correctly update the camera position when changing sim region] [1:57:17][Q&A][:speech] [1:57:52][@sahfortv][There seems to be a second problem with StairCam 1 vs StairCam 2, i.e. you need to be moving even though you're on the first stair, so the collision areas are out a bit?] [1:58:38][@rooctag][Why are the trees below smaller than the trees up top?] [2:01:36][@butwhynot1][Are you going to experiment zooming by changing the FOV rather than changing the distance?] [2:02:09][@macielda][Why use velocity and not, for instance, acceleration as a constraint parameter?] [2:02:43][@m0re85][Why are the health bars flickering? Seems to be most noticeable when the hero is at standstill (the familiars move all the time and they don't flicker as much)] [2:03:30][handmade_entity.cpp: Enable DrawHitpoints() to prevent Z-fighting] [2:04:19][@radovik][Off-topic: Is it normal for a trivial code change to lead to a 250MB diff file? Is this optimization / MIPS architecture weirdness?] [2:05:18][@rooctag][What do you want to fit in the camera view? Whole room, or some amount of tiles so camera movement per room is needed] [2:05:53][@ahoward1024][Hey Casey, in the PushBitmap function of the handmade_render_group you have a shadowed v4 parameter Color that is masked by the u32 Color. Compiles as a warning (to an error) in VS 2015] [2:07:21][handmade_render_group.cpp: Move in PushSetup() and transient_clip_rect from handmade_render_group.h[ref site="GitHub" page="HandmadeHero/cpp Issues" url="https://github.com/HandmadeHero/cpp/issues"]] [2:09:19][@teamrandb][Does the profiler still work? If not, what is a quick overview of the work that is needed to get it working again? And was it purely a display issue that we could not see it?] [2:10:40][handmade_render_group.cpp: Fix GetClipRect() to correctly clip the profiler's text] [2:15:39][handmade_render_group.cpp: Introduce GetScreenPoint() for GetClipRect() to call] [2:19:11][Run the game to see that it's getting closer to working] [2:20:03][Blackboard: Mapping screen dimensions to -1 to 1] [2:22:18][handmade_opengl.cpp: Try disabling the ClipRect bounds setting] [2:26:33][Run the game to see what's going on with the clipping] [2:28:09][@teamrandb][Thanks Casey, appreciate you walking through it] [2:28:44][handmade_render_group.cpp: Temporarily prevent the clipping from occuring and run the game to see that] [2:29:41][@macielda][Can you click "Threads" on the Profile window?] [2:31:15][@macielda][Is the mouse over text working now?] [2:31:55][Sign off][:speech] [/video]