[video output=day632 member=cmuratori stream_platform=twitch stream_username=handmade_hero  project=code title="Experimenting with Voxelized Collision" vod_platform=youtube id=21wpPIVg6So annotator=Miblo]
[0:01][Recap and set the stage for the day][:collision :speech]
[1:02][Demo our :collision boxes][:"debug visualisation" :run]
[1:36][Positive-sense (where you can go) :collision detection][:speech]
[4:05][:Collision tasks: 1. Change MoveEntity() to look for and pick the nearest legal position][:speech]
[5:15][:Collision tasks: 2. Upgrade to support simultaneous motion][:speech]
[7:22][Make MoveEntity() use the DesiredPosition, with no concern for :collision]
[8:01][Our familiar "penetrates" us and walls][:collision :run]
[8:48][Plan to introduce "requested physics" stuff for MoveEntity() to take][:collision]
[10:01][Plan to replace the all entities iteration in MoveEntity() with a spatial partition][:collision]
[12:38][Rearrange and clear out the cruft from MoveEntity()][:collision]
[15:15][:Collision from a game design perspective][:speech]
[16:56][Demo conversation zooming][:collision :run]
[17:37][:Collision from a game design perspective (cont.)][:speech]
[18:11][Remove SpeculativeCollide() and add EventOnCollision and PreventMotionOnCollision entity_flags][:collision]
[19:14][Reject dynamic event-based :collision, in favour of deterministic entity_flags][:speech]
[23:13][Remove HandleCollision() and CanOverlap()][:collision]
[24:06][Determine to make MoveEntity() search in subdivided space][:collision :speech]
[25:37][~4coder theming][:admin]
[27:16][@jarput][Purple means it couldn't find the variable in the theme file]
[27:33][@tarriest_python][@handmade_hero I wrote this addition you can disable it with  // f4_disable_cursor_token_occurance = true; in config.4coder]
[27:50][@tarriest_python][The color option is: fleury_color_token_minor_highlight = 0xC0797979; in the theme]
[27:55][~4coder: Set fleury_color_token_minor_highlight = 0xff2f2f37][:admin]
[29:15][Make MoveEntity() search in subdivided space, initially a fixed-size grid, introducing MoveEntityLocally()][:collision]
[35:09][Write a voxel iterator in MoveEntityLocally()][:collision :geometry]
[36:44][Make MoveEntityLocally() perform the collision test in each voxel][:collision :geometry]
[37:29][Determine to extend our voxel search with an apron to permit screw-up recovery][:collision :geometry :speech]
[39:35][Extend our voxel search with an apron in MoveEntityLocally()][:collision :geometry]
[43:26][Introduce v3 overloaded / and * operators, and replace Hadamard() with * overloads][:language :mathematics]
[50:43][@victor_cminus][There's f4_backspace_token_boundry and f4_delete_token_boundry you can try]
[50:54][~4coder bindings][:admin]
[51:17][Backspace and Del are much better][:admin]
[51:39][Can we delete just a character at a time from the "Open" line?][:admin]
[51:53][Replace Hadamard() with * overloads (cont.)][:language :mathematics]
[52:52][@somebody_took_my_name][I believe the lister thing is this param in the config: lister_whole_word_backspace_when_modified]
[53:10][~4coder: Set lister_whole_word_backspace_when_modified = true][:admin]
[54:28][The Hadamard changes did not break anything][:language :mathematics :run]
[54:51][Consider how to determine where in the voxel we can move][:collision :geometry :research]
[57:30][Initialise a Vacant voxel in MoveEntityLocally()][:collision :geometry]
[58:57][Introduce IterateVoxel(), voxel_iter and related IsValid() and NextInOrder() functions][:"data structure" :geometry]
[1:03:00][Respecify Vacant as Occupied in MoveEntityLocally(), and set it up to set Occupied to true][:collision :geometry]
[1:04:02][Set up MoveEntityLocally() to test if the entire voxel, one level up, is completely unoccupied][:collision :geometry]
[1:05:32][@neitchzehrer][Can the amount of time the "entering second hour" notice is displayed be adjusted?]
[1:07:03][Make MoveEntityLocally() test the entire Occupied array][:collision :geometry]
[1:09:47][@thesandvichmaker][@handmade_hero You don’t seem to have virtual whitespace enabled in ~4coder. Is that deliberate?]
[1:10:12][Enable MoveEntityLocally() to find the best closest position, permitting movement to the desired position][:collision :geometry]
[1:16:11][In-cell :movement works][:collision :run]
[1:16:44][Set up to make MoveEntityLocally() do a point-in-box test][:collision :research]
[1:18:06][Break][:admin]
[1:18:22]["Away from Keyboard" Presentation][:afk]
[1:22:10][Return with refilled water][:admin]
[1:22:51][Make MoveEntityLocally() call RectanglesIntersect() to do its point-in-box test][:collision :geometry]
[1:25:54][This doesn't work yet][:collision :geometry :run]
[1:26:01][Double-check MoveEntityLocally()][:collision :geometry :research]
[1:26:22][We can punch through walls][:collision :geometry :run]
[1:26:39][Triple-check MoveEntity() and MoveEntityLocally()][:collision :geometry :research]
[1:29:04][Temporarily make MoveEntityLocally() default to preventing movement][:collision :geometry]
[1:29:18][Our glove does not move][:collision :geometry :run]
[1:29:20][Scour MoveEntityLocally() for errors][:collision :geometry :research]
[1:31:29][Step through MoveEntityLocally()][:collision :geometry :run]
[1:32:35][@Molly][Hi][:speech]
[1:34:50][We forgot to test the entity_flags][:collision :geometry :research]
[1:35:37][@Molly][*cuddles*][:speech]
[1:36:51][Make MoveEntityLocally() test entity_flags, renaming PreventMotionOnCollision to AllowsMotionOnCollision, and making GenerateRoom() and AddConversation() set entity_flags][:collision :"entity system" :geometry]
[1:40:04][Our entities can move, notably our proportional derivative controlled glove][:collision :geometry :run]
[1:41:21][Double-check our occupation test in MoveEntityLocally()][:collision :geometry :research]
[1:43:17][We never collide][:collision :geometry :run]
[1:44:10][Double-check RectanglesIntersect()][:geometry :research]
[1:45:01][Make MoveEntityLocally() draw occupation state][:collision :"debug visualisation" :geometry]
[1:48:56][We seem to be detecting :collision][:"debug visualisation" :run]
[1:50:28][Try making MoveEntityLocally() default to preventing :movement][:collision :geometry]
[1:50:42][We detect :collision and prevent :movement][:"debug visualisation" :run]
[1:51:41][Apologise to speedrunners]
[1:51:55][We collide, allowing tunnelling and recovery][:collision :geometry :run]
[1:55:24][Make MoveEntity() subdivide the voxelized :collision search]
[2:04:48][Our glove no longer moves, but the familiar does][:collision :geometry :run]
[2:07:05][Consider how to handle the glove's interpenetration][:collision :geometry :research]
[2:08:42][Prevent MoveEntityLocally() from drawing the occupation state][:collision :"debug visualisation" :geometry]
[2:08:53][Our :performance has degraded][:collision :geometry :run]
[2:09:27][Add an assertion on the StepCount in MoveEntity()][:collision]
[2:09:47][Hit our assertion in MoveEntity()][:collision :geometry :run]
[2:10:35][Inspect our values in MoveEntity()][:collision :geometry :run]
[2:11:19][Make MoveEntity() cap the voxel subdivision StepCount to 5][:collision]
[2:12:12][Our :performance remains poor][:collision :geometry :run]
[2:13:03][Q&A][:speech]
[2:13:16][@centhusiast][Q:I am always wondering why we use CPU optimization if the rendering is done by GPU. Maybe it is a silly question]
[2:13:43][Disable the :lighting in UpdateLighting()]
[2:14:30][Our unlit :performance in -O2 is fine][:collision :geometry :run]
[2:14:36][Our unlit :performance in -Od is slow][:collision :geometry :run]
[2:15:25][Re-enable the :lighting in UpdateLighting()]
[2:15:37][UpdateAndRenderEntities() takes 10% of our frame time][:performance :run]
[2:16:17][Make MoveEntity() a TIMED_FUNCTION][:"debug system"]
[2:16:47][MoveEntity() takes 5% of our frame time][:performance :run]
[2:17:19][Disable MoveEntity()][:collision]
[2:17:41][ComputeLightPropagationWork() takes 90% of our frame time][:performance :run]
[2:18:04][Disable the :lighting in UpdateLighting()]
[2:18:11][UpdateAndRenderEntities() takes 69% of our frame time][:performance :run]
[2:19:03][Re-enable the :lighting in UpdateLighting()]
[2:19:17][@mindmark42][Q: Doesn't the OrigP need to be updated each step?][:collision]
[/video]
