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

86 lines
8.0 KiB
Plaintext
Raw Permalink 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 output=day449 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Preventing Overlapping Rooms" vod_platform=youtube id=tluPd2CyN3M annotator=Miblo]
[0:00][Recap and set the stage for the day continuing with room layout][:speech]
[0:45][:Run the game to show our strange situation with the :camera placement]
[1:39][Enable CreateWorld() to set a sane initial :camera position]
[4:24][:Run the game to see the :camera oddly positioned]
[5:13][Step in to CreateWorld() to inspect the :camera and room data][:run]
[7:49][Step in to GenerateRoom() to inspect its values][:run]
[9:06][Fix Layout() to not include the bounding edges in the volume dimensions][:geometry]
[10:41][:Run the game to see that our :camera is now correctly initialised]
[11:09][TODO(casey): Fix 2-high room bug - :camera seems to get confused]
[11:45][Check out our orphanage, and determine to implement the doors][:run]
[13:26][Make PlaceRoomsAlongEdge() knock out the entire wall between connecting rooms][:geometry]
[15:54][:Run the game to see that we actually don't overlap our rooms in this placement scheme][:geometry]
[16:42][Determine to make PlaceRoomsAlongEdge() expand the door dimensions into each room][:geometry]
[19:37][Step in to PlaceRoomsAlongEdge() and inspect MinDoor and MaxDoor][:geometry :run]
[21:39][Make PlaceRoomsAlongEdge() flip the door's Min and Max dimensions along the axis pointing to the adjoining room][:geometry]
[22:01][:Run the game to see that the door placement is almost there][:geometry]
[22:20][Fix typo in PlaceRoomsAlongEdge()][:geometry]
[22:59][Hop around the world and consider fixing the :camera and :lighting once the world generation is done enough][:run]
[24:54][Make PlaceRoomsAlongEdge() constrain the door width to 1 unit wide][:geometry]
[26:57][:Run the game and consider tweaking the eccentricity of the perspective projection][:geometry :camera]
[28:04][Adjust the :camera focal length and zoom in UpdateAndRenderWorld() and UpdateCameraForEntityMovement()]
[31:27][:Run the game and note the reduced eccentricity of the perspective projection, with a few thoughts on the :camera in The Binding of Isaac and Hotline Miami]
[33:32][Determine to get things up to a playable state, generating more stuff, and making a separately moveable debug :camera][:run]
[36:00][Make CreateWorld() create multiple orphanages, and Layout() to take an initial room][:"graph topology"]
[38:22][:Run the game to see some Z-fighting, and determine to make the layout code check for overlap][:geometry]
[40:38][Make CreateWorld() call Connect() on the orphanages][:"graph topology"]
[41:24][:Run the game and walk between our two orphanages]
[42:39][Make CreateOrphanage() create smaller rooms][:geometry]
[43:19][:Run the game to see that the :camera correctly handles traversal between the orphanages]
[44:16][Make CreateWorld() create 64 orphanages all chained together]
[45:45][:Run the game to see that our :"debug system" runs out of space for the timings]
[46:16][Remove TIMED_FUNCTION() calls pertaining to :simulation regions][:"debug system"]
[47:20][Traverse the world, with a few words on structuring our code to ease :"procedural generation"][:run]
[49:21][Note the low loading time of our game considering its anticipated length][:run]
[51:06][Remove TIMED_FUNCTION() from BeginTicketMutex()][:"debug system" :threading]
[51:24][Note that our high entity count does not affect our :performance][:run :simulation]
[53:34][Step in to the game and inspect the LastUsedEntityStorageIndex][:run]
[54:41][Make CreateWorld() create 1024 orphanages]
[55:29][Disable HANDMADE_INTERNAL and redefine DEBUG_STRING and HUD_TIMED_FUNCTION to do nothing in this mode][:"debug system"]
[56:10][:Run the game in release mode and inspect the LastUsedEntityStorageIndex, noting that it is computationally free to have many entities][:performance]
[58:39][Increase the world_room array size in the world struct by × 4]
[59:09][:Run the game one last time with this large world]
[1:00:06][Restrict CreateWorld() to create a single orphanage]
[1:00:25][Determine to address the room overlapping bug][:geometry :run]
[1:04:09][Consider augmenting the world struct with a two-tiered representation of the world at both entity- and room-granularity][:"entity system" :speech]
[1:08:17][Setup PlaceRoomsAlongEdge() for overlap testing before room placement][:geometry]
[1:10:37][Highly recommend ~Milton][:blackboard]
[1:12:09][Edge Subscription][:blackboard :geometry]
[1:15:44][Directed Search vs Blind Search][:blackboard :geometry]
[1:19:21][Introduce a TestVol in PlaceRoomsAlongEdge()][:geometry]
[1:22:52][Consider that we may have hit a ~4coder bug]
[1:25:16][Continue setting up PlaceRoomsAlongEdge() for overlap testing][:geometry]
[1:26:38][Overlap testing each room from the start of the placement edge][:blackboard :geometry]
[1:28:03][Coffee at Molly Rocket and in indie development in general][:trivia]
[1:30:16][Finish setting up PlaceRoomsAlongEdge() for overlap testing, introducing GetDeltaAlongAxisForCleanPlacement()][:geometry]
[1:34:25][:Run the game to see all connected rooms placed on top of each other][:geometry]
[1:34:39][Don the pig :hat with a few words on working on one thing at a time][:speech]
[1:36:37][Enable GetDeltaAlongAxisForCleanPlacement() to perform overlap testing and clean room placement][:hat :programming]
[1:40:35][:Run the game and crash in PlaceRoomsAlongEdge()][:geometry :hat]
[1:41:25][Prevent GetDeltaAlongAxisForCleanPlacement() from considering unplaced rooms][:geometry :hat]
[1:41:55][Step through PlaceRoomsAlongEdge()][:geometry :hat :run]
[1:42:18][Fix PlaceRoomsAlongEdge() to correctly loop over the edges][:geometry :hat]
[1:42:39][:Run it to see that the room placement is all totally correct][:geometry :hat]
[1:43:53][Q&A][:hat :speech]
[1:44:25][@thebirkisreal][Q: Do you plan on making an in-game editor similar to the one in The Witness?]
[1:45:19][@therainbowmask][Q: The "4coder bug" was not a bug, it was a missing '\]']
[1:45:27][Insert a '\]' in PlaceRoomsAlongEdge() (not a ~4coder bug)]
[1:45:46][@naysayer88][Q: How can I earn a piggy hat for myself?]
[1:46:43][@garryjohanson][Q: I think I know the answer to this question, but do you know of some simple preprocessor :library that has iteration as a feature? I really don't want to write my own at the moment][:language]
[1:50:23][@mmd966][Q: Hello sir. I just started creating my first game using SDL in C++. Can you give me some advice? Am I going the right way or I should change my tools? Plus, I'm looking for a game programming book. Do you know a good one to start with? (I worked a little with Unity3D)[ref
author="Jason Gregory"
title="Game Engine Architecture"
url=http://gameenginebook.com/]][:language :library]
[1:54:57][@cvaucher][Q: The current generator always creates two-tile wide walls when rooms are adjacent. Will you leave it like this because it's easier to include the walls inside the room volume? Would you take the same approach if the tile size were not tied to the traversable size, which would allow for thinner walls, for example?][:geometry]
[1:56:26][@butwhynot1][Q: libclang can parse your code and give you the AST. It's a simple C interface][:language :library]
[1:56:38][@vaualbus][Q: Can you show the game? Just fell asleep and missed all of the coding]
[1:56:44][:Run the game to show the orphanage layout]
[1:57:11][@toolegit2quit_][Q: What to do if CS course enforces OOP?][:language]
[2:02:28][@netcha_][Q: What do you think about Lua and Love2D?][:language :library]
[2:02:35][@keepingtrckofthisacct][@handmade_hero What paradigm do you use instead of OOP?][:language]
[2:02:49][@naysayer88][Q: The problem is that understanding why OOP is really bad probably requires 5+ years of experience, because it takes that long to be able to build sufficiently complex programs such that you know what "should" be easy, or which complications are unnecessary][:language]
[2:03:38][On the problem with languages whose design philosophy is divorced from the computer][:hardware :language :speech]
[2:07:42][Close down][:speech]
[/video]