I’ve always liked the board game Carcassonne — simple mechanics, but surprisingly deep strategy.
A while back I started tinkering with the idea of building something similar that could be played easily in a browser with friends. That side project eventually turned into TileLord — a small web game where you can play Carcassonne online free with bots or friends, no installs needed.
Why I wanted to build it
There aren't many online versions, it's either old Desktop apps or pay-up-front official apps. So I started building an open, Carcassonne game alternative that follows the same core rules
It’s not the official game (and isn’t affiliated with it), but it scratches the same strategic itch.
Under the hood
- Frontend: React + PixiJS for tile rendering and UI
- Backend: Node.js + Socket.io for multiplayer state sync
- Hosting: Cloudflare, curretnly still on free tier:)
Hard things
Extending game engine
The base rules are simple, but once you start adding expansions (like Inns & Cathedrals, River, Abbots, Farmers, etc.), the logic tree gets messy.
Each feature can affect multiple parts of the scoring or tile-placement rules. I ended up refactoring the entire engine 3 times to add abstraction layers one on top of each other (eg. multi-tile buildings instead of per-tile features).
AI Bot heuristics
Deciding where to place a tile, and where to place a follower, isn't as simple as eg. tic-tac-toe solver. You have to account for how many followers you still have, how many open edges of a building, defensibility of your buildings, trying to merge (attack) with other larger buildings, trying to "trap" enemies so they can't complete their cities, calculate what's the chance required tile will be drawn, etc. Many rules/weights that need to be tuned, and additional complexity arises when you add expansions into the base game.
Bot optimizations
At first it just brute-forced every legal move, deep-copying the full board to estimate the diff in value (which can be score, trapped follower, etc) for each move. But after >50 placed tiles, such algo takes quite some time, up to a point where you are waiting 20+ seconds for a bot move.
By adding just a state diff and rollbacks (placing/removing followers or tiles), bots required an order of magnitude less compute time.
Current state & whats next
Right now, TileLord supports all the base rules plus several expansions. Multiplayer, Replay mode, AI bots, and mobile browser play are all working.
I plan to add additional expansions (major and mini ones), beginner tutorials, game/turn analysis, better difficulty tuning for AI, and more!
PS. We're hiring!
Top comments (0)