[video output=day059 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Adding a Basic Familiar Entity" vod_platform=youtube id=KBCNjjeXezM annotator=schme annotator=Miblo]
[2:29][Recap and plan for the day ahead]
[5:34][handmade.h: Add EntityType_Familiar and EntityType_Monster]
[6:21][handmade.cpp: Introduce AddMonster and update AddLowEntity]
[10:49][Add a monster]
[12:04][Run the game and see the monster]
[13:37][Reiterate the fact that it is the SetCamera call that brings everything into the HighEntity set]
[14:29][handmade.cpp: Write cases for drawing each EntityType]
[16:47][Run the game and see our Monstar for the first time]
[17:10][handmade.cpp: Add a familiar]
[18:16][Run the game and see our Familiar for the first time]
[19:40][handmade.cpp: Consider how to update the HighEntities]
[21:04][Introduce UpdateEntity]
[22:30][Consider the "jump code" and do some clean up]
[25:52][handmade.h: Introduce entity_visible_piece and entity_visible_piece_group]
[27:52][Change DrawBitmap calls to PushPiece]
[37:09][Consider doing the rendering directly, rather than deferring it]
[38:06][Finish implementing PushPiece]
[41:05][Run the game and note that we're doing the exact same thing we were doing]
[41:18][handmade.cpp: Add Update calls for the entities]
[42:22][Compute the ShadowAlpha incorrectly for now]
[42:52][Implement these Update calls and give the Familiar some logic]
[49:09][Implement EntityFromHighIndex]
[51:22][Change MovePlayer to MoveEntity]
[52:23][Give the Familiar some movement logic towards the Hero]
[53:51][Run the game and tweak the Familiar's logic]
[54:48][Moment of realisation: The player's speed is baked into MoveEntity]
[55:04][Make the Familiar move at half the speed of the Hero and check it out in-game]
[56:41][Q&A][:speech]
[58:09][Q: Why "Monstar" and not "Monster"?]
[58:58][Q: If someone rewrites your code using OOP and it runs faster, what would you do?]
[59:24][Q: Why do you want to be able to outrun your familiar? Doesn't having to stop for him to catch up get annoying?]
[1:00:44][Q: Could you make the head bob up and down while following the player?]
[1:03:49][Q: Could you write Pong real fast, so I can see how to start?]
[1:04:03][Q: "Monstar" would be confused with "Mon*", a pointer to a Mon]
[1:04:19][Q: Are we going to eventually use a component-based entity system, instead of using an enum of entity types? If not, why?]
[1:05:50][Q: Would you think about doing some proportional integral derivative control for familiars to follow?]
[1:06:50][Q: I have a bad feeling about that switch on EntityType. Do you think it will probably go away as we get closer to the final architecture?]
[1:07:35][Q: Would collision be an XY-only thing, or would you take into account Z, as in jumping over another entity?]
[1:08:49][Q: I have a feeling your Low entities will be quite big if they have AI and stuff. Won't this be a problem for the huge world? Maybe it would have made sense if you had kept the tile data in chunks so you can deflate some entities just when needed]
[1:09:47][Q: The performance boost off the low / high shuffle: when will we see this come into play?]
[1:10:33][Q: Could we spawn a ton of these floating head things?]
[1:30:46][Q: How will the Z work exactly?]
[1:31:35][Q: Will there be a flock system for all the floating heads following the Hero?]
[1:31:43][Q: What kind of path finding will be implemented for High entities and how will they differ from faraway Low entities? And will Low entity NPCs who are always on the move really far away always resolve? It would be interesting to come across a very live world full of history, dead bodies, etc. due to constant AI acting, but would that be feasible?]
[1:32:19][Q: How easy would it be to chain multiple bobbly heads to follow each other?]
[1:35:25][Q: CameraTileY + OffsetY not OffsetX in AddFamiliar call]
[1:36:04][Q: I was very glad to hear that you deem classes to be basically garbage. I spent too much time with C# trying to learn object inter-jugglery between them]
[1:36:19][Q: About the chaining familiars, could each familiar check if the hero has a familiar already and, if it does, then try to follow the familiar instead?]
[1:36:44][We've come to the end of the questions][:speech]
[/video]
