{"id":47440,"date":"2019-06-27T06:11:46","date_gmt":"2019-06-27T10:11:46","guid":{"rendered":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=47440"},"modified":"2019-09-25T17:10:49","modified_gmt":"2019-09-25T21:10:49","slug":"procgen-spaceship","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=47440","title":{"rendered":"Procgen Spaceship"},"content":{"rendered":"<p>I mentioned in <a href=\"?p=47409\">this week\u2019s diecast<\/a> (around the 18:30 mark) that I thought Rebel Galaxy would have been improved<span class='snote' title='1'><a href=\"?p=47419\">other flaws<\/a> not withstanding<\/span> if it had some procedurally generated spaceships, instead of just the stock ones. If proc-gen is an unfamiliar term, Shamus has written a <a href=\"?p=542\">few articles<\/a> on it. Okay, <a href=\"?p=2940\">more than a few<\/a>. Actually, it\u2019s all he talks about when he has time to stop complaining about videogames, but you know how life is, what with work and family and sleep, who has time for obsessions?<\/p>\n<p>So, why am I talking about proc-gen then? Well, it\u2019s an obsession of mine as well, and a large part of what drew me to this site. I could go on about my own projects but I think we\u2019ve done enough introduction, so instead let\u2019s make a<span class='snote' title='2'>practically unlimited set of<\/span><\/p>\n<h3>procedurally generated spaceship!<\/h3>\n<p>The right way to start a project like this is to decide on a programming language, and some code conventions. Then you set up your development environment, and begin writing header files. No, wait, that\u2019s not right. That\u2019s how to&#8230; actually that\u2019s not the right way to do anything. To design something you need a goal, not a set of processes. In this case the goal is to program the computer to be able to design and model spaceships, and that\u2019s basically impossible if you can\u2019t even&#8230;<br \/>\n<!--more--><\/p>\n<h3>Do it Yourself First<\/h3>\n<p>So that\u2019s where we start. It may feel like a waste of time to start a programming project by doing the work by hand. But this feeds back into the point about code documentation and game design. Programming a computer to do design means communicating something complicated in simple terms to someone who<span class='snote' title='3'>\u201dsomething that\u201d in this case, but the principle is the same<\/span> has no idea what you\u2019re talking about. That\u2019s hard enough when you\u2019re an expert, but when you don\u2019t know how to do it yourself, it becomes next to impossible.<\/p>\n<p>Ok, so where do we start with spaceships? Well, I don\u2019t know about you, but the first ingredient I want for a spaceship is:<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship01.jpg' width=100% alt='Well, it\u2019s not great, but I don\u2019t have all day here.' title='Well, it\u2019s not great, but I don\u2019t have all day here.'\/><\/div><div class='mouseover-alt'>Well, it\u2019s not great, but I don\u2019t have all day here.<\/div><\/p>\n<h3>Space!<\/h3>\n<p><span class='snote' title='4'>Ahh! Mmmm! Nah! Ehh! None of that! I won\u2019t have any; Oh! Well, you\u2019ve gone and done it now. Yes yes, you\u2019re very clever for, But you don\u2019t have to, Yes, that\u2019s how it goes but. But&#8230; But now you\u2019re just saying \u201cSpace!\u201d over and over!<\/span><br \/>\nSo after we\u2019ve blacked out the background and added some far-away stars and a close-up star or two, and a few big colored spheres for planets I think we can finally begin with the ship part of the spaceship that you\u2019ve all been waiting for. And, like so many other things, let\u2019s begin this design with squares. And because I prefer making 3D spaceships, let\u2019s volumetrize that square and:<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship02.jpg' width=100% alt='Okay, good work everyone. Pack it up and go home.' title='Okay, good work everyone. Pack it up and go home.'\/><\/div><div class='mouseover-alt'>Okay, good work everyone. Pack it up and go home.<\/div><\/p>\n<h3>Throw Some Cubes Together<\/h3>\n<p>Cubes are special for being clearly artificial. Spheres appear everywhere in nature,<span class='snote' title='5'>Just look at the background!<\/span> but the right angles of the square, and by extension of the cube, implies intent and planning. Cubes are, in some senses, the essential artifact.<\/p>\n<p>Still though, some greebles wouldn\u2019t hurt.<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship03.jpg' width=100% alt='Don\u2019t let your pareidolia get out of control now. It\u2019s just a bunch of cubes.' title='Don\u2019t let your pareidolia get out of control now. It\u2019s just a bunch of cubes.'\/><\/div><div class='mouseover-alt'>Don\u2019t let your pareidolia get out of control now. It\u2019s just a bunch of cubes.<\/div><\/p>\n<p>Now, I wouldn\u2019t recommend stopping with the cube<span class='snote' title='6'>Star Trek Borg vessels notwithstanding, though the overbearing simplicity of the shape grants a profound insight into the radical conformity of that fictional collective.<\/span> but there\u2019s no harm in starting there. We can make arrays of cubes, and cubes covered in cubes, and fairly soon we arrive at something that somewhat resembles a spaceship of some kind.<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship04.jpg' width=100% alt='Kinda like a spaceship, right? I mean, it doesn\u2019t look like anything ELSE!' title='Kinda like a spaceship, right? I mean, it doesn\u2019t look like anything ELSE!'\/><\/div><div class='mouseover-alt'>Kinda like a spaceship, right? I mean, it doesn\u2019t look like anything ELSE!<\/div><\/p>\n<p>It\u2019s missing something though, isn\u2019t it? We have something that looks manufactured, but it might just as well be a modern building. We need another shape, one that still connotes artificiality, but also implies motion. We need the circle! And as long as we\u2019re doing squares, or rectangles really at this point, let\u2019s combine the principles and use:<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship05.jpg' width=100% alt='I think I hear this spaceship driving around my neighborhood late at night.' title='I think I hear this spaceship driving around my neighborhood late at night.'\/><\/div><div class='mouseover-alt'>I think I hear this spaceship driving around my neighborhood late at night.<\/div><\/p>\n<h3>Lathes of Rectangles<\/h3>\n<p>Yessir, that\u2019s more like it. I\u2019m feeling the spaceshippiness already.<br \/>\nLathes are great because they look like wheels and turbines and rocket engines without even trying.<\/p>\n<p>So now that we have our two essential elements, we should start playing with the functional sections of a spaceship. For lack of a better plan, I propose to start at the back and work forward. And what\u2019s at the back of every spaceship?<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship06.jpg' width=100% alt='Engines?' title='Engines?'\/><\/div><div class='mouseover-alt'>Engines?<\/div><\/p>\n<h3>Engineering<\/h3>\n<p>I always think of engineering as being characterized by lots of cables and tubes and pipes snaking everywhere, so let\u2019s do that.<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship07.jpg' width=100% alt='Oh tubes. Not, um, not engines then?' title='Oh tubes. Not, um, not engines then?'\/><\/div><div class='mouseover-alt'>Oh tubes. Not, um, not engines then?<\/div><br \/>\nMaybe some of the pipes are glowing? With, I dunno, radioactive fuel? It\u2019s a spaceship! Glowy bits!<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship08.jpg' width=100% alt='I was sure you needed engines though.' title='I was sure you needed engines though.'\/><\/div><div class='mouseover-alt'>I was sure you needed engines though.<\/div><\/p>\n<p>And of course, we need some engines. Big engines! Small engines! Short ones and long ones! Engines for the engine god! That\u2019s what an Engineer is, right?<span class='snote' title='7'>Let me have this. It\u2019s better this way.<\/span><span class='snote' title='8'>Probably.<\/span><br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship09.jpg' width=100% alt='Right. There it is' title='Right. There it is'\/><\/div><div class='mouseover-alt'>Right. There it is<\/div><\/p>\n<p>Okay, so we have the engine territory, but now we need a territory for all the people that will get thrown all over the place by the explosions from the guns that we\u2019ll get to near the end of this article. That\u2019s right, we need the:<\/p>\n<h3>Crew Quarters<\/h3>\n<p>Now, as fun as it would be to start procedurally generating the interior of this spaceship, and making procedurally generated bunk halls and captain\u2019s chairs and massage parlors and such, this very temptation brings me to my second principle of design. You\u2019ve probably heard the phrase \u201cDon\u2019t re-invent the wheel\u201d which warns against redeveloping familiar technology. This one is similar, and can be phrased as, \u201cDon\u2019t depict the familiar\u201d or, at least, not if you can help it. The familiar is really difficult to get right, exactly because everyone knows what it should look like. Everyone is familiar with beds and chairs and doorways, so, why bother? Instead of spending a bunch of time making things that everyone already knows about, let\u2019s just nod to them with a bit of shorthand in the form of lit-up windows.<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship10.jpg' width=100% alt='Hmm, okay. Not as fun as seeing the interior, but better than nothing!' title='Hmm, okay. Not as fun as seeing the interior, but better than nothing!'\/><\/div><div class='mouseover-alt'>Hmm, okay. Not as fun as seeing the interior, but better than nothing!<\/div><\/p>\n<p>Adding windows<span class='snote' title='9'>Nope! Not doing that joke either.<\/span> does two things for us. As above, it lets us imply crew quarters without actually modeling them. But just as important, it lets us indicate scale.<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship11.jpg' width=100% alt='Are you sure this is the same ship?' title='Are you sure this is the same ship?'\/><\/div><div class='mouseover-alt'>Are you sure this is the same ship?<\/div><\/p>\n<p>And just like that, we can turn a tiny spaceship into a huge one, all with one little parameter. Pretty neat!<\/p>\n<p>Okay, we have engines and crew, now let\u2019s add the part I was complaining about earlier. Some big empty spaces between the dangerous engines and the fenestrated quarters that we can fill full of:<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship12.jpg' width=100% alt='Yes, okay, the spaceship is casting a giant shadow on the planet, exposing the ruse of the false perspective. Is not perfect system.' title='Yes, okay, the spaceship is casting a giant shadow on the planet, exposing the ruse of the false perspective. Is not perfect system.'\/><\/div><div class='mouseover-alt'>Yes, okay, the spaceship is casting a giant shadow on the planet, exposing the ruse of the false perspective. Is not perfect system.<\/div><\/p>\n<h3>Cargo<\/h3>\n<p>I think all we need for this is to make some big modular blocky parts. We can put them on the engineering section, for, storing fuel! And cargo on the crew section to store, rations I guess?<\/p>\n<p>And then add something that looks like a door to them<span class='snote' title='10'>Moar rectangles!<\/span>.<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship13.jpg' width=100% alt='If that doesn\u2019t look like a bunch of cargo bays, um, too bad?' title='If that doesn\u2019t look like a bunch of cargo bays, um, too bad?'\/><\/div><div class='mouseover-alt'>If that doesn\u2019t look like a bunch of cargo bays, um, too bad?<\/div><br \/>\nAnd I guess that will do it for the cargo section!<\/p>\n<p>And with that, all that\u2019s left are the:<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship14.jpg' width=100% alt='I\u2019ll admit, it\u2019s a bit busy.' title='I\u2019ll admit, it\u2019s a bit busy.'\/><\/div><div class='mouseover-alt'>I\u2019ll admit, it\u2019s a bit busy.<\/div><\/p>\n<h3>Guns<\/h3>\n<p>Which are basically the opposite of cargo, long narrow lathes instead of short blocky cubes.<br \/>\nFrom there we can do turrets, which are just gimballed guns. We\u2019ll add some cargo units to the guns for ammunition storage.<br \/>\n<div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/ProcGenSpaceship15.jpg' width=100% alt='Man, the view from the upper decks used to be so good! Now it\u2019s just the side of this lousy turret.' title='Man, the view from the upper decks used to be so good! Now it\u2019s just the side of this lousy turret.'\/><\/div><div class='mouseover-alt'>Man, the view from the upper decks used to be so good! Now it\u2019s just the side of this lousy turret.<\/div><br \/>\nSo, that\u2019s the process! Obviously I could add more detail and improve the design, but that\u2019s not the point. The point is to take the design process from start to finish and get comfortable with the steps involved.<br \/>\nYou can download the <a href=\"\/files\/ProcgenSpaceship1.blend\">source file<\/a> for all of this, and play with it yourself. Next step is to make three or four more of these, and really solidify the process, and then, finally, we can start writing some code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I mentioned in this week\u2019s diecast (around the 18:30 mark) that I thought Rebel Galaxy would have been improvedother flaws not withstanding if it had some procedurally generated spaceships, instead of just the stock ones. If proc-gen is an unfamiliar term, Shamus has written a few articles on it. Okay, more than a few. Actually, [&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-47440","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\/47440","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=47440"}],"version-history":[{"count":5,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/47440\/revisions"}],"predecessor-version":[{"id":47445,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/47440\/revisions\/47445"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=47440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=47440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=47440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}