[video output=day352 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Isolating the Camera Update Code" vod_platform=youtube id=m6yAMBpk7Bg annotator=Miblo] [0:07][Recap the career-switching side-streams] [3:26][todo.txt: Consult the TODO list and set the stage for the day's programming] [12:16][Run the game to remind ourselves of where we are] [14:39][handmade_world_mode.cpp: Reacquaint ourselves with how the region simulation works] [18:29][handmade_sim_region.cpp: Reacquiant ourselves with how EndWorldChange() updates the camera] [21:28][A few words on dependency reduction and functional programming] [24:34][handmade_sim_region.cpp: Pull out the camera updating code from EndWorldChange() into a new UpdateCameraForEntityMovement() function] [28:05][Run the game to find that the camera no longer functions] [28:23][handmade_world_mode.cpp: Make UpdateAndRenderWorld() call UpdateCameraForEntityMovement()] [31:31][Run the game to find that the camera now follows the hero again] [32:02][handmade_sim_region.cpp: Reorganise the code and consider BeginWorldChange() and EndWorldChange()] [33:30][handmade_world_mode.h: Introduce game_camera struct and make the necessary functions use it] [36:46][handmade_world_mode.cpp: Prevent AddStandardRoom() from generating boost pads] [37:46][Run the game to find that we have the same functionality as before] [38:00][handmade_sim_region.cpp and handmade_world_mode.cpp: Make every function that uses the camera take game_camera] [41:38][A few words on supporting multiple-sized rooms] [45:55][handmade_sim_region.cpp and handmade_world_mode.cpp: Continue making functions take a world rather than game_mode_world] [50:18][handmade_world_mode.cpp: Isolate the CameraP computation from BeginSim()] [1:02:41][Run the game to find that everything appears to be working properly, but that the game is running faster] [1:03:39][handmade_world_mode.cpp: Consider preventing Simulate() from taking a game_mode_world] [1:06:27][handmade_entity.cpp: Consider preventing UpdateAndRenderEntities() from taking the TypicalFloorHeight] [1:07:37][handmade_world_mode.cpp: Temporarily make Simulate() take the TypicalFloorHeight and GameEntropy rather than a whole game_mode_world] [1:10:23][handmade_world.h: Make GameEntropy belong in the world struct] [1:15:28][handmade_world.h: Consider specifying rooms as entities] [1:18:23][handmade_entity.h and handmade_world_mode.cpp: Add EntityType_Room to the entity_type struct and change AddStandardRoom() to create rooms as entities] [1:25:39][handmade_entity.cpp: Re-enable UpdateAndRenderEntities() to do volume rendering debug visualisation] [1:29:08][handmade_render_group.cpp: Disable entity rendering and run the game to see the volume bounds more clearly] [1:32:08][handmade_particles.cpp: Re-enable UpdateAndRenderFire() to do the full particle effect] [1:32:39][handmade_world_mode.cpp: Enable AddStandardRoom() to make the added rooms encompass the shape that the room actually is] [1:33:27][handmade_entity.h: Remove the entity_type struct] [1:34:13][handmade_entity.cpp and handmade_world_mode.cpp: Disable rendering of traversables and addition of trees] [1:36:04][Run the game to see the bounding box of the room, and consider how to make rooms encompass their contained entities] [1:38:14][handmade_brain.h: Consider adding Type_brain_room to the brain_type struct] [1:44:41][handmade_brain.h: Add Type_brain_room to the brain_type struct] [1:46:32][handmade_world_mode.cpp and handmade_brain.h: Make AddStandardRoom() give the room a brain, and introduce SpecialBrain() and SpecialBrainSlot()] [1:49:40][Run the game to find that the brain system isn't broken] [1:49:54][handmade_sim_region.cpp: Enable UpdateCameraForEntityMovement() to determine which, if any, room we are in and move the camera accordingly] [2:00:07][Run the game to find that the camera fails to follow the hero] [2:00:59][Q&A][:speech] [2:01:37][@godling72][1) Do you ever work on large (multimillion LOC) codebases like Chrome, GCC, Unreal, etc? The full build dev process you've been using works for small projects, but how do you scale?] [2:05:22][@godling72][2) Why is past video archiving disabled?] [2:06:13][@godling72][3) Are you in a closet? The back wall looks really close] [2:06:19][@sevesos2][I don't know if unrelated questions are allowed, but how do you stay so focused on your programming and are so efficient?] [2:09:21][@mtsmox][I think the speedup is due to wrong offsets of the simulation regions for the multithreaded tasks: you used tile size for your calculation, not chunk / room size] [2:09:47][@iantjac][Now that you intend to use 3D, will the code support software rendering?] [2:10:03][@dsjimenez][Is the career advice episode uploaded anywhere? I'm having trouble finding it] [2:10:25][@mtsmox][You said you wanted to remove the notion of rooms / layers from the drawing routine, but don't you still need it for fading in the room above you?] [2:11:28][@a_pulsing_mage][You said that 20 seconds to build is a reasonable amount of time? It's huge! 10 seconds is too much] [2:13:09][@gene_victor][Off-topic: Will HandmadeCon 2016 VOD be on YouTube soon?] [2:13:28][@godling72][How long did The Witness take to build?] [2:15:15][@popcorn0x90][I would think it would take about 5-10 mins] [2:15:49][Wrap it up][:speech] [/video]