When Someone Wrote a Bot for Your Flash Game

In 2012, I was working as a Junior Web Developer at МЕДИ - a network of medical clinics in Saint Petersburg that provided various healthcare services, including laser vision correction.

One of my tasks was to launch a Flash game called "lasikmania" for a marketing campaign. The idea was simple but unusual: patients could play the game and convert their score into a discount for LASIK surgery.

The Challenge

The game was developed by an external studio, but when we received the code, it didn't work properly. I had to urgently fix all the bugs and make it playable. The deadline was tight and Flash/ActionScript 3 was not my primary technology at that time.

I spent evenings debugging the game logic, fixing collision detection and ensuring that everything worked correctly. I also implemented EAN-13 barcodes for the discount coupons and created different difficulty levels to make the game more engaging.

After many hours of testing, everything worked well. After some practice, I was able to consistently get the maximum 25% discount.

The Discovery

A year later, in November 2013, I discovered an article on Habr: "Написание бота для флэшевой игры" (Writing a bot for a Flash game).

The author couldn't reach needed amount of points for 25% discount manually and, like a true engineer, decided to solve the problem in a different way. He wrote a C# bot that captured screenshots, detected moles on the screen and automatically clicked on them to get the maximum 25% discount.

My Reaction

I was genuinely happy about this. Here's why:

  1. Engineering approach. Instead of giving up, the author spent two evenings reverse-engineering and automating the solution.
  2. It went viral. Other people joined in and started looking for ways to beat the system. Some explored the server protocol, others built similar bots.
  3. Real business impact. By that time, I had already left the company, but colleagues contacted me saying that after the article was published, the number of visitors significantly increased.
  4. It survived the Habr effect. Tens of thousands of people visited the website after the article was published. My code not only worked and brought value and engagement - it also handled the famous "Habr effect" when thousands of users suddenly hit your servers.

The Outcome

The campaign was successful on multiple levels:

  • The clinic got more clients
  • Patients got real discounts
  • Engineers got an interesting technical challenge
  • The community had fun reverse-engineering the game

Technical Details

The game was built with:

  • ActionScript 3 / Flash - the main game engine
  • PHP backend - for saving scores and generating discount coupons

As the whole code was on the client side, we didn't have any goals to prevent all possible cheating, so only basic signed requests were implemented. Based on our tests, most of the people were able to get their discount without bots.

Lessons Learned

  1. Different people solve problems differently
  2. Unexpected challenges create engagement
  3. Good code scales
  4. Community engagement matters
  5. Projects can succeed in ways you never planned

Thank you to the bot author and everyone who participated in this technical discussion.