Revamped AI for Capture the Flag games

tl;dr There are 6 new CTF playing AI's who all behave differently and I plan on open-sourcing it's code so you can create your own.

Last year I launched Capture the Flag as a new way to play ESDAO. This proved to be extremely popular, so much so that I changed the default game type to Capture the Flag from the Single Hex domination games. Unfortunately the AI player got left behind as it couldn't play Capture the Flag. This affected the 'Battle the AI' single player games in that they couldn't be switched to Capture the Flag and stayed as Single Hex domination games. These games are important as they are a new player's very first experience with ESDAO and so it's critical that they're as fun as possible!

If you're reading this and haven't played ESDAO before, there is a big red 'Battle the AI' button on the home page that launches you straight into a game vs some AI players. You don't have to have registered to play allowing you to just get right in there and play ESDAO without committing to anything.

Back in August 2011 I started updating the AI player to know about Capture the Flag games figuring it would take me about a month - plenty of time I figured as the original AI took me a couple of weekends. It took a bit longer than expected as I've only just rolled it out yesterday, 5 months later. It may appear that work on ESDAO had stalled during this time, but nope, I was just really really busy working on the new AI.

Whats new?

Importantly the 'Battle the AI' games are now a single player Capture the Flag game vs 3 randomly picked AIs which run for a maximum of 25 turns, which should take about 60 minutes for a new player.

The Hex Threat Analysis panel came about when creating the new AI as it needed to know this information.

When starting new CTF games your can now add up to 6 AI players - this means you can create you're own single player Capture the Flag games vs all of them if you wish :-)

I've tweaked a couple of other game settings by increasing the maximum duration to 75 turns and introducing a Massive map size where maps average 55 hexes per player. As a comparison Extra Large maps average 40 hexes per player.

How is it different?

Previously the AI was really more just a fancy script with a fixed playing style based on a friend who I considered the best ESDAO player at the time. It also cheated by starting with more ships, this began happening once everyone could easily beat it as it became predictable. Giving an AI more resources than it's human opponents is not an uncommon thing to have done in a strategy game, but it didn't actually make the AI player any better or teach it new tricks.

Now after reading a bunch of blog posts, articles and select book chapters I've created a basic AI player that doesn't need to cheat and can beat the old AI script that I had been using. Previously it had 5 users registered in the system who all played exactly the same due to the same underly script, where as there are now 6 AI's who all behave slightly differently:

skynet - Extremely fast to expand and very aggressive and high risk taking hal-9000 - Slowish to expand but takes small risks colossus - Defensive, but likes to take risks red-queen - Quick to expand, very aggressive and a high risk taker deep-thought - Quick expanding, slightly defensive and no risk taking marvin - Slow to expand, low aggression and very defensive

This is my first ever attempt at an AI, it's by no means a brilliant player and people who've played ESDAO for a while will likely find it easy to beat - but new players to ESDAO shouldn't.

Watch out though as I will be continuing to work on the AI player, tweaking it etc...

The grand plan

Do you think you can create a better AI than me? Well, I'm planning on letting you do just that.

The 6 new AIs all play differently as they each have a custom set of behaviors that are feed into the new AI application when their turns are done. It is my intention to let you create you own AI with it's own values for these behaviors. How aggressive do you want it? Focus on expansion or defense? What level of importance to place on enemy hexes? lots as it's an Industry 9 or because it has heaps of ships in it etc... You'll get to test it out in your own single player games and then when it's ready for the limelight others will be able to play against it too. You could even pit your AI against your friend's AI.

Create and run your own AI

I have written this new AI as a stand-alone NodeJS application as I plan to open-source it. You'll can either fork it and tweak the code or use it as an example and create your own from scratch talking to the ESDAO API. Yep the ESDAO Server has a full API for doing turns - building stargates, moving ships, looking at previous turns etc... Additionally I've tested the AI running under the a free Heroku account and it works just fine.

Releasing the new AI has been the first step towards this grand plan. There is still a bunch of work todo before it fully realised so, as they say, stay tuned.

2012-01-15 07:00AM — #capture-the-flag #ai
blog comments powered by Disqus