[video output=day483 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Debugging Tagged PNG Imports" vod_platform=youtube id=3H4FLqGpTlQ annotator=Miblo]
[0:00][Recap and set the stage for the day][:speech]
[0:40][:Run the game to see our upside-down and blue-toned textures][:"asset system"]
[3:47][The steps in the asset creation, packing, rendering process][:"asset system" :speech]
[5:04][:Run hhaedit on our local.hha to see that we have some UNKNOWN tagging information, and consider adding dumpbmp functionality][:"asset system"]
[7:52][Unify the NameTags and TagNameFromID tables in a newly created handmade_file_formats.cpp][:"asset system"]
[17:06][Introduce TagNameFromID() and TagIDFromName()][:"asset system"]
[22:41][:Run hhaedit -dump on our local.hha to see all the tags filled in][:"asset system"]
[23:15][Rename the block* asset files back into the system and :run the game to see them in there][:admin :"asset system"]
[25:43][View our full local.hha in TabView, to see that these block* assets are not being fully tagged][:"asset system" :run]
[27:56][Add asset_tag_id and NameTags for the blocks, and rename their files using these tags][:"asset system"]
[36:03][Regenerate the asset pack and check it out in TabView][:"asset system" :run]
[37:50][Add asset_tag_id Tags to the entity struct for UpdateAndRenderEntities() to match on][:"asset system" :"entity system"]
[45:46][:Run the game with no special tagging of entities][:"asset system" :"entity system"]
[45:57][Enable GenerateRoom() to tag entities, introducing AddTag()][:"asset system" :"entity system" :"procedural generation"]
[49:38][:Run the game to see that we're not picking the desired textures][:"asset system" :"entity system"]
[50:23][Step in to UpdateAndRenderEntities() and inspect the asset matches][:"asset system" :"entity system" :run]
[54:29][Switch GetBestMatchAssetFrom() to a positive-matching scheme][:"asset system"]
[58:00][:Run the game to see exactly the textures we wanted to see][:"asset system"]
[58:44][Dive into our investigation of the blue-shifted texture issue][:"asset system" :rendering]
[1:05:14][Capture a frame in Nsight and inspect the downloaded textures, to see that the R and B channels are swapped][:"asset system" :rendering :run]
[1:08:32][Scrutinise the texture submission code to see what's happening with the colour channels[ref
    site=W3C
    page="PNG (Portable Network Graphics) Specification"
    url=https://www.w3.org/TR/PNG-DataRep.html]][:"asset system" :rendering]
[1:14:11][Regularise the texture row flipping and colour channel swapping in ExtractImage() for ProcessPlateImport(), ProcessSingleTileImport() and ProcessMultiTileImport() to call][:"asset system" :rendering]
[1:25:09][:Run the game, importing assets afresh to see everything looking correct][:"asset system" :rendering]
[1:27:21][Add StoneFloor boolean in gen_room_spec for CreateOrphanage() to set and test asset picking][:"asset system" :"procedural generation"]
[1:29:47][:Run the game to see stone-floored bedrooms][:"asset system" :"procedural generation"]
[1:30:29][Make GenerateRoom() randomise the texture UV layout][:"asset system" :"procedural generation"]
[1:33:23][:Run the game to see variation on the walls][:"asset system" :"procedural generation"]
[1:33:50][Change GenerateRoom() to randomise floor tiles][:"asset system" :"procedural generation"]
[1:34:02][:Run the game to see randomised floor tile textures and colours][:"asset system" :"procedural generation"]
[1:35:14][Temporarily make GenerateRoom() use the Color not of the textures but our cube geometry][:rendering]
[1:35:28][:Run the game to see the red and green cube colours coming through][:rendering]
[1:35:43][Make GenerateRoom() reduce the texture colour application][:rendering]
[1:36:26][:Run the game to see that we're looking pretty respectable][:rendering]
[1:37:29][Q&A][:speech]
[1:38:10][@kim_jorgensen][Q: Will you update the test_asset_builder to version 1?][:"asset system"]
[1:38:43][@Brian][Q: So was the reason for the blue that the PNG parser was swapping B and R when we did not need to?][:"asset system"]
[1:39:38][@tethyss_][Q: Will you write any unit tests to QA yourself?]
[1:42:40][@rationalcoder][Q: I've never streamed, so I'm not sure what's going on, but why are [@naysayer88 Jon]'s streams left in the videos tab, and yours aren't? I ask because I wanted to see yesterday's stream, but it isn't on YouTube yet]
[1:42:55][@rooctag][Q: Will you tile the fonts as well then?][:"asset system" :font]
[1:43:56][Wrap it up with a glimpse into the future of :"game design"][:speech]
[/video]
