{"id":47659,"date":"2019-08-13T10:46:09","date_gmt":"2019-08-13T14:46:09","guid":{"rendered":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=47659"},"modified":"2019-09-25T17:09:15","modified_gmt":"2019-09-25T21:09:15","slug":"procgen-everything","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=47659","title":{"rendered":"Procgen Everything"},"content":{"rendered":"<p>I promise we&#8217;re going to finally get to actual programming in this post, but first a huge aside.<\/p>\n<p>When I started this project, it was 2010, and my wife had just purchased me the Star Trek Enterprise D blueprints. I was inspired. But it was an odd kind of inspiration. The kind that starts building connections into other parts of your life and making you think strange thoughts.<\/p>\n<p>It began innocently enough. I noted, as I was pouring over the plans, a certain similarity to the masonry script I had written a few years prior. I was feeling the need to get back into coding, and this seemed the perfect opportunity! Just re-purpose the old code to make starship floorplans! How hard could it be?<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/pgs6_00.jpg' width=100% alt='They are practically the same already. Good work everyone.' title='They are practically the same already. Good work everyone.'\/><\/div><div class='mouseover-alt'>They are practically the same already. Good work everyone.<\/div><br \/>\nIt didn&#8217;t hurt that I had some experience making space ships from floor plans. Back in 2007, I started working on a 3D model of a spaceship based off of some bitmap floorplans designed as headquarters for a Starwars fan-fiction group. The project was never really &#8220;finished&#8221; because there was never really a goal. It was mostly motivated from &#8220;wouldn&#8217;t it be cool to have a 3d model of this whole spaceship that we&#8217;ve been writing stories about?<!--more--><\/p>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/pgs6_01.jpg' width=100% alt='When I made this, I had not figured out the &apos;cool hull plates&apos; technique. Arguably, the case is the same today.' title='When I made this, I had not figured out the &apos;cool hull plates&apos; technique. Arguably, the case is the same today.'\/><\/div><div class='mouseover-alt'>When I made this, I had not figured out the &apos;cool hull plates&apos; technique. Arguably, the case is the same today.<\/div><br \/>\nSo I figured it wouldn&#8217;t be any trouble to have the computer build the space ships instead of doing it by hand.<\/p>\n<h3>It Was A Lot Of Trouble<\/h3>\n<p>Turns out I&#8217;m a crazy person, and the project stalled out. But not before producing what I am resurrecting in this article.<\/p>\n<p>You see, I began working backward to a starting point, simplifying over and over until I had something I could wrap my brain around. The star-trek guys started with the Enterprise C, which was an iteration from the B, which was based on the A which was, from the looks of it, based off a toilet seat cover and some toilet paper rolls. A &#8220;shape first&#8221; approach. Which, when all you really need is the outside of the starship, is a fine place to begin. Sure you have the problem of having the geometry &#8220;read&#8221; properly as to scale and function, but those are problems with potential solutions, as I have been attempting to demonstrate with this series so far.<\/p>\n<p>So, me being disagreeable, I decided to start at the other end. With the internals. I didn&#8217;t just want to wave my hands at the problem and say &#8220;it has space magic technology that goes &#8220;vroom&#8221; and &#8220;pew pew&#8221; when it needs to.&#8221; I wanted these ships to make real sense. The Enterprise D had a crew of 1014, but what did they all do? What was the skeleton crew? Sure, there were 4 staff on duty in the sick bay because that makes for good drama when one is a main character, two of them are holding down a patient, and the last one gets killed by the disaster of the week, but I wanted more technical answers. I wanted to be able to perform a calculation!<\/p>\n<p>So I built a calculator.<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/pgs6_02.jpg' width=100% alt='Science again!' title='Science again!'\/><\/div><div class='mouseover-alt'>Science again!<\/div><\/p>\n<p>Well, technically I used a giant absurdly powerful hardware calculator to run a calculator based calculator platform to run a different software calculator to iteratively program another, different, smaller, less powerful calculator. In the engineering business, they call this:<\/p>\n<h3>Re-inventing the Wheel<\/h3>\n<p>And while it&#8217;s often used with a deeply derogatory connotation, and while that connotation was probably appropriate in this case, there are certain advantages to re-inventing the wheel. Sometimes, the wheels you need just aren&#8217;t readily available! Sometimes you want to better understand the wheel instead of just buying one off the shelf! And sometimes the wheel you want to re-invent is a super-ordinate meta-wheel which, as it rolls, stamps out other smaller wheels. You also shouldn&#8217;t try to re-invent the metaphor.<\/p>\n<h3>Get to the Point Already!<\/h3>\n<p>But that&#8217;s the point, isn&#8217;t it? Once I started making a calculator for calculating how many crew cabins you would need in an arbitrary space-ship, I realized it was a very small step to making a calculator for calculating how many abstract production groups you would need in an arbitrary resource network balancing system. So I did that, and it worked fairly well.<\/p>\n<p>Before further excursions into madness, I&#8217;m going to mention that rockets have a bad problem that, while not unique to them, is at least fairly uniquely bad for them, where they need to carry fuel, and the more fuel they carry, the more fuel they need. This calculator was designed to solve just this sort of iterative self-referential problem.<\/p>\n<p>But then I had a further realization that if the calculator could be based on nodes, which in turn could contain other nodes, then it would be able to calculate everything. And if I could calculate everything, then I could:<\/p>\n<h3>Procgen Everything<\/h3>\n<p>Don&#8217;t you see? It&#8217;s all so elegant! The basis of a net-production network undergirds all sustainable systems, and when non-sustainable resources are given abstract trans-finite sources, one can calculate not only the spatial dimensions, but the temporal dimensions as well! N-dimensional computation would be trivial! Every problem had only to be defined as a linearized solution space! And even non-linear solutions could be approximated by a set of discrete linear segments, represented by nodes! The spatiotemporal output maps onto an effectively infinite set of implementations, allowing for style and preference, all based on a single unifying ruleset used to generate the nodes! It could:<\/p>\n<h3>Procgen Everything<\/h3>\n<p>And you could procgen game mechanics, and time itself, and minds, and stories! The possibilities!<br \/>\nDo it!<\/p>\n<h3>Procgen Everything!<\/h3>\n<p>Ahem&#8230;<\/p>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/pgs6_03.jpg' width=100% alt='Let&apos;s take a moment to enjoy this proc-gen star-field. Man, it just never gets old! Who needs ships?' title='Let&apos;s take a moment to enjoy this proc-gen star-field. Man, it just never gets old! Who needs ships?'\/><\/div><div class='mouseover-alt'>Let&apos;s take a moment to enjoy this proc-gen star-field. Man, it just never gets old! Who needs ships?<\/div><\/p>\n<p>So, that was ten years ago.<\/p>\n<p>I still hope to be able to procgen everything. At some point. I&#8217;ve <a href=\"http:\/\/blog.projectfledgeling.com\/\">written<\/a> in fits and starts about it from time to time, which you&#8217;re welcome to read if you like the craziness of the above.<\/p>\n<p>But in the meantime, I&#8217;ve made tremendous strides, and today I am happy to announce that the calculator can very nearly handle nested nodes. I mean, it definitely works for nested nodes, but it can only solve one layer at a time, though it should be a fairly trivial to add the ability to&#8230;<\/p>\n<p>Ahh, see, there I go again.<\/p>\n<p>To avoid dissipating into the infinite sea of the possible, I&#8217;m going to strictly limit myself to the here and now. As in: Here is what I have right now.<br \/>\n<a href=\"http:\/\/jhundts.org\/UniversalArchitect\/\">http:\/\/jhundts.org\/UniversalArchitect\/<\/a><\/p>\n<p>The calculator is UA_Calc.py which is a Python program. I wish I had the time to go over the whole thing in depth, but you can read the code and the comments if you are interested.<\/p>\n<p>It takes a specification file (Specification.txt is an example), and solves the specification, and outputs specification files of the solutions. You can then copy-paste those specifications into other specification files, and, well, you get the idea. There are a few examples of the output in that folder as well.<\/p>\n<p>Although the program itself is written in Python, the specification file itself is a very simple flexible format which I made up, and which I hope is easy enough to pick up yourself.<br \/>\nFor example, if you use this as Specification.txt:<br \/>\n<code>?<br \/>\n!<br \/>\n!Potted Plant<br \/>\npetals 5<br \/>\nodur 1<br \/>\nPot -1<br \/>\nSoil -0.21<br \/>\n!Garden<br \/>\nSoil -15<br \/>\nPotted Plant -7<br \/>\n!Box of Pots<br \/>\nPot 5<br \/>\n!Bag of Soil<br \/>\nSoil 12<\/code><br \/>\nthen the calculator will spit out this in the &#8220;Garden.txt&#8221; file:<br \/>\n<code>?<br \/>\n? generated in 3 iterations.<br \/>\n!<br \/>\n? Originally calculated from Specification.txt<br \/>\n!Garden<br \/>\npetals 35.0<br \/>\n? petals generated 35.0<br \/>\nodur 7.0<br \/>\n? odur generated 7.0<br \/>\nSoil 7.530000000000001<br \/>\n? Soil generated 24.0<br \/>\n? Soil consumed -16.47<br \/>\nPot 3.0<br \/>\n? Pot generated 10.0<br \/>\n? Pot consumed -7.0<br \/>\n? All local nodes and resources are as follows:<br \/>\n? Soil -15.0<br \/>\n? Potted Plant 7.0<br \/>\n? Bag of Soil 2.0<br \/>\n? Box of Pots 2.0<br \/>\n? node results for Garden complete<\/code><br \/>\nThe details of how to write your own specification file are in the example specification file.<\/p>\n<p>As you can see it can calculate anything at all, as long as that anything can be expressed as a set of nodes that produce and consume resources. I would start listing examples, but we all know where that leads.<\/p>\n<p>And yes, there are a lot of things wrong with UA_Calc.py and I want to make it more robust and add error checking and all the rest, but I&#8217;ve already missed two weeks of articles fiddling with it instead of releasing it as-is. So, here&#8217;s what I propose. While I work on getting back around to exploring a few more of the visual aspects of starship design that I&#8217;d like to touch on, perhaps the more programming minded of you could suggest improvements to the calculator, and the systems minded could build specification files that result in the kind of starship content manifests that you would like to see visualized. And then, eventually, I&#8217;ll get back around to improving the calculator, and maybe we&#8217;ll make a bit faster progress together than I could working on this in spare moments snatched here and there.<\/p>\n<p>I&#8217;m looking forward to reading what you come up with! Thanks for putting up with my insanity in this post. I&#8217;d really like to procgen everything, but you&#8217;re going to have to bear with me for a while. Or, you know, do it yourself.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I promise we&#8217;re going to finally get to actual programming in this post, but first a huge aside. When I started this project, it was 2010, and my wife had just purchased me the Star Trek Enterprise D blueprints. I was inspired. But it was an odd kind of inspiration. The kind that starts building [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-47659","post","type-post","status-publish","format-standard","hentry","category-projects"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/47659","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\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=47659"}],"version-history":[{"count":7,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/47659\/revisions"}],"predecessor-version":[{"id":47740,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/47659\/revisions\/47740"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=47659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=47659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=47659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}