[video output=day224 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Prefetching Cutscene Layers" vod_platform=youtube id=C4Il0g8vtg0 annotator=Miblo]
[1:24][Recap, run the game and point out an objectionable artifact]
[3:14][Debugger: Step into RenderCutScene and note the unset State of the Asset]
[6:12][handmade.cpp: Play the cutscene back at an artificially fast rate]
[6:49][handmade_cutscene.cpp: Introduce RenderCutsceneAtTime]
[9:25][handmade_cutscene.cpp: Do an additional RenderCutsceneAtTime in RenderCutscene, passing 0 as the RenderGroup in order to do a PrefetchBitmap]
[11:49][Run the cutscene and see how it works]
[12:24][@cmuratori][Do you guys know why there's \[a glitch\] on the beginning one?]
[13:23][handmade_cutscene.cpp: Create an initial black Shot lasting 20 (artificially accelerated) seconds]
[14:20]["n{un,one}?"][quote 340]
[15:28][Run the cutscene and see the delay]
[16:17][handmade.cpp: Play the cutscene back at the natural rate]
[17:20][win32_handmade.cpp: ToggleFullscreen on and watch the result]
[18:24][handmade_cutscene.cpp: #define CUTSCENE_WARMUP_SECONDS]
[18:55][win32_handmade.cpp: Issue a Clear if the LayerCount == 0]
[20:11][win32_handmade.cpp: Figure out why the flicker is happening]
[21:25][Internet: VirtualAlloc[ref
    site=MSDN
    page="VirtualAlloc function"
    url=https://msdn.microsoft.com/en-us/library/windows/desktop/aa366887]]
[23:12][Debugger: Step into Win32ResizeDIBSection and inspect Buffer->Memory]
[23:50][Internet: GetStockObject function[ref
    site=MSDN
    page="GetStockObject function"
    url=https://msdn.microsoft.com/en-us/library/windows/desktop/dd144925]]
[25:57][win32_handmade.cpp: Draw the window background with GetStockObject(BLACK_BRUSH)]
[26:12][Run the cut scene and see that the startup experience is pretty nice]
[26:43][win32_handmade.cpp: Create the window without it being visible]
[27:39][Consider possible directions]
[30:08][handmade.cpp: Toggle back to the game and illustrate the concept of the game getting started]
[32:21][handmade.h: Provide the ability to switch between the cutscene and the game]
[33:29][Run the game, join it and note the need to prefetch the game assets]
[34:34][handmade.cpp: Introduce DeleteLowEntity to be called upon pressing Esc]
[38:08][Run the game and try killing the hero]
[38:46][handmade.cpp and handmade_platform.h: Provide the ability to exit the game]
[42:18][Run the game and try exiting it]
[42:35][handmade.cpp: Check to see if the Esc key WasPressed]
[43:44][Run the game and test the exiting]
[43:59][handmade_cutscene.h: Introduce struct playing_cutscene to formalise what the cutscene is doing]
[45:42][handmade_cutscene.cpp: Introduce MakeIntroCutscene]
[47:17][handmade_cutscene.cpp: Pass in the CutScene to RenderCutscene]
[49:21][handmade.h: Initialise CurrentCutscene]
[50:56][handmade_cutscene.cpp: Note that the cutscene will no longer be hot reloadable]
[51:59][handmade_cutscene.cpp: AdvanceCutscene to allow multiple cutscenes]
[52:29][Run the game, test our new functionality and consider making the cutscenes reset]
[54:40][Q&A][:speech]
[55:17][@insofaras][Would adding a BlockUntilLoaded style function be a good idea to make sure even slower computers have all layers loaded before the scene starts?]
[55:54][handmade_cutscene.cpp: Turn off the prefetches]
[57:07][handmade.cpp: Check for AllResourcesPresent before doing TiledRenderGroupToOutput]
[58:48][@cubercaleb][Isn't there a way to clear the back buffer using SIMD?]
[59:21][@ijustwantfood][Will there be any animated cutscenes or just zooming shots?]
[59:39][@Fyoucon][Can you do a cloc?]
[1:00:05][@Miblo][Would it be possible to fade from the desktop to the game's initial black screen? Failing that, I think it'd be cool if we fade into the cut scene from the black, and then back to black when we quit the game]
[1:01:42][win32_handmade.cpp: Introduce FadeOut]
[1:04:30][Internet: UpdateLayeredWindow[ref
    site=MSDN
    page="UpdateLayeredWindow function"
    url=https://msdn.microsoft.com/en-us/library/windows/desktop/ms633556]]
[1:16:55][Shut it down][:speech]
[/video]
