[video output=day628 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Brains and Aprons" vod_platform=youtube id=gj0ypC0RDF8 annotator=Miblo] [0:01][Recap and set the stage for the day][:"entity system" :speech] [1:01][The brain system's multi-component entity construction per frame][:"entity system" :research] [5:46][Set up the lightboard][:admin] [8:52][Brains and Aprons][:blackboard :"entity system"] [11:56][Partial gather of multi-component entities][:blackboard :"entity system"] [15:14][Entity activation beyond the sim-region][:blackboard :"entity system"] [18:43][Return to the keyboard][:admin] [19:21][@0lpbm][Q: You were great and the light board is still magic] [19:35][@volcanicpopsicle][Wait, why have more than one brain?][:"entity system"] [20:55][Augment brain with an Active boolean for MarkBrainActives() to set and Simulate() to use][:"data structure" :"entity system"] [22:14][We already have an opened door][:"entity system" :run] [24:23][Comment out PlaceSnake() in CreateDungeon()][:"procedural generation"] [24:40][Our snakes are gone, but we have a placed door that lacks tiles][:"entity system" :run] [26:14][Change CreateDungeon() to pass the PrevRoom to PlaceTilePattern()][:"procedural generation"] [26:51][Our door tiles are now placed correctly, but a placed door still lacks tiles][:"entity system" :run] [28:29][Break in to the SwitchesSet branch of ExecuteBrainSwitches()][:"entity system" :run] [31:14][Hit our breakpoint erroneously and inspect the Switches][:"entity system" :run] [32:20][Check our use of EntityFlag_Active and UpdatableBounds][:"entity system" :research] [35:51][@Molly][Meow] [36:58][Determine to expand the UpdatableBounds][:"entity system" :research] [37:40][@Molly][*clambers*] [38:07][Determine to draw the sim region and apron][:"debug visualisation" :"entity system" :research] [40:24][@Molly][*makes a decision*] [41:03][Eyeball the broken door paging in using the debug :camera][:run] [43:29][Make BeginWorldChange() expand the SimRegion->Bounds using AddRadiusTo()][:"entity system"] [47:15][Our broken door is now fixed][:"entity system" :run] [49:16][Augment game_mode_world with a StandardApronRadius for CreateWorld() to set][:"data structure" :"entity system"] [57:03][Our doors work well][:"entity system" :run] [59:04][Remove "TODO(casey): If entities were stored in the world, we wouldn't need the game state here!" from BeginWorldChange()][:"entity system"] [59:32][@incremented][Wasn't the TODO there actually describing the bug?] [1:00:11][@incremented][handmade_world_mode.cpp around l300] [1:00:57][Remove "TODO(casey): There are risks to allowing the simulation region to be determined by the camera, because of the way we use "brains" where logical entity collections can be split by a simulation boundary" from UpdateAndRenderWorld()][:"entity system"] [1:01:23][Re-enable PlaceSnake() in CreateDungeon(), and make it add a brain and body segments][:"entity system" :"procedural generation"] [1:05:34][Augment gen_entity with a BrainID and BrainSlot for the entity generation functions to set][:"data structure" :"entity system"] [1:22:30][Replace the brain_id values with gen_room_connection pointers in gen_connection, and augment gen_room_connection with a brain_id DoorBrainID][:"data structure" :"entity system"] [1:26:42][Hit a null-pointer dereference][:run] [1:27:56][Assert in GenerateRoom() that PendingEntity->Creator is not 0][:"entity system" :"procedural generation"] [1:29:34][Hit that assertion in GenerateRoom()][:"entity system" :"procedural generation" :run] [1:30:08][Make PlaceSnake() pass AddSnakeBody to AddEntity()][:"entity system" :"procedural generation"] [1:30:22][:Run successfully][:"entity system" :"procedural generation"] [1:31:05][Our snakes have bodies but no assets, and our switches can fail to spring back up][:"entity system" :"procedural generation" :run] [1:32:53][Fix PlaceSnake() to add Tags to the segments][:"asset system" :"entity system"] [1:34:03][Our snake segments have assets but incorrect facing direction][:"asset system" :"entity system" :"procedural generation" :run] [1:35:07][Introduce ExecuteBrainSnake() and make it set the segments' FacingDirection][:"asset system" :"entity system"] [1:40:38][Our snake segments now face the correct direction][:"asset system" :"entity system" :run] [1:42:11][Q&A][:speech] [/video]