Skip to main content
1 of 2

I read up an answer on these board about this, I tried to search for the link it because it was more detailed, but I couldnt find it back. to give you a summary about it : it was about how AI decide where to build town in Civ game. I'm not sure what a CoC game looks like, but since its resources base it should be similar.

You just basicly build a basic town placement AI. When you generate a map, you give a startingValue integer to each "square" or hexagone, or however you split your map. You recalculate to adjust the value whenever a player makes a new town, or "spawn"

You have to determine what gives a good value to a starting location, and give it an score. to be fair, spawn to player at locations with similar score, even if the resources differs, as long as the total point is similar, it should be fair.

close to a gold mine = +5 points

distance to nearest enemy > 5 = +3

on water's edge (port, fishing, etc ) +3

close to XXX luxury resources = 2 points

close to food resources = 8 points.

...

Now just decide how you want to spawn your player, and what you consider to be fair.

Ex : You have 3 player, you spawn them on locations with 10,11 and 11 points, even if you have 2 other location worth 15 points, since it wouldn't be fair to the third player.