Browsed by
Category: Uncategorized

Building Camelot the Build #5

Building Camelot the Build #5


Now that the boring AI stuff is done, I can move onto the pretty things! This week I’ve been overhauling the game’s user interface from the ground-up! I was never very pleased with my first attempt at the UI (it was meant as more of a placeholder anyway), so I’m glad the more important stuff is out the way so I can finally focus on prettying up the game.


I think it’s a huge improvement! There are also tonnes of new animations to accompany the new UI.


As far as the UI goes, there are a few more things to do- the game over screen where each loosing player will be executed by Gawain, and a few multiplayer specific elements.


Since I’ve last posted I’ve also been working a lot on the sound- I’ve created a sound effect for every individual building as well as lots of pleasant UI sounds to accompany the gameplay. Expect to hear the sounds of butchers butchering, swords swinging, baths being run and weavers weaving as you build.


Although not visible in these screenshots, I’ve moved the ‘end turn’ button to the bottom right instead of the bottom left. Instead, the ‘undo’ button occupies the bottom left space. This feels more natural as the bottom right is a natural ‘final’ positioning- if you think of it like a book, you would end up here before turning the page. The same principle applies in design.



Next on the agenda: Bug fixing. AI tweaks. Tile graphical tweaks. Multiplayer testing.

See you soon!

Building Camelot the Build #4

Building Camelot the Build #4


So there’s been a bit of a break with the dev blog entries lately. My reasoning is I’ve been reworking the AI from the ground up- and as I’ve talked about a lot of what I wanted to include in previous posts, I didn’t really want to repeat myself. Especially because it’s very difficult to show you the AI changes in visual form.

So in the last post I ended up with a semi-competent AI that was perhaps passable at best. Not really good enough. Also it was slow. Too slow. It paused the game while it thought, even on the PC version- and the sheer amount of calculations it had to do meant it would be a very tricky convert to mobile devices.

So I re-built everything from the ground up, with the aim of not only making it better, but making it much, much more efficient. I’m happy to say I’m 90% of the way there now- I’ve got a much more functional AI which is fast and most importantly, doesn’t pause the game and can run on mobile platforms! At the time of writing there are still some bugs to sort out regarding garden tiles and the end game, but I’m confident I can tackle these.

So for the really hardcore development fans out there- in the rest of the blog entry I’m going to post my detailed explanation of exactly what’s going on with the AI:

So when the AI begins it’s turn it starts to run through each possible combination of tiles it can lay in every position. This is often a huge number- especially at the start when it can be in the region of 20,000+ different combinations depending on what tiles it has. That’s why in the first iteration the game paused for a while processing them all.

So to get around this I’ve made it more efficient by giving it some basic rules to cut down the number of calculations it should proccess. If there is between 95-40% of the game left the AI will only anylise plays which are next to existing placed tiles. This cuts down on the combinations a huge amount. When there is 40% of the game left (60% of the tiles have been placed), the number of different combinations across the whole board is managable.

When the AI has gathered all the combinations of plays it can make, it has to rank them. It basically just puts all the combinations into a list, assigns them a score, the combination with the highest score is the one played.

This is currently how it determins the score:

((total tile score * tile multiplier) + (adjacent score * adjacent multiplier) + (double score bonus * double score bonus multiplier)) * scoring multiplier )
– ((total tile potential * potential multiplier) * (1 – game completion percentage/100))
– (next player scoring opportunity * next player multiplier)
– (2nd next player scoring opportunity * 2nd next player multiplier)
– (3rd next player scoring opportunity * 3rd next player multiplier)
+ (play blocking value * play blocking multiplier)

= ranking score

Here are the variables explained:

Total tile score; the total red score from just the tiles in this combination.

Tile multiplier; a variable we can use to tell the AI how to value the score on the tiles. In testing I have this at 100.

Adjacent score; the total points from adjacent tiles this combination gets.

Adjacent multiplier; a variable we can use to tell the AI how to value points gained from adjacent tiles. It’s useful to have this high compared to the others so it chooses ‘good value’ plays. In testing I have this at 300.

Double score bonus; the score multiplier that is applied if the combination features 3 end to end tiles. This is actually just 0 or 1 * the existing combination score (seeing as you either get it or not).

Double score bonus multiplier; a variable used to tell the AI how to value the double score. I’ve got this set at 100 in testing.

Scoring multiplier; a variable used to tell the AI how much to value scoring points. This is like a master variable for all of the above.

Total tile potential; because certain tiles are more ‘valuable’ than simply their score in red, I’ve implemented a variable (unseen to the player ofcourse) to determin the scoring potential of a tile. Without this the AI would just play garden tiles like they were wall pieces for example.

I’m still experimenting with the rankings, but they are supposed to represent the maximum scoring potential of the tile in relation to how common they are, and their positioning on the board. Here they are currently:

2 pnt corner- 10
3 pnt corner- 15
Blank wall- 0
Blank ground- 5
Garden- 100
1pnt wall tiles- 0
Scriptorium- 30
Round table- 50
Goblet – 50
Chapel – 40
Small Halls – 20
Great hall corner- 10
Great hall wall- 10
Uther Pen Dragon- 30
Dragon Banner- 40
Throne- 40
Excalibur- 50
Fireplace – 90
Wall inside corner – 5
Gates – 10

Furthermore though, I found this value needs to be less important as the game goes on. This is because at the start of the game every tile has it’s biggest chance to achieve it’s maximum scoring potential. As the game goes on it becomes less relevent, because as the tiles are filled in the chances that a tile can achieve it’s max scoring potential is reduced.

So to reflect this, I’ve made it so this value becomes less important in the equation as the game progresses like so:


Potential multiplier; a variable used to tell the AI how to value the potential. I’ve got this set at 60 in testing. I could just set the above tile rankings lower, but this allows me to easily adjust them all while keeping their ratio to each other the same (which is the important part).

Next/2nd Next/3rd Next player scoring opporunity; The AI will look at the hands of the following players and anylise how many points they can score from the current combination, if placed.

Next/2nd Next/3rd Next player multiplier; I’ve got a seperate multiplier for each following player here. I’ve given a higher weight to the immediately following player, with quickly declining weights given to the others- as obviously at this stage we don’t know what will be played inbetween those turns. In testing I’ve got next player at 100, 2nd at 50, 3rd at 20.

Play blocking value; This is how the AI attempts to block high scoring plays. It looks at the hand of the other players, and generates a ‘heatmap’ of the remaining board. This heatmap represents possible high scoring plays for the other players. The value on the heatmap for the spaces in the combination  is added to the ranking. It’s still quite a basic representation of the opponent’s high scoring tiles- it doesn’t take into account most of the variables above as this would require anylising through up to 3 turns worth of additional combinations.

Play blocking multiplier; A value to tell the AI how much to value play blocking. I have this at 160 in testing.

So that’s a detailed breakdown of how the new AI works. It might be hard to get your head around but I figured I might as well share this with you guys if you wanted to try!

Building Camelot The Build #3

Building Camelot The Build #3


I’m writing this having just completed my first attempt at implementing AI. It’s working! Mostly! How often is it beating me at the game? Sometimes. It’s not dominating, but it’s rarely far behind in terms of points. It has beaten me a few times although the lucky bugger did get the better tiles! I am not a Camelot The Build pro though, or even much of a competent player myself, so it remains to be seen how good this ai really is. I don’t expect it will ever be able to challenge the best players of this game. Camelot requires more cunning than I am capable of squeezing out of the math operations which currently make up it’s brain.

I talked a little about what I was planning to do a few weeks back, but I’ll go into detail about what I ended up with.

First off, last time I said that making it calculate all the highest scoring places to put it’s tiles was going to be straightforward. Nope. I wasn’t thinking about how the scoring system of the game gives points from adjacent tiles, gardens or the score doubling. This made things much more complicated and actually was the hardest part of the whole thing. The rest of the ideas I had last time made it in though.

In a nutshell, the AI analyses all it’s possible plays and effectively makes a pros/cons list for each one. If an actual human attempted this it would lead to an incredibly boring and drawn out game, but computers tend to be pretty quick at this sort of thing when numbers are involved! Although currently not quick enough, as there are hundreds of potential plays near the start of the game and it takes a little time to calculate– something I’ll be working to refine in the coming weeks.


The pro column consists of the total score it can get this turn, and that’s pretty much it. Simple. I’ve added a little incentive to score off of already placed tiles though- these plays will weigh higher in it’s decision making process.

The cons column is a little more complicated and consists of 1) how much potential there is for an opponent to score from the tiles it’s just played, and 2) the perceived ‘worth/future scoring potential’ of the tiles it’s using.

1) counts up the probability of the opponents having the surrounding tiles and combines that with the points they can get from the tiles it can put down. This was an attempt to stop it from playing it’s most valuable tiles right away for it’s opponents to play off (although in some situations it still does play them fairly early because it decides the points it will get is ‘worth it’). This is a tricky balance to get right I am finding. If I make this variable too conservative, the ai will pass on some opportunities to score massive points which may not be there in later turns. Too aggressive means it will lay down it’s highest scoring tiles at times where an opponent can get a similar or better score by using average tiles.

2) This is something I came up with after I found the AI frequently wasted it’s garden tiles where it could of just used an empty tile. It’s reasoning was that garden tiles are worth 1 where empty tiles are worth 0, so to get the most points this turn I’ll use that garden now (even though the garden wasn’t being used to it’s full potential by scoring off diagonal tiles). So I had to come up with a system, separate to the points in red, that gave value to special tiles like the garden tile. This is a value assigned to each tile based on it’s worth, I guess in essence this is it’s maximum scoring potential. At the start of the game this value is at it’s maximum because there is the biggest chance it can be used to it’s full potential at some point in the game. This value is dropped as the game progresses because that chance lowers. This value is part of the ‘cons’ list, so it will count against it in the decision making process. This ensures tiles like the garden tile will only be played when it can score enough points to ‘overcome/justify’ this value.

I hope all that makes some kind of sense. In the next dev blog I should be telling you about how the presentation is progressing as well as improvements to the AI.

Building Camelot The Build #2

Building Camelot The Build #2


Hello once again everybody, I hope you are all having a great week. Here’s part #2 of my Camelot The Build development blog, a board-to-digital conversion I am doing with Wotan Games.


The main difference since last time, as you might notice, is the scoring is more or less completely working now. The counters at the top show how many points the tile placed is worth (red), how many points it gains from surrounding tiles (brown/green icon), then the total for that tile (blue). There are three sets of these, representing the 3 tiles a player can place on their turn, then finally the accumulated total with an indicator to tell the player whether the score is doubled from placing 3 tiles end-to-end.


The game is progressing well, and I would estimate I am nearing the half way mark to total completion. We have the game in more or less a completely playable state, albeit with just local hotseat players. The next step I think is to add in some AI- basic at first, but something I can build on and make more complex over the course of the rest of the project.

So, this week I’ve been planning and working out how a computer can play Camelot The Build. It’s probably one of the more challenging tasks of this project- my others games up until now have not had AI with big decisions to make. This is completely different…

At time of writing I am about to implement my first ideas on how this could work. What needs to be done initially is have the ai calculate high scoring positions for it’s three tiles.  This should be fairly straightforward, and just involve looping through all the possible tile locations and combinations. I’m not sure having it scan every combination is viable, and I could end up having ai with harder difficulty settings scan more combinations than an ai on an easier setting. So I will likely build a system that calculates obvious places first- using high scoring tiles (placed or in-hand) to start the analysis.

But Camelot The Build has more strategic depth than just laying the tiles with the highest score of course. We also need the ai to be wary about other players scoring off it’s placed tiles and getting more value out of them than it did. This is where things are going to get complicated! It needs to take into account the free spaces around the tiles it wants to lay by having a rough idea of the probability that the other player(s) have a tile that will score off it. This obviously needs to be more of a priority for high scoring tiles than low ones.

So, with all that in mind, I’m going to build a system where the ai assigns a value to each combination of tiles it could play. This value will consist of the number of points it can get this turn with that combination minus the risk (amount of game points + probability that other plays can score off it). Then it will order that list, and the combination of tiles with the highest value is the one it chooses. Done!

There are lots of different variables I can plug into this. Stuff like the aforementioned number of combinations it checks, how aggressively it wants to score points vs how much it wants to keep others from scoring etc. I might even make it able to screw up it’s maths a little!

There’s also the issue of the last tile being played counting double against you. This is probably something I’ll implement later- I just want to get the basics working for now. But this is going to have to be incorporated into the decision making process at some point.


The weird thing about developing all this is that I won’t know how effective it is until I’ve completed the system. Which is very unusual for me, as I usually get to see how well stuff is working as I’m making it.

So in my next update I’ll hopefully be telling you how badly my ai is beating me at the game!