[video output=day488 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Adding an In-Game Editor" vod_platform=youtube id=fDSVYJMXnIQ annotator=Miblo]
[0:02][Recap and set the stage for the day implementing asset editing features][:"asset system" :speech]
[2:00][:Run the game to see our currently misaligned and scaled cat][:"asset system"]
[3:33][Set up to implement asset editing, comparing our procedurally generated situation with the hand-designed situation of a game like Braid][:"asset system" :"procedural generation" :speech]
[8:13][Set up to make our asset editing capabilities at the level above our game's modes – title screen, cutscene, world – also available in the shipping game as was the editor in Braid's PC release][:"asset system" :speech]
[11:15][Introduce in_game_editor and related structs in a newly created handmade_in_game_editor.cpp][:"asset system"]
[18:21][A few words on passing to a function its minimum necessary set of parameters][:language :rant :speech]
[20:15][Change UpdateAndRenderEntities() to take a new editable_hit_test instead of the entire game_input][:"asset system" :"entity system"]
[31:08][Introduce AddHit()][:"asset system" :"entity system"]
[38:26][Introduce BeginHitTest(), EndHitTest() and ShouldHitTest()][:"asset system" :"entity system"]
[45:23][Make GameUpdateAndRender(), UpdateAndRenderWorld() and DoWorldSim() use our new asset editing functionality][:"asset system" :"entity system"]
[49:58][:Run the game to find that entities with asset index 0 (white bitmap) are already highlit][:"asset system" :"entity system"]
[50:28][Make UpdateAndRenderEntities() only highlight entities whose BitmapID equals the HighlightAssetIndex][:"asset system" :"entity system"]
[50:57][:Run the game to see that the white bitmaps are no longer highlit][:"asset system" :"entity system"]
[51:05][Finish implementing AddHit() to append hits][:"asset system" :"entity system"]
[52:48][:Run the game to find that our highlighting works, and consider printing asset information in-game][:"asset system" :"entity system"]
[55:26][Introduce the notion of an in_game_editor_mode][:"asset system" :"entity system"]
[58:17][:Run the game to find that our editor does not pick entities][:"asset system" :"entity system"]
[58:31][Enable BeginHitTest() to toggle the editor mode][:"asset system" :"entity system" :"input handling"]
[1:00:12][:Run the game and toggle our editor mode][:"asset system" :"entity system" :"input handling"]
[1:00:36][Flesh out our editor modes, introducing UpdateAndRenderEditor() to print asset information][:"asset system" :"entity system"]
[1:04:51][Refresh our memories on PushFont() and consider rolling the fonts into the main :"asset system"][:font :speech]
[1:08:01][Continue to implement UpdateAndRenderEditor()][:"asset system" :"entity system"]
[1:11:34][:Run the game to find that the picking still works][:"asset system" :"entity system"]
[1:11:51][Consider separating out the layout code from the :"debug system" for use in a non-debug (i.e. profiling) context][:speech :ui]
[1:18:32][Introduce AssetEditor() based on PrintContents()][:"asset system" :ui]
[1:53:04][See how AssetEditor() would shake out if it was FormatString()-centric][:"asset system" :ui]
[1:58:16][Decide on the original, function-heavy approach for AssetEditor(), to write tomorrow][:"asset system" :ui]
[1:59:25][Q&A][:speech]
[2:00:12][@zrizi][Q: Off-topic: How do you index large meshes (index needs more than 16-bit)? Would you divide into multiple chunks (and have more draw calls) or increase bandwidth by using 32-bit for indices? Which approach is better for large meshes?][:rendering]
[2:00:58][@jim0_o][Q: @SIMPalaxy asked earlier if you have changed your ~4coder custom since you handed it over to [@mr4thdimention Allen], so now I'm wondering the same]
[2:01:33][@bulmanator][Q: Not really on-topic, but how would you go about implementing a generic resizable array, as you said you don't like to use templates?][:language]
[2:02:15][Example of C++'s offering for implementing generic resizable arrays][:language :rant :speech]
[2:13:02][@zrizi][Q: Off-topic (pre-multiplied alpha): I watched the episodes in which you presented it and I remember you mentioned that you prefer to defer multiplying by alpha "at the end". Can you explain what this means? Also, what's the benefit of pre-multiplied alpha, other than the fact that it's now a linear operation (if that's the case)? I can only see the value if you're compositing multiple transparent / translucent layers][:rendering]
[2:15:38][@alchemist_ubi][Are you forced to use templates? I don't code in C++ but the :language does not force you to do it, right?]
[2:16:35][@pythno][Q: Is the asset tool fixed? From Day 470 I wasn't able to build some of the tools (commented out in build.bat) for asset file creation][:"asset system"]
[2:17:27][That's it for today][:speech]
[/video]
