Wednesday 20 June 2012

Random Territory Name Generator

I decided to add a bit of pizazz to the game.  I haven't had much time lately to work on the game, so I decided to add a nice simple feature that will add a bit of charm to the game.  I've created an algorithm for generating random territory names!

My ultimate goal is to create a map editor with the game and allow users to share their maps with other players.  Better still, if the random map generator creates a particularly good map, you can share it with other users.  As part of this, I thought it would be nice to give each territory a name.  That way, if you wanted to recreate the Risk map, you could actually ensure the wobbly bit on the right is labelled "Kamchatka".

For the randomly generated maps, I wanted some randomly generated names.  My first thought was just to create a random group of letters.  After a little hunting on the net, however, I found this wiki page: List of generic forms in place names in the United Kingdom and Ireland.  This is a great list that shows the root word origin for a lot of common UK place names - Toponymy as the cool kids call it.

This list breaks out the common parts of many places names.  I knew a few of these - "Chester" comes from the Latin word for Camp.  "Bourne" is the place where a river starts.  It also had heaps of other ones - "bre" for hill, "combe" for valley and "drum" for ridge.

I pulled out the list and came up with an algorithm that randomly concatenates two elements from this list.  Below are some cool names it generated:

  • Drumcott
  • Kilham
  • Pitness
  • Tarnstow
  • WinTilly

They all sound suitably British and perfect for my fantasy game!

I can now display to the user that they've built a castle in Kilham, rather than just that forest territory on the left!  Simple, but 5% more charming!





No comments:

Post a Comment