{"author_name":"JonathanG","cat":"LD #33","comments":[],"epoch":1442260980,"likes":0,"metadata":{"p_key":"12924","p_author":"JonathanG","p_authorkey":"11515","p_urlkey":"48177","p_title":"Random shire generation, for added detail","p_cat":"LD #33","p_event":"LD33","p_time":"1442260980","p_likes":"0","p_comments":"0","p_status":"UPD5","us_key":"11515","us_name":"JonathanG","us_username":"jonathang","event_start":"1440115200","event_key":"29","event_name":"LD33"},"text":"<p>In <a href=\"http:\/\/ludumdare.com\/compo\/ludum-dare-33\/?action=preview&amp;uid=11515\" target=\"_blank\">The adventures of the Squire and the Liar<\/a>, you&#8217;re always travelling somewhere new. This is because wherever you go, you fool the villagers into giving you their money (you monster), so you are never welcome in the same Shire twice! It&#8217;s also a good showcase of random generation used as an easy way to add detail and richness to a world, given how short the Ludum Dare deadline is!<\/p>\n <div id=\"attachment_501625\" style=\"width: 560px\" class=\"wp-caption aligncenter\"><img class=\"wp-image-501625 size-large\" src=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/09\/random-town-generation-s-550x429.png\" alt=\"random town generation-s\" width=\"550\" height=\"429\" srcset=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/09\/random-town-generation-s-300x234.png 300w, http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/09\/random-town-generation-s.png 550w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><p class=\"wp-caption-text\">Wouldn&#8217;t you just love to visit the famous &#8216;Amusing Bridge&#8217; in Trumpcote?<\/p><\/div>\n <p>The code to do this is really simple!<\/p>\n <pre>private readonly string[] villagePre = {\n \u00a0\u00a0 \u00a0\"North\",\n \u00a0\u00a0 \u00a0\"South\",\n \u00a0\u00a0 \u00a0\"New\",\n \u00a0\u00a0 \u00a0\"Old\"\n };\n \n private readonly string[] villageNames = {\n \u00a0\u00a0 \u00a0\"Axe\",\n \u00a0\u00a0 \u00a0\"Raven\",\n \u00a0\u00a0 \u00a0\"Trump\",\n \u00a0\u00a0 \u00a0\"Beer\",\n \u00a0\u00a0 \u00a0\"Cringe\"\n };\n \n private readonly string[] villageCompound = {\n \u00a0\u00a0 \u00a0\"ton\",\n \u00a0\u00a0 \u00a0\"bridge\",\n \u00a0\u00a0 \u00a0\"hall\",\n \u00a0\u00a0 \u00a0\"ham\",\n \"cote\"\n };\n \n private readonly string[] villageDesc = {\n \u00a0\u00a0 \u00a0\"Village\",\n \u00a0\u00a0 \u00a0\"Hollow\",\n \u00a0\u00a0 \u00a0\"Motte\",\n \u00a0\u00a0 \u00a0\"Crossing\"\n };\n \n private const int PreVillageChance = 3;\n private const int VillageCompoundChance = 2;\n private const int VillageDescChance = 4;\n \n public string GenerateVillageName ()\n {\n \u00a0\u00a0 \u00a0string vName = \"\";\n \u00a0\u00a0 \u00a0\n \u00a0\u00a0 \u00a0if (Random.Range (0, PreVillageChance) == 0) {\n \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0vName += villagePre [Random.Range (0, villagePre.Length)] + \" \";\n \u00a0\u00a0 \u00a0}\n \u00a0\u00a0 \u00a0\n \u00a0\u00a0 \u00a0vName += villageNames [Random.Range (0, villageNames.Length)];\n \u00a0\u00a0 \u00a0\n \u00a0\u00a0 \u00a0if (Random.Range (0, VillageCompoundChance) == 0) {\n \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0vName += villageCompound [Random.Range (0, villageCompound.Length)];\n \u00a0\u00a0 \u00a0}\n \u00a0\u00a0 \u00a0\n \u00a0\u00a0 \u00a0if (Random.Range (0, VillageDescChance) == 0) {\n \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0vName += \" \" + villageDesc [Random.Range (0, villageDesc.Length)];\n \u00a0\u00a0 \u00a0}\n \u00a0\u00a0 \u00a0\n \u00a0\u00a0 \u00a0return vName;\n }<\/pre>\n <p>The arrays of name segments are inspired both by fantasy worlds, and by good-old English town names. There are plenty more in our game (and we had fun thinking them up), but this is just an example.<\/p>\n <p>Whenever a world is generated, the villages on the map are given random names, to add some variety on multiple playthroughs.\u00a0 It also helps with the Mood and Humour judging categories, because it gives the feel of a richer world, and sometimes the generated names can be really funny \ud83d\ude00<\/p>\n <p>There is a lot more random detail generation in our game, see if you can spot all the places we used it!<\/p>\n <p>Play our game, <a href=\"http:\/\/ludumdare.com\/compo\/ludum-dare-33\/?action=preview&amp;uid=11515\" target=\"_blank\">The adventures of the Squire and the Liar<\/a>!<\/p>\n <p><a href=\"http:\/\/ludumdare.com\/compo\/ludum-dare-33\/?action=preview&amp;uid=11515\"><img class=\"aligncenter size-large wp-image-501213\" src=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/09\/screenshot-01-550x344.png\" alt=\"screenshot-01\" width=\"550\" height=\"344\" srcset=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/09\/screenshot-01-300x188.png 300w, http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/09\/screenshot-01-550x344.png 550w, http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/09\/screenshot-01.png 960w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/a><\/p>","time":"September 14th, 2015 3:03 pm","title":"Random shire generation, for added detail"}