[video output=day667 member=cmuratori stream_platform=twitch stream_username=molly_rocket project=code title="Simplified Tile Occupancy Checking" vod_platform=youtube id=vikZUmIFS8M annotator=Miblo] [0:01][Recap and set the stage for the day pushing around some entity code][:"entity system" :speech] [0:53][Describe our spatial-primary–id-secondary lookup system][:"entity system" :speech] [3:16][Reacquaint ourselves with the sketched entity (un)pack code][:"entity system" :research] [4:52][Determine to maintain spatial coherence][:"entity system" :research] [5:36][Reacquaint ourselves with the world_chunk_iterator][:"entity system" :research] [6:32][Fix typo in the world_chunk_iterator overload of IsValid()][:"entity system"] [7:09][Describe EnsureValidChunk() as a double-to-single loop and reusable iterator][:language :research] [8:55][Consider the utility of EnsureValidChunk() skipping empty chunks][:"entity system" :research] [11:11][Reacquaint ourselves with GetWorldChunkInternal()][:"entity system" :hashing :research] [11:48][Update EnsureValidChunk() to pass Result->P as a v2s to GetWorldChunkInternal()][:"entity system"] [11:59][Update IterateChunks() to unbundle the MinChunkP and MaxChunkP values to pass to RectMinMax(), and pass Result.P as a v2s to GetWorldChunkInternal()][:"entity system"] [13:31][Consider removing BeginWorldChange(), only retaining the brain scan][:"entity system" :research] [17:20][Remove BeginWorldChange() and EndWorldChange()][:"entity system"] [17:42][Implement TileIsOpen()][:"entity system"] [24:34][Update TileIsOccupied() and TransactionalOccupy() for our new TileIsOpen()][:"entity system"] [25:20][Reacquaint ourselves with OverlappingEntitiesExist() and GenerateApron()][:"entity system" :research] [27:10][Consider stateful querying of TileIsOpen()][:"entity system" :research] [28:20][Remove OverlappingEntitiesExist()][:"entity system"] [28:34][Reacquaint ourselves with GetClosestEmptyTileTo() and FindAdjacentOpenTile()][:"entity system" :research] [29:21][Embark on stateful querying of TileIsOpen()][:"entity system" :research] [30:29][Add EntityFlag_SupportsOccupation][:"entity system"] [31:33][Respecify TileIsOpen() as OrAllFlagsOnTile()][:"entity system"] [32:12][Review the call site of TileIsOccupied() in ExecuteBrainSwitches()][:"entity system" :research] [32:53][Respecify TileIsOccupied() as TileCanBeOccupied()][:"entity system"] [34:07][Update TransactionalOccupy() to call TileCanBeOccupied()][:"entity system"] [34:24][Update ExecuteBrainSwitches() to call TileCanBeOccupied()][:"entity system"] [35:09][Reacquaint ourselves with GetClosestEntityWithBrain()][:"entity system" :research] [35:33][Update GetClosestEntityWithBrain() to take a world and world_position][:"entity system"] [37:22][@aksndz][@molly_rocket I think TileCanBeOccupied() should read && instead of & in between][:language] [37:38][Fix TileCanBeOccupied() to use a boolean && rather than a bitwise &][:"entity system" :language] [38:38][@muffindrake][Yo, the #embed gang sends their regards][:language] [40:21][Consider how to encode world positions for GetClosestEntityWithBrain()][:"entity system" :research] [41:18][Encoding world positions: 1) Integer TileIndex + Offset][:"entity system" :research] [41:37][Encoding world positions: 2) Tile-aligned chunk-relative offset][:"entity system" :research] [42:02][@agus_dev][Have you removed the math :library and made the functions like sqrt? If not, do you have any plans on how to do that?][:mathematics] [43:50][Wolfram|Alpha's Padé approximant of cos(x) order 10,10[ref site="Wolfram|Alpha" page="Pade approximation cos(x) order 10,10" url=https://www.wolframalpha.com/input?i=Pade+approximation+cos%28x%29+order+10%2C10]][:mathematics :research] [44:41][Wolfram|Alpha's Chebyshev approximation formula[ref site="Wolfram|Alpha" page="Chebyshev approximation formula" url=https://www.wolframalpha.com/input?i=Chebyshev+approximation+formula]][:mathematics :research] [45:41][Roughly describe a Sin() function][:mathematics :research] [47:33][@sagian2005][But those divides will bite you][:mathematics :performance] [47:52][Consider where GetClosestEntityWithBrain() will get the TestEntity->P from][:"entity system" :research] [48:08][@sagian2005][The divides in the Padé are slow][:mathematics :performance] [49:13][DIVPS (XMM, M128),[ref site="uops.info" page="DIVPS (XMM, M128)" url=https://uops.info/html-instr/DIVPS_XMM_M128.html] DIVPS (XMM, XMM)[ref site="uops.info" page="DIVPS (XMM, XMM)" url=https://uops.info/html-instr/DIVPS_XMM_XMM.html] and RCPSS (XMM, XMM)[ref site="uops.info" page="RCPSS (XMM, XMM)" url=https://uops.info/html-instr/RCPSS_XMM_XMM.html]][:hardware :performance] [52:22][Speculatively introduce GetTileIndexOf() and GetWorldPositionOf()][:"entity system"] [54:39][Determine to check the call sites of FindRandomOpenTile()][:"entity system" :research] [55:38][Move closest_entity from handmade_world.cpp to handmade_world.h][:"entity system"] [56:00][Remove FindNextEntity(), IterateAllEntities() and the entity_iterator overload of Advance()][:"entity system"] [56:15][Review the call site of GetClosestEmptyTileTo() in CheckForJoiningPlayers()][:"entity system" :research] [57:37][Update AddPlayer() to take a world and not a game_mode_world, and return an entity_id, and relieve CheckForJoiningPlayers() of taking a sim_region][:"entity system"] [59:42][Consider the placement by AddPlayer() of pieces in the world to be fine][:"entity system" :research] [1:00:15][Introduce tile_result, and update GetClosestEmptyTileTo(), FindRandomOpenTile() and FindAdjacentOpenTile() to take a world][:"data structure" :"entity system"] [1:01:11][Update FindAdjacentOpenTile() to work with v2s rather than gen_v3 and edit_tile][:"entity system"] [1:02:54][Consider the meaning of FindAdjacentOpenTile() from its call sites][:"entity system" :research] [1:04:08][Make FindAdjacentOpenTile() call TileCanBeOccupied() rather than TraversableIsOpen()][:"entity system"] [1:04:25][Reacquaint ourselves with GetDirection()][:"entity system" :research] [1:05:08][Move GetDirection() from handmade_math.h to handmade_box.cpp][:"entity system"] [1:05:53][Make FindAdjacentOpenTile() set the Result][:"entity system"] [1:06:14][Consider the meaning of FindRandomOpenTile() from its call sites][:"entity system" :research] [1:08:12][#if 0 FindRandomOpenTile() for now][:"entity system"] [1:08:27][Determine to write the entity iterator][:"entity system" :research] [1:08:39][Check the absolute time][:admin] [1:09:06][Wind it down with the determination to do brains next time][:speech] [/video]