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

100 lines
8.8 KiB
Plaintext
Raw Normal View History

2022-06-22 21:20:16 +00:00
[video output=day657 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Implementing Move Queues" vod_platform=youtube id=Ax5vU4mXJ48 annotator=Miblo]
[0:01][Recap and set the stage for the day moving the glove][:"entity system" :run]
[0:34][Describe our sketched out move patterns and queues, and stats][:"data structure" :"entity system" :research]
[5:25][Walk through our move queue enqueuing code in ExecuteBrainHero()][:"entity system" :research]
[7:38][Demo the brain-directed movement synchronisation][:"entity system" :run]
[8:59][Consider move queue-directed movement integrity][:"entity system" :run]
[11:41][Our facing direction is wrong when pressing Up][:"entity system" :run]
[11:57][Investigate why our facing direction is wrong][:"entity system" :research]
[12:30][Make ExecuteBrainHero() compute the FacingDirection with the ATan2 of the X vector][:"entity system"]
[12:51][Our facing direction remains wrong][:"entity system" :run]
[13:05][Investigate why our facing direction is wrong][:"entity system" :research]
[13:42][Make ExecuteBrainHero() compute the FacingDirection with the ATan2 of y / x of the X vector][:"entity system"]
[13:54][Our facing direction is now correct][:"entity system" :run]
[14:07][Consider where the glove should sit][:"entity system" :run]
[16:43][Determine to put the glove on the hero's tile, and not occupy tiles it passes through][:"entity system" :research]
[24:52][Make ExecuteBrainHero() move the glove without transactionally occupying tiles][:"entity system"]
[26:29][Our glove doesn't move with us][:"entity system" :run]
[26:55][Investigate why the glove doesn't move][:"entity system" :research]
[28:00][Move without hitting extra keys, and the glove still not following us][:"entity system" :run]
[28:11][Break into the "glove at rest" branch in ExecuteBrainHero()][:"entity system" :run]
[29:58][Step through UpdateAnimation()][:animation :"entity system" :run]
[33:03][Reacquaint ourselves with UpdateAnimation()][:animation :"entity system" :research]
[34:23][Check that the glove's :animation data doesn't get overwritten][:"entity system" :research]
[36:46][Break into AddPlayer() for the glove's entity ID (10845), then see what UpdateAnimation() does to that entity][:animation :"entity system" :run]
[44:38][Find that UpdateAndRenderEntities() sets Entity->GroundP][:"entity system" :research]
[47:23][Remove GroundP from entity][:"data structure" :"entity system"]
[49:28][Entities are now in different locations][:"entity system" :run]
[49:54][Our glove follows us, but does not animate][:animation :"entity system" :run]
[51:03][Investigate why the glove does not animate][:animation :"entity system" :research]
[52:50][Fix ExecuteBrainHero() to set the Glove's tMovement to 0][:animation :"entity system"]
[53:10][Our glove follows us, animating smoothly][:animation :"entity system" :run]
[53:46][Determine to offset the glove's location relative to the player][:"entity system" :research]
[54:40][Try making AddPlayer() offset the glove in X][:"entity system"]
[55:13][Our glove is offset in X][:"entity system" :run]
[55:26][Try making AddPlayer() offset the glove in Z][:"entity system"]
[55:56][Our glove is offset in Z][:"entity system" :run]
[56:10][Increase the glove's X offset from 0.25 to 0.5 in AddPlayer()][:"entity system"]
[56:18][Our glove offsetting doesn't respect its parent entity's facing direction][:"entity system" :run]
[59:47][Traverse the dungeon admiring the :lighting][:run]
[1:01:28][@mallesbixie][With a fixed offset from the actual position, animating would get hard, I guess][:animation :"entity system"]
[1:02:19][Determine to dequeue moves off the move queue][:"entity system" :research]
[1:03:42][Enable UpdateAndRenderEntities() to dequeue moves off the move queue, augmenting entity with a MoveQueueIndex][:"data structure" :"entity system"]
[1:08:31][The game still runs][:run]
[1:08:43][Make UpdateAndRenderEntities() draw move queues][:"debug visualisation" :"entity system"]
[1:10:52][See no move queue drawings][:"debug visualisation" :"entity system" :run]
[1:11:02][Make UpdateAndRenderEntities() elevate the move queue drawing above the ground][:"debug visualisation" :"entity system"]
[1:11:28][Still see no move queue drawings][:"debug visualisation" :"entity system" :run]
[1:11:30][Make AddPlayer() set the Glove->Stats.MaxMoveGroupCount to 1, and ExecuteBrainHero() reset Glove->MoveQueueIndex to 0 when with the body][:"entity system"]
[1:13:41][Still see no move queue drawings][:"debug visualisation" :"entity system" :run]
[1:13:50][Scour ExecuteBrainHero() for bugs][:"entity system" :research]
[1:14:23][Break in to ExecuteBrainHero() to find the glove's stats are not set][:"entity system" :run]
[1:15:07][Change AddPlayer() to set the Glove->BaseStats.MaxMoveGroupCount to 1][:"entity system"]
[1:15:35][Break in to ExecuteBrainHero() to find the glove's stats remain not set][:"entity system" :run]
[1:15:51][accumulate entity stats]
[1:16:20][Love @insobot, and feel like @insofaras needs to use GPT-3 and have @insobot do everything][:speech]
[1:17:05][Make AdvanceEntityStats() acquire the Entity->BaseStats][:"entity system"]
[1:17:31][Break in to ExecuteBrainHero() to find the glove's stats are now set, and move queue boxes are drawn][:"debug visualisation" :"entity system" :run]
[1:18:11][Make ExecuteBrainHero() locate the move queue drawings relative to its entity's occupying position][:"debug visualisation" :"entity system"]
[1:19:35][Our move queue drawings work pretty well][:"debug visualisation" :"entity system" :run]
[1:19:44][Determine to make the glove return to the body after punching][:"entity system" :research]
[1:21:14][@technicbeam][People always wonder when @insobot is going to become sentient]
[1:21:48][Our move pattern rotates properly][:"entity system" :run]
[1:21:55][Investigate why the glove doesn't return to the body after punching][:"entity system" :research]
[1:22:18][Fix the glove reset condition in ExecuteBrainHero()][:"entity system"]
[1:22:34][Our glove now returns after punching][:"entity system" :run]
[1:22:55][Increase Glove->BaseStats.MaxMoveGroupCount from 1 to 2 in AddPlayer()][:"entity system"]
[1:23:11][We can chain punches, but the pattern direction is off][:"entity system" :run]
[1:23:30][Investigate why the second punch's direction is off][:"entity system" :research]
[1:25:03][@technicbeam][Have fun reading it, if you can find a copy. It's gotta be, what, 40 years old at least by now?]
[1:25:12][Gain insight into the chained punching direction][:"entity system" :run]
[1:25:32][Try using a WentDown input event in ExecuteBrainHero()][:"input handling"]
[1:26:16][@technicbeam][The Adolescence of P-1[ref
author="Thomas Joseph Ryan"
title="The Adolescence of P-1"
publisher="Macmillan Publishing"
isbn=0026065002]]
[1:26:29][We have HalfTransitionCount but not WentDown in game_button_state][:"data structure" :"input handling"]
[1:27:20][Make ExecuteBrainHero() also factor in the HalfTransitionCount to its attack checks][:"entity system" :"input handling"]
[1:27:55][We can chain punches in the correct directions][:"entity system" :run]
[1:29:15][Consider the definition of :collision][:"entity system" :research]
[1:30:31][Change ExecuteBrainHero() to give the glove a 1-step attack pattern][:"entity system"]
[1:30:53][Try our simple punch][:"entity system" :run]
[1:31:07][Introduce SetAnimation() for the ExecuteBrain*() functions to call, augmenting entity with a dtMovement][:animation :"data structure" :"entity system"]
[1:36:50][That all looks fine][:animation :"entity system" :run]
[1:37:04][Switch UpdateAndRenderEntities() to use the new Entity->dtMovement][:"entity system"]
[1:37:26][Our glove doesn't move][:animation :"entity system" :run]
[1:37:40][Consider where and how to set the glove's dtMovement][:"entity system" :research]
[1:40:58][Let UpdateAndRenderEntities() also move entities if their dtMovement is 0][:"entity system"]
[1:41:23][Our glove now moves][:animation :"entity system" :run]
[1:41:33][Increase the glove's animation speed from 4 to 8 in ExecuteBrainHero()][:animation :"entity system"]
[1:41:53][Our glove punches faster][:animation :"entity system" :run]
[1:42:44][@mallesbixie][Would the attack pattern define the speed?][:"entity system"]
[1:43:23][Make UpdateAndRenderEntities() set the Entity->dtMovement, and AddPlayer() the glove's BaseStats.Speed][:animation :"entity system"]
[1:45:13][Our glove still punches faster][:animation :"entity system" :run]
[1:45:16][Toggle to the 3-step attack pattern in ExecuteBrainHero()][:"entity system"]
[1:45:43][Try out our fast-slow-fast punch][:animation :"entity system" :run]
[1:46:24][@spacenaming][There is a function to determine if the button was pressed this frame (named WasPressed)][:"input handling"]
[1:46:29][Call it for today with a glimpse into the future doing damage and collapsing down to grid][:speech]
[/video]