A gamebot for the mobile game "Moonlight Sculptor"
Purposes and features of the gamebot:
I programmed a gamebot (link for codes) to execute tedious daily tasks in "Moonlight Sculptor," an MMORPG game. With my gamebot, players do not waste their time doing daily routines, such as getting rewards, guild hunting, raids, and dungeons. The gamebot has the following features:
User interface: for users who do not know how to program to read and set up program parameters easily.
Background clicking and typing: allows users to keep using their computer or playing multiple characters (for "farming game items").
Automatical task executions : (1) resurrecting character, (2) accepting and sending team invitation, (3) exchange store shopping, (4) daily raid, (5) getting daily rewards, (6) daily coinstore shopping, (7) daily guild hunt, (8) timed dungeon, (9) daily arena.
The interface of my gamebot is presented below. The left panel shows the gamebot setting, and the right panel shows game information while running the gamebot (No English version gamebot because all users speak Chinese):
Gamebot gameplay videos: (under preparation)
Main elements of the program:
I choose Python for building the gamebot because it has packages, such as cv2, scikit-learn, and sys, to help make decisions according to game images and execute system commands. More importantly, these packages help to apply machine learning techniques and train customized decision-making procedures. To build this gamebot, I need to:
Use Python Tkinter: creates a clean user interface.
Accomplish background screenshot: obtain real-time game image (OBS, a streaming application, also use this technique).
Accomplish background mouse clicking: send mouse clicks to inactive game windows.
Accomplish background mouse dragging: send mouse drags to inactive game windows.
Accomplish background keyboard typing: send keyboard press to inactive game windows.
Challenges:
The first challenge is that the gamebot has to be compatible with different desktops because users' desktops may lag occasionally or in different conditions. That is, time-gaps between each click should be adaptable but not constant. Therefore, I design the clicking function to possess the following features:
Click after conditions, such as "certain images are presented" or "certain pixel are disappeared," are satisfied.
Finish clicking until conditions are satisfied.
Click once or multiple times before the clicking function finishes.
After optimizing the clicking function, it turns out that the gamebot is more efficient and capable of dealing with unexpected errors.
Next, create decision-making procedures as conditions used in the clicking function. Because all decision-making procedures are based on the current gameplay screen, the gamebot has to decide whether pixels, icons, or objects are presented. According to my Statistics background, it is not hard to apply statistical models and machine learning skills to train my gamebot.
Last, design stable and structured workflows to run the gamebot. This makes it easier for me to organize and maintain the gamebot program and achieve "Don't Repeat Yourself (DRY)." More importantly, unexpected bugs occasionally interrupt gamebot workflows, so the designed workflows have to be capable of handling these bugs. I spend more time on this part because I have to test some functions over and over (while seeing what happens in the gameplay).