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

51 lines
4.0 KiB
Plaintext

[video output=day082 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Caching Composited Bitmaps" vod_platform=youtube id=09bUpNbRzzc annotator=Miblo]
[0:41][Let's take a look at where things were]
[2:12][Toggle off the debug boundaries]
[2:49][Two things to look at: 1) Speeding up the texture splats and 2) Multiple layers]
[4:16][How to make the random number generation more systemic]
[10:17][Introduce random_series which takes a seed]
[13:03][RandomUnilateral (0 - 1) and RandomBilateral (-1 - 1)]
[14:35][Blackboard: Brief recap of yesterday's maths class]
[15:18][Introduce RandomBetween]
[16:38][Pass RandomChoice to the Stamp picker]
[17:17][Make Seed function]
[18:23][Implement the rest of the random number generation]
[22:25][(Re)introduce Lerp]
[24:48][Blackboard: Lerp or Linear blend]
[26:48][Stick it in handmade_math.h and use it?]
[27:53][Finish propagating RandomChoice]
[31:17][Make a RandomBetween for use in integer space]
[33:45][Find the Familiar]
[36:34][Fix the FamiliarOffset range]
[39:26][We've taken care of everything regarding the random number table]
[40:08][Next: Try doing a pre-composite]
[41:09][Look at how game_offscreen_buffer used to work]
[41:54][Condense game_offscreen_buffer and loaded_bitmap down to one thing]
[45:47][Set the Pitch and Pixel pointer from the Bitmap]
[48:37][A small correction, and viewing the results]
[49:12][Change DrawBitmap to take loaded_bitmap *Buffer, and change *Pixels to *Memory in loaded_bitmap]
[50:02][Remove BytesPerPixel from game_offscreen_buffer]
[51:10][Make everything take the data from loaded_bitmap]
[52:53][Implement a GroundBuffer cache]
[56:00][Implement MakeEmptyBitmap]
[1:00:22][Set the alpha channel of the composited bitmap]
[1:04:45][Recap today's work]
[1:06:14][Q&A][:speech]
[1:07:02][Q: Casey, I missed the earlier part of the feed, but what was the intention of moving the ground plane with the player?]
[1:07:37][Q: Why aren't RandomUnilateral and RandomBilateral not just using the implementation of RandomBetween? Seems like a pretty clear violation of DRY, although I realise you aren't currently intending for this code to be extremely clean right now]
[1:11:19][Someone wants a cloc count]
[1:12:11][Q: Why does the Seed function not have a prefix or suffix Random?]
[1:13:54][Q: Is it okay that RandomChoice doesn't select the random value uniformly? \[...\]]
[1:15:22][Q: Wouldn't RandomChoice have a slightly uneven distribution if the number of choices didn't evenly divide the maximum random number?]
[1:17:19][Q: When is it okay to pass larger objects like r3's by value instead of by reference?]
[1:22:01][Q: Casey, just curious because the background tiles are static at the moment...]
[1:22:28][Q: Do you see yourself extending RandomNumber to have anything other than a uniform distribution?]
[1:23:22][Q: Is this strictly handled in RAM? Do you have plans to use GPU resources for rendering?]
[1:24:06][Q: I notice in functions you will always use a Result variable even if the calculation is a one-liner, rather than using the expression directly in a return statement. Does this incur an extra copy and are there performance implications?]
[1:25:06][Q: Do you plan to move all the other loaded_bitmap memory to be in a memory_arena as well?]
[1:25:37][Q: I think you've used an aggregate initialiser in one place with random_series being seeded, i.e. you only have one call to RandomSeed but you have at least...]
[1:26:53][Q: Initially, you put BytesPerPixel into the bitmap structure because it can be useful. Then I asked you to remove it because it never changes, and you did that. But ten or so episodes later you added it back because it would be useful. And now you're removing it again. This is funny]
[1:27:45][Q: You fix Random to be uniform by generating a full 32bit random number, do mod next power of 2 choice count, then check if result is less than choice count. If not, repeat the whole process]
[1:28:18][The end of another full-power episode of Handmade Hero, which was dedicated to Abner Coimbre][:speech]
[/video]