NoTTe - DevBlog #2
Yeah, I definitely think I'm gonna do this "article series" just after major updates in the platform '_>'.
Automating Tactic Testing
Let's start by saying that the system is not fully automatic. NoTTe (Node Tactic Testing) -yeah, we gave that shitty software a name- It still needs some input from real people: we need to collect and put the
tactics and their
Opposition Instructions into a shared folder on Google Drive (@Kenneth: it's drive, not "disk").
The folder is automatically synced on my more-or-less dedicated computer that runs FM, so I didn't have to write a routine to sync some remote folder with that, or write some automatic downloading system of a set of given tactics file's links, or have to give access to my computer to all the MrLTactics testing team! Thanks, Google
But you should already know all that amazing information from Kenneth's blog post!
What I'm here to talk about is how I did it.
How it was developed
Algorithm and stability
Earlier, when we were testing manually, Francesco wrote down the test instructions in a step by step guide that we all followed. I simply then rewrote this algorithm in NodeJs.
Of course, I had to solve problems like "find a tactic that is not yet tested" or "put OIs in the game".
I found out that those things were not hard at all! I have to be honest, it's a spartan program in the design and in the way it works, but... It works!
To be honest, it's not very stable, but not because of my errors!
NATeS unluckily relies on unstable programs such as FM Fitness Coach, WiLMA and Football Manager itself (try to load, play, save and reload 20/25 games, FM will crash -.-), and I cannot really get away from them!
The whole system is built on top of something that simulates human actions on programs. So I just wrote all the micro-routines such as "load the save-file", "load the tactic", "load OIs" and "extract results", I put all of them together and in the only thing missing was to upload the results to the site.
Now, if you're not interested in the technical part: skip to "Publishing results" :)
Doing our algorithms manually, I saw that the actions were always the same for every tactic: we just clicked the same exactly buttons every time.
What I used in order to achieve the same thing is RobotJs, a simple but yet effective way to simulate mouse movements and keyboard clicks.
I stored in a
JSON file all the coordinates of the buttons I had to click, and simply implemented all the "movements".
Then while FM was already ready to test, a problem came: every time you run FM Fitness Coach it "spawns" in different positions (-.-), so theoretically I could not store "fixed" coordinates, here WiLMA came in help. Thanks to it I could move the FMFC window where I wanted without knowing where it was before!
Amazing, now I can do testing! But we still cannot publish results :(
Oh, to keep track of the already-tested tactics in the folder I just use a really simple and inefficient array as database that I store on a
txt file as
Now, SI became serious when the subject of the discussion is copyright, so I want to be clear: to extract results we use nothing more than their given functionalities. I just print and parse the final table of the league.
With the parsed data I just use the forum APIs to publish the results.
In the end doing this little project was fun. The right level of complexity.
It gave me the possibility to use something I knew that existed, but that I never used. There is of course margin of improvement, adding some Computer Vision and other fancy things, but probably it's a little overkill at the moment.
This part is a little bit off topic and totally useless, but I'd like to talk with you about that.
Now that we have a system that doesn't take time for us to test tactics, we can concentrate on giving you users more.
We're going to hire volunteers.
(We don't have money to pay the server, imagine people). That's one of the most important parts: we really want to give you more quality content, but we're not able to do that without your help.
MrL is going to create new tactics
Yep, he's working on some few things! But he wants to be sure that it's the best, so I don't know how much time he's gonna take
I am still going to develop new stuff
One of the first things I'm gonna do is to redesign a little bit the testing table's page (while writing this article, for example, I changed the "ratings" in stars with the help of a new guy called Duncan).
Then I'll start to design a user ranking system. Why so? Simple ~spoiler alert~ we'll start various competitions through our users in order to win amazing prizes.
Mhm... I think that's all. Thanks for reading it all. Let me know what you think in the comments!