{"id":8719,"date":"2010-07-21T08:01:03","date_gmt":"2010-07-21T13:01:03","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=8719"},"modified":"2010-07-21T08:05:34","modified_gmt":"2010-07-21T13:05:34","slug":"recursive-procedural","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=8719","title":{"rendered":"Recursive Procedural"},"content":{"rendered":"<p>Talking about procedural content, Bobknight <a href=\"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=8523&#038;cpage=1#comment-158104\">asks<\/a>:<\/p>\n<blockquote><p>wouldn&#39;t the vast majority of the content be(by definition) random? or do you mean that instead of specifying each individual \u00e2\u20ac\u02dcbox&#39; they just point to an area and go \u00e2\u20ac\u02dcmountain here.&#39; or \u00e2\u20ac\u02dcdesert here&#39; and use the appropriate algorithm for each one? If that is true, wouldn&#39;t he algorithm become increasingly\/impossibly more complex if you want to put any kind of detail(the kind of detail that most RPG\/sandbox games demand) in it?<\/p>\n<p>I mean, how does this help to make something like fallout?(where you have the dead janitor on the ground with his two bits of meat and a can of beer)? Would the resulting game world be merely a HUGE collection of randomized terrain that has absolutely nothing on it?<\/p><\/blockquote>\n<p>So far my approach to this &#8211; and I&#8217;m sure FUEL does this as well &#8211; is to make procedural systems recursive. A system produces data, and that data is used as input for another system.  One level carves up the world into geographic regions.  That data is used to generate the topography of the world.  The topography is used to decide where to place cities.  Those locations are used to build street systems.  The streets are used as a guide for placing buildings. The buildings can then be filled with hallways.  Hallways are filled with dudes. Rooms connect to hallways. Furniture goes in rooms.  Objects go on furniture. Player is given a gun and told to go kill some dudes and get some objects. <\/p>\n<p>Each system is a set of rules and depends on good input.  In 2003 or so I wrote a program (and the source is gone, I keep meaning to re-write it, dangit) to take some topographic data and attempt to plot a road across it.  The rules governing roads &#8211; while not set in stone &#8211; are fairly reliable and observable. Roads will curve in response to hills to keep from becoming too steep.  When a road is navigating around a hill, the inside of the curve should bite into the hill and the outside should lift it up.  (In the real world, engineers displace dirt from one side to add to the other, which produces the familiar banks on either side and the distinctive not-dumping-you-into-a-ravine horizontal flatness for which roads have become so popular.)  In my system, the road was willing to go up and down steeply in direct proportion to how far off course it was.  My road wanted to go north, but would veer to either side to avoid hills.  But as it came closer to heading due east or west, it would be willing to climb or drop to a much greater degree.  This produced a very convincing road. (However, the system would occasionally encounter topography that was not solvable with the given rules, and the result usually looked hilariously bad.) <\/p>\n<p>You can see this at work in FUEL. If you go out to the perfectly flat zone in the northeast you can see the roads basically form a grid.  In the hilly parts of the game, the roads bend around quite a bit.  In the <em>really<\/em> hilly sections, the roads get crazy twisted. Sometimes you&#8217;ll see a road get &#8220;trapped&#8221; by unworkable input data and it will either climb a sheer cliff or simply give up and end abruptly. Note that the roads in FUEL had the added challenge of needing to intersect with one another at reasonable angles, which was something I never attempted.<\/p>\n<p>The point is, FUEL is recursive.  It generates topography. (And I suspect even the topography generation is a multi-stage deal.) Then it places roads.  Then it places debris on the roads and buildings alongside them.  If you&#8217;re trying to make &#8220;procedurally generated Fallout 3&#8221;, the next step is to add more stages. This becomes really easy if you decide to take the Bethesda shortcut and make exterior doors into magic teleporters that will move the player into the building without needing to worry about a smooth transition between the two. (This solves tons of problems.  You don&#8217;t need your interior floor plan to precisely match the exterior of the building, and you don&#8217;t have to worry about the complex culling problems you get when the player starts seeing through multiple windows at once.)<\/p>\n<p>As for the &#8220;dead janitor&#8221; problem:  You can have artists design special set pieces and simply make their placement exceptionally rare.  The artist will make a group of objects like the janitor, his mop bucket, and his beer, and specify rules like &#8220;this thing only goes in hallways&#8221; and &#8220;this should never appear more than once in the same building&#8221; and &#8220;this should only appear in 1 out of every 50&#8221; buildings. Then the game will drop in the janitor every now and again.  As far as the game is concerned, he&#8217;s just &#8220;furniture&#8221;.  <\/p>\n<p>The move to a procedurally generated would wouldn&#8217;t mean that the world would have to be dull and sterile. With the right rules you can make places just as vibrant and interesting as those in Fallout 3.  You just need to make the up-front investment of building the system (no small thing, I&#8217;ll grant you) and change how your artists approach their work. If the world feels monotonous then it means your rules aren&#8217;t robust enough or your artists haven&#8217;t added enough variety yet. <\/p>\n<p>I&#8217;m convinced this this has been do-able for the last several years. I just wish I could earn a paycheck proving it. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Talking about procedural content, Bobknight asks: wouldn&#39;t the vast majority of the content be(by definition) random? or do you mean that instead of specifying each individual \u00e2\u20ac\u02dcbox&#39; they just point to an area and go \u00e2\u20ac\u02dcmountain here.&#39; or \u00e2\u20ac\u02dcdesert here&#39; and use the appropriate algorithm for each one? If that is true, wouldn&#39;t he algorithm [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-8719","post","type-post","status-publish","format-standard","hentry","category-game-design"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/8719","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8719"}],"version-history":[{"count":0,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/8719\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}