Random shire generation, for added detail

In The adventures of the Squire and the Liar, you’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’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!

random town generation-s

Wouldn’t you just love to visit the famous ‘Amusing Bridge’ in Trumpcote?

The code to do this is really simple!

private readonly string[] villagePre = {
     "North",
     "South",
     "New",
     "Old"
 };
 
 private readonly string[] villageNames = {
     "Axe",
     "Raven",
     "Trump",
     "Beer",
     "Cringe"
 };
 
 private readonly string[] villageCompound = {
     "ton",
     "bridge",
     "hall",
     "ham",
 "cote"
 };
 
 private readonly string[] villageDesc = {
     "Village",
     "Hollow",
     "Motte",
     "Crossing"
 };
 
 private const int PreVillageChance = 3;
 private const int VillageCompoundChance = 2;
 private const int VillageDescChance = 4;
 
 public string GenerateVillageName ()
 {
     string vName = "";
     
     if (Random.Range (0, PreVillageChance) == 0) {
         vName += villagePre [Random.Range (0, villagePre.Length)] + " ";
     }
     
     vName += villageNames [Random.Range (0, villageNames.Length)];
     
     if (Random.Range (0, VillageCompoundChance) == 0) {
         vName += villageCompound [Random.Range (0, villageCompound.Length)];
     }
     
     if (Random.Range (0, VillageDescChance) == 0) {
         vName += " " + villageDesc [Random.Range (0, villageDesc.Length)];
     }
     
     return vName;
 }

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.

Whenever a world is generated, the villages on the map are given random names, to add some variety on multiple playthroughs.  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 😀

There is a lot more random detail generation in our game, see if you can spot all the places we used it!

Play our game, The adventures of the Squire and the Liar!

screenshot-01