[video output=day230 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Refining Renderer Sort Keys" vod_platform=youtube id=9-jltZmDMHI annotator=Miblo annotator=debiatan]
[0:07][Recap and set the stage for the day]
[1:25][Blackboard: Sort Key for Rendering]
[6:06][Blackboard: Treating Z purely semantically]
[10:00][handmade_world_mode.cpp: Disable the GroundBuffer, run the game and demo the situation with rendering entities on stairwells]
[13:26][Blackboard: On rendering entities on stairwells]
[17:42][Unexpectedly hit an InvalidCodePath]
[18:43][Debugger: Realise that we never reset SortEntryAt]
[19:14][handmade_render_group: Introduce ClearRenderValues]
[23:47][Run the game and watch the last frame time]
[24:58][handmade_render_group.cpp: Consider how best to generate the SortKey]
[27:15][handmade_render_group.h: Add b32 Upright to render_transform]
[28:06]["Move this out to its own thang"][quote 344]
[28:41][handmade_render_group.cpp: Use Upright in the SortKey computation]
[30:28][handmade_world_mode.cpp: Set the GroupBuffer to not be Upright]
[31:01][Run the game and note that we don't leave a hole for the stairwells]
[32:28][Try getting the stairwell thing working a little bit]
[33:48][Run the game and note some rendering problems]
[34:58][handmade_world_mode.cpp: Give the GroundBuffer some Z]
[36:27][Run the game and find that the topmost GroundChunk now occludes everything, as expected]
[37:12][handmade_world_mode.cpp: Get FadeTopStart to happen again]
[38:39][Run the game and see that everything seems to be rendering properly]
[39:55][Note that we're drawing the entire screen many times]
[41:28][win32_handmade.cpp: Drop down the resolution to 960x540]
[43:08][handmade_render_group.h: Separate the transform data into object_transform and camera_transform]
[45:18][handmade_render_group.h: Introduce DefaultUprightTransform and DefaultFlatTransform]
[46:59][handmade_render_group.cpp and handmade_debug.cpp: Propagate these changes]
[59:51][Run the game and find that everything is exactly the same]
[1:00:44][Q&A][:speech]
[1:01:25][@abnercoimbre][Brace yourself]
[1:01:53][@Connor_Rentz][What is your preferred sorting method?]
[1:03:33][@LaresYamoir][Hi Casey. I'm currently working on an OpenGL framework for games. Wanted to ask whether I can use the code up to Day 023 (Live Code Editing), with the intend of making a commercial game eventually with it. Might be important to note that I'm also streaming, so the code might be visible sometimes when I stream framework development]
[1:03:58][@gimpycpu][I know you said you really like discriminated unions, but how do you deal with managing the big case switch they may cause? That is usually handled by the OOP model by delegating to the object]
[1:05:36][Demo: Switch statement vs dispatch]
[1:08:42][@ChronalDragon][Obviously we lost some performance over the last couple streams. Are you planning to try to optimize it back down, or just leave the software renderer as is and move into GPU rendering?]
[1:09:34][@elxenoaizd][A lot of the times when you develop something, you write it in the simplest way that just works, then you polish it to something good and more finished (e.g. what you did with dsound). For someone catching up, do you think it's good enough to just study and focus on that better version, or is there a value in writing that initial version ourselves?]
[1:10:47][@SnowyCrystalz][Hey Casey! I just found your series and was amazed that you are creating an entire game without using an external library like SDL (from what your episode one said, at least). I really wanted to watch your progress through the series but I have no Idea where to start in the 200+ episodes since I already am working on an SDL OpenGL game. What is your suggestion?]
[1:11:49][@quartertron][I can't remember if you discussed this when it first cropped up but, when you are halfway up the stairs and blending the trees, you get a darker area where they overlap. What's the "fix" for that?]
[1:12:18][Blackboard: On the need for compositing in order to fade]
[1:13:30][@coxpuncher][Is std::qsort worth using compared to rolling your own?]
[1:14:24][@NoRaD91][How do / would you deal with collisions between multiple entities in terms of collision resolution, not detection, like deciding how to resolve conflicts between multiple moving things? I kinda hit a wall there not seeing solutions that aren't very ugly (especially movement-order dependency)]
[1:16:28][@Robrobby][You said the scaling value is not used, but the camera transforms everything. What is the difference?]
[1:17:44][@karn1948][What keyboard are you using these days? I know you're a connoisseur, so I'd love to hear a recommendation]
[1:18:26][@Culver_Fly][How would a front-to-back renderer actually work? Would it test every pixel before writing to it?]
[1:19:57][@Mr4thDimention][Does multiple dispatch come up for you much (as in n types with n^2 branches)? How do you handle it when it does?]
[1:21:30][@NoRaD91][Would you rather have an explicit fall-through statement with implicit break, instead of standard switch-statements? Seems much cleaner to me, or am I missing something?]
[1:22:41][@quartertron][That's what I was afraid of but thought maybe you had some trick like a messed up precomputed alpha]
[1:23:17][@ttbjm][I know we just got over the holiday break, but will there be a break in Handmade Hero when The Witness launches? If it's a possibility, it might be better to ask the community if they want that]
[1:23:36][@Robrobby][Are you productive / feel good at programming no matter how many hours you work per week?]
[1:24:41][Close up shop and glimpse into the future][:speech]
[/video]
