[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Reorganizing the Head and Body Code" vod_platform=youtube id=sEHDoJnZSKY annotator=Miblo] [1:40][Run the game and recap our current situation] [2:56][Stand on the FloatyThingForNow and note a bug] [3:44][handmade_world_mode.cpp: Set Found = false for the HeroBody] [5:18][Run the game, note that the body cannot find a traversable and consider making the head operate more specifically] [7:46][handmade_world_mode.cpp: Decouple of the hopping from the head and make it happen more predictably] [12:27][Run the game, move the head and find that the body does not hop] [12:57][4coder: Indentation request] [13:12][handmade_world_mode.cpp: Make the controller also control the body, if one exists] [21:37][Run the game and hop around] [21:48][handmade_world_mode.cpp: Make the Head test to see if the Body can move to a traversable] [26:08][handmade_entity.h: Introduce IsEqual] [28:21][Run the game and find that nothing has changed] [30:51][handmade_world_mode.cpp: Investigate this behaviour with the FloatyThingForNow like a bug, starting with DEBUG_VALUE] [35:27][Record a loop in order to investigate it] [46:00][Blackboard: Figuring out the tile delta] [59:36][win32_handmade.cpp: Copy a loop and provide the ability to play one back independently of recording] [1:01:52][Run the game and try playing back a loop] [1:23:14][Moment of realisation: This isn't even a bug] [1:24:44][Owl of Shame Moment: FloatyThingForNow is hard-setting the P.z][quote 484] [1:25:05][Blackboard: How the FloatyThingForNow messes with the relative coordinate system] [1:27:20][handmade_world_mode.cpp: Set the P.z as a delta for now and then hop onto the FloatyThingForNow and find that the bug has gone] [1:28:39][Blackboard: sine and cosine as derivatives of each other] [1:35:06][Q&A][:speech] [1:36:06][@klemensbaum][Is there a geometric explanation for the quaternion sandwich product? Where does the formula q * p * conj(q) come from?] [1:37:00][@mr4thdimention][I am a bit unclear on why the relative positioning of Z worked. Is Z rebased somewhere in the code?] [1:38:33][@zakssi][I'm still quite newbie on programming, but wouldn't commenting your code a bit more help in situations like today?] [1:40:40][@cubercaleb][Only three swears? I have counted a lot more than that] [1:41:04][@longboolean][So, not only did that bug effect the floating thing going to high / low, but it also was the cause of the head picking the wrong point and the body jumping to it?] [1:41:23][Blackboard: What was causing the guy to jump] [1:43:15][@themindoverall][What if you really wanted to set an absolute position for an entity? How would you handle that?] [1:44:00][Blackboard: Quaternion Sandwich Product or Similarity Transform] [1:45:56][@klemensbaum][Yes, that's the question] [1:46:34][Blackboard: The algebraic reason] [1:48:56][Blackboard: Things that represent a frame of reference] [1:54:38][Blackboard: Knowing what B is in the space of A] [1:57:27][Blackboard: The Similarity Transform] [2:03:16][Blackboard: Diagram of the transform] [2:07:17][Blackboard: Why do we care about this?] [2:10:35][Blackboard: Thinking about this algebraically] [2:12:05][Blackboard: Doing this transform, with P encoded in a different space] [2:16:08][Blackboard: Transforming a bone chain] [2:21:02][Blackboard: Inserting and expanding the identity] [2:25:43][@klemensbaum][Thank you, very insightful explanation. Can you recommend a book where I can learn more about these kinds of things? How did you learn it all in such an intuitive way?] [2:29:21][@jameswidman][Would any of this have been mentioned in the comments in the Granny source code, or is it considered "obvious" to people working in that context?] [2:30:51][Wrap it up][:speech] [2:31:32][Relaunch the awesome ~Milton and find that everything is saved and undoable] [/video]