The game
Springblades is an action RPG where you battle your way through a fantasy island filled with funny characters. Time your attacks and dodge enemy blows in exhilarating battles. Fight beehives, dragons and ordinary peasants on your epic quest to find 3 mysterious gems. You can find more about this game in the steam Springblades page.
The battles are turn based like in many other games of the genre. Each victory will give you gold, experience and sometimes gear for your hero. As your journey progress through the fantasy world, your character levels up and becomes much stronger, which lets you reach harder, more advance areas of the world.

Making a bot
While the game is fun, the turn based dialog can be a bit slow once you understand the mechanics at play and your available skills. You know exactly how you want to play the battle but unfortunately the events popups just get in the way slowing you down, not much fun.
Since leveraging your character is the only way to progress further into the game and I wanted to finish it, I decided to make a bot to autoplay the game and save time. After the initial time investment to get this code up and running I just let it play though the night and it blazed ahead, tirelessly slashing mobs and getting sweet experience points.
Here you can watch a video of the bot playing fully auto, traveling, starting battles and winning them. You can see how the bot heals itself when it needs to. Uses its turn action points wisely, attaking only when it makes sense to do so. The video is speed up.
51 minutes bot gameplay in 38 seconds timelapseSensing the environment
The bot is a PHP based CLI program running on background. In order to sense the game it takes a screenshot, then decides where in the game it is (map view, event mode, action mode, winning mode, battle selection screen, level up, etc) and acts accordingly. If the game mode is one of the in-battle ones, then the bot also crops some bits from the screen and runs those crops by tesseract OCR to read the values and make better decisions.

Currently the bot can sense:
- HP (hit points or life points)
- SP (skill points or action points)
- ATK (attack power, it changes during battle)
- Targets selecion
Taking action
Once the bot knows on which screen it is and the battle status, the playstyle algorithm is very simple: heal first if needed, then attack only if a number of requisites can be met (available target, enough ATk, enough SP, etc) otherwise just pass turn and wait.
The algorithm values more safe play and battle winning certainty that winning speed on each battle. We trade speed for a greater chance to win the battle every time.

Efficiency: 1.94 kills/minute
If I deploy the bot in stage one, right next to the starting castle where the mobs are easier to kill, the bot has an average efficiency of 1.94 kills per minute. This is accomplished due to a number of improvements: hero gear and battle tactics to allow for one turn wins, by shaving miliseconds from action delay and turning off voice dictation. The bot narrates its sensing and internal state while playing to allow me to follow the bot logic, but that introduces delays, hence I only turn on voice dictation for tuning or debuging reasons.
Levels
I have made it to level 51 after many, many days of 24x7 run time. Unfortunately the game eats RAM memory like the cookie monster eats cookies. After 24 hours of game play its memory footprint has balloned to about 70GB at which point it just crashes, regardless of how much memory I have. Which means there is a memory leak somewhere.
Unfortunately for us, Sokpop Collective the makers of this game are notorious for their "spray release". They release lots of small minigames which too often are unpolished, buggy, or sometimes even unfinished and unplayable for some users.
Here is the number of kills needed to level up at each level:
- Level 38: 2048 kills
- Level 39: 2436 kills
- Level 40: 2897 kills
- Level 41: 3445 kills
- Level 42: 4096 kills
- Level 43: 5793 kills
- Level 44: 6889 kills
- Level 45: 8182 kills
- Level 46: 9742 kills
- Level 47: 11586 kills
- Level 48: 13778 kills
- Level 49: 16384 kills
- Level 50: 19484 kills
- Level 51: 23171 kills
Next steps
This projects ends here as I just wanted to level pump the hero. It could be interesting to make it travel all locations by itself, buying all available gear while traveling. We could also have the bot change the hero gear randomly before every battle and keep a detailed log of the gear and the battle result. With that information we could find the most statistically strong gear to play.
Since the gear gives different skills, the play style is very gear dependant. In order to explore this and have a full-game auto bot we would need to enter machine learning territory.