[video output=day450 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Supporting All Room Connection Directions" vod_platform=youtube id=9k35h94RSRs annotator=Miblo]
[0:00][Recap and set the stage for the day][:speech]
[0:38][Demo the limitations of a) the current :simulation code affecting the :lighting, and b) the :camera code][:rendering :run]
[2:36][Determine to exercise the world generation code and add a more manoeuvrable debug :camera][:"procedural generation" :run]
[5:32][Consider the functional nature of our code, and thoughtful randomisation][:prng :"procedural generation" :speech]
[10:43][Introduce CreateDungeon() and CreateForest()][:"procedural generation"]
[21:44][Enable CreateDungeon() to create each floor's random batch of rooms][:prng :"procedural generation"]
[31:06][Consider encoding connections between families of rooms for the layout code to deal with][:"graph topology" :"procedural generation" :speech]
[35:31][Enable CreateDungeon() to create all the paths between rooms and special Shop and Item rooms][:"procedural generation"]
[45:00][Stub out CreateForest(), move RequiredDim from gen_room to gen_room_spec, and propagate this change][:"procedural generation"]
[50:28][:Run the game to see our orphanage][:"procedural generation"]
[50:34][Make CreateDungeon() set the dungeon size, and CreateWorld() to call it][:"procedural generation"]
[53:38][:Run the game and hit our assertion in GetBoxIndexFromDirMask()][:"graph topology"]
[54:11][Rename PlaceRoomsAlongEdge() to PlaceRoomAlongEdge() and make it explicitly take a Connection and SurfaceIndex][:"graph topology" :"procedural generation"]
[58:08][:Run the game to see our same orphanage][:"graph topology" :"procedural generation"]
[58:17][Make PlaceRoomAlongEdge() return whether or not it placed a room, for Layout() to call it multiple times on different surface indices][:"graph topology" :"procedural generation"]
[1:02:34][Rip up and replace, having backed ourselves into a corner while picking rooms][:blackboard :"graph topology" :"procedural generation"]
[1:04:26][Enable Layout() to call PlaceRoomAlongEdge() multiple times on all directions, introducing GetRandomDirectionFromMask()][:"graph topology" :"procedural generation"]
[1:10:29][:Run the game to see that our existing orphanage gets generated][:"graph topology" :"procedural generation"]
[1:11:06][Make CreateWorld() call CreateDungeon()][:"procedural generation"]
[1:11:18][:Run the game and hit the assertion in PlaceRoomAlongEdge() because the GenerationIndex was erroneously set][:"graph topology" :"procedural generation"]
[1:11:43][Fix Layout() to only set the GenerationIndex if the room was indeed placed][:"graph topology" :"procedural generation"]
[1:12:41][:Run the game and hit the assertion in PlaceRoomAlongEdge() because we don't support up / down connections][:"graph topology" :"procedural generation"]
[1:13:01][Temporarily restrict CreateDungeon() to only create one floor][:"procedural generation"]
[1:13:30][:Run the game and hop around our dungeon][:"procedural generation"]
[1:14:10][Consider how to handle up / down connections][:"graph topology" :"procedural generation" :speech]
[1:18:20][Enable PlaceRoomAlongEdge() to handle up / down connections, allowing them to occur anywhere on a floor][:"graph topology" :"procedural generation"]
[1:37:37][Switch CreateDungeon() back to only create one floor, and CreateWorld() to call CreateOrphanage()][:"procedural generation"]
[1:38:54][:Run the game, crash in Layout() and step through PlaceRoomAlongEdge() to see what it does][:"graph topology" :"procedural generation"]
[1:41:11][Make PlaceRoomAlongEdge() test the TestVol in Y up to and including the MaxRelY][:"procedural generation"]
[1:41:53][Continue to step through PlaceRoomAlongEdge()][:"graph topology" :"procedural generation" :run]
[1:42:44][Switch back to -O2 and see that the orphanage is correctly generated][:"graph topology" :"procedural generation" :run]
[1:43:04][Switch CreateWorld() to call CreateDungeon() and determine that it works for up to four floors][:"graph topology" :"procedural generation" :run]
[1:45:10][Make UpdateAndRenderWorld() set the far clip plane proportional to the target distance][:camera]
[1:46:28][:Run the game to see our whole dungeon][:camera :"graph topology" :"procedural generation"]
[1:46:46][Make CreateWorld() create both the Dungeon and Orphanage][:"graph topology" :"procedural generation"]
[1:48:19][Further increase the FarClipPlane in UpdateAndRenderWorld()][:camera]
[1:48:43][:Run the game to see our whole world, and consider labelling the rooms][:camera :"graph topology" :"procedural generation"]
[1:52:10][Q&A][:speech]
[1:53:17][@sherjilozair][Q: How do you decide whether to include a library in your project or not?]
[1:53:29][@ttbjm][Q: Who builds a dungeon under an orphanage?!]
[1:54:01][@flirtychair][Q: What are you listening to?]
[1:54:22][@bobby1up][Q: What's the InvalidDefault thing in your switch statement?][:language]
[1:55:27][@toolegit2quit_][Q: Are you wearing headphones because you want to hear the visual studio error sounds?]
[1:55:47][@mrlovepickle][Q: How do you keep the motivation to continue working on [~hero Handmade Hero]?]
[1:58:02][@longboolean][Q: So I'm guessing the layout system still will not handle cyclical connections nicely, or do you think it could now?][:"graph topology"]
[1:58:24][@pythno][Q: Can you do a brief overview of all the parts that are involved in generating the world? I lost the thread][:"graph topology" :"procedural generation"]
[2:02:28][@gaius_is_best_colossus][@handmade_hero Are you working on other stuff parallel to [~hero Handmade Hero]?]
[2:02:45][@sc4llyw4g_][Q: Just caught up and watched the stream for the first time live today. Wanted to say thanks for the amazing learning resource. You've made me a better programmer than college or university ever could]
[2:03:03][@neitchzehrer][Q: Have you decided how many levels the world will have in the end?]
[2:05:37][@cvaucher][Q: The current system doesn't handle adding a rotated or mirrored orphanage, right?][:"procedural generation"]
[2:07:27][@pythno][Q: At the moment the gen_rooms are all created by hand, correct? Are you going to use some sort of logic to generate them? If yes, what do you have in mind?][:"procedural generation"]
[2:08:52][@sc4llyw4g_][Q: Have you worked on procedurally generated worlds similar to this before?][:"procedural generation"]
[2:10:07][Wrap it up, with a glimpse into the future cleaning up the :camera code][:speech]
[/video]

