From 8936accacb9fb2a77c861fa81d709fff72d4074d Mon Sep 17 00:00:00 2001 From: Matt Mascarenhas Date: Wed, 9 May 2018 18:45:09 +0100 Subject: [PATCH] Annotate hero/code447 hero/code446: Add quote 614 --- cmuratori/hero/code/code446.hmml | 3 ++ cmuratori/hero/code/code447.hmml | 76 ++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 cmuratori/hero/code/code447.hmml diff --git a/cmuratori/hero/code/code446.hmml b/cmuratori/hero/code/code446.hmml index a74c32f..0d3cfaa 100644 --- a/cmuratori/hero/code/code446.hmml +++ b/cmuratori/hero/code/code446.hmml @@ -25,6 +25,8 @@ url=https://en.wikipedia.org/wiki/Metropolis%E2%80%93Hastings_algorithm]][:research :statistics] [1:25:28][The problem of stably iterating over multiple, changeable brute force possibilities][:speech] [1:26:42][Enable Layout() to unionise our rooms, clipping that union to the largest spaces to accommodate a connecting room and placing a room there using PlaceRoom()][:geometry :"procedural generation"] +[1:28:34][][:geometry :"procedural generation" :speech][quote 614] +[1:28:46][Enable Layout() to expand the volume by an apron][:geometry :"procedural generation"] [1:39:22][Minimum / maximum bounding rectangle room requirements to satisfy connections][:blackboard :geometry :"procedural generation"] [1:43:23][Remove the union gathering phase from Layout(), in favour of room clipping based on the dimensions stored in gen_volume, introducing IsMinimumDimensionsForRoom()][:geometry :"procedural generation"] [1:57:44][Constraining our possible room placements][:blackboard :geometry :"procedural generation"] @@ -41,3 +43,4 @@ [2:41:42][@bigmofo1][Q: Why you did not place important rooms randomly, then generate more rooms to join them? This seems more efficient than generating all the rooms upfront before placing them][:"procedural generation"] [2:44:45][Wrap it up][:speech] [/video] + diff --git a/cmuratori/hero/code/code447.hmml b/cmuratori/hero/code/code447.hmml new file mode 100644 index 0000000..5c5054b --- /dev/null +++ b/cmuratori/hero/code/code447.hmml @@ -0,0 +1,76 @@ +[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Placing Adjacent Rooms" vod_platform=youtube id=afCSha34Hg0 annotator=Miblo] +[0:00][Recap and set the stage for the day continuing on :"procedural generation" of level layout][:speech] +[1:47][#if 1 our half-written layout code from yesterday, and implement PushRoom() and PopRoom()][:memory :"procedural generation"] +[12:36][Fix up typos in PlaceRoom() and implement CanBeDirection() and HasEntries()][:"procedural generation"] +[16:32][Create handmade_box.h to contain a new box_surface_mask as a generalised box directional mask based on the existing GetBoxSurface() from the :lighting system, for CanBeDirection() also to use][:"procedural generation" :rendering] +[35:09][Enable Connect() and CanBeDirection() to use the box_surface_mask to connect rooms][:"graph topology" :"procedural generation"] +[39:37][Introduce GetBoxMaskComplement()][:geometry] +[44:04][Rename CanBeDirection() to CouldGoDirection(), and make it flip the incoming mask using GetBoxMaskComplement() if it isn't the mask of Connection->B][:geometry :"graph topology" :"procedural generation"] +[46:50][Introduce PlaceRoomInVolume() for Layout() to call, in order to special-case the placement of the first room][:"graph topology" :"procedural generation"] +[52:10][Augment gen_room with a RoomName string to aid debugging, and #define two versions of GenRoom() for release and debug builds] +[56:04][Step through Layout() to see that the Stack wasn't correctly built][:"graph topology" :"procedural generation" :run] +[57:22][Fix PushConnectedRooms() to push the correct room][:"graph topology" :"procedural generation"] +[57:48][Step back into Layout() to see what happens][:"graph topology" :"procedural generation" :run] +[1:02:25][Introduce GetSurfaceMask() for CouldGoDirection() to call][:geometry] +[1:03:45][Jump back into CouldGoDirection() and through PlaceRoom()][:"graph topology" :"procedural generation" :run] +[1:04:51][Fix PlaceRoom() to clip the rooms to the correct dimensions][:geometry :"procedural generation"] +[1:06:49][Continue to step through PlaceRoom() to see how it works][:geometry :"graph topology" :"procedural generation" :run] +[1:08:48][Make Layout() set the FirstRoom to one unit high][:geometry :"procedural generation"] +[1:09:16][Continue to step through PlaceRoom() into IsMinimumDimensionsForRoom(), to see that it may overflow][:geometry :"graph topology" :"procedural generation" :run] +[1:11:06][Make InfinityVolume() produce a smaller volume to avoid overflowing signed int, and IsMinimumDimensionsForRoom() compute the dimensions individually for ease of inspection][:geometry :"procedural generation"] +[1:12:25][Step in to IsMinimumDimensionsForRoom() and inspect its values to consider that PlaceRoom() may be clipping the room incorrectly][:geometry :"procedural generation" :run] +[1:16:23][Make InfinityVolume() cast its computed min dimensions to signed integers][:geometry] +[1:17:00][Step into InfinityVolume() to see that the Min dimensions now correctly remain negative][:geometry :run] +[1:17:05][Force S32Min and S32Max to be signed integers][:language] +[1:17:41][Continue to step through PlaceRoom()][:"graph topology" :"procedural generation" :run] +[1:18:16][Enable PlaceRoom() to keep chaining up rooms for every room connection][:"graph topology" :"procedural generation"] +[1:20:20][Continue to step through PlaceRoom() to see that the room clipping is incorrect][:geometry :"procedural generation" :run] +[1:22:29][Make PlaceRoom() more correctly clip and handle rooms that cannot be placed, introducing InvertedInfinityVolume()][:geometry :"procedural generation"] +[1:29:27][Step into PlaceRoom() to see that MinVol.MaxZ may be off by 1][:geometry :"procedural generation" :run] +[1:36:56][Make PlaceRoom() consistently clip the new room's Min and Max dimensions such that it exactly abuts the other room or the interior apron, introducing ClipMin() and ClipMax()][:geometry :"procedural generation"] +[2:02:13][Overlapping rooms][:blackboard :geometry] +[2:05:28][Continue to make PlaceRoom() correctly clip to the interior apron][:geometry :"procedural generation"] +[2:08:11][Step into PlaceRoom() to see what it produces][:geometry :"procedural generation" :run] +[2:09:03][Prevent PlaceRoom() from expanding the InteriorApron in Z][:geometry :"procedural generation"] +[2:09:15][Step back into PlaceRoom() to see that the dimensions are looking more sane][:geometry :"procedural generation" :run] +[2:10:34][Make PlaceRoom() offset both the other dimensions only by the interior apron (i.e. without a further +/- 1 offset)][:geometry :"procedural generation"] +[2:14:35][Step in to PlaceRoom() to determine that the clipping should actually be asymmetric][:geometry :"procedural generation" :run] +[2:14:59][Make PlaceRoom() offset the other max dimension by 1][:geometry :"procedural generation"] +[2:15:10][Step in to PlaceRoom() to determine that this room is correctly placed][:geometry :"procedural generation" :run] +[2:15:43][Take a look at our world][:geometry :"procedural generation" :run] +[2:16:12][Simplify CreateOrphanage() to only create two adjoining rooms][:"procedural generation"] +[2:17:56][Step through Layout() to see how it places our two rooms][:"procedural generation" :run] +[2:20:18][Make PlaceRoom() leave the loops][:"procedural generation"] +[2:21:42][:Run the game to see our two placed rooms][:"procedural generation" :run] +[2:22:37][Fix PlaceRoom() to exactly abut the rooms][:"procedural generation"] +[2:24:35][:Run the game to see that the rooms abut][:"procedural generation"] +[2:24:47][Increase the InteriorApron in PlaceRoom()][:"procedural generation"] +[2:24:54][Check out our room abutment with more space][:"procedural generation" :run] +[2:25:05][Reduce the maximum room size][:"procedural generation"] +[2:25:17][Check out the smaller rooms][:"procedural generation" :run] +[2:26:38][Enable PlaceRoom() to knock out the entire abutment of adjoining rooms, introducing Union() and Intersect()][:"procedural generation"] +[2:34:53][:Run the game to see that we knocked it out backwards][:"procedural generation"] +[2:35:14][Fix PlaceRoom() to correctly position the door][:"procedural generation"] +[2:35:45][:Run the game and traverse between the rooms][:"procedural generation"] +[2:36:44][Q&A][:speech] +[2:38:17][@drzool][Q: Would nomenclature like: Low / High / Width be helpful?] +[2:38:36][@nxsy][Q: Would using a range of low values and a range of high values for dimensions be easier than having two volumes?][:geometry] +[2:38:54][@floorislava][Q: Why are you appending 'x' to some of the types?] +[2:40:15][@vkar2][Q: Didn't you want to avoid recursion?] +[2:41:46][@qwindoo][Q: Could the hero walk outside the rooms in this setup (in the gray / void zone)?][:movement] +[2:42:50][@nxsy][Q: Low can be between -30 and 5, and high can be between -4 and 20. As opposed to a min volume of -4 and 5 and a max volume of -30 and 20. (In one dimension). Makes it easier to fit in my brain, at least][:geometry] +[2:43:48][@foocat][Q: Do you think that languages that interact with the GPU directly (like Nvidia's CUDA or AMD HIP) would be useful for game programming?][:hardware :language] +[2:45:04][@thejimjames40][Q: (Off-topic) Do you miss some features that exist in C but are absent in C++?][:language] +[2:46:31][@internal_static_void_][Q: Thoughts on DXR?] +[2:46:38][@0lpbm][Q: will you ever get back to the nicely aligned grass / rocks bitmaps, map them over the current tiles maybe?][:art] +[2:47:31][@tmtow][Q: Sorry, I could not exactly follow, but can you guess at what makes the interval computations tiresome?][:geometry] +[2:51:29][@uebel_andre][Q: Do you feel it'd be worth it to abstract away subsystems (input, audio, lifecycle) with an Event system?] +[2:51:58][@vaualbus][Q: Can we try all the rooms now?] +[2:52:08][Let CreateOrphanage() try and create the whole building][:"procedural generation"] +[2:52:42][:Run the game to show that it's always connecting rooms at the further side, and will inevitably fail when it would need to connect along another side][:"procedural generation"] +[2:54:37][@jim0_o][Q: Have you ever made a visualization tool for working stuff like this out? (I'm thinking of something like live-code-editing combined with showing values on screen and lerping between previous and new values showing how the changes affect the scene when the code reloads.)][:"debug visualisation"] +[2:55:02][@vaualbus][Q: Also, after all of this code on :rendering and this, is code reloading still working?] +[2:55:42][Demonstrate the hot code reloading by making LightingTest() return immediately][:lighting :rendering :run] +[2:56:59][@devblacky][Q: Are you doing custom :memory management?] +[2:58:08][Wrap it up][:speech] +[/video]