Terra Mystica

I’ve completed a touch table conversion of the board game Terra Mystica. In this game, players lead a faction in a race to terraform and settle the map. Each faction is unique with different costs for building, abilities and desires for terrain type. These differences along with random bonus tiles makes every game different without any luck or hidden information.


I wrote the game using the Unity game engine and our timeline event system. This game wasn’t as complicated as Caverna, but there were some tricky bits involving the terraforming rules. Getting all the unique faction abilities drawing and working was another challenging part of this conversion.

As always, I found it was well worth the effort needed to add a save/load/undo system to the game. It saves so much time during development to be able to quickly get the game into the desired state. This game was particularly challenging to test because of the fourteen distinct factions. A single game couldn’t have all the factions represented, so I ended up playing though more games than usual, and I still missed quite a few faction-specific bugs.

I don’t expect the touch table to save a lot of time beyond setup and teardown for this game. The players can’t perform actions in parallel like in Caverna and there isn’t a lot of extra information that I can show like Puerto Rico. However, it is very easy to forget things in the board game: Income and victory points come from four or five different sources, so it is easy to miss something. There are also quite a few pieces for each player that need to be setup at the beginning of the game. Overall, I expect the touch table version to save about 30 minutes per play and reduce mistakes.

One problem with the original board game is that the factions didn’t end up being very well balanced. With fourteen unique factions that have significant differences, it is very difficult to balance them so that there isn’t a big advantage or disadvantage. There is a web version of Terra Mystica that has been played thousands of times by players online. People have gathered statistics from those games and found significant differences between the best and worst factions. In a game with a final score of ~100, the best faction averages 15 points more than the worst.

In the touch table version, I’ve included the option to handicap the factions with victory points or extra income. I’ve also included strategy guides for each faction within the game so that the players can look up information about how good players play that faction.

Another feature that I added to the touch version is help for choosing factions. Some factions are better or worse when certain bonus or round tiles are out and when other factions have already been chosen. At the beginning of the game, I summarize all this information (gleaned from online strategy guides) to make it easier for the players to choose strong factions for the game.


This screen is displayed when a player is picking their faction. Each faction is listed with its handicap and a guide to advantages and disadvantages to picking that faction. There are some random differences in the setup of each game that can give certain factions an advantage and this screen summarizes those factors.


After the players have chosen their faction, they select starting positions on the map. This screen helps the players choose by displaying the cost to terraform each hex and labeling the most popular starting locations for their faction.

This game took about 120 hours to create. That makes it a large project, but Caverna and Le Havre were both larger.

Game Script Other Total Hours
Yacht 2218 0 2218 ?
Le Havre 5117 1161 6278 150
Vegas Showdown 4209 110 4319 80
Caverna 9544 1298 10842
(plus scenes)
Terra Mystica 7938  953 8891
(plus scenes)

Unity hides quite a few lines of code in it’s scenes and prefabs. These hold the GUI positions, sizes, settings, colors, layout rules, etc. To get an estimate of the amount of code that would be, I look at the number of hours I spent writing the script code compared to the hours spent in Unity. For this game, I spent 57 hours writing the scripts, 48 hours in Unity (includes testing time), 7 hours in Photoshop and 8 hours doing pen and paper design.

So I estimate an effective 13000 lines of code. Now that I’ve written a few games in Unity, I’m starting to see a decent amount of reused code between projects. I’d guess that about 750 of the lines are copied from other projects.

I’d also like to mention again how nice the C# Linq extension methods are. I’m writing about 1/2 or even 1/3 of the for loops that I used to write and replacing them with one line linq statements.

// Linq
return Favors.Sum(f => f.Bonuses.Sum(b => b.Type == Ability.AbilityType.INCOME && b.IncomeType == type ? b.Amount : 0));

// Old
int sum = 0;
for ( int f=0; f<Favors.Count; ++f)
for (int b=0; b<Favors[f].Bonuses.Count; ++b)
if ( Favors[b].Bonuses[b].Type == Ability.AbilityType.INCOME && Favors[b].Bonuses[b].Type.IncomeType == type )
sum+= Favors[b].Bonuses[b].Amount;
return sum;
// Linq
return towns.Where(town => mustFoundTown(player, town));

// Old
List<Town> retList= new List<Town>();
foreach ( Town town in towns )
if ( mustFoundTown(player, town) )
return retList;

4 thoughts on “Terra Mystica”

  1. This is truly some amazing work and love the fact that you added help to see which factions is more advantageous at certain moments.
    Terra mystica is a great game but this would make it alot easier to play.
    Is there a way to get this program?

    1. I can’t distribute the game since I don’t have permission from the publisher who has the copyright.

      I’ve had really bad luck at getting permission to even give away copies of my board game conversions. Most publishers see it as a threat to physical sales or as a conflict with their iPad licensing agreement. But I don’t think I even asked for Terra Mystica. I think that the U.S. publisher is Z-Man games, so I’ll send them an email asking for a license to distribute. I’ll update this post when I hear back and I’ll email you direct if I do get permission.

Leave a Reply