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

142 lines
13 KiB
Plaintext
Raw Permalink Normal View History

2022-08-17 17:18:44 +00:00
[video output=day661 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Connecting the Overworld Map" vod_platform=youtube id=mt4Z9RkylF0 annotator=Miblo]
[0:00][Recap and set the stage for the day][:speech]
[0:35][Demo our sparse overworld layout][:"procedural generation" :run]
[0:59][Thicken the location outline from 0.01 to 0.1][:"debug visualisation" :"procedural generation"]
[1:22][Demo our annulus-based location regeneration][:"procedural generation" :run]
[5:49][Determine to connect locations with paths][:"procedural generation" :run]
[7:24][@orclockx][Is [@cmuratori he] using compute shaders?][:rendering]
[7:54][@dustdrown][For the entire :rendering I think is what he meant]
[8:08][Determine to compute a connectivity graph for our locations][:"procedural generation" :run]
[9:50][Check the chat][:admin]
[10:29][Compute shaders][:rendering :simd :speech]
[11:36][@roblon][These questions are so off-topic]
[12:23][Overflow the :"debug system"][:run]
[13:46][Consider clustering up locations][:"procedural generation" :research]
[15:24][Determine to create waypoint locations][:"procedural generation" :research]
[15:48][Demo our need for waypoints][:"procedural generation" :run]
[17:06][Add a WorldLoc_NavRoom and introduce CreateNavRoom()][:"procedural generation"]
[18:20][Determine to fill gaps in the map with nav rooms][:"procedural generation" :run]
[18:46][Enable LayoutOverworld() to generate nav rooms][:"procedural generation"]
[21:01][Hit our max iteration assertion in PickPointInAnnulus()][:"procedural generation" :run]
[21:33][Let the world generator complete if locations cannot be placed, augmenting world_gen_annulus with RequirePlacement, and introducing world_gen_pick_v2][:"data structure" :"procedural generation"]
[26:42][We have one green waypoint, standing at the edge][:"procedural generation" :run]
[26:53][Decrease MinDist from 60 to 30 for the nav rooms in LayoutOverworld()][:"procedural generation"]
[27:07][We have many more waypoints][:"procedural generation" :run]
[27:38][Hit our max iteration assertion in PickPointInAnnulus()][:"procedural generation" :run]
[27:55][Desire a better annulus picker, and regenerate many layouts][:"procedural generation" :run]
[28:28][Determine to connect nearby and unobstructed pairs of rooms][:"procedural generation" :research]
[31:20][Confirm that we can draw lines][:rendering :research]
[31:50][Introduce world_room_connection, and augment world with ConnectionCount and Connections][:"data structure" :"procedural generation"]
[32:46][Set up LayoutOverworld() to connect locations][:"procedural generation"]
[37:08][@doesntmeananything][WutFace]
[38:14][Augment world_room_connectionw with DebugColor and introduce AddWorldConnection(), for LayoutOverworld() to call][:"data structure" :"procedural generation"]
[40:49][We see no location connections][:"procedural generation" :run]
[40:56][Make UpdateAndRenderWorld() draw the location connections][:"debug visualisation" :"procedural generation"]
[45:04][All the locations are connected, but a blue room overlaps the orphanage][:"debug visualisation" :"procedural generation" :run]
[45:47][Prevent GenerateRoom() from creating a WorldRoom][:"procedural generation"]
[46:47][That blue room has gone][:"procedural generation" :run]
[47:09][Specify a location connection criterion in LayoutOverworld(): 1) Locations must be nearby][:"procedural generation"]
[49:00][All the locations remain connected][:"procedural generation" :run]
[49:08][Fix our "nearby" criterion in LayoutOverworld()][:"procedural generation"]
[49:19][Most rooms are not connected][:"procedural generation" :run]
[49:29][Increase our "nearby" location criterion from 30 to 60][:"procedural generation"]
[49:38][Our rooms are mostly, but not entirely, connected][:"procedural generation" :run]
[53:43][Determine to repair disconnections, using a disjoint-set forest][:"procedural generation" :run]
[54:20][Determine to forcibly connect the closest two rooms of disjoint islands][:"procedural generation" :research]
[55:05][Regenerate many disjoint layouts][:"procedural generation" :run]
[56:04][Make LayoutOverworld() draw location connections of satellites in purple, augmenting world_gen_location with ConnectedToOrphanage][:"debug visualisation" :"procedural generation"]
[1:01:41][Immediately hit our !B->ConnectedToOrphanage assertion in LayoutOverworld()][:"procedural generation" :run]
[1:01:47][Propagate our ConnectedToOrphanage checks in LayoutOverworld()][:"procedural generation"]
[1:03:30][Location connections of satellites are purple][:"procedural generation" :run]
[1:04:01][Make LayoutOverworld() instead draw all rooms of satellites in purple][:"debug visualisation" :"procedural generation"]
[1:06:21][Our satellite rooms are not purple][:"debug visualisation" :"procedural generation" :run]
[1:06:41][Make CreateWorld(), rather than LayoutOverworld(), colour satellite rooms in purple][:"debug visualisation" :"procedural generation"]
[1:07:24][Now all rooms are purple][:"debug visualisation" :"procedural generation" :run]
[1:07:35][Fix the !Loc->ConnectedToOrphanage test in CreateWorld()][:"debug visualisation" :"procedural generation"]
[1:07:48][Satellite rooms are now coloured purple][:"debug visualisation" :"procedural generation" :run]
[1:08:29][Enable LayoutOverworld() to connect satellite locations to the orphanage's locations][:"procedural generation"]
[1:10:30][@dmviper][Hey [@cmuratori Casey], I just found the Molly Rocket channel on YouTube and I'm only on day 7, but I wanted to thank you for the great content!]
[1:10:35][Enable LayoutOverworld() to connect satellite locations to the orphanage's locations (cont.)][:"procedural generation"]
[1:13:28][We have an unconnected satellite][:"debug visualisation" :"procedural generation" :run]
[1:13:55][Double-check our satellite connection code][:"procedural generation" :research]
[1:14:41][Fix typo in the satellite connection code's inner loop][:"procedural generation"]
[1:14:53][Potential satellites are now connected][:"debug visualisation" :"procedural generation" :run]
[1:18:08][Temporarily remove nav rooms][:"procedural generation"]
[1:18:23][It's better without nav rooms][:"procedural generation" :run]
[1:18:40][Let LayoutOverworld() create fewer nav rooms][:"procedural generation"]
[1:18:55][Sometimes extra rooms fill in the world too much][:"procedural generation" :run]
[1:19:04][Hit our Pick.PassedFilters assertion in LayoutOverworld()][:"procedural generation" :run]
[1:19:36][Consider a world with fewer nav rooms to feel better][:"procedural generation" :run]
[1:20:16][Let LayoutOverworld() create between 4 and the DungeonCount nav rooms][:"procedural generation"]
[1:20:41][Consider forcing nav rooms to have multiple connections]
[1:21:46][@wheeel][Is a nav room <-> nav room connection also redundant?][:"procedural generation"]
[1:21:59][@technicbeam][Somehow I think I would have set the startup view to be way zoomed out ages ago, if I were testing this]
[1:23:54][@mtsmox][Q: Maybe just remove nav rooms with one connection?][:"procedural generation"]
[1:24:31][Determine to forcibly connect nav rooms following the trajectory from their inbound connection, removing ones where this is impossible][:"procedural generation" :run]
[1:26:10][Enable LayoutOverworld() to remove the connection of all orphaned nav rooms][:"procedural generation"]
[1:28:13][Orphaned nav rooms are now jettisoned][:"procedural generation" :run]
[1:29:35][Enable LayoutOverworld() to remove the connections of "jointly orphaned" nav rooms][:"procedural generation"]
[1:32:21][Orphaned nav rooms are no longer jettisoned][:"procedural generation" :run]
[1:32:51][Double-check our orphaned nav room jettisoning code][:"procedural generation" :research]
[1:33:55][Orphaned nav rooms are mostly left intact][:"procedural generation" :run]
[1:34:37][Fix LayoutOverworld() to remove the connections of orphaned nav rooms with 0 or 1 connections][:"procedural generation"]
[1:34:50][We can delete valuable nav rooms][:"procedural generation" :run]
[1:35:25][Enable LayoutOverworld() to remove the connection only of nav rooms with one connection][:"procedural generation"]
[1:36:23][Tolerate exterior "jointly orphaned" nav rooms][:"procedural generation" :run]
[1:36:54][Hit our Pick.PassedFilters assertion in LayoutOverworld()][:"procedural generation" :run]
[1:37:16][Our connections are nice][:"procedural generation" :run]
[1:37:28][Specify a location connection criterion in LayoutOverworld(): 2) Connections must not pass too close to other locations][:"procedural generation"]
[1:40:42][Introduce DistanceBetweenLineSegmentAndPointSq()][:mathematics]
[1:51:49][We still produce obstructed connections][:"procedural generation" :run]
[1:52:08][Make LayoutOverworld() draw viable connections green on nonviable ones red][:"debug visualisation" :"procedural generation"]
[1:53:25][Double-check DistanceBetweenLineSegmentAndPointSq()][:mathematics :research]
[1:54:19][Determine to debug nonviable connections][:"procedural generation" :run]
[1:54:52][@wheeel][Muted?]
[1:55:26][Determine to debug nonviable connections (cont.)][:"procedural generation" :research]
[1:56:06][@multiplybyone][I don't think clamping to between zero and one will give the same as doing the inner product with the normalized vectors. I'm not 100% sure what you're doing, though, so sorry if bad suggestion][:mathematics]
[1:56:33][Fix DistanceBetweenLineSegmentAndPointSq() to compute the distance along the line's perpendicular][:mathematics]
[2:00:59][We still produce obstructed connections][:"procedural generation" :run]
[2:01:13][Double-check DistanceBetweenLineSegmentAndPointSq()][:mathematics :research]
[2:01:40][Fix DistanceBetweenLineSegmentAndPointSq() to multiply in the Dir to the ClosestP][:mathematics]
[2:01:50][We now identify obstructed connections][:"procedural generation" :run]
[2:02:44][Increase the connection obstruction radius from 10 to 20 in LayoutOverworld()][:"procedural generation"]
[2:02:54][We identify more connections to be obstructed][:"procedural generation" :run]
[2:03:33][That's it][:"procedural generation" :research]
[2:03:51][Enjoy the maps][:"procedural generation" :run]
[2:05:08][Make LayoutOverworld() set orphaned rooms as WorldLoc_None to prevent CreateWorld() from creating them][:"procedural generation"]
[2:05:37][We have no unconnected rooms][:"procedural generation" :run]
[2:05:45][@johnm___][What's up with the boxes with no connections?][:"procedural generation"]
[2:06:05][Temporarily prevent LayoutOverworld() from setting orphaned rooms as WorldLoc_None][:"procedural generation"]
[2:06:15][Describe orphaned nav rooms removal][:"procedural generation" :run]
[2:07:37][Temporarily prevent LayoutOverworld() from removing the connections of orphaned nav rooms][:"procedural generation"]
[2:07:59][Describe orphaned nav rooms removal (cont.)][:"procedural generation" :run]
[2:08:28][Let LayoutOverworld remove the connections of orphaned nav rooms][:"procedural generation"]
[2:08:48][Describe orphaned nav rooms removal (cont.)][:"procedural generation" :run]
[2:09:02][Let LayoutOverworld() set orphaned rooms as WorldLoc_None][:"procedural generation"]
[2:09:14][Describe orphaned nav rooms removal (cont.)][:"procedural generation" :run]
[2:09:58][@brian_nevec][Will the world still be infinite?][:"procedural generation"]
[2:10:28][@frizi09][Would it correctly remove a leaf sequence of multiple nav rooms?][:"procedural generation"]
[2:11:11][Admire our maps][:"procedural generation" :run]
[2:11:38][@fallen_spirit][Is the plan to still have smooth transitions between rooms, or will the player "teleport" between rooms?][:camera :"procedural generation"]
[2:12:28][@fallen_spirit][There is just a lot of space between rooms now][:"procedural generation"]
[2:14:32][@samoth2401][I guess a way to not have a sqrt is to not normalize, do the inner product, divide the result by LengthSq(Delta), Clamp01 and multiply t by Delta?][:mathematics]
[2:16:10][Compare SQRTPS, DIVPS, RCPPS and RSQRTPS :performance[ref
site=uops.info
url=https://uops.info/table.html]][:research]
[2:18:58][Consider simplifications to DistanceBetweenLineSegmentAndPointSq()][:mathematics :research]
[2:21:09][@vulpanul][Sorry to disturb the train of thought. Meow[ref
site="Meow the Infinite"
url=https://meowtheinfinite.com/] finally arrived this month and we loved it. Any hints on when the next volume will be out?]
[2:28:31][@tomisqi][What other projects are you working on?]
[2:29:40][@bulmanator][The print quality is second to none, it's so good!]
[2:32:37][Plug Meow the Infinite[ref
site="Meow the Infinite"
url=https://meowtheinfinite.com/]][:research]
[2:35:47][@technicbeam][Does violence and sex improve things?]
[2:36:10][That's it for today, with a glimpse into the future filling in entities][:"procedural generation" :speech]
[2:37:21][@infernalagent][Why didn't you do this generator backwards, like with the Witness grass?][:"procedural generation"]
[2:37:45][@infernalagent][Creating the connections first][:"procedural generation"]
[2:38:24][@infernalagent][Yeah, and then you do not need to cull the connections][:"procedural generation"]
[2:41:54][Thank you, everyone][:speech]
[/video]