Castles!

Please note the live castles page is currently broken. I'm not sure when it will be fixed but hopefully sometime in the near future!

I remember being sat in my front room last year when my flatmate invited me to play a game on his phone. It was a simple game, part of a '50-games-in-one-app' app, but it was so engaging and had so much room for genuinely tactical play that I was stunned nobody had made a more fleshed out, standalone version. It was simply titled 'castles', and the name has stuck.
The game consisted of a map of nodes, connected with some edges. At the start each player controls one node, indicated by the node having the player's color. Nodes owned by players would grow over time, their 'mass' increasing. Players can then tap adjacent edges and cause the node to split off half of its mass and send it down the edge to the other connected node. If the marching mass has more mass than the node it is attacking, it takes the node and claims it for the player. The aim then is world domination, naturally.

I wanted to create a desktop version of the game, fleshed out with a browser-based client and more features. I started out by building the game using exclusively p5.js and a node.js backend server, using socket.io to communicate between clients and the server. I implemented all of the general gameplay mechanics you would need for an MVP: map generation, node growth and splitting, capturing enemy nodes etc. My troubles started as soon as I had to focus on client user interfacing. The site was a static html file with a p5 canvas rendering the game. I tried implementing a rudimentary login interface using buttons and input fields, but quickly realised I needed a more powerful framework to do exactly what I wanted.

I had been planning to learn React for some time by this point, and this seemed like a good time to start. I installed the framework and worked on some of the 'Hello World' projects before setting off on my own to build a unique web app. After much work and some serious spaghetti code I got a basic example demo up and running. There are however a lot of bugs with the project, and as it is currently published you can't actually play it.

I plan to migrate the whole thing once more - this time into the Unity engine - and have one more crack at creating the game.