[video output=day295 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Stacking Rooms for Z Layer Debugging" vod_platform=youtube id=N0K0eHnVc1Y annotator=Miblo]
[0:11][On determining which systems impact many other systems, and solidifying them early on]
[2:45][What Mike Acton had to say about the potential costliness of some game design decisions[ref
    site="Molly Rocket"
    page="HandmadeCon 2015: Mike Acton"
    url="https://mollyrocket.com/news_0035.html"]]
[7:43][Recap our current situation and set the stage for solidifying Z]
[9:54][handmade_world_mode.cpp: Make AddStandardRoom generate some stairs]
[15:59][Run the game and traverse the offset stairs]
[16:31][handmade_world_mode.cpp: Make PlayWorld generate more layers of rooms]
[17:18][Run the game and see the multiple layers]
[18:14][handmade_world_mode.cpp: Expand the TraversablePoint rectangles to fill the tiles and give them outlines]
[22:30][handmade_render_group.cpp: Make PushRect multiply the Color by GlobalAlpha]
[22:51][Run the game and see that we're already in pretty good shape, but need to more clearly specify Z]
[24:42][handmade_world_mode.cpp: Make AddStandardRoom generate a hole in the ground]
[29:15][Run the game and look down through the hole]
[30:01][The snake just went up the stairs][quote 492]
[30:24][handmade_world_mode.cpp: Make UpdateAndRenderWorld draw the tiles green]
[31:37][Run the game and consider the problem with drawing down so far]
[33:28][handmade_world_mode.cpp: Make UpdateAndRenderWorld expand FadeBottomStartZ and FadeBottomEndZ]
[34:21][Profiler: Note that BeginSim and UpdateAndRenderWorld are slow]
[38:28][build.bat: Switch to -O2 find that we're now running at 60 FPS]
[39:59][Profiler: Switch to the software renderer]
[41:01][win32_handmade.cpp: Add more BEGIN_BLOCK and END_BLOCK pairs in Win32DisplayBufferInWindow]
[43:24][handmade_world_mode.cpp: Add more BEGIN_BLOCK and END_BLOCK pairs in UpdateAndRenderWorld]
[44:12][Run the game, view those timings and find that brains are not taking much time]
[45:04][handmade_debug.cpp: Make DrawTopClocksList calculate and display a cumulative percentage]
[47:39][handmade_debug.cpp: Make DrawTopClocksList call AddTooltip to draw this percentage]
[52:06][Debugger: Step into DrawTopClocksList and find and investigate why our TextRect is not valid]
[54:56][handmade_debug.cpp: Make DrawTopClocksList set TextRect off GetTextSize]
[55:59][handmade_debug_ui.cpp: Introduce a version of GetTextSize that takes a v2 At]
[56:39][handmade_debug_ui.cpp: Make AddTooltip draw a background]
[58:40][handmade_debug.cpp: Make ToolTipTransform appear above everything]
[1:00:28][Run the game and view our tooltip]
[1:02:48][handmade_sim_region.cpp: Add a TIMED_BLOCK for SimUnpack in BeginSim]
[1:03:17][handmade_sim_region.cpp: Make the PushArray calls in BeginSim do NoClear, and check that all of the necessary data is initialised]
[1:05:42][Profiler: Find that BeginSim no longer takes so much time]
[1:06:52][handmade_world_mode.cpp: Add BEGIN_BLOCK and END_BLOCK pairs for EntityRendering and EntityPhysics in UpdateAndRenderWorld]
[1:08:18][Profiler: Find that EntityRendering is taking up the lion's share of the time]
[1:11:07][handmade_world_mode.cpp: Move the EntityRendering block down to look only at the Piece list]
[1:11:36][handmade_world_mode.cpp: Add BEGIN_BLOCK and END_BLOCK pairs for CollisionRendering, VectorClear, and HitpointRendering in UpdateAndRenderWorld]
[1:12:33][Profiler: Find that CollisionRendering is the hog]
[1:12:47][handmade_world_mode.cpp: Add BEGIN_BLOCK and END_BLOCK pairs for VolumeRendering and TraversableRendering in UpdateAndRenderWorld]
[1:13:34][Profiler: Find that TraversableRendering is the most expensive]
[1:14:33][handmade_world_mode.cpp: #if 0 the PushRectOutline calls for the traversables]
[1:15:35][Consider turning on the optimiser just for these traversable drawing routines or blowing out the PushRect functions to be more explicit]
[1:16:19][Q&A][:speech]
[1:17:21][@cmuratori][@insobot Do you have a question for me?]
[1:17:28][@insobot][@cmuratori: Duuuuude]
[1:17:34][@serge_rgb][How much longer does it take to build Handmade Hero with release optimizations?]
[1:18:24][Debugger: Demo the insufficiency of MSVC's debug information in optimised builds]
[1:22:59][@cubercaleb][The switch is -Zo]
[1:23:46][@themarsalla][I missed the optimization due to buffering but I caught some stuff about the clear being bloated, but didn't catch what the fix was?]
[1:24:13][@thesizik][Far-away floors turning transparent don't look quite right since you can see through them]
[1:24:43][@longboolean][When peering down the hole at the more transparent layers, you can see characters through those ground layers. My guess is you would want to mix with a "fog color" instead of just making the tiles transparent?]
[1:25:24][@elyasm][Would LLVM work on Windows / Handmade Hero?]
[1:27:18][@dandymcgee][What editor is most similar to 4coder, and how long did it take to pick it up?]
[1:28:22][@wellingguzman][Having many levels of rooms and having entities in each level actively executing, wouldn't that be heavy / expensive? Or have you think in a performance solution or a level limitation?]
[1:29:17][@longboolean][Is there a way to tell the compiler to optimize just a particular section of the code? If not, how would you work around that?]
[1:31:07][@cubercaleb][Clang++ is worse. Honestly, why can't the PDB just say "Hey, you are at this instruction? Okay, the value is in this register / address or whatever"?]
[1:33:46][Wind it down][:speech]
[/video]
