How I made a bot by my self to play Splinterlands
Hi everyone, this is my first post on Hive Blog.
I am a programmer. Recently a friend recommended the game to me and told me I could make money with this game. That's the Splinterlands. I tried playing the game and found it to be amazing. However, if I play the game manually and only have a few accounts, I find the profit not attractive, along with that I do not have much free time to play the game. So I used my strengths as a programmer to create a bot that plays games on its own.
Start building bots
I use Nodejs and Puppeteer library to write bots. Writing bots for automated manipulation is quite easy and doesn't take too much time. It only took me half a day for the BOT to log into the game and start creating matches.
However, if in the match let the BOT choose random cards, the win rate will not be high. So I decided to build an API for the BOT to get card information for the match. To make an API, I need data first. So I have to go crawl first.
Step 2: Crawl match data
Fortunately, in-game match data is easily accessible. It took me a day to code the data collection and got 1 million matches in hand. Of course I can collect more but to test the BOT running this much data is more than enough.
Step 3: Build API
When entering the match, the BOT will call the API that I built and the API will filter from the match data with the matching mana_cap, rule_set. I will sort and count the deck that won the most matches and return the information to the BOT.
Step 4: Test and improve
BOT has completed the first version. I ran tests with a few accounts to test and found the win rate to be above 40%. The number of consecutive wins ranges from 10-20. This result is quite good. However, as a curious programmer, I want my BOT to work even better.
Step 5: Improve the API for the bot.
After digging through the game's API, I found that most of the time I would be able to see my opponent's cards (except for those with anti-view enabled). So I know that the API will work better from this. I will wait for the opponent to choose the hand first and then choose the winning hand in the database for the BOT to choose. In the end, the BOT had a win rate of 60%. And I DO NOT HAVE TO RENT CARDS, JUST PLAY GAMES WITH BASIC CARDS. HOW WONDERFUL!
A few more improvements can be shared such as I will wait until the last second to submit the team to avoid my opponent seeing my post...
I saw that it was possible to sell this BOT to a few other players, so I introduced it to a group of players. Finally 1 customer interested and contacted to use. He has many accounts and on average 1 account only earns 30 Dec per day. After using my BOT, 1 day he earns from 60-100DEC. That was an unexpected result.
After selling to the first customer for 2 days, the game announced an update and the opponent card viewing feature no longer works. This news came too soon and so my BOT will not be as effective as before. And the first customer did not rent my BOT anymore. If the game was updated a few seasons late, I would probably make a lot of money.
Never give up.
I said before that I don't rent cards and only play at bronze rank 3. After the update I researched on renting cards to play at higher ranks. And I continue to create bots that automatically rent specified cards and rent any cards to get enough CP(collection power).
After some research and improvement, I now have a bot that plays consistently at bronze rank 1 and is profitable. Now with each account, i can earn 50-100 DEC and I am happy with it.
If someone is interested and wants to learn, I can guide and share. Let's discuss and play games together.