Phantom Blog

sidenav_top
Phantom Blog Logo

The Phantom EFX Blog gives you an inside look at what we do. From the process of making our games, to a closer look at the various departments within the company, following the blog will give you help you learn more about the people who make the games you love.

Subscribe to the blog

Phantom EFX on Twitter

Follow Phantom EFX on Twitter

artical

Inside Battle Slots: 8monkey Labs Engineer Andres Reinot

Apr 5th, 2011

Share |

Posted By Emma Peterson

Intelligent Battle Slots 
Effective gambling strategies for the modern monster.

My name is Andres Reinot and I form the other 50% of the 8monkey Labs engineering team. Last week Mr. Jeff Russell gave a synopsis of what it means to develop games.  Having not read it (I am very busy), I will assume it was a thorough look at software engineering today: standards and practices (probably several semesters-worth of college credit, knowing Jeff).  Now with you all caught up to speed on the basics, I am going to dive right into one of the more interesting aspects of Battle Slots: the part I worked on.

The Battle Slots Artificial Intelligence (AI) was a fun and new aspect of game-making for me.  It was my first real crack at writing AI and I was lucky enough to have time to try different things and learn as I went along.

First, some Battle Slots basics:  in the battle portion of Battle Slots, two warriors face each other and dish out hurt by means of spells and attacks (collectively referred to as Combat Techniques).  Spells need Mana to cast and attacks Attack Points to invoke.  Spinning the slot machine generates Mana and Attack points much as a real slot machine would pay out casino tokens.

My goal was to write a single AI routine that would work for all monsters in the game, regardless of what techniques were assigned to it.  Since the monsters were constantly being changed, their techniques balanced and tweaked by the designer, it was important for the AI system to be flexible.  And because the game called for hundreds of unique monsters and close to 600 monster techniques, the AI needed to be general-purpose, one size fits all.

Jeff and I talked about writing "The Perfect AI", one that would compute the cost-effectiveness of every technique, predict slot machine payout improvements of spells that modify slot machine odds, and basically pick the all-around Optimal-with-a-capital-O course of action.  But it was quickly decided this would be difficult to write and boring to fight against as a player. Of those nearly 600 monster techniques, many would be deemed "less than optimal" and would never get cast by the AI.  We wanted the monsters to use all their given techniques for the sake of variety and the creative flare the designer was trying to add to the world of Battle Slots.  If the Werewolf King has a Howl at Moon technique, why shouldn't he use it?

The approach I finally settled on was to pick a technique randomly from the monster's arsenal and force variety as much as possible.  Because picking a truly random technique led to some overly-obvious random behavior (healing when not necessary, not attacking when damage buffs are active etc.), the techniques were first very broadly categorized and random ones were pulled from the appropriate category.

The AI that ended up shipping in Battle Slots works as follows:
1.  Categorize the monster's techniques into 3 broad categories of: Heal, Buff, and Attack. 
2.  Choose a category based on the current state of the monster and it's enemy
3. From the category, pick a random technique to cast; preferably something new and interesting.

Healing techniques are ones that give the monster more health points, Attack techniques ones that take health points away from the opponent, and Buff  techniques are any that provide a bonus on damage dealt, damage resisted, or slot machine payouts, odds, etc.  Anything that will give the monster an upper hand against its foe for the next few turns was considered a Buff.

Part of me wants to continue writing a smarter Battle Slots AI and part of me wants to develop The Perfect AI.  However, in game development simple-and-effective almost always trumps lofty engineering goals.  Maybe for Battle Slots 2...

 

For more on Battle Slots be sure to check out these recent links from www.BattleSlots.net:

The Lore of the Croc Men

The Power of the Croc Man Warrior

The Lore of the Waters

The Waters of Tellus