Index hero/code666

This commit is contained in:
Miblo 2022-12-22 21:47:41 +00:00
parent 85e55669fd
commit 599fbf93c2
1 changed files with 98 additions and 0 deletions

View File

@ -0,0 +1,98 @@
[video output=day666 member=cmuratori stream_platform=twitch stream_username=molly_rocket project=code title="Entity Packing and Unpacking" vod_platform=youtube id=u0N9y5wVxpk annotator=Miblo]
[0:00][Recap and set the stage for the day continuing our :"entity system" simplification][:speech]
[1:53][Recap our sim_region and entity ID removal considerations][:"data structure" :"entity system" :research]
[5:19][Consider simplifying the UpdatableBounds and BrainHash out of the sim_region struct][:"data structure" :"entity system" :research]
[6:56][Remove sim_region, entity_hash and brain_hash, and GetHashFromID()][:"data structure" :"entity system"]
[7:39][Reacquaint ourselves with our IterateAllEntities() call sites][:"entity system" :research]
[9:06][Clear out handmade_sim_region.h][:"entity system"]
[9:24][Remove AddBrain(), AllocateEntityID() and MarkOccupied()][:"entity system"]
[10:05][Move MarkBit() and IsEmpty() from handmade_sim_region.cpp to handmade.cpp][:"entity system"]
[10:43][Remove GetHashFromID() and GetEntityByID_()][:"entity system"]
[11:00][Move EntityOverlapsRectangle() and EntityOverlapsEntity() from handmade_sim_region.cpp to handmade_entity.cpp][:collision :"entity system"]
[11:44][Remove GetOrAddBrain(), AddEntityToHash(), MapIntoSimSpace() and RegisterEntity()][:"entity system"]
[11:59][Move BeginWorldChange(), CreateEntity() and DeleteEntity() from handmade_sim_region.cpp to handmade_world.cpp][:"entity system"]
[13:54][Move IsRoom() from handmade_sim_region.cpp to handmade_entity.cpp][:"entity system"]
[14:14][Remove RegisterEntity()][:"entity system"]
[14:35][Move TileIsOpen(), TileIsOccupied(), TransactionalOccupy(), OverlappingEntitiesExist(), closest_entity, GetClosestEntityWithBrain(), GetClosestEmptyTileTo(), FindRandomOpenTile() and FindAdjacentOpenTile() from handmade_sim_region.cpp to handmade_world.cpp][:"entity system"]
[15:14][Move the entity iterator FindNextEntity(), IterateAllEntities() and Advance() from handmade_sim_region.cpp to handmade_world.cpp][:"entity system"]
[15:33][Move UpdateCameraForEntityMovement() from handmade_sim_region.cpp to handmade_world_mode.cpp][:camera :"entity system"]
[15:45][Reflect on our sim_region removal][:"entity system" :speech]
[16:00][Delete handmade_sim_region.{cpp,h}][:admin :"entity system"]
[16:38][Remove the late sim_region from the entity code, moving DeleteEntity() from handmade_world.cpp to handmade_entity.cpp][:"entity system"]
[18:56][Perform the easy removals of sim_region from UpdateAndRenderEntities()][:"entity system"]
[19:43][Note our need to replace the final use of sim_region in UpdateAndRenderEntities() with a pre-pass gathering all local entities][:"entity system" :research]
[20:20][Note our new need to move entities between spatial partition nodes][:"entity system" :research]
[21:46][Remove the forward-declaration of FillUnpackedEntity() from handmade_entity.h][:"entity system"]
[22:03][Reacquaint ourselves with AdvanceEntityStats()][:"entity system" :research]
[22:16][Lament our lack of sleep and need for caffeinated coffee and / or sugar][:health :speech]
[23:03][Consider the discontinuity arising from distant, active entities wanting to interact with inactive entities][:"entity system" :research]
[26:26][Enable UpdateAndRenderEntities() to gather all local entities, making it take the world and a rectangle3, not a sim_region][:"data structure" :"entity system"]
[27:09][Turn off phone][:admin]
[27:23][Introduce our regional entity iterator: IterateEntityInBounds()][:"entity system"]
[29:28][Consider fixed- vs floating-point precision for our entity iteration][:"entity system" :research]
[30:39][Change UpdateAndRenderEntities() to take a world_position and v2 Radius, not a rectangle3][:"data structure" :"entity system"]
[31:19][Introduce world_region for UpdateAndRenderEntities() to take][:"data structure" :"entity system"]
[31:52][Rename IterateEntitiesInBounds() to IterateEntitiesIn(), taking a world_region][:"entity system"]
[32:48][Reacquaint ourselves with world_sim][:"data structure" :"entity system" :research]
[36:17][Remove world_sim, and the sim_region * from world_generator][:"data structure" :"entity system"]
[36:44][Unify AddEntity() as an overload of CreateEntity(), both taking a world and world_position, not a sim_region][:"entity system"]
[40:04][Move the CreateEntity() functions from handmade_entity.cpp to handmade_world.cpp][:"entity system"]
[40:17][Make CreateEntity() pass the world and world_position, not the late sim region's World, to AcquireUnpackedEntitySlot(), removing AddEntity()][:"entity system" :memory]
[40:51][Embark on setting up the world storage][:"entity system" :memory :research]
[41:37][Switch entity_block_storage to be a union][:"data structure" :"entity system"]
[41:46][Describe packed_entity_block and unpacked_entity_block][:"entity system" :research]
[43:51][Structure ChunkX and ChunkY as a v2s Chunk in world_position][:"data structure" :"entity system"]
[44:18][Consider relieving entities of storing their containing chunk information][:"data structure" :"entity system" :research]
[45:29][Remove NullPosition() and the world_position overload of IsValid()][:"entity system"]
[46:17][Fix up accesses of our structured Chunk in world_position][:"data structure" :"entity system"]
[47:17][Reacquaint ourselves with the TILE_CHUNK_SAFE_MARGIN][:"entity system" :research]
[49:25][Remove TILES_PER_CHUNK and reposition TILE_CHUNK_SAFE_MARGIN][:"entity system"]
[50:02][@pfizzyenator][I believe it was arbitrary][:"entity system"]
[50:38][Consider the TILE_CHUNK_SAFE_MARGIN][:"entity system" :research]
[51:19][Reduce TILE_CHUNK_SAFE_MARGIN from INT32_MAX / 64 to INT32_MAX - 1024][:"entity system"]
[53:21][Reacquaint ourselves with the bulk allocation of world chunks][:"entity system" :memory]
[56:04][Enable GetWorldChunk() to allocate :memory for the chunks, structuring the ChunkX and ChunkY as a Chunk in world_chunk][:"data structure" :"entity system" :memory]
[59:31][Remove RemoveWorldChunk()][:"entity system"]
[1:00:50][Remove stale code from CreateWorld()][:"entity system"]
[1:02:21][Update accesses of the world_position Chunk in MapIntoChunkSpace()][:"entity system"]
[1:02:35][Change the world_position overload of Subtract() to operate in fixed-point][:"entity system" :mathematics]
[1:04:30][Consider our world-level multithreading ticketing scheme][:"entity system" :research :threading]
[1:06:36][Remove the ticket_mutex from the world][:"entity system" :research :threading]
[1:07:30][Thoughts on humidifiers][:health :speech]
[1:08:29][Note the existence of MoveEntityToNewPosition()][:"entity system" :research]
[1:09:03][Consider the relative difficulty of determining which chunks to pack][:"entity system" :research]
[1:10:29][Consider maintaining rectangles bounding all unpacked entities, resizing as we pack distant entities][:"entity system" :research]
[1:14:24][Augment world with a rectangle2i UnpackedRegions array][:"data structure" :"entity system"]
[1:16:05][Mentally sketch out the least recently used chunk packing scheme][:"entity system" :research]
[1:17:45][Reacquaint ourselves with UseChunkSpace()][:"entity system" :memory :research]
[1:19:25][Inline ClearWorldEntityBlock() in UseChunkSpace()][:"entity system" :memory]
[1:20:45][Introduce EnsureFreeBlockExists() for UseChunkSpace() to call, renaming the latter to UsePackedSpace()][:"entity system" :memory]
[1:22:08][Unify the sizes of packed_entity_block and unpacked_entity_block][:"data structure" :"entity system"]
[1:25:57][Yearn to programmatically size struct members][:"data structure" :language :rant]
[1:26:43][Update accesses via packed_entity_block_header, and make UsePackedSpace() use Chunk->FirstPacked][:"data structure" :"entity system" :memory]
[1:27:54][Image Jai to support relative sizing of struct members][:"data structure" :language :speech]
[1:29:00][@infinite_entropy_][Isn't [@j_blow he] shooting guns today?]
[1:29:19][Update accesses via packed_entity_block_header][:"data structure" :"entity system" :memory]
[1:29:37][Unify packed_entity_block and unpacked_entity_block as a generic entity_block, splitting HasRoomFor() out as HasRoomForPackedBytes() and HasRoomForUnpackedEntityCount()][:"data structure" :"entity system" :memory]
[1:32:50][Update EnsureFreeBlockExists() and UsePackedSpace() to use our new entity_block][:"entity system" :memory]
[1:34:21][Respecify UseChunkSpace() as a world_position overload of UsePackedSpace()][:"entity system" :memory]
[1:35:15][Simplify world_chunk *Old out of AddToFreeList()][:"entity system" :memory]
[1:37:02][Consider doing UsePackedSpace() inline in EnsureChunkIsPacked()][:"entity system" :memory :research]
[1:40:18][Remove both overloads of UsePackedSpace(), and inline the world_chunk one in EnsureChunkIsPacked()][:"entity system" :memory]
[1:41:28][Determine to make EnsureChunkIsPacked() loop over each unpacked chunk][:"entity system" :research]
[1:42:59][Make EnsureChunkIsPacked() loop over each unpacked chunk, packing the entities and discarding their blocks][:"entity system"]
[1:46:18][Implement EnsureChunkIsUnpacked() based on EnsureChunkIsPacked(), introducing ChunkIsValid()][:"entity system"]
[1:51:48][Consider distinguishing between the creation of an entity in an unpacked chunk, and in one in the process of being unpacked][:"entity system" :research]
[1:53:31][@staythirsty90][Hey, I'm thinking it through!]
[1:53:37][Finish implementing EnsureChunkIsUnpacked()][:"entity system"]
[1:55:10][Introduce UseBlockSpace(), respecifying entity_block in terms of a UsedByteCount][:"data structure" :"entity system"]
[2:02:51][Simplify EnsureChunkIsPacked() to use UseBlockSpace()][:"entity system"]
[2:04:23][Update CreateEntity() to use GetWorldChunk(), EnsureChunkIsUnpacked() and UseBlockSpace()][:"entity system"]
[2:06:44][Glimpse into the future working on entity iteration][:"entity system" :speech]
[2:07:04][Reorganise CreateEntity() above the entity iteration code][:"entity system"]
[2:07:36][Call it there with thoughts on deleting and tightening code, and a plug of Molly Rocket's 25% Off Everything sale[ref
author="Molly Rocket"
title="Holiday Sale: 25% Off Everything We Make!"
publisher=YouTube
url=https://www.youtube.com/watch?v=HI0IALE2g-M]][:speech]
[/video]