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

131 lines
13 KiB
Plaintext

[video output=day662 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Generating Entities from Layouts" vod_platform=youtube id=F1b0daEyh2M annotator=Miblo]
[0:01][Recap and set the stage for the day][:"procedural generation" :speech]
[0:58][Demo our procedurally laid-out overworld][:"procedural generation" :run]
[4:38][Generate a new map, with the determination to place environmental entities respecting the connectivity graph][:"procedural generation" :run]
[5:29][Environment generation: 1) Using the connection line literally][:"procedural generation" :run]
[6:58][Environment generation: 2) "Jankifying" or making the lines meander][:"procedural generation" :run]
[8:02][Determine to start by following the lines literally][:"procedural generation" :run]
[9:41][Consider the performance of our entity structure][:"entity system" :run]
[10:30][Prepare to generate our connected forest, encompassed by an impenetrable wall][:"procedural generation" :run]
[12:15][Pull up the code for CreateWorld()][:"procedural generation" :research]
[12:27][We could generate stuff in the other room types][:"procedural generation" :run]
[12:37][Make CreateItemRoom() call GenerateRoom()][:"procedural generation"]
[12:59][Our item rooms are not close enough to be paged in][:"entity system" :"procedural generation" :run]
[13:23][Let CreateOrphanage() generate a far larger room][:"procedural generation"]
[13:48][There's a nav room in our orphanage][:"procedural generation" :run]
[13:56][Make CreateNavRoom() call GenerateRoom()][:"procedural generation"]
[14:17][Our nav room is generated, but offset][:"procedural generation" :run]
[14:57][Reacquaint ourselves with CreateNavRoom() and PlaceDebugMarker()][:"procedural generation" :research]
[16:03][Our nav rooms are shifted inconsistently][:"procedural generation" :run]
[16:47][Wonder if we have a scaling disparity between the debug marker drawing and entity placement][:"procedural generation" :run]
[18:19][Reacquaint ourselves with the debug marker drawing in UpdateAndRenderWorld(), to see it is done in a RenderGroup][:"debug visualisation" :"entity system" :"procedural generation" :research]
[18:54][Expect our room markers to shift with the simulation region][:"debug visualisation" :"entity system" :"procedural generation" :run]
[19:40][Try to disable boundaries by making CreateOrphanage() set RoomSpec.Outdoors to true][:"procedural generation"]
[20:16][We still have boundary trees][:"procedural generation" :run]
[20:31][Try to disable tree creation by making GenerateRoom() set OnEdge to false][:"procedural generation"]
[20:48][Our room markers do not shift with the simulation region][:"debug visualisation" :"entity system" :"procedural generation" :run]
[22:34][Reconsider it to be a scaling disparity][:"procedural generation" :research]
[24:49][Our debug markers and grid edits occur in totally different spaces][:"procedural generation" :research]
[26:17][Determine to line up our debug markers and grid edits][:"procedural generation" :research]
[27:39][Change PlaceDebugMarker() to position it using ChunkPositionFromTilePosition()][:"debug visualisation" :"procedural generation"]
[30:51][Our map is maybe too big][:"debug visualisation" :"procedural generation" :run]
[31:03][Make PlaceDebugMarker() scale the positions by 0.5][:"debug visualisation" :"procedural generation"]
[31:30][Our map is probably more what we want][:"debug visualisation" :"procedural generation" :run]
[31:44][Move the scaling factor from PlaceDebugMarker() out to LayoutOverworld()][:"debug visualisation" :"procedural generation"]
[33:31][We now produce over-long and, again, obstructed connections][:"procedural generation" :run]
[34:15][Fix LayoutOverworld() to apply the Scale to GeneratorRadius][:"debug visualisation" :"procedural generation"]
[35:57][Generate maps][:"procedural generation" :run]
[36:12][Generate a buggy map][:"procedural generation" :run]
[36:33][Wonder if LayoutOverworld() gave up in a loop][:"procedural generation" :research]
[36:54][Decrease the Scale from 1 to 0.5 in LayoutOverworld()][:"procedural generation"]
[37:10][Our map is much tighter, but we still generate obstructed connections][:"procedural generation" :run]
[37:34][Wonder if making PlaceDebugMarker() use ChunkPositionFromTilePosition() caused our obstructed connection generation][:"procedural generation" :research]
[38:22][Revert PlaceDebugMarker() to not use ChunkPositionFromTilePosition()][:"debug visualisation" :"procedural generation"]
[38:44][Generate maps][:"procedural generation" :run]
[38:51][Generate a buggy map][:"procedural generation" :run]
[39:46][Scour CreateWorld() for any uninitialised values][:"procedural generation" :research]
[41:33][Scour LayoutOverworld() for a cause of our obstructed connections][:"procedural generation" :research]
[43:09][Generate maps, and manage to get a buggy one on startup][:"procedural generation" :run]
[44:06][Scour the AddWorldConnection() loop in LayoutOverworld() for bugs][:"procedural generation" :research]
[45:00][Scour DistanceBetweenLineSegmentAndPointSq() for bugs][:mathematics :research]
[47:10][Scan through LayoutOverworld(), describing the white and purple line colouring, and AddWorldConnection()][:"procedural generation" :research]
[48:12][Seek a pattern in our buggy map generation][:"procedural generation" :run]
[49:49][Wonder if our rooms got moved after connection][:"procedural generation" :research]
[51:20][Try disabling the if(Viable) check in LayoutOverworld() to aid debugging our obstructed connection generation][:"procedural generation"]
[52:03][Check out our rejected, red connection lines][:"procedural generation" :run]
[53:22][Check out our rejected, red connection lines on a buggy map][:"procedural generation" :run]
[53:52][Try toggling off the connection removal of unnecessary nav rooms in LayoutOverworld()][:"procedural generation"]
[55:11][Generate a plethora of non-buggy maps][:"procedural generation" :run]
[55:43][Wonder if there actually is a room 0][:"procedural generation" :research]
[55:51][Generate another plethora of non-buggy maps][:"procedural generation" :run]
[56:23][Investigate how setting the two rooms to 0 can generate obstructed connections][:"procedural generation" :research]
[58:48][It is an indexing bug: Setting LocA->Type to WorldLoc_None, thus not creating a room, throws the connection indices off-by-1][:language :"procedural generation" :research]
[1:00:35][Leave the connection removal of unnecessary nav rooms toggled off, and add a TODO to track indices correctly][:"procedural generation"]
[1:03:36][Enable LayoutOverworld() to scale the map after the fact][:"procedural generation"]
[1:04:39][Generate a map][:"procedural generation" :run]
[1:04:44][Decrease the WorldScale from 1 to 0.5 in LayoutOverworld()][:"procedural generation"]
[1:04:55][Our world is now more smooshed][:"procedural generation" :run]
[1:05:09][Introduce TileFromPoint() to line up the debug markers and grid edits coordinate systems][:"procedural generation"]
[1:07:45][Make CreateOrphanage() use TileFromPoint()][:"procedural generation"]
[1:08:47][Our orphanage remains lined up][:"procedural generation" :run]
[1:08:53][Make CreateItemRoom(), CreateMonsterGenerator() and CreateDungeon() use TileFromPoint()][:"procedural generation"]
[1:09:45][Our rooms' generated entities all line up with their debug markers][:"debug visualisation" :"procedural generation" :run]
[1:10:13][Determine to fill in the connective tissue between rooms][:"procedural generation" :run]
[1:15:17][Consider subdividing the map into a coarse grid and rasterising each populated region][:"procedural generation" :run]
[1:16:14][Make LayoutOverworld() compute the union between all locations, for CreateWorld() to generate as a world room, augmenting world_generator with WorldBounds][:"data structure" :"procedural generation"]
[1:22:45][Hit a read access violation in CreateWorld()][:"procedural generation" :run]
[1:23:12][Fix CreateWorld() to call EndWorldGen() at the very end][:"procedural generation"]
[1:23:24][Our map is now outlined][:"procedural generation" :run]
[1:23:36][Increase the WorldScale from 0.5 to 0.7 in LayoutOverworld()][:"procedural generation"]
[1:23:58][We now have a perimeter within which we may march and generate entities][:"procedural generation" :run]
[1:24:43][Determine to march through and rasterise everything][:"procedural generation" :run]
[1:25:46][Reduce CreateNavRoom(), CreateItemRoom(), CreateMonsterGenerator() and CreateDungeon() to only call PlaceDebugMarker()][:"debug visualisation" :"procedural generation"]
[1:26:25][Our rooms are no longer filled in][:"procedural generation" :run]
[1:26:31][Introduce GenerateBlock() to generate environmental entities throughout the block, for CreateOrphanage() to call][:"procedural generation"]
[1:39:54][Hit our !World->UnpackedIsOpen assertion in EnsureRegionIsUnpacked()][:"procedural generation" :run]
[1:40:01][Make GenerateBlock() call EndGridEdit() at the very end][:"procedural generation"]
[1:40:27][The :camera begins not set to anything][:"procedural generation" :run]
[1:40:34][Make GenerateBlock() put the :camera somewhere][:"procedural generation"]
[1:41:21][We have a patch of grass as the orphanage][:"procedural generation" :run]
[1:41:42][Make GenerateBlock() place trees on non-walkable tiles, using IsOnEdge() as the IsWalkable() test][:"procedural generation"]
[1:42:39][Trees are placed around the edge][:"procedural generation" :run]
[1:42:54][Make GenerateBlock() use the room locations and connection lines as its IsWalkable() tests, to generate environmental entities there][:"procedural generation"]
[1:46:50][Our orphanage remains as a patch of grass][:"procedural generation" :run]
[1:47:05][Make CreateWorld() rather than CreateOrphanage() call GenerateBlock()][:"procedural generation"]
[1:47:47][@nickito97][I'm scared of doing anything with enough tomato in a seasoned wok][:cookery]
[1:47:57][Make CreateWorld() subdivide the world into blocks, on which to call GenerateBlock()][:"procedural generation"]
[1:52:28][Crash in AddEntity()][:"procedural generation" :run]
[1:52:45][Compile in -Od][:language]
[1:53:02][Hit the InvalidCodePath in AcquireUnpackedEntitySlot()][:"entity system" :run]
[1:53:21][Check EndGridEdit() for bugs related to AcquireUnpackedEntitySlot()][:"entity system" :research]
[1:54:20][Investigate our InvalidCodePath hit in AcquireUnpackedEntitySlot()][:"entity system" :run]
[1:57:48][Break on the CountExceeded check in EnsureRegionIsUnpacked()][:"entity system" :run]
[1:59:05][Try unsuccessfully to break on the IsOutsideVolume assertion in EnsureRegionIsUnpacked() before hitting the InvalidCodePath in AcquireUnpackedEntitySlot()][:"entity system" :run]
[2:01:59][Fix CreateWorld() to subdivide the world into different blocks to pass to GenerateBlock()][:"procedural generation"]
[2:02:30][:Run successfully without hitting an InvalidCodePath][:"entity system"]
[2:02:53][Fix CreateWorld() to offset the block subdivisions by MinTileI][:"procedural generation"]
[2:03:14][@filiadelski][Everyone is fired]
[2:03:16][@thesandvichmaker][Just throw any leftover vegetables in][:cookery]
[2:03:19][Our room connections are filled with environmental entities, but entities do not get streamed in][:"entity system" :"procedural generation" :run]
[2:04:02][Uncomment the hero's head light in AddPlayer()][:"entity system" :lighting]
[2:04:45][Our room connections remain filled correctly, only lacking entity streaming][:"entity system" :"procedural generation" :run]
[2:06:59][Decrease BlockDim from 32 to 16 in CreateWorld()][:"procedural generation"]
[2:07:24][Hit a write access violation on AcquireUnpackedEntitySlot() upon moving between sim regions][:"entity system" :"procedural generation" :run]
[2:07:56][:Run in -Od and hit the InvalidCodePath in AcquireUnpackedEntitySlot()][:"entity system" :run]
[2:08:47][End it there][:speech]
[2:09:02][Compile in -O2, and consider removing the 3rd dimension][:language]
[2:09:18][Traverse our forest][:"procedural generation" :run]
[2:09:55][Inflate our WorldBounds in LayoutOverworld()][:"procedural generation"]
[2:10:26][Traverse our forest][:"procedural generation" :run]
[2:10:38][Determine to remove Z next week][:speech]
[2:10:50][Consider our start-up :performance to be good][:"procedural generation" :run]
[2:11:46][@sagian2005][Is there going to be a stream next week? I actually try to plan my Sunday around the stream]
[2:11:54][Plug the Molly Movie Club[ref
site="Molly Movie Club"
url=https://www.mollymovieclub.com/] stream here[ref
site=Twitch
page="Molly Rocket"
url=https://twitch.tv/molly_rocket] on Friday 30th September 2022][:speech]
[2:13:21][Determine to remove Z and update entity streaming next week][:speech]
[/video]