cinera_handmade.network/cmuratori/hero/code/code487.hmml

58 lines
7.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Hit-Testing Boxes in 3D" vod_platform=youtube id=g6lM0xhcTX0 annotator=Miblo]
[0:01][Recap and set the stage for the day][:speech]
[0:30][:Run the game and point out the discombobulation of the cat artwork][:"asset system"]
[1:33][View the intro_art_v2.hha file in TabView][:admin :"asset system"]
[2:34][The three things to do: 1. Use the alignment points; 2a. Get alignment data into our metadata file; 2b. Edit results in real time][:"asset system" :speech]
[5:42][Set up to provide a way to edit placement points][:"asset system" :run]
[7:27][Consider reconceptualising the :"debug system" as an integral part of the shipped game][:run]
[9:19][Set up to integrate the entity picking code into the game][:"entity system" :ui]
[12:47][Begin to enable UpdateAndRenderEntities() to handle picking of all sprites][:"debug visualisation" :"entity system"]
[14:19][:Run the game to see our sprite :"debug visualisation"][:"entity system"]
[14:48][Change UpdateAndRenderEntities() to use PushRectOutline() for the sprite :"debug visualisation"][:"entity system"]
[16:27][:Run the game to see the more sensible, if incorrectly scaled sprite :"debug visualisation"][:"entity system"]
[17:00][Remove the EntityTransform.OffsetP addition from the WorldP computation in UpdateAndRenderEntities()][:"debug visualisation" :"entity system"]
[18:26][:Run the game to see the better positioned sprite :"debug visualisation"][:"entity system"]
[18:49][Adjust the dimensions of the sprite :"debug visualisation"][:"entity system"]
[20:12][:Run the game to see the cat's sprites correctly visualised][:"debug visualisation" :"entity system"]
[20:47][Create a sprite-picking mouse cursor in UpdateAndRenderEntities()][:"entity system" :"input handling" :ui]
[32:30][:Run the game to find that the sprite-picking mouse cursor sort of works][:"entity system" :"input handling" :ui]
[33:05][Decouple the use of WorldP and Piece->Offset in UpdateAndRenderEntities() to correctly locate entities and render their :"debug visualisation"][:"entity system" :"input handling" :ui]
[35:22][:Run the game to find that the sprite-picking is pretty close, but that the Y is wrong][:"entity system" :"input handling" :ui]
[36:42][Enable UpdateAndRenderEntities() to draw a line connecting the cursor and the picked entity][:"entity system" :"input handling" :ui]
[40:10][:Run the game to see our cursorentity connection, but with incorrect projection to the entity][:"entity system" :"input handling" :ui]
[42:03][Create a picking ray in UpdateAndRenderEntities()][:"debug visualisation" :"entity system" :"input handling" :ui]
[49:59][:Run the game to find that the picking ray is pegged to the correct location][:"debug visualisation" :"entity system" :"input handling" :ui]
[50:22][Enable UpdateAndRenderEntities() to draw and highlight the outline of picking boxes using PushVolumeOutline()][:"debug visualisation" :"entity system" :"input handling" :ui]
[54:34][:Run the game to see outlines around all volumes][:"debug visualisation" :"entity system" :"input handling" :ui]
[54:48][Introduce RayIntersectsBox() based on RayCast()][:geometry]
[1:02:57][:Run the game to find that the picking is working][:"debug visualisation" :"entity system" :geometry :"input handling" :ui]
[1:03:20][Enable RayIntersectsBox() and UpdateAndRenderEntities() to highlight only the nearest intersection][:"debug visualisation" :"entity system" :geometry :"input handling" :ui]
[1:07:33][:Run the game to find that it only picks the closest hit][:"debug visualisation" :"entity system" :geometry :"input handling" :ui]
[1:07:54][Enable UpdateAndRenderEntities() to support sprite picking][:"debug visualisation" :"entity system" :"input handling" :ui]
[1:09:38][:Run the game to find that sprites may be picked, and consider how to proceed, including the problem of disambiguating layered (transparent) sprites][:"debug visualisation" :"entity system" :"input handling" :ui]
[1:14:43][@insobot][16 minutes into the Q&A, -1 until end. (based on NOTE)]
[1:15:57][Look forward to further improving the :lighting][:run]
[1:17:09][Consider displaying errors recorded for a picked bitmap][:"asset system" :"entity system" :speech :ui]
[1:22:22][Augment hha_annotation with an error stream and propagate this addition to WriteHHA_V2() and PrintContents()][:"asset system" :"error handling" :parsing]
[1:32:12][Check out local.hha in TabView to see no mention of error streams][:admin :"asset system" :"error handling" :parsing]
[1:33:04][Consider where to write asset import error messages][:"asset system" :"error handling" :speech]
[1:36:51][Enable WriteImageToHHA() to write out asset and file errors, introducing WriteAssetStream()][:"asset system" :"error handling" :"file io"]
[1:46:00][Trigger an asset reimport and check out local.hha in TabView to see the Errors field, but with no content][:admin :"asset system" :"error handling"]
[1:47:21][Fix typo in PrintContents()][:"asset system" :"error handling" :parsing]
[1:47:33][Trigger another asset import and see errors, with slightly incorrect printout][:admin :"asset system" :"error handling" :parsing]
[1:48:17][Fix PrintContents() to correctly parse out the errors][:"asset system" :"error handling" :parsing]
[1:50:02][Reimport and check out local.hha in TabView to see that all is correct][:admin :"asset system" :"error handling" :parsing]
[1:50:23][Add newlines to the asset and file error messages][:"asset system" :"error handling"]
[1:51:19][Reimport and check out local.hha in TabView to cleanly see our errors][:admin :"asset system" :"error handling"]
[1:52:25][Q&A][:speech]
[1:53:12][@desuused][Q: Is it possible to account for sprite opacity when selecting items, for the selection to be more intuitive? Is it useful to generate a more slim triangulation for sprites?][:"debug visualisation" :"entity system" :"input handling" :ui]
[1:55:36][@frostyninja][Q: Instead of fussing with selecting the individual sprite parts, wouldn't it be handier to list them in a picked entity HUD][:"debug visualisation" :"entity system" :"input handling" :ui]
[1:55:50][@somebody_took_my_name][Q: Is the .Count inclusive with strings? In other words, do you really need the nested ifs in the line printer?][:parsing]
[1:56:08][@desuused][Q: You spent a lot of time optimizing the hash function, but is it worth it? Most of the time you calculate hashes when doing I/O, which will always be significantly slower, so you'll save more time if you calculate the hash in parallel with I/O. This way MeowHash and SHA512 would have the same impact on runtime, despite MeowHash being 80 times faster][:"file io" :hashing :performance]
[2:00:26][@somebody_took_my_name][Q: You check for At == Count, but I should think that by then you would already be past the last character in the stream][:parsing]
[2:01:20][Simplify the error printing in PrintContents()][:parsing]
[2:01:52][Check out local.hha in TabView to find that the error printing remains correct][:admin :parsing]
[2:02:57][:Hashing :performance, in terms of (not) being :memory or I/O bound][:"file io" :speech]
[2:09:14][Wrap it up][:speech]
[/video]