I believe you can measure the success of an open source project with the number of issues it receives. Mine received one yesterday, for a grand total of one issue. This is infinitely higher than the number I had before, so I call that a huge success! Thank you, Brojamin!

After fixing that silly bug, I set on to make recruiting new soldiers a possibility. I really didn't like the interface I had, so the first thing I did was to spend a lot of time making it better. I got my inspiration from Travian Kingdoms — a game I do not recommend to play, it's a huge time killer, like a black hole that absorbs all the free time you have, and more. With a zest of CSS grid, some flexbox magic, and a touch of box-shadow, here's what that new military building interface ended up looking like:

That was cool, but those buttons still weren't doing anything. So I then worked on actually recruiting them soldiers. I got thinking about the data structure, wanted to do some optimizations, to add some cool features, but then I realized that I should just build it the simplest possible way. So, I added a queue to military buildings. When you recruit a new unit, you pay its cost, then add an object to the queue, with the soldier type and the number of turns it takes to train it. On each end of turn, I look at all the queues, take the first item, decrement its number of turns. If that number falls down to zero, the item is removed from the stack, and a new soldier of that item's type is added to the army.

I'm glad I didn't fall into the trap of making it a complicated feature. This was simple but very efficient. You train soldiers in the order you recruited them. It is going to be a tad difficult to properly show on screen, but I think that's fine.

Now, guess what? You can actually compete against those silly demons! Your army can grow! Look at this:

In a game like this one, it's important to have proper information, so that you can make good decisions. Knowing exactly what a military building is doing is thus very important, so I spent my early afternoon adding that data to the UI. That means more information: how many soldiers are enqueued, which one is the next coming up and when, what exactly are soldiers worth, etc. I added icons, I tried to make it pretty, I made space for the (hopefully) forthcoming soldier icons, and voilà:

You'll note that I also restricted the type of soldiers you can train based on the level of your building. You'll need to get your barracks to the 3rd level before you can start recruiting those Veterans.

At that point, I felt it was time to start on the next big feature: the world map. Remember, you're supposed to be able to conquer new space and build new villages, ever increasing your production and your army, until you can defeat the Demon Boss. So I got myself thinking about how to implement that. That wasn't easy, as it raised a lot of questions: how do you conquer a new village, what does a village start with, how do you share resources between villages, do you have one global army or one per village, how do you handle food, etc.

I was past the half-way point of my Solo Game Jam, so I had to make that as simple as I could, while still being challenging and fun. So I made a bunch of decisions, and started coding on a world map. I split the app into screens, one for the World map and one for the Village view. They both show the same map structure, but the World map is filled with demon camps, and one human village. Each demon camp has a strength: when your army is ready, you'll be able to send it against a camp adjacent to one of your villages to start a special fight. If you win, you'll claim the new tile and it will become another village for you to build. Well, eventually it will, because I am not there yet. But take a look at the game at that point:

After that, I spent a long time refactoring data structures to make them work with the new world order. Instead of having one village map and one resources stack, I had to have one village per conquered tile, and one resources stack per village. Except for food, which became its own global resource, shared across all villages. That work is not splashy, there's no new UI to show, but it was needed and it's going to allow the next steps: conquering new tiles and building new villages!

Gosh! Every day is longer than the last: today I worked approximately 9 hours! But I'm very happy about the game at this point: it's actually starting to feel like a game, with some challenge and some decisions. It's lacking a victory condition though, and some key features are still missing. Well that's good because I wouldn't want to be bored during the remaining two days!

The code is pushed to my GitHub repository, adngdb/village-builder, and you can play today's build here: Play Village Builder - Day 3 Build. I hope you'll enjoy it!

/me goes to dream about conquest and demon blood.