From 93217a8b4794a5b50ee5620ec52c76b2d4bff706 Mon Sep 17 00:00:00 2001 From: Matt Mascarenhas Date: Mon, 29 Jan 2018 19:12:01 +0000 Subject: [PATCH] Annotate hero/code424 Also further standardise categorisation --- cmuratori/hero/code/code419.hmml | 10 +++--- cmuratori/hero/code/code424.hmml | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 cmuratori/hero/code/code424.hmml diff --git a/cmuratori/hero/code/code419.hmml b/cmuratori/hero/code/code419.hmml index 2802890..35c4987 100644 --- a/cmuratori/hero/code/code419.hmml +++ b/cmuratori/hero/code/code419.hmml @@ -42,8 +42,8 @@ [1:13:04][:Run the game and consider the frame rate at different zoom levels, at least initially][:lighting :rendering] [1:17:15][:Run it again and see that PeekMessage starts taking more time later][:"input handling" :"platform layer"] [1:19:08][Read through Win32ProcessPendingMessages()][:"input handling" :research :"platform layer"] -[1:19:53][:Run the game, check our :memory usage and provide a ton of input to the game to get PeekMessage up to the top of the :profiler][:"input handling" :"platform layer"] -[1:23:29][Step into Win32ProcessPendingMessages() to see how often it gets hit, and realise that Alt-Tabbing away removes PeekMessage from the top spot in the :profiler][:"input handling" :"platform layer" :run] +[1:19:53][:Run the game, check our :memory usage and provide a ton of input to the game to get PeekMessage up to the top of the profiler][:"input handling" :performance :"platform layer"] +[1:23:29][Step into Win32ProcessPendingMessages() to see how often it gets hit, and realise that Alt-Tabbing away removes PeekMessage from the top spot in the profiler][:"input handling" :performance :"platform layer" :run] [1:26:15][Read through Win32ProcessPendingMessages()][:"input handling" :"platform layer" :research] [1:26:50][:Run the game and spam PeekMessage with mouse movement][:"input handling" :"platform layer"] [1:29:56][Put our "PeekMessage" TIMED_BLOCK in Win32ProcessPendingMessages() inside the message loop][:"input handling" :"platform layer"] @@ -52,7 +52,7 @@ site=MSDN page="PeekMessage function" url=https://msdn.microsoft.com/en-us/library/windows/desktop/ms644943]][:"input handling" :"platform layer"] -[1:33:53][:Run the game, try to spam PeekMessage again and find it not rising to the top of the :profiler][:"input handling" :"platform layer"] +[1:33:53][:Run the game, try to spam PeekMessage again and find it not rising to the top of the profiler][:"input handling" :performance :"platform layer"] [1:34:59][Determine to try and narrow down the problem in Win32ProcessPendingMessages()][:"input handling" :"platform layer"] [1:35:36][:Run the game and successfully produce that bad case][:"input handling" :"platform layer" :rant] [1:37:17][Prevent Win32ProcessPendingMessages() from skipping WM_PAINT messages][:"platform layer" :rendering] @@ -60,13 +60,13 @@ [1:37:49][Prevent Win32ProcessPendingMessages() from skipping WM_MOUSEMOVE messages][:"input handling" :"platform layer"] [1:38:08][:Run the game and fail to produce the bad case, determining that WM_MOUSEMOVE cannot be skipped][:"input handling" :"platform layer"] [1:38:58][Note our PeekMessage observations][:"input handling" :"platform layer"] -[1:40:04][A few words on the utility of our always-on :profiler from the :"debug system"][:speech] +[1:40:04][A few words on the utility of our always-on profiler from the :"debug system"][:profiling :speech] [1:41:13][Wonder why this is happening][:"input handling" :"platform layer"] [1:42:04][:Run the game and try to trigger lots of WM_PAINT messages][:"platform layer" :rendering] [1:44:29][Prevent Win32ProcessPendingMessages() from skipping WM_PAINT messages][:"platform layer" :rendering] [1:44:54][:Run the game and experience no bad behaviour][:"platform layer" :rendering] [1:45:16][Try to prevent Win32ProcessPendingMessages() from skipping 0x738 messages][:"platform layer" :rendering] -[1:45:44][:Run the game to see that PeekMessage no longer takes the top spot in the :profiler][:"platform layer" :rendering] +[1:45:44][:Run the game to see that PeekMessage no longer takes the top spot in the profiler][:performance :"platform layer" :rendering] [1:46:08][Re-enable Win32ProcessPendingMessages() to skip 0x738 messages][:"platform layer" :rendering] [1:47:12][Q&A][:speech] [1:47:16][@chaoscom][[@cmuratori Casey], did you notice that the annotation search doesn't seem to be working anymore?[ref diff --git a/cmuratori/hero/code/code424.hmml b/cmuratori/hero/code/code424.hmml new file mode 100644 index 0000000..1eb0f8e --- /dev/null +++ b/cmuratori/hero/code/code424.hmml @@ -0,0 +1,55 @@ +[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Modifying Lighting to Use a Spatial Hierarchy" vod_platform=youtube id=jbWKPQuRed4 annotator=Miblo] +[0:00][Recap and set the stage for the day, creating a hierarchy of :lighting nodes][:rendering :speech] +[0:45][:Run the game to see our current :lighting solution running at \~30 fps][:rendering] +[4:28][Determine to make SplitBox() do something intelligent][:geometry :lighting :optimisation :rendering :speech] +[5:07][Introduce AddBoxStorage() and AddBoxReference()][:geometry :lighting :optimisation :rendering] +[9:04][A few words on box storage vs box referencing][:geometry :lighting :rendering :speech] +[9:27][Implement AddBoxReference() and AddBoxStorage()][:geometry :lighting :optimisation :rendering] +[12:36][Consider how to store our partitioned boxes][:geometry :lighting :memory :rendering :speech] +[15:03][Begin to enable BuildSpatialPartitionForLighting() to build the spatial hierarchy][:geometry :lighting :optimisation :rendering] +[22:08][Introduce a rectangle3 version of Union()][:geometry :mathematics] +[22:56][Continue to enable BuildSpatialPartitionForLighting() to build the spatial hierarchy][:geometry :lighting :optimisation :rendering] +[24:54][Introduce InvertedInfinityRectangle3() and GetRadius()][:geometry :mathematics] +[27:20][Finish setting up BuildSpatialPartitionForLighting() to call SplitBox()][:geometry :lighting :optimisation :rendering] +[33:08][Spatial Partition "In Place"][:blackboard :geometry :memory] +[36:18][Add ScratchA and ScratchB arrays to lighting_solution and enable BuildSpatialPartitionForLighting() to use them][:geometry :lighting :optimisation :rendering] +[38:26][Begin to enable SplitBox() to split a box along each axis][:geometry :lighting :optimisation :rendering] +[44:56][Consult our MergeSort() to see how it stores the data][:memory :research :sorting] +[46:08][Try to enable SplitBox() to ping-pong between the buffers][:geometry :lighting :optimisation :rendering] +[1:04:28][Introduce AddBoxReferences()][:geometry :lighting :optimisation :rendering] +[1:07:54][Step through BuildSpatialPartitionForLighting() and SplitBox() to inspect their values][:geometry :lighting :optimisation :rendering :run] +[1:13:35][Make SplitBox() break after splitting][:geometry :lighting :optimisation :rendering] +[1:13:54][Continue to step through SplitBox()][:geometry :lighting :optimisation :rendering :run] +[1:14:36][:Run the game to see our resulting :lighting][:rendering] +[1:16:35][Determine to debug the splitting][:geometry :lighting :optimisation :rendering :speech] +[1:17:38][Delete AddOverlappingBoxes() and read closely through RayCastRecurse()][:geometry :lighting :optimisation :rendering :research] +[1:19:27][Note that RayCastRecurse() is not checking to see if we are inside a bounding box][:geometry :lighting :optimisation :rendering :speech] +[1:20:47][Introduce IsInRectangleCenterHalfDim() to enable RayCastRecurse() to check if we are inside a box][:geometry :lighting :mathematics :optimisation :rendering] +[1:26:06][:Run the game to see that that sort of fixed us][:geometry :lighting :optimisation :rendering] +[1:26:53][Make PlayWorld() create 32 rooms][:"procedural generation"] +[1:27:12][:Run the game to see our more realistic :lighting situation][:rendering] +[1:28:50][Q&A][:speech] +[1:29:21][@jacksonbanan][Q: Do you even like sushi?][:trivia] +[1:30:00][@insobot][89 minutes into the main stream. 31 until Q&A. (based on NOTE)] +[1:31:02][@Brian][Q: This is a generic question, but for an example AddBoxStorage demonstrates this. I see Asserts are used to find exceptions in debug mode. What would be the way to handle a failed Assert in release mode, assuming in release Assert is just stubbed. Is it a case where most if not all problems would be found during testing and not needed to make changes for release?] +[1:33:03][Add a TIMED_FUNCTION() in BuildSpatialPartitionForLighting()][:geometry :optimisation :profiling] +[1:33:32][:Run the game to see the :performance of BuildSpatialPartitionForLighting()][:geometry :optimisation] +[1:34:12][@0b0000000000000][Q: Couldn't you have just used a stack or a queue to do a depth first search or breadth first search? You init the stack with the root box, and then splitting just adds to it, if the stack is empty you're done?] +[1:34:49][@Brian][Q: Will we need to go through each Assert call and eventually add ways to handle failure cases? Or only when we run into an issue down the line and fix those specific failures? I ask because I add Asserts to my code but then wonder what is the proper way to handle failures when I am not building release] +[1:36:06][@dragoonx6][Q: I noticed how you barely have any code / keyword highlighting in your editor. Do you not like that?] +[1:36:32][@jacksonbanan][Q: Do you wish you never started the Sushi game thing to begin with or do you feel like you didn't waste your time and you actually got something out of it?] +[1:37:45][@dragoonx6][Q: Like I have here for example[ref + site=https://puu.sh/yC8CO.png + url=https://puu.sh/yC8CO.png]] +[1:38:20][@jim0_o][Q: Have you thought of making a stream be a recap of your code, kind of looking over it and explaining it to catch people up who can't watch it all?] +[1:39:04][@zennmystic][Q: Started slightly late and the pre-stream went on for longer than usual] +[1:39:40][@bigmofo1][Q: Can you add partition box visualization? Or is that not valuable?][:"debug visualisation"] +[1:40:28][@deadlines_over][How close are you to finishing?] +[1:40:58][@menelaus35][Q: That frame profiler :UI, is that custom made on stream? Looks good][:profiling] +[1:41:06][Show off the profiler][:run :profiling] +[1:43:13][@deadlines_over][Q: What do you think of functional programming[ref + site="Handmade Hero" + page="Annotated Episode Guide" + url=https://hero.handmade.network/episode/code#functional%20programming]] +[1:43:42][Wrap up][:speech] +[/video]