{"id":9,"date":"2013-05-18T18:10:10","date_gmt":"2013-05-19T01:10:10","guid":{"rendered":"https:\/\/www.crabattack.org\/blog\/hawk\/?p=9"},"modified":"2013-05-19T16:46:16","modified_gmt":"2013-05-19T23:46:16","slug":"world-generation-fundamental-shapes","status":"publish","type":"post","link":"https:\/\/www.crabattack.org\/blog\/hawk\/world-generation-fundamental-shapes\/","title":{"rendered":"World Generation: Fundamental shapes"},"content":{"rendered":"<p>Random generation is a pretty interesting part of game development in that there aren&#8217;t that many standard algorithms to apply to it. There&#8217;s an edge of creativity when building an algorithm for it. It&#8217;s most commonly applied to dungeons, typically by splattering around a few randomly sized rectangles and then connecting them by thin hallways.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/dungeon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11\" alt=\"dungeon\" src=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/dungeon.png\" width=\"200\" height=\"200\" srcset=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/dungeon.png 200w, https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/dungeon-150x150.png 150w, https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/dungeon-144x144.png 144w\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Our game requires a more organic approach since it takes place on a world rather than a confined, man-made dungeon. A number of possible generation styles were considered- the most ambitious being to place a few elements at random and then &#8220;simulate&#8221; the world for awhile. Eventually I settled down into deciding that we mostly just needed to achieve a world with\u00a0naturalistic\u00a0edges- wavy, unpredictable and rarely straight. One of the early attempts at this was to place down random points, and then connect them together.<\/p>\n<p><a href=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/point.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12\" alt=\"point\" src=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/point.png\" width=\"200\" height=\"168\" srcset=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/point.png 200w, https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/point-144x120.png 144w\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>This worked well with enough points and a large enough area, but ultimately failed to create organic shapes for smaller areas given our large tile size. So I went down to an even simpler technique of having a &#8220;cursor&#8221; tile that moves about the map randomly creating land. This was, of course, a little too random so I structured it a further by having it move along all 4 &#8220;edges&#8221; of a shape, moving up and down at random to create the flow. Once the outline was finished it could simply be filled in.<\/p>\n<p><a href=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/phase1-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-13\" alt=\"phase1-2\" src=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/phase1-2-300x225.png\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/phase1-2-300x225.png 300w, https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/phase1-2-144x108.png 144w, https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/phase1-2.png 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><a href=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/phase2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-14\" alt=\"phase2\" src=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/phase2-300x225.png\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/phase2-300x225.png 300w, https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/phase2-144x108.png 144w, https:\/\/www.crabattack.org\/blog\/hawk\/wp-content\/uploads\/2013\/05\/phase2.png 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The end result was satisfactory at creating continents with an organic feel. The technique was then extended towards the rest of the world- lakes would use the same style of shape generation, rivers could simply move about towards a direction, and so on.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Random generation is a pretty interesting part of game development in that there aren&#8217;t that many standard algorithms to apply to it. There&#8217;s an edge of creativity when building an algorithm for it. It&#8217;s most commonly applied to dungeons, typically by splattering around a few randomly sized rectangles and then connecting them by thin hallways.&#8230; <a href=\"https:\/\/www.crabattack.org\/blog\/hawk\/world-generation-fundamental-shapes\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">World Generation: Fundamental shapes<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-9","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-generation"],"_links":{"self":[{"href":"https:\/\/www.crabattack.org\/blog\/hawk\/wp-json\/wp\/v2\/posts\/9","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.crabattack.org\/blog\/hawk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.crabattack.org\/blog\/hawk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.crabattack.org\/blog\/hawk\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.crabattack.org\/blog\/hawk\/wp-json\/wp\/v2\/comments?post=9"}],"version-history":[{"count":8,"href":"https:\/\/www.crabattack.org\/blog\/hawk\/wp-json\/wp\/v2\/posts\/9\/revisions"}],"predecessor-version":[{"id":41,"href":"https:\/\/www.crabattack.org\/blog\/hawk\/wp-json\/wp\/v2\/posts\/9\/revisions\/41"}],"wp:attachment":[{"href":"https:\/\/www.crabattack.org\/blog\/hawk\/wp-json\/wp\/v2\/media?parent=9"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.crabattack.org\/blog\/hawk\/wp-json\/wp\/v2\/categories?post=9"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.crabattack.org\/blog\/hawk\/wp-json\/wp\/v2\/tags?post=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}