[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Handling Annotation Data During Import" vod_platform=youtube id=YvIS84oVfyw annotator=Miblo] [0:00][Recap and set the stage for the day cleaning up the asset importing][:"asset loading" :speech] [2:55][Continuing thoughts on asset tagging][:"asset loading" :speech] [6:26][:Run the game and consider hhaedit's ability to upgrade .hha files][:"asset loading"] [8:16][Note our desire to get :art into the game][:"asset loading" :run] [9:57][Determine to persist hha_annotation information across runs of the game][:"asset loading" :speech] [14:31][Two solutions to the problem of storing and sharing .hha file information: 1) In a separate file; 2) Directly in the .hha file][:"asset loading" :speech] [16:41][Determine to make the asset loader care about annotations][:"asset loading" :speech] [17:47][Augment the asset struct with an hha_annotation and enable AllocateGameAssets() to read these in from file][:"asset loading" :"file io" :memory] [24:11][Consider how to build the asset_source_file information][:"asset loading" :speech] [30:26][Make AllocateGameAssets() read in our needed annotation information when an .hha file is open for editing, handling the error in which two assets occupy the same slot in a spritesheet][:"asset loading" :"error handling" :"file io"] [44:16][Augment asset_source_file with a FileCheckSum and prepare AllocateGameAssets() to set the lowest FileDate][:"asset loading"] [46:56][Introduce GetOrCreateAssetSourceFile() and StringHashOf()][:"asset loading"] [54:25][Make AllocateGameAssets() call GetOrCreateAssetSourceFile(), and fix up compile errors][:"asset loading"] [56:35][Consider annotation loading done, and set up to write that information back out][:"asset loading" :speech] [57:22][Enable WriteModificationsToHHA() to write our annotations to file][:"asset loading" :"file io"] [1:06:20][Enable ProcessTiledImport() to set the relevant annotation information, augmenting import_grid_tags to contain Name, Description and Author strings][:"asset loading"] [1:19:11][Introduce WriteAssetString()][:"asset loading" :"file io"] [1:23:22][Rename PushString() to PushStringZ() and introduce a new PushString() that pushes an entire null-terminated string][:memory :"string manipulation"] [1:27:02][Checksums][:"asset loading" :hashing :speech] [1:31:57][Introduce CheckSumOf() for CheckForArtChanges() to call and set the FileCheckSum][:"asset loading" :hashing] [1:34:09][Introduce a version of StringHashOf() that takes a string][:"asset loading" :hashing] [1:34:46][Point out the checksum algorithms BLAKE[ref site=Wikipedia page="BLAKE (hash function)" url=https://en.wikipedia.org/wiki/BLAKE_(hash_function)] and SHA-2[ref site=Wikipedia page=SHA-2 url=https://en.wikipedia.org/wiki/SHA-2]][:"asset loading" :hashing :research] [1:37:08][Note in CheckSumOf() to put a full hash function][:"asset loading" :hashing] [1:37:30][:Run the game fine] [1:38:17][Q&A][:speech] [1:38:34][@ablindorphan][Q: How often are assets updated? What are the performance characteristics you're aiming at?][:"asset loading"] [1:40:38][@556i][Q: Would you suggest any resources that cover modern C++ :memory management very well? I tend to overuse unique_ptr] [1:41:31][@gg_nate][Q: You already have an adler32 function written out in the PNG parser, why not use that?][:"asset loading" :hashing] [1:42:19][@Brian][Q: If I wanted to run the game locally, is the steps I need to run the test_asset_build first? And then we could run the hhaedit to update to v1 if we wanted?] [1:42:34][@kanbie][Q: Looking at struct hha_annotation could we append the authors of assets into the credits for the assets in the current run of the game?] [1:42:46][@mmozeiko][Q: Pre-stream off-topic: GL swizzling with GL_TEXTURE_SWIZZLE_R/G/B/A works fine with GL v3.3 and higher. Even for core profile. Before v3.3 it works only if extension is present. So you get whatever channel (R/G/B/A or 0/1 constant) into any channel you want][:hardware :rendering] [1:43:58][@nordicplayer][Q: What are your thoughts on the Rust programming :language?] [1:44:07][@gg_nate][Q: I thought you added it along with the Huffman :compression? They go hand in hand][:"asset loading"] [1:44:45][@mmozeiko][Q: This is in GL core spec][:hardware :rendering] [1:45:10][@wintermute87][Q: Is C++ :memory management bad "for games" or "just bad"? If the latter, what's a good general purpose memory management strategy for C++?] [1:50:03][@ablindorphan][Q: Do you use any of the Handmade code on your 1935 project?] [1:52:08][@bulmanator][Q: Will you be changing your fonts to be packed bitmaps rather than a bitmap per glyph? If not, how would you store the UVs for the glyphs in the HHA file?][:"asset loading" :font] [1:52:50][@Rounin][Q: Have you tried the Opus codec, by the way? Though it might be even more complex than Vorbis][:codec] [1:53:27][@centhusiast][Q: Is it necessary to use pragma pack (push) and pop for the hha structs? Is it okay to use 0 instead of '\\0' for the string null terminator?][:"asset loading"] [1:54:42][@bonqen][Why does Vorbis suck? (Not being skeptical, I just don't know)][:codec] [1:57:04][@mmozeiko][Here's a comparison if somebody is interested[ref site=xiph.org page="Opus 1.2 Released" url=https://people.xiph.org/~jm/opus/opus-1.2/]][:codec] [1:57:31][Thoughts on code complexity of audio decoders][:codec :speech] [2:01:28][@Rounin][Q: 47024 lines and counting][:codec] [2:03:29][We are done for today][:speech] [/video]