diff --git a/cmuratori/hero/code/code663.hmml b/cmuratori/hero/code/code663.hmml new file mode 100644 index 0000000..be65dda --- /dev/null +++ b/cmuratori/hero/code/code663.hmml @@ -0,0 +1,124 @@ +[video output=day663 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Simplifying Entity Storage, Part I" vod_platform=youtube id=LR3THwlv_r4 annotator=Miblo] +[0:00][Recap and set the stage for the day][:speech] +[0:34][Demo our updated world generation without entity unpacking][:"entity system" :"procedural generation" :run] +[1:19][Determine to simplify entity storage][:"entity system" :speech] +[4:12][Describe our entity packing system][:compression :"entity system" :speech] +[5:51][Plan our entity storage simplification][:"entity system" :speech] +[7:21][Remove ChunkZ from world_chunk and world_position][:"data structure" :"entity system"] +[11:13][The game runs just the same][:"entity system" :run] +[12:22][Reacquaint ourselves with the TODO in world_position][:"entity system" :research] +[12:59][Consider removing the ChangeTicket ticket_mutex from world][:"data structure" :research :threading] +[17:27][Plan to simplify the world][:"data structure" :"entity system" :research] +[18:46][Reorganise Rooms and Connections to the end of the world][:"data structure" :"debug system" :"entity system"] +[19:03][Describe our rooms and connections :"debug visualisation"][:"procedural generation" :run] +[19:48][Reacquaint ourselves with the entity packing system][:"data structure" :"entity system" :research] +[22:07][Consider switching to an updatable entity hash table: 1) Removing the sim_region][:"data structure" :"entity system" :research] +[24:16][Consider switching to an updatable entity hash table: 2) Moving the unpacked stuff from the world into the sim_region][:"data structure" :"entity system" :research] +[25:15][Consider the need to handle distant unpacked sim regions, e.g. free-exploring couch co-op][:"entity system" :research] +[27:30][Consider the need for spatial partitioning][:"entity system" :research] +[30:12][@nsaibot][Usually I take a nap to think about things] +[30:41][Consider the need for spatial partitioning (cont.)][:"entity system" :research] +[32:40][Reacquaint ourselves with the world's LastUsedEntityStorageIndex][:"data structure" :"entity system" :research] +[33:34][Respecify world_entity_block as packed_entity_block, and remove FirstFree from the world][:"data structure" :"entity system"] +[36:28][Introduce unpacked_entity_block for world_chunk to contain][:"data structure" :"entity system"] +[40:27][Consider moving EntityHash from sim_region to the world, for entity ID lookup][:"data structure" :"entity system" :research] +[41:12][Consider switching entity hash collision resolution from probing to chaining][:"entity system" :hashing :research] +[43:39][Consider removing entity ID lookup entirely in favour of spatial querying][:"entity system" :research] +[45:14][Briefly :run the game] +[45:26][Speculatively remove GetEntityByID()][:"entity system" :hashing] +[46:35][Plan entity storage simplification: 1) Remove traversables in favour of grid square occupation][:"entity system" :movement :research] +[47:22][@landosensei][Amazing content! I like the theme color palette. I would like to know: which theme are you using?] +[48:05][@alparkaan][Can you share the theme? The one in the source files is outdated[ref + site="Dion-Systems / 4coder" + page="4coder / ship_files / themes" + url=https://github.com/Dion-Systems/4coder/tree/master/ship_files/themes]] +[50:09][@ponkkiz][I always thought it was [@ryanjfleury Ryan]'s theme. It looked very similar] +[50:18][@lesnariv][The repo is archived now. I don't think you can submit it] +[50:23][Copy theme-casey.4coder into the [~hero Handmade Hero] directory][:admin] +[51:02][@tarriest_python][I don't know if it will get merged, but I have a repo with just ~4coder themes if you wanna submit it there. It's where most people get pointed to from the ~4coder discord] +[51:47][@tarriest_python][I have access to the [~hero Handmade Hero] code so as long as your happy with it being public I can chuck it in when it goes up] +[51:59][Remove StompOnEntity()][:"entity system" :movement] +[52:18][Determine to change the idea of traversables to be based on an actual position][:"entity system" :movement :research] +[53:41][Plug OALabsLive[ref + site=Twitch + page=OALabsLive + url=https://www.twitch.tv/oalabslive]][:speech] +[55:31][@an0nymal][Just wondering, is 32-bit int + float a quick and dirty way to get around floating point precision issues (assuming you only need a small range of the float within any 32-bit ID?] +[59:12][Plan our removal of traversables][:"entity system" :movement :research] +[1:00:30][Change IsOccupied() and Vacate() to take a v2s rather than traversable_reference][:"entity system" :movement] +[1:01:41][Introduce v2s, to possibly replace v2u][:"data structure"] +[1:02:55][#define function as static][:language] +[1:04:25][@cynokron][Rust: Hold my fn][:language] +[1:04:36][Remove Vacate() and change TransactionalOccupy() to take a v2s rather than traversable_reference][:"entity system" :movement] +[1:05:59][Consider respecifying IsOccupied()][:"entity system" :movement :research] +[1:07:58][Remove GetClosestTraversable()][:"entity system" :movement] +[1:09:59][Remove GetClosestTraversableAlongRay()][:"entity system" :movement] +[1:10:56][Remove GetMovementVoxelIndex() and AlignToMovementVoxel()][:"entity system" :movement] +[1:11:53][@sbrabez][IsCrossable()? I used this terminology in my Lemmings game][:"entity system" :movement] +[1:12:31][@detrohutt][Is it intentional for TransactionalOccupy() to always return false?][:"entity system" :movement] +[1:12:34][Enable TransactionalOccupy() to return true][:"entity system" :movement] +[1:12:38][Yearn for @sbrabez's Lemmings game][:speech] +[1:13:20][@bulmanator][Stream will not continue until this Lemmings game is found] +[1:13:52][@sbrabez][Not released yet, it was a personal project in Java] +[1:14:06][@sagian2005][We need LemmingsVR] +[1:14:48][Augment entity with TileIndex and add EntityFlag_OccupiesTile][:"data structure" :"entity system" :movement] +[1:16:55][@philbohun][I swear someone will make an "open world" Lemmings] +[1:17:17][Replace GetClosestTraversable() with tile indexing in ExecuteBrainHero(), changing Occupying and CameFrom to be a v2s in entity][:"data structure" :"entity system" :movement] +[1:20:19][Update DeleteEntity(), CreateEntity(), IsRoom() and EndWorldChange() to use our new "function" keyword][:language] +[1:21:22][Note mis-parsed error by ~4coder][:admin] +[1:21:44][Introduce a v2s overload of operator+()][:language] +[1:23:03][@thesandvichmaker][When I implement this code in C I tend to just make a macro festival to declare all the operator boilerplate][:language] +[1:23:52][@thesandvichmaker][This is one of the things I despise about GLM] +[1:23:59][Introduce a v2s overload of AreEqual()] +[1:24:27][@thesandvichmaker][It's the C++ math :library everybody on the open source internet likes to use][:mathematics] +[1:24:40][Implement the v2s overload of AreEqual()] +[1:24:58][@pajpiart][Best music I've heard all year] +[1:25:40][@thebaker__][Indiana Jones theme is mouth-trumpetty] +[1:26:19][Change ExecuteBrainHero() to test on EntityFlag_OccupiesTile rather than IsValid()][:"entity system" :movement] +[1:28:22][Move on to ExecuteBrainSnake()][:"entity system" :movement :research] +[1:28:37][Wonder why ExecuteBrain*() first set CameFrom to Occupying][:"entity system" :movement :research] +[1:29:11][Replace GetClosestTraversable() with tile indexing in ExecuteBrainSnake()][:"entity system" :movement] +[1:30:06][Consider changing how TransactionalOccupy() works][:"entity system" :movement :research] +[1:32:16][Fix ExecuteBrainHero() to set CameFrom to Occupying before TransactionalOccupy()][:"entity system" :movement] +[1:32:54][Introduce SingleTileDeltaFrom() for ExecuteBrain*() to use][:"entity system" :movement] +[1:35:20][Remove Traversables and Occupying from entity][:"data structure" :"entity system" :movement] +[1:35:46][Change ExecuteBrainSwitches() to use IsOccupied(), removing entity_traversable_point and traversable_reference, and augmenting entity with WasOccupiedLastCheck][:"data structure" :"entity system" :movement] +[1:42:03][Temporarily make IsOccupied() simply return false][:"entity system" :movement] +[1:42:31][Determine to replace the ATan2() calls in ExecuteBrainSnake()][:"entity system" :movement :performance :research] +[1:44:35][Introduce GetFacingDirectionFromSingleTileDelta() for ExecuteBrainSnake() to use][:"entity system" :mathematics :movement] +[1:47:56][@bulmanator][Pi and Tau have been cancelled][:mathematics] +[1:48:44][@technicbeam][It's a math thing, and "Turns" hasn't become popular enough yet][:mathematics] +[1:49:36][Implement GetFacingDirectionFromSingleTileDelta()][:"entity system" :mathematics :movement] +[1:50:39][@nates7][Do you configure your sin, cos and tan functions to use 0-1, then, instead of radians?][:mathematics] +[1:50:48][@ponkkiz][Some dude said tau > pi in some early stream's Q&A and we all fell for it][:mathematics] +[1:51:54][@rct33][Just don't let the math people see the video][:mathematics] +[1:52:44][@chadges_][For the assert would it be better to use an XOR since you don't want dTile x and y to both be 0?][:mathematics] +[1:53:17][@123_bou][Yes please!][:mathematics] +[1:53:47][Implement GetFacingDirectionFromSingleTileDelta() (cont.)][:"entity system" :mathematics :movement] +[1:56:19][@whimax07][2 - y and 1 - x then some type of mask?][:mathematics] +[1:56:44][Implement GetFacingDirectionFromSingleTileDelta() (cont.)][:"entity system" :mathematics :movement] +[2:05:12][Replace all ATan2() calls in ExecuteBrain*() with GetFacingDirectionFromSingleTileDelta()][:"entity system" :mathematics :movement] +[2:11:17][Introduce a v2s overload of operator-()][:language] +[2:11:51][Scan through our remaining traversable replacement work][:"entity system" :movement :research] +[2:13:01][#undef function for Windows][:language] +[2:13:27][Scan through our remaining traversable replacement work (cont.)][:"entity system" :movement :research] +[2:13:58][@spacenaming][Q: Don't know if it is still in there but in handmade_entity.cpp there was a flag check where the or / and part needed extra parentheses: ((Entity->Flags & EntityFlag_Deleted|EntityFlag_Active) == EntityFlag_Active)][:"entity system"] +[2:14:30][Fix the parentheses in IsActive()][:"entity system"] +[2:14:40][@spacenaming][Yep] +[2:15:03][@spacenaming][And goes before or, if I am correct][:"entity system"] +[2:15:30][@spacenaming][I meant the execution] +[2:16:28][@und3f1n3d][What editor is it? Smooth scroll looks nice] +[2:18:14][@valigo][You can try to search for "scroll" right on GitHub and pray that their search will work[ref + site="Dion-Systems / 4coder_fleury" + page="4coder_fleury" + url=https://github.com/Dion-Systems/4coder_fleury][ref + site="Dion-Systems / 4coder" + page="4coder" + url=https://github.com/Dion-Systems/4coder]] +[2:22:34][@tarriest_python][Pretty sure smoothscroll is default behaviour. Did you submit it to [@allen4th Allen] and he added it to the default layer maybe? So it's probably part of 4coder_default_hooks.cpp[ref + site="Dion-Systems / 4coder" + page="4coder / custom / 4coder_default_hooks.cpp" + url=https://github.com/Dion-Systems/4coder/blob/master/custom/4coder_default_hooks.cpp]] +[2:26:14][Reflect on our cubic-spline interpolation scrolling for ~4coder][:speech] +[2:26:39][Call it a day][:speech] +[/video]