[video output=day637 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Adding Collision Spheres" vod_platform=youtube id=HAHcu69HlK0 annotator=Miblo] [0:01][Welcome with thanks to our sponsor the Rust Recovery Foundation][:speech] [1:25][Recap and set the stage for the day][:collision :speech] [2:16][Demo our :collision system][:run] [3:00][:Collision system clean-up phase: 1) Spatial partition][:performance :run] [5:33][:Collision system clean-up phase: 2) Spherical collision volume][:performance :run] [8:17][:Collision system clean-up phase: 3) Partial embedding][:performance :run] [9:25][Determine to add :collision spheres][:research] [11:39][Set up CollidesAtP() to support :collision spheres] [15:54][Respecify CollidesAtP() to compute :collision of various shapes in the same branch] [18:22][@ronin825][Branchless programming?] [19:09][Introduce ShapesCollide()][:collision :geometry] [20:10][@abecderic][If less code is better, isn't no code at all most best? Why are we even doing programming then?] [22:29][Implement ShapesCollide()][:collision :geometry] [33:59][Describe ShapesCollide()][:collision :geometry :research] [35:34][Add EntityFlag_SphereCollision and fix compile errors][:collision] [36:07][Rectangular :collision continues working][:run] [37:14][Make the Glove use SphereCollision in AddPlayer()][:collision] [37:45][We don't know if our Glove is a sphere][:collision :geometry :run] [38:25][Make UpdateAndRenderEntities() draw SphereCollision entities in orange][:collision :"debug visualisation" :geometry] [39:19][Our Glove is a sphere][:collision :"debug visualisation" :geometry :run] [40:45][Double-check CollidesAtP() and ShapesCollide()][:collision :geometry :research] [45:53][Consider diagramming spherical :collision][:"debug visualisation" :geometry :research] [49:17][Determine to enable CollidesAtP() to use the repulsion direction computed by ShapesCollide()][:collision :geometry :research] [52:33][Consider adding spherical drawing to the renderer][:"debug visualisation" :geometry :research] [55:34][Change ShapesCollide() to use CenterDelta and Radius for its rectangle vs rectangle test][:"debug visualisation" :collision :geometry] [1:00:37][The Glove's spring is wild][:collision :geometry :run] [1:01:11][Make the rectangle vs rectangle :collision test less permissive in ShapesCollide()][:"debug visualisation" :geometry] [1:01:48][Familiar movement is still broken][:collision :geometry :run] [1:02:14][Double-check the rectangle vs rectangle :collision test in ShapesCollide()][:geometry :research] [1:02:23][Use Square() in the rectangle vs rectangle :collision test in ShapesCollide()][:geometry] [1:03:36][@Molly][Meow][:speech] [1:05:20][Our familiar does move and collide fine][:collision :geometry :run] [1:05:59][Reflect on ShapesCollide()][:collision :geometry :research] [1:07:08][@Molly][Scrolling around][:speech] [1:08:18][Consider improvements to ShapesCollide()][:collision :geometry :research] [1:09:57][@Molly][Put the mouse out of action][:speech] [1:10:51][Suspect improvements to shape vs shape :collision][:research] [1:11:52][Instrument ShapesCollide() to diagram various shaped collisions][:collision :"debug visualisation" :geometry] [1:20:39][Set up MoveEntity() to call DIAGRAM_Phase()][:collision :"debug visualisation" :geometry] [1:22:34][Create handmade_diagram.h with stubs of the various DIAGRAM_*() functions][:"debug visualisation"] [1:27:44][Q&A][:speech] [1:27:51][@thesandvichmaker][@handmade_hero I just tested and ~4coder 4.1.8 does fix the indentation. It's a one-line diff] [1:28:14][@an0nymal][const? Did I see him instinctively type const][:language] [1:30:32][@emperormetallix][Q: Why is a new diagramming system needed? Why not just use the existing renderer?][:"debug visualisation"] [1:30:46][Demo the current :"debug visualisation"][:run] [1:32:20][@tfnw][@handmade_hero Off-topic: Should the PushArray() for SpatialGridLeaves in handmade_lighting.cpp be aligned to 16 bytes, for movaps on 128-bit memory operands?][:lighting :memory] [1:34:37][Make GridBuildSpatialPartition() align the SpatialGridLeaves PushArray() to 16 bytes][:lighting :memory] [1:35:12][The :lighting remains fine][:memory :run] [1:37:04][@mindmark42][Q: Are we still planning on adding cylinder or capsule collisions?][:collision] [1:37:28][@tfnw][@handmade_hero Should the ID.Value be checked to be not null in handmade_asset.cpp?][:"asset system"] [1:38:07][@tfnw][LoadFont()][:"asset system"] [1:38:51][Make LoadFont() check that ID.Value is not null][:"asset system"] [1:41:33][@mooofdoom][@handmade_hero Hi [@cmuratori Casey]! First time catching your stream live after I finally caught up on every [~hero Handmade Hero] episode. Wanted to tell you it's been really fun and very enlightening following along. Super looking forward to Star Code Galaxy as well!] [1:41:55][@thesandvichmaker][@handmade_hero For the upgrade to ~4coder 4.1.8, it seems to break something with modal bindings] [1:42:41][@centhusiast][Q: Could you explain flood fill algorithm as it was used in the Minesweeper game? Thanks!] [1:43:15][@thesandvichmaker][@handmade_hero The fix for the auto indentation is one line. You could apply it to your current ~4coder] [1:43:24][@mooofdoom][Q: Any reason you only have the xyz-diagonal case in the voxel :collision system? Wouldn't you want xy-, xz-, and yz-diagonal motion as well?] [1:44:54][TODO(casey): Try having edge-diagonal motion as well as corner-diagonal motion?][:collision] [1:45:19][@emperormetallix][Q: Does [~hero Handmade Hero] really not have a sphere drawing routine?][:rendering] [1:46:48][@sagian2005][Q: Couldn't you just apply a circle to a camera-facing quad to fake a sphere?][:rendering] [1:47:18][@centhusiast][Q: This algorithm[ref site=Wikipedia page="Flood fill" url=https://en.wikipedia.org/wiki/Flood_fill]] [1:48:25][@centhusiast][Q: How does it work?] [1:51:37][@thesandvichmaker][Will it be finished before Cyberpunk 2077?] [1:52:42][Thanks, everyone][:speech] [/video]