diff --git a/cmuratori/hero/code/code658.hmml b/cmuratori/hero/code/code658.hmml new file mode 100644 index 0000000..386a3ac --- /dev/null +++ b/cmuratori/hero/code/code658.hmml @@ -0,0 +1,90 @@ +[video output=day658 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Handling Glove Collisions" vod_platform=youtube id=GxMz9U7FJ0E annotator=Miblo] +[0:00][Recap and set the stage for the day doing glove :collision][:speech] +[0:11][Demo the glove's chaining move patterns][:"entity system" :run] +[1:23][Determine to handle glove :collision, on overlapping hit boxes][:"entity system" :run] +[6:07][Define a strike as Street Fighter-esque overlapping hit boxes][:collision :"entity system" :research] +[6:51][RayIntersectsBox() is for debug purposes][:collision :research] +[7:32][Prepare to handle glove :collision, considering switching to a grid][:"entity system" :research] +[9:52][Set up UpdateAndRenderEntities() to process projectile collisions in a post-pass loop][:collision :"entity system"] +[13:35][@richardycg][That entity_iterator would look lovely with the new C++ for-loop syntax][:language] +[13:57][@richardycg][lol, no, but it's the one thing they fixed][:language] +[15:26][@richardycg][for (entity *Projectile : IterateAllEntities(SimRegion)) { /**/ }] +[15:56][Add EntityFlag_Collider to entity_flags] +[16:29][@genughaben][By the way, what is your opinion of Rust?][:language] +[16:32][Set up UpdateAndRenderEntities() to work on EntityFlag_Collider in its post-pass :collision loop][:"entity system"] +[16:46][Further thoughts on modern languages][:language :rant :speech] +[17:26][Set up UpdateAndRenderEntities() to check if a projectile collides][:collision :"entity system"] +[18:32][Try out conversation box checking][:collision :"entity system" :run] +[19:05][Consider handling projectile :collision like conversation boxes][:"entity system" :research] +[20:00][@bryantdrewjones][What’s the obviously good for-loop syntax?][:language] +[22:39][@yuika_lamonting][Jai has: for array {action}][:language] +[23:15][Make UpdateAndRenderEntities() check if a projectile collides][:collision :"entity system"] +[24:09][Consider single-hit application schemes: invincibility frames, projectile disabling][:collision :"entity system" :research] +[28:37][Toggle to the 1-step attack pattern in ExecuteBrainHero()][:"entity system"] +[29:12][Try our simple punch][:"entity system" :run] +[29:15][Toggle off the attack pattern drawing in ExecuteBrainHero()][:"debug visualisation" :"entity system"] +[29:40][Desire to repeatedly punch the same enemy][:collision :"entity system" :run] +[30:16][Consider using a global attack sequence number to makes attacks only hit once][:collision :"entity system" :research] +[31:58][@annonymus][Wouldn't that mean a slow projectile could be invalidated by a later fast projectile?][:collision :"entity system"] +[32:44][Consider making hit boxes activated on only one frame][:collision :"entity system" :research] +[33:46][Spawn multiple heroes][:"entity system" :run] +[34:55][Consider tracking a list of previously overlapping entities][:collision :"entity system" :research] +[39:28][Introduce an entity_collider_group for entity to contain][:collision :"data structure" :"entity system"] +[40:28][Make UpdateAndRenderEntities() compare an Old and New entity_collider_group to detect projectile collisions][:collision :"entity system"] +[46:39][@hmendoza2001][Not from San Francisco, but from Ohio] +[47:09][@hellminmunster][Hey @handmade_hero! I've just started going through this series on YouTube, currently on [~hero/code/code004 Day 004]. So, now that you are 600+ episodes into the series is there anything you want to tell someone just starting?] +[51:49][Make UpdateAndRenderEntities() finally update LastFrameColliders to the NewGroup][:collision :"entity system"] +[52:04][Describe the projectile collision detection loop, considering exit events][:collision :"entity system" :research] +[53:49][Describe a :SIMD version of the projectile collision detection loop][:collision :"entity system" :optimisation :research] +[58:17][Remove unused entity_flags, and split EntityFlag_Collider into EntityFlag_AppliesCollision and EntityFlag_ReceivesCollision][:collision :"entity system"] +[1:01:57][Remove pairwise_collision_rule][:collision :"data structure" :"entity system"] +[1:03:47][@sagian2005][So we can't punch trees…][:collision :"entity system"] +[1:04:38][Remove particle_cel and particle, and CanCollide()][:collision :"data structure" :"entity system" :"particle system"] +[1:05:09][Introduce CollisionResolve()][:collision :"entity system"] +[1:07:02][The snakes have hit points][:collision :"entity system" :run] +[1:07:56][Rename HIT_POINT_SUB_COUNT to HIT_POINT_SUBDIVISIONS][:collision :"entity system"] +[1:09:02][@sagian2005][…but [@cmuratori Casey] can't download Minecraft because the biggest software company in the world wouldn't let him buy the most popular game in the world] +[1:10:49][Implement CollisionResolve(), introducing ApplyDamage()][:collision :"entity system"] +[1:18:22][Make AddPlayer() set EntityFlag_AppliesCollision and SnakePattern set EntityFlag_ReceivesCollision][:collision :"entity system"] +[1:19:45][Punching a snake does no damage][:collision :"entity system" :run] +[1:20:38][Fail to break on ApplyDamage()][:collision :"entity system" :run] +[1:21:10][Break in to the projectile collision detection loop in UpdateAndRenderEntities()][:collision :"entity system" :run] +[1:21:38][Toggle on collision volume drawing in UpdateAndRenderEntities()][:collision :"debug visualisation" :"entity system"] +[1:21:58][The glove obviously collides with the snake][:collision :"debug visualisation" :"entity system" :run] +[1:22:46][Fix SnakePattern() to OR in EntityFlag_ReceivesCollision][:collision :"entity system"] +[1:23:37][Reacquaint ourselves with EntityOverlapsEntity()][:collision :"entity system" :research] +[1:24:46][Separate out the ReceivesCollision and EntityOverlapsEntity() checks in UpdateAndRenderEntities()][:collision :"entity system"] +[1:26:42][Try unsuccessfully to break in to the projectile collision detection loop in UpdateAndRenderEntities()][:collision :"entity system" :run] +[1:27:26][Set EntityFlag_ReceivesCollision to 1 << 3][:collision :"entity system"] +[1:27:55][Scour the projectile collision detection loop for bugs][:collision :"entity system" :research] +[1:28:09][Fix UpdateAndRenderEntities() to set Check to the CheckIter.Entity][:collision :"entity system"] +[1:28:21][Restart the game into our empty room][:collision :"entity system" :run] +[1:28:25][Make CreateOrphanage() generate a snake in the FloorEntranceRoom][:"procedural generation"] +[1:30:43][Try unsuccessfully to punch a snake][:collision :"entity system" :run] +[1:31:14][Break in to the projectile collision detection loop][:collision :"entity system" :run] +[1:32:19][Fix the loop increment direction in ApplyDamage()][:collision :"entity system"] +[1:32:44][Try unsuccessfully to add a breakpoint on ApplyDamage()][:collision :"entity system" :run] +[1:33:05][Break on CollisionResolve() and inspect the disassembly][:asm :collision :"entity system" :run] +[1:33:36][Scour ApplyDamage() for bugs][:collision :"entity system" :research] +[1:34:37][Break on CollisionResolve() in -Od, step through ApplyDamage(), and successfully damage the snake][:asm :collision :"entity system" :run] +[1:36:46][Rebuild in -O2 and successfully damage the snake][:asm :collision :"entity system" :run] +[1:37:31][Enable ApplyDamage() to call DeleteEntity() upon death and only apply damage to active entities, introducing IsActive()][:collision :"entity system"] +[1:40:17][@coffeeeeeeeeeee][Are you going to implement critical hits?][:collision :"entity system"] +[1:41:23][Successfully punch the snake to death][:collision :"entity system" :run] +[1:42:34][Reacquaint ourselves with DeleteEntity()][:"entity system" :research] +[1:43:59][Delete TestWall() and test_wall][:"data structure" :"entity system"] +[1:44:24][Reacquaint ourselves with TransactionalOccupy()][:"entity system" :research] +[1:45:42][Make DeleteEntity() vacate the occupied tile, introducing Vacate()][:"entity system"] +[1:48:58][Punch snakes to death, and successfully walk where they were][:collision :"entity system" :run] +[1:51:54][Remove BoxIndex_Down and BoxIndex_Up, and related stairwell code][:"procedural generation"] +[1:55:07][Hit the Room->GenerationIndex == GenerationIndex assertion in Layout()][:"procedural generation" :run] +[1:55:44][Decrease FloorCount from 4 to 1 in CreateDungeon()][:"procedural generation"] +[1:55:50][Still hit the Room->GenerationIndex == GenerationIndex assertion in Layout()][:"procedural generation" :run] +[1:56:18][Reacquaint ourselves with the Room->GenerationIndex == GenerationIndex assertion in Layout()][:"procedural generation" :research] +[1:57:28][Comment out the Room->GenerationIndex == GenerationIndex assertion in Layout()][:"procedural generation"] +[1:57:39][Hit assertion on PlaceEntityAtP() in StandardLightingPattern()][:"entity system" :"procedural generation" :run] +[1:57:51][Consider making the :"procedural generation" code more direct][:research] +[2:03:32][Consider making the forest area not room-based][:"procedural generation" :research] +[2:05:32][Plan to work on world generation next time][:"procedural generation" :research] +[2:08:49][That's it for today][:speech] +[/video]