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

47 lines
5.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=day446 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Generating Possible Room Volumes" vod_platform=youtube id=BnS1WgMOAYc annotator=Miblo]
[0:02][Recap and set the stage for the day generating possible room volumes][:"graph topology" :"procedural generation" :speech]
[1:52][Describe our current world layout code in CreateOrphanage() with a note that we are using an undirected graph][:"graph topology" :"procedural generation" :research]
[4:15][:Run the game to show our current world]
[5:03][A few words on starting to devise solutions and to open black boxes][:speech]
[7:25][Inter-room Layout][:blackboard :"graph topology" :"procedural generation"]
[9:29][Dynamically resizable rooms][:blackboard :"graph topology" :"procedural generation"]
[12:39][Recall dad's work at DEC around the time of the DEC Alpha[ref
site=Wikipedia
page="DEC Alpha"
url=https://en.wikipedia.org/wiki/DEC_Alpha], chip layout, and "rip up and replace"][:fabrication :hardware :research]
[18:47][Speculative layout, and the notion of starting off with a totally brute force solution, before trying to reduce the search space of that solution][:blackboard :"graph topology" :"procedural generation"]
[26:30][Setup to tackle our layout problem with an eye toward impermanence][:blackboard :"graph topology" :"procedural generation"]
[29:01][Specify our world generation rules for Layout() to follow][:"graph topology" :"procedural generation" :research]
[31:47][Introduce gen_room_stack for Layout() to use, with a few words on the use of the compiler's vs our own stack management by recursive functions][:"graph topology" :memory :"procedural generation"]
[45:30][Introduce GetOtherRoom() for Layout() to call][:"graph topology" :"procedural generation"]
[49:52][Determine to enable Layout() to figure out where to place and connect rooms in a trial-and-error fashion, with four connections per room, connecting two rooms after both are placed][:"graph topology" :"procedural generation" :speech]
[54:10][Continue enabling Layout() to place and connect rooms in separate passes, introducing PushConnectedRooms()][:"graph topology" :"procedural generation"]
[1:00:28][Enumerating shapes of rooms that satisfy connections][:blackboard :"graph topology" :"procedural generation"]
[1:10:26][Union and intersection][:blackboard :geometry :"graph topology" :"procedural generation"]
[1:16:08][Determining the largest rectangle that touches other rectangles in our union][:blackboard :geometry :"procedural generation"]
[1:19:42][MetropolisHastings algorithm[ref
site=Wikipedia
page="MetropolisHastings algorithm"
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"]
[1:59:20][Enable PlaceRoom() to clip our rooms in all dimensions][:geometry :"procedural generation"]
[2:08:49][Introduce InfinityVolume() containing the whole world for Layout() to call before PlaceRoom() clips out our desired region][:geometry :"procedural generation"]
[2:14:37][Introduce GetMaximumVolumeFor(), and consider using a room spec to constrain our dimensions][:geometry :"procedural generation"]
[2:18:05][Min / Max Intervals for Reasonable Length Picking][:blackboard :geometry :"procedural generation"]
[2:22:05][Enable PlaceRoom() to pick reasonable room dimensions][:geometry :"procedural generation"]
[2:28:49][#if 0 most of today's code, with a view to getting the existing code to work with our newly formulated notion of parameterised room volumes][:geometry :"procedural generation"]
[2:34:06][:Run the game to see that all is okay][:geometry :"procedural generation"]
[2:34:34][Q&A][:speech]
[2:35:20][@LongBoolean][Q: I think one of your >= should be <=, also some < to >, around line 180, 190-ish, I think...]
[2:38:40][Fix PlaceRoom() to correctly clip our new room][:geometry :"procedural generation"]
[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]