I’m happy to finally announce that the second major update to Automata Empire is live!
While I originally intended to complete this update within a few weeks, it took 2 months. The update ended up being particularly large because of the scope of the changes I made to the enemy’s AI, making it much more strategic while also making Hard difficulty harder and Easy difficulty easier. It took 2 complete rewrites of the AI code to get it right. I’ll explain in more detail at the bottom of this post. I also spent the last several weeks doing major performance overhauls to eliminate lag when there are thousands of monsters moving around the screen, which will be especially important for multiplayer.
Here’s what’s new in this update:
- added a fourth “Challenging” difficulty option
- improved difficulty scaling so Easy is easier and Hard is harder
- AI is more strategic about achieving primary objectives in each game type
- AI uses A* path planning to build more intelligent road routes
- AI is capable of rebuilding missing or destroyed roads
- AI builds defensive walls around its taverns, castles, and flags
- AI counterattacks nearby threats to its bases
- AI stops moving units out of a tavern if its population gets too low
- AI can reinforce underpopulated taverns
- AI chooses better locations for taverns, catapults, armorers, and arsenals
- undead spawn rate increases with game difficulty
- adjusted rules for monsters’ death by overpopulation so it happens less frequently
- made camera scrolling smoother
- added 50 new monster voice clips
- added sound effects for mouse clicks and building placement/construction
- achievement for exclusively controlling all 3 zones in King of the Plateau now awarded correctly
- fixed bug where monsters announced when enemy castles were under attack too
- players can no longer destroy their own flag capture zones in Capture the Flag
- catapulting monsters into an enemy catapult now deals it double damage too
- improved level load times
- improved the precision of each turn’s duration
- many, many framerate and memory optimizations to reduce lag
- game no longer uses gigabytes of memory if left running for hours
- fixed several rare bugs that caused game to freeze or crash
Multiplayer
Now that the singleplayer AI is much smarter, the game runs much smoother, and my replacement computer is built, I’m finally free to finish multiplayer. Based on the feedback I was getting from players, these issues seemed more important to fix before releasing multiplayer, especially streamlining the game’s performance. I’ll need a few days to catch up with personal responsibilities that I’ve been ignoring since the game launched, but then I’ll be fully committed to completing multiplayer and further performance improvements. A lot of the remaining work is in the user interface: letting people play with their Steam friends, giving people control over who can join the match, adding error messages for every conceivable connection problem, handling when players leave matches or get disconnected from the game, and making sure the server list scrolls and updates properly when there are lots of open games. I don’t know how long this will take so I can’t promise a specific completion date yet. Plus, after my computer fire before launch and a 7000 acre wildfire came within a few miles of my apartment this month, I’m wary of more unscheduled misfortunes in the future.
AI: Behind the Scenes
For those who are interested in a behind the scenes look at the game development process, I wanted to go into further detail on the story of the game’s AI. While I was working on multiplayer a week before the game launched, I realized I needed to add construction timers for the buildings to compensate for the amount of time it takes to send that info to another player’s computer. Previously, you’d click on the screen to build a tavern and it would instantly appear fully built, immediately killing 6 monsters for its cost. But in multiplayer, it might build on Day 35 on your computer and Day 36 on the other player’s computer. In a normal RTS, this isn’t a huge problem. But in a deterministic cellular automata simulation, if even one monster turns left instead of right it creates a massive butterfly effect of changes between the two players’ games over time. We realized this during testing when we both started gloating about our victory in a 1v1 multiplayer match. Our game worlds had diverged in a way that allowed us both to win on our own computers.
The solution was to add a construction timer to delay when a building was placed on the grid, allowing time to synchronize it on each computer. Unfortunately, I wasn’t able to implement the construction timer until 2 days before the game’s scheduled launch date. While I got it working in time, the AI was designed with the expectation that every building it placed would build immediately. With the delay of the construction timer, now units might move out of range before the timer ended, causing the building to despawn. This was especially a problem with the AI’s roads. A few roads in the chain might not complete and the AI had no way of knowing to rebuild them. Delaying the launch date wasn’t an option so unfortunately the game launched with these AI issues making it much less competent than it had been just a few days earlier.
Rather than apply some quick fixes, I wanted to replace the entirety of the AI’s logic and rebuild something more versatile that was capable of macro strategy. That took several complete rewrites of the AI code before everything finally came together, but I’m very pleased with the results. I think it’s going to be a lot better at putting up a fight against skilled players and I definitely enjoy watching the AI battle itself in Autoplay mode a lot more. I’d like to continue improving the AI by giving it more capacity for strategic foresight and cooperation with other losing players to block the leading player’s victory, but those further improvements will have to wait until after multiplayer is live.
I hope you enjoy playing against the new AI and feel free to let me know what you think of it on the Steam forum. If you’re interested in getting more frequent progress updates on the game’s development, along with screenshots of funny bugs, follow @Nonadecimal on twitter too.