[video output=day312 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Cross-entity Manual Sorting" vod_platform=youtube id=8ke6OKMFeAI annotator=Miblo] [0:08][Recap and set the stage for the day with an embarassing confession] [1:35][Run the game and assess our current situation] [4:46][Blackboard: Manual Edge Specification] [7:02][handmade_entity.cpp: Make UpdateAndRenderEntities() only call BeginAggregateSortKey() if the PieceCount is > 1] [7:55][Consider how to articulate the intention that one sprite (e.g. the head) must always draw in front of another (e.g. the aggregated body)] [10:35][handmade_entity.h: Add ManualSortInFrontOf and ManualSortKey to the entity struct] [11:17][handmade_brain.cpp: Make ExecuteBrain() set those values when a Head and Body are linked] [15:10][handmade_brain.cpp: Enable ExecuteBrain() to talk to the RenderGroup] [16:21][handmade_entity.cpp: Consider how to specify the render order in UpdateAndRenderEntities()] [19:42][handmade_render_group.cpp: Consider making BuildSpriteGraph() add some additional edges that force sorts] [21:38][Consider simplifying things] [23:06][Blackboard: Putting something into the SortKey to tag it as AlwaysInFrontOf or AlwaysBehind] [23:45][handmade_render.h: Add AlwaysInFrontOf and AlwaysBehind to the sort_sprite_bound struct] [24:33][handmade_render.cpp: Make IsInFrontOf() check if sprite_bound A is AlwaysInFrontOf or AlwaysBehind B, to save having to manually specify edges] [27:39][handmade_platform.h: Add LastUsedManualSortKey to the game_render_commands struct] [27:55][handmade_render_group.cpp: Introduce ReserveSortKey()] [30:45][handmade_entity.cpp: Make UpdateAndRenderEntities() set AlwaysInFrontOf and AlwaysBehind] [32:06][handmade_render.h: Introduce manual_sort_key struct] [33:08][handmade_render_group.cpp: Erase ComputeSortKey() and make GetBoundFor() copy the ObjectTransform.ManualSort to SpriteBound.Manual] [35:37][handmade_platform.h: Move manual_sort_key in from handmade_render.h with a mini-rant on the language] [36:46][Run the game and see how we're doing] [37:22][Debugger: Break into ExecuteBrain() and see if we're setting the SortKey] [39:11][handmade_entity.cpp: Add a BreakHere in UpdateAndRenderEntities() when an EntityTransform is not AlwaysInFrontOf or AlwaysBehind] [40:07][Debugger: Break in there and inspect the values] [42:45][handmade_render.cp: Correct a typo in IsInFrontOf()] [43:04][Run the game and see that that wasn't our only bug] [43:15][handmade_render.cpp: Make IsInFrontOf() check AlwaysInFrontOf and AlwaysBehind separately and correctly] [48:01][Run the game and see that we're in a better situation, but not quite perfect] [50:49][Toggle on GlobalShowSortGroups and identify that, when the sorting is incorrect, we have a cycle] [53:58]["Thank you, Mr Cycle Detection"][quote 503] [54:15][Q&A][:speech] [54:55][@thesizik][Perhaps breaking the cycle on the in-front / behind pair?] [56:49][@LongBoolean][Will there ever be a case when the character's facing direction will change what we want for the sort order? I can think of a possible case if the characters had arms. Does the current method take these cases into account?] [57:34][@Miblo][Looking forward to rewatching that simplification from early on. I don't think I quite followed that live] [58:41][@mnkmnkmnk][I'm the communications director at a game development studio in Montreal. I just found your stream minutes ago and it's very fascinating. Your trailer seems to convey the idea that a game is "better" if it's entirely handmade, from scratch. Do you feel a game can't be made with as much "love" if it uses a premade engine as opposed to one that's made entirely from scratch? Do you not feel like reinventing the wheel may be a waste of time?] [59:32][On the amount of love involved in making games whether from scratch or using a pre-made engine] [1:02:56][On reinventing the wheel, and the educational responsibility of Handmade Hero] [1:07:52][On the assumption that someone made a wheel] [1:08:49][Blackboard: Where the game industry is at in terms of inventing the wheel] [1:10:55][There is no wheel][quote 504] [1:15:52][On love and money] [1:16:34]["Your goal has to be that the reason you want money is to make games, not the reason you make games is to make money"][quote 505] [1:19:03][Close up shop][:speech] [/video]