[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Debugging HHT to HHA Packing" vod_platform=youtube id=SWdM5MdSCbc annotator=Miblo] [0:01][Meow the Infinite[ref site="Meow the Infinite" url=https://meowtheinfinite.com/]][:research] [1:52][Recap and set the stage for the day debugging HHT to HHA packing][:"asset system" :speech] [6:14][Plan to delete and rebuild our current .hha file][:"asset system" :run] [7:48][Continue to plan our .hha deletion and rebuild][:"asset system" :speech] [10:48][Create handmade_import.cpp and .h to house the non-runtime :"asset system" code] [16:17][Make AllocateGameAsssets() call ImportChangedAssets() just before returning][:"asset system"] [19:22][Delete base_game.hha and step in to ImportChangedAssets()][:admin :"asset system"] [20:03][On Visual Studio's incorrect display of #if blocks][:speech :ui] [20:56][Step through ImportChangedAssets()][:"asset system" :parsing :run] [22:05][Fix the Author settings in cutscene.hht[ref site=GitHub page="HandmadeHero / cpp / Authors swapped in cutscene.hht" url=https://github.com/HandmadeHero/cpp/issues/87]][:admin :"asset system"] [24:02][Continue to step through ImportChangedAssets() to ParseHHT() until we detect an error][:"asset system" :parsing :run] [25:33][Change cutscene.hht to use our #hha directive][:admin :"asset system"] [26:02][Continue to step through ParseHHT(), until we spot a bug exhibited in InitSourceHHA()][:"asset system" :parsing :run] [28:54][Make GetOrCreateHHAByStem() refresh the file info after creating a new .hha, to get its correct file size][:"asset system" :"file io"] [29:57][Delete intro_cutscene.hha and successfully step through ImportChangedAssets() to CopyAllInputUpToAndIncluding()][:"asset system" :parsing :run] [32:37][Comment out the unimplemented CopyAllInputUpToAndIncluding()][:"asset system" :parsing] [32:49][Continue to step through ImportChangedAssets() after the CopyAllInputUpToAndIncluding() call][:"asset system" :parsing :run] [35:10][Fix the .hha directory Path in ParseTopLevelBlock()][:"asset system" :parsing] [35:44][Continue to step through ParseTopLevelBlock()][:"asset system" :parsing :run] [39:41][Fix ParseTagList() to check the next token after pulling off the closing parenthesis][:"asset system" :parsing] [40:35][Continue to step through ParseTagList()][:"asset system" :parsing :run] [41:55][Make StampAssets() pass the Tags.TypeID to EndTags() and prevent the latter from calling AddTag() if passed an Asset_None][:"asset system" :parsing] [43:51][Continue to step through ParseTagList() to find that we parsed the correct number of tags][:"asset system" :parsing :run] [45:03][Just insert the missing semicolons in intro_cutscene.hht][:admin :"asset system"] [46:46][Continue to step carefully through ParseTopLevelBlock()][:"asset system" :parsing :run] [48:28][Make PeekToken() pass the duplicated Temp tokenizer to GetToken()][:"asset system" :parsing] [49:02][Continue to step through ParseTopLevelBlock()][:"asset system" :parsing :run] [50:08][Fix ParseTagList() to use PeekToken() rather than GetToken() wherever we operate conditionally on tokens][:"asset system" :parsing] [51:44][Continue to step through ParseTopLevelBlock()][:"asset system" :parsing :run] [54:03][Respecify StampAssets() as UpdateAssetMetadata() which itself determines if the metadata tags differ, changing ParseTopLevelBlock() to call it always][:"asset system" :parsing] [1:06:53][Introduce GetTagCount() and TagsAreEqual(), and fix compile errors][:"asset system" :parsing] [1:14:11][Delete intro_cutscene.hha and step through UpdateAssetMetadata()][:"asset system" :parsing :run] [1:16:04][Make ParsePieces() tag plates as Asset_Plate][:"asset system" :parsing] [1:17:24][Continue to step through UpdateAssetMetadata() until the image extraction phase][:"asset system" :parsing :run] [1:21:47][Make UpdateAssetMetadata() mark the file as Modified if the tags differ][:"asset system" :parsing] [1:24:00][Hit an error while importing base_game.hht][:"asset system" :parsing :run] [1:25:52][Comment out the item and obstacles and cover settings in base_game.hht][:admin :"asset system"] [1:26:40][Find that our generated intro_cutscene.hha file is empty][:admin :"asset system"] [1:27:36][Introduce WriteModificationsToAllHHAs() for ImportChangedAssets() to call][:"asset system" :parsing] [1:30:45][Delete and regenerate base_game.hha and intro_cutscene.hha][:"asset system" :parsing :run] [1:32:16][Find that the hero's head is missing, but the intro cutscene displays okay][:"asset system" :parsing :run] [1:34:09][Move intro_art_v2.hha to a new directory, and find that the intro cutscene now fails to display][:"asset system" :parsing :run] [1:35:22][Check out our intro_cutscene.hha in TabView][:admin :"asset system"] [1:38:16][Add an -extract command to hhaedit][:"asset system"] [1:45:04][Copy WriteImageTopDownRGBA() and bitmap_header into hhaedit.cpp and introduce ExtractBitmapAsset()][:"asset system"] [1:53:07][Try to extract test1_v2.hha with partial success][:"asset system" :run] [1:54:13][Comb through WriteImageTopDownRGBA() for any clear bugs][:"asset system" :research] [1:56:43][Step through an extract of test1_v2.hha][:"asset system" :run] [1:59:00][Remove the colour Mask values from hhaedit's bitmap_header][:"asset system"] [1:59:46][Try again to extract test1_v2.hha with full success][:"asset system" :run] [2:00:18][Extract intro_cutscene.hha to see that all is correct][:admin :"asset system"] [2:01:11][Q&A][:speech] [2:02:19][@wheeel][Q: What's your first major gameplay programming topic going to be?] [2:02:52][@centhusiast][Q: Do you use string :library from CRT? I though we wrote our own version?][:"string manipulation"] [2:03:27][@letambourinroyal][Q: Have you every programmed non-blocking TCP sockets? I wonder what is the cost of directly calling recv() / send() vs select()][:ipc] [2:05:14][@uplinkcoder][Q: Could you improve the assert macro such that it prints the stringized expression which failed? On Linux the debugger does not always show which assert failed where] [2:06:20][@centhusiast][Q: What is your thought on the structure of config files in Windows (.ini files) that have sections in the close brackets? Do you think it is a good structure for the game config file?][:"file format"] [2:06:50][@s0imn][Q: How would you implement immediate mode-esque functionality for :rendering anti-aliased polygons? I am currently rendering n-gons with a geometry shader, but I am unable to implement anti-aliasing] [2:10:34][@wheeel][Q: When trying to manage entities in my own game engine / game (just me on my own), do you think the Entity-Component structure is worth considering, or am I just giving myself too much work when it's just my own code?][:"data structure" :"entity system"] [2:14:09][@naysayer88][I am here as the ambassador of DON'T BOTHER WITH COMPONENT SYSTEMS][:"data structure" :"entity system"] [2:14:45][@toideng][Q: What should I choose: Xlib or XCB?][:api] [2:15:08][@naysayer88][@handmade_hero Yeah, I haven't thought in a while to explain the "walling yourself in" thing, but that is 100% true. It's like playing Go... when you build a strategic structure, you are also filling the board and ruling out possibilities for yourself][:"data structure" :"entity system"] [2:17:07][@devsigner][Q: I've been writing my own game / render loop but I've been having trouble getting the loop :timing to be constant. I seem to get a stutter or skip in motion, but it's not because the render procedure takes too long. Any ideas on what could be the issue? Sorry, I know it's not much to go on, but any ideas would be helpful[ref site=Twitter page="Alen Ladavac" url=https://twitter.com/AlenL]] [2:22:07][@ideas_guy][lada-vatz] [2:22:35][Call it a day with a plug of Meow the Infinite[ref site="Meow the Infinite" url=https://meowtheinfinite.com/]][:speech] [/video]