From ffff89b2ad3f27649a0f945b89a2a1ecef5843ad Mon Sep 17 00:00:00 2001 From: Matt Mascarenhas Date: Thu, 30 Dec 2021 23:19:29 +0000 Subject: [PATCH] Index hero/code645 --- cmuratori/hero/code/code645.hmml | 72 ++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 cmuratori/hero/code/code645.hmml diff --git a/cmuratori/hero/code/code645.hmml b/cmuratori/hero/code/code645.hmml new file mode 100644 index 0000000..66908be --- /dev/null +++ b/cmuratori/hero/code/code645.hmml @@ -0,0 +1,72 @@ +[video output=day645 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Switching to Voxel Centers for Collision" vod_platform=youtube id=UCdJhmFhwHc annotator=Miblo] +[0:00][Recap and set the stage for the day][:collision :speech] +[1:14][Consider: 1) Giving entities a "participates in :collision" bitfield][:speech] +[1:44][Consider: 2) Is the world generator erroneously creating entities without a :collision volume?][:speech] +[1:52][Consider: 3) Finishing the :collision system, with embedding recovery and spatial partitioning][:speech] +[5:24][Demo our unoptimised :collision :performance][:run] +[7:19][Step through the diagrams of a :collision embedding bug][:"debug visualisation" :run] +[9:20][Consider making the :collision checks symmetric][:run] +[14:03][Consider snapping the entity's position to the voxel center before testing for :collision][:run] +[14:50][Reproduce an embedding bug between the glove and familiar][:collision :run] +[16:32][Set up to perform :collision on discrete boundaries][:research] +[18:03][Consider switching to voxel centers for :collision][:research] +[20:50][Switch to voxel centers for :collision, modifying voxel_stack][:"data structure"] +[22:41][A few words on feeling stupider vs smarter than you are][:speech] +[23:43][Respecify voxel_corners as voxel_center][:collision :"data structure"] +[24:15][Consider our :collision testing to be faster and symmetric, once it's switched over][:research] +[25:06][Switch MoveEntity() to use voxel centers for :collision, changing AlignToMovementVoxel() to use Round()] +[33:31][Introduce GetMovementVoxelIndex() for MoveEntity() to use, and remove voxel_grid from voxel_stack][:collision :"data structure"] +[37:34][@tim7775][The problem with feeling stupid is that it can make you want to quit. While feeling smart makes you want to keep going] +[38:33][Continue switching MoveEntity() to use voxel centers, relieving it of checking corners][:collision] +[42:11][Make PushVoxelStack() call CollidesAtP()][:collision] +[50:23][Augment voxel_stack with a MinCenterP for MoveEntity() to set][:collision :"data structure"] +[51:42][Introduce GetVoxelCenterP() for MoveEntity() to call, removing the voxel iterator][:collision] +[54:08][Change PushVoxelStack() to call IsInArrayBounds() and use HaveTested][:collision] +[59:11][Remove CheckCorners() and change MoveEntity() to call GetVoxelCenterP()][:collision] +[1:00:02][Introduce GetVoxelBounds() for MoveEntity() to call][:collision] +[1:02:04][Consider cleaning up this code][:collision :research] +[1:02:55][Our voxel center-based :collision runs first time][:run] +[1:04:04][Let UpdateAndRenderEntities() call PushCube(), to draw the walls][:"entity system"] +[1:04:46][Try out our voxel center-based :collision][:run] +[1:05:19][Determine to clean up this code][:collision :research] +[1:07:15][Make MoveEntity() pass GetVoxelCenterP() as FromP to RefineVoxelPlacement()][:collision] +[1:08:39][Clean up the PushVoxelStack() branch in MoveEntity()][:collision] +[1:12:38][Enable PushVoxelStack() to handle embedding recovery][:collision] +[1:21:12][Replace the voxel_stack's b8 HaveTested with u8 OccupyCode, for MoveEntity() to pass to PushVoxelStack(), introducing GetOccupyCode()][:collision :"data structure"] +[1:24:02][Enable PushVoxelStack() to handle embedding recovery (cont.)][:collision] +[1:26:23][Remove embedding repulsion code from MoveEntity(), and search for the nearest unoccupied position around the initial embedded position, introducing occupy_code][:collision] +[1:31:01][Try out our :collision and embedding recovery][:run] +[1:32:40][Make CollidesAtP() call AlignToMovementVoxel() on each TestEntity][:collision] +[1:33:49][Try out our :collision detector][:run] +[1:35:27][Make CollisionEditor() create a "Disable Diagrams" button][:collision :"debug visualisation" :ui] +[1:37:22][Try out our "Disable Diagrams" button][:collision :"debug visualisation" :run :ui] +[1:37:41][Augment diagram_group with CaptureFrameCount and make CollisionEditor() create a "Capture Frames" slider to set this value][:collision :"data structure" :"debug visualisation" :ui] +[1:40:22][Try out our "Capture Frames" slider][:collision :"debug visualisation" :run :ui] +[1:41:17][Try out our :collision detector][:run] +[1:42:52][Q&A][:speech] +[1:43:18][@technicbeam][Chat was too quiet this stream] +[1:44:05][@mindmark42][Q: Can you explain the issue with two objects colliding again? Does using voxel centers fix it?][:collision] +[1:46:26][@sagian2005][Q: Do you have chat set to subscriber only again?] +[1:46:41][@wallfacer7][How much verticality is there going to be? Because gameplay-wise you may end up restricting :collision to a plane, and then maybe this would all be a lot simpler] +[1:47:08][@purpleeleven][Q: Won't that result in clipping?][:collision] +[1:48:00][@purpleeleven][If you check based on the center then adjust the position, then you can have sprites appearing inside walls][:collision] +[1:49:41][@sagian2005][Q: Did you know you can set enum types now. Just '\: type' after the name. It still has to be integral][:language] +[1:50:38][Try using \: u8 on occupy_code][:language] +[1:52:16][@headless_corpse][Q: Do you recommend this book "Tricks of the Windows Game Programming Gurus" by André Lamothe in 2021?[ref + author="André LaMothe" + title="Tricks of the Windows Game Programming Gurus, 2nd Edition" + isbn="9780672323690" + publisher="Sams Publishing" + url=https://www.informit.com/store/tricks-of-the-windows-game-programming-gurus-9780672323690]] +[1:52:59][@sagian2005][Q: What is the reason that things like SimRegion get passed around instead of plucking it from a global variable? Is it just preference? Are there cache considerations?] +[1:55:14][Wrap it up with a plug of Meow the Infinite: Book Two[ref + site=Kickstarter + page="Meow the Infinite: Book Two" + url=https://www.kickstarter.com/projects/annarettberg/meow-the-infinite-book-two] and further streams][:speech] +[1:58:46][@dj_turfie][Man, I've been loving these lightboard code talks. I would pay good money for more of these. I think you've got a good concept here!] +[2:00:08][@memfault][Q: Does [~hero Handmade Hero] work on Linux or do I need to follow on Windows?][:"operating system"] +[2:00:45][Plug Star Code Galaxy[ref + site="Star Code Galaxy" + url=https://starcodegalaxy.com/]][:speech] +[2:05:49][Wrap it up with a plug of an upcoming :cryptocurrency interview with Alex Gladstein][:speech] +[/video]