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

130 lines
10 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[video output=day635 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Debugging Voxel Motion Stepping" vod_platform=youtube id=-0cd-pBC0zU annotator=Miblo credit=Molly:prime_puss]
[0:00][Recap and set the stage for the day][:collision :speech]
[1:50][Plug Star Code Galaxy[ref
site="Star Code Galaxy"
url=https://starcodegalaxy.com/] and its nonlinear teachchallenge structure][:research]
[5:59][Show the start of MoveEntity()][:collision :research]
[6:40][:Run in -Od][:collision]
[7:00][The :collision code sadly permits tunnelling][:run]
[8:22][@insofaras][blow raid]
[8:58][Admire the notes feature of [@naysayer88 Jon]'s programming :language][:speech]
[12:15][Walk through MoveEntity()][:collision :research]
[14:14][Defining :collision around the minimum thickness to obstruct motion][:research]
[16:12][Walk through MoveEntity() (cont.)][:collision :research]
[17:47][Bug in MoveEntity(): It determines :collision based on location in space][:research]
[19:10][TODO(casey): This may be incorrect, let's see][:collision]
[19:56][Walk through MoveEntity() (cont.)][:collision :research]
[20:45][@Molly][Meow]
[22:52][Walk through MoveEntity() (cont.)][:collision :research]
[25:09][Remove CenterP declaration from MoveEntity()][:collision]
[25:27][Walk through MoveEntity() (cont.)][:collision :research]
[27:52][Walk through UpdateBest()][:collision :research]
[29:11][Walk through MoveEntity() (cont.)][:collision :research]
[29:45][Comment out the StartCollide declaration in MoveEntity()][:collision]
[30:23][Walk through MoveEntity() (cont.)][:collision :research]
[31:18][Temporarily make MoveEntity() finish by positioning the entity at the BestCell's center, rather than using RefineVoxelPlacement()][:collision]
[31:47][:Run in -Od][:collision]
[32:27][The :movement looks too smooth][:collision :run]
[34:26][Make MoveEntity() draw the final BestCell][:collision :"debug visualisation"]
[35:20][Our :collision cells are tiny][:"debug visualisation" :run]
[37:13][Make MoveEntity() draw the intermediary BestCell][:collision :"debug visualisation"]
[37:46][The BestCell doesn't get updated][:collision :"debug visualisation" :run]
[38:16][Make MoveEntity() instead draw the intermediary Cell][:collision :"debug visualisation"]
[38:42][We have :collision voxel trails, and interpenetration of walls][:"debug visualisation" :run]
[40:00][Inspect MoveEntity() for unseemliness][:collision :research]
[41:55][Make UpdateBest() only consider not Occupied cells][:collision]
[44:58][Our :collision behaviour hasn't changed][:"debug visualisation" :run]
[45:07][Make UpdateBest() draw cells based on their consideration and occupancy][:collision :"debug visualisation"]
[47:10][A flash of red may precede interpenetration][:collision :"debug visualisation" :run]
[48:17][Scour MoveEntity() and CollidesAtP() for bugs][:collision :research]
[51:37][Remove OccupiedCount from MoveEntity()][:collision]
[51:53][Scour MoveEntity() for bugs (cont.)][:collision :research]
[56:40][@jskrist][It looks like the test volume is so small that it is only colliding at the wall boundary, and when the test cell pushes far enough into the wall, it is no longer detecting a :collision]
[59:05][@mindmark42][Doesn't CollidesAtP() need to grow each :collision volume with the moving entity's collision volume?]
[59:40][Plan to capture :collision][:run]
[1:00:18][Hunt the code for the F-key handling][:"input handling" :research]
[1:01:29][Add a DevMode_collision action on F9][:collision :"input handling"]
[1:02:20][Introduce CollisionEditor() for UpdateAndRenderEditor() to call, augmenting game_mode_world with TimeStepScale][:collision :"debug system"]
[1:06:31][Time does not flow][:run]
[1:06:40][Make PlayWorld() initialise TimeStepScale to 1.0f]
[1:07:30][Time flows but F9 doesn't work][:run]
[1:07:44][Elevate DevMode_collision into the editor section of dev_mode][:collision :"debug system"]
[1:08:55][F9 is still a little weird][:run]
[1:09:04][Set DevMode_last_editor to DevMode_collision][:collision :"debug system"]
[1:09:18][Slow down the TimeStep in Collision Recorder][:collision :"debug system" :run]
[1:10:22][Our configuration of :collision boxes seems wrong][:"debug visualisation" :run]
[1:11:11][Consider our :collision box configuration][:research]
[1:12:52][Make UpdateBest() pass the Dir as the colour to PushVolumeOutline()][:collision :"debug visualisation"]
[1:14:17][Try to interpret our :collision box configuration][:"debug visualisation" :run]
[1:16:15][Make MoveEntity() draw the starting BestCell][:collision :"debug visualisation" :"hot reloading"]
[1:16:42][Interpret our :collision box configuration][:"debug visualisation" :"hot reloading" :run]
[1:17:44][Try to provoke stickiness][:collision :"debug visualisation" :run]
[1:18:42][Make MoveEntity() finish by calling RefineVoxelPlacement()][:collision]
[1:19:04][Determine to set up a test case][:collision :"debug visualisation" :run]
[1:19:16][Make CreateWorld() place the player in their bedroom][:"procedural generation"]
[1:19:53][Try to penetrate the bedroom wall at different timesteps][:collision :"debug visualisation" :run]
[1:22:05][Investigate why ToP is erroneously affecting the :collision detection][:research]
[1:23:57][Add a lerp sanitation assertion in RefineVoxelPlacement()][:collision :mathematics]
[1:24:44][Never hit that assertion][:collision :mathematics :run]
[1:24:57][Make RefineVoxelPlacement() draw the lerp test in cyan (can place) or magenta (cannot place)][:collision :"debug visualisation" :mathematics]
[1:26:58][Check out our refinement placement][:collision :"debug visualisation" :mathematics :run]
[1:27:41][Add a "Single Stepping" boolean button to CollisionEditor(), augmenting game_mode_world with SingleStep][:collision :"debug system" :ui]
[1:33:41][Single Stepping does not work][:collision :"debug system" :run]
[1:33:51][Change CollisionEditor() to draw a Red / Green "Single Stepping" button][:collision :"debug system" :ui]
[1:37:33][Our "Single Stepping" button works][:collision :"debug system" :run]
[1:37:53][Add a "Step" boolean button to CollisionEditor(), augmenting game_mode_world with StepLatch][:collision :"debug system" :ui]
[1:39:38][Enable MoveEntity() to step through the :movement, augmenting sim_region with DEBUGPreventMovement][:collision :"debug system"]
[1:43:57][Try out Single Stepping][:collision :"debug system" :run]
[1:46:42][Revert UpdateBest() to draw cells based on their consideration and occupancy][:collision :"debug visualisation"]
[1:47:02][:Collision seems entirely based on direction][:run]
[1:47:48][Toggle off the combined and individual z and y Occupied checking in MoveEntity()][:collision]
[1:48:45][The x Occupied check is rock solid][:collision :run]
[1:49:28][Toggle on the z and y Occupied checking in MoveEntity(), leaving only the combined checking off][:collision]
[1:49:53][The individual x, y, z Occupied checking permits tunnelling][:collision :run]
[1:50:11][Toggle off the z and y Occupied checking in MoveEntity()][:collision]
[1:50:24][The x Occupied check remains rock solid][:collision :run]
[1:50:47][Toggle on the y Occupied checking in MoveEntity()][:collision]
[1:50:59][We can tunnel easily][:collision :run]
[1:51:36][Toggle off the x Occupied checking in MoveEntity()][:collision]
[1:52:01][The y Occupied check remains rock solid][:collision :run]
[1:53:00][Introduce GetClosestPointInBoxConservative()][:collision :geometry]
[1:57:36][Our glove can only move in Y][:collision :movement :run]
[1:57:58][Toggle on the x Occupied checking in MoveEntity()][:collision]
[1:58:18][We can still tunnel easily][:collision :run]
[1:58:58][Try Single Stepping][:collision :run]
[2:00:14][Produce a :collision test case][:run]
[2:00:50][Toggle off the y Occupied checking in MoveEntity()][:collision]
[2:01:04][Hopping pushes the glove through the wall][:collision :run]
[2:02:24][The x Occupied check remains rock solid][:collision :run]
[2:03:00][Toggle on the combined and off the individual x, y and z Occupied checking in MoveEntity()][:collision]
[2:03:16][We are punching up][:collision :run]
[2:04:29][We clearly tunnel through walls][:collision :run]
[2:05:29][Investigate our corner :collision test][:research]
[2:06:43][Spot the bug][:collision :research]
[2:07:14][@mallesbixie][Sure...]
[2:07:52][Let MoveEntity() compute the occupancy of all surrounding cells][:collision]
[2:08:12][Our combined corner Occupied checking is rock solid][:collision :run]
[2:08:29][Toggle on the individual x, y and z Occupied checking in MoveEntity()][:collision]
[2:08:39][Our :collision is much more stable][:run]
[2:11:31][Determine to improve gliding][:collision :run]
[2:13:01][Q&A][:speech]
[2:13:12][@jskrist][Can you still hop / push the glove into the wall?][:collision]
[2:13:14][Hopping no longer pushes the glove through the wall][:collision :run]
[2:16:10][@buildervanished][@handmade_hero Shouldn't you also add Eps to the min side in the conservative test?][:collision :geometry]
[2:17:29][TODO(casey): RectanglesIntersect should probably be changed to be properly >= and < instead of >= and <= ??][:geometry]
[2:18:18][@fat_dratini][@handmade_hero What kind of :pathfinding would you use for the glove's return path? A* or do you use something simpler?][:collision]
[2:18:58][@miscellus][@handmade_hero What would you do differently for :collision detection in non AABB :geometry?]
[2:19:26][@centhusiast][Q: I think this C model of programming is a bit time consuming in that we need to compile and look at the result and go back and forth to fix a problem. Do you think what would be a better model of programming and I also don't mean the scripting :language]
[2:19:42][Demo :"hot reloading"][:run]
[2:21:56][@emperormetallix][In retrospect, would it have been worth it to make a visualiser for :collision code before actually writing it?][:"debug visualisation"]
[2:23:11][The glove can stick and fail to glide][:collision :run]
[2:24:20][Make MoveEntity() only tell UpdateBest() that Occupied is true if all (rather than any) sides are occupied][:collision]
[2:25:03][Gliding happens more nicely][:collision :run]
[2:28:01][TODO(casey): Handle getting "unembedded"][:collision]
[2:28:28][@mindmark42][Q: Would :collision cylinders have rounded caps or flat?]
[2:28:59][@d0g_me4t][Q: Couldn't you simply clamp to X,Y. What does having Z axis movement on the glove in this problem space accomplish?][:collision :geometry]
[2:29:06][Demo :movement in Z][:collision :run]
[2:30:53][@jskrist][The :collision could have a max z delta]
[2:32:12][Wrap it up with a glimpse into the future][:speech]
[/video]