The online gaming market is a competitive arena, and users demand engaging and challenging experiences. As well as providing the construction platforms for developing mobile apps, cloud computing also offers a new dimension in the form of affordable machine learning and the way it can inject new life into the gaming experience. Yatzy, a popular mobile gaming app, became an excellent demonstration of these new capabilities in practice.
About Fictional Factory Inc
Fictional Factory Inc is an Android game developer that has been active since 2012. The current app portfolio contains 2 games, all of which are listed in the category "Board". Two of the most important apps from Fictional Factory Inc are Yatzy Online and Farkle Online. Both of them have been installed more than 100 thousand times.
Yatzy Online is a popular mobile gaming app with over 2 million downloads. This mobile Android and iOS app allows users of all ages, from all over the world, to play online, against themselves, the computer, or with other players. The app started in 2012. Since its launch, the platform has experienced continuous growth. With over two million downloads, Yatzy Online allows users to connect easily to play with friends or random players from all over the world. This mobile app was built for both Android and iOS. It was developed utilizing Node.js and React.js. and deployed using Amazon Web Services (AWS). It has recently undergone a powerful transformation to utilize Machine Learning as a part of its technology stack.
Yatzy Online was what we term at PCG as a “born in the cloud” solution, meaning, since conception the app has utilized powerful cloud technology to enhance functionality, scale, and control costs.
We have specifically utilized Amazon Web Services according to the following iterative timeline:
- Deploy to Amazon EC2 in 2012
- Migrate from MongoDB to Amazon DynamoDB
- Enable human-like computer with Amazon SageMaker
- Convert compute to AWS Lambda
We have taken this approach to achieve the following core outcomes, to iteratively improve game functionality, allow a large amount of data to be quickly accessible, and create a believable computer player.
In 2019, one of the continuous challenges the project was facing were limitations in the current computer player. Thus, a plan was created to utilize AWS Machine Learning services to optimize AI and human-like behavior.
The existing computer player was making category choices with the help of precalculated combinations and some calculations on the go. Since calculations take almost every dice combination, the computer player almost always has the predisposition to win the game, which would reduce the overall user experience.
Due to the fact that Yatzy Online already uses plenty of AWS services and is highly dependent on this ecosystem, the logical way to upgrade the application was to continue adding AWS services. We worked to assess what AWS services could allow for the building and training of machine learning models.
Several AWS services were used in order to collect the data, transform it, train a ML model and deploy it. The first step is to collect the data from the users i.e. players of the Yatzy Oline game. For this, Amazon Kinesis Data Firehose was used, which provides an easy way to reliably load the streaming data into Amazon Simple Storage Service (S3). Next, the data was filtered, and transformed into the format needed for the next step, using AWS Glue, a fully managed ETL (Extract, transform and load) service, and saved into Amazon Simple Storage Service (S3) in CVS format.
The entire process of ML model selection, training, validation, hyper-parameter tuning, and the deployment was done using Amazon SageMaker. Jupyter notebooks were used, provided by Amazon SageMaker notebooks with fully elastic underlying compute resources. Several built-in algorithms were tested and two, Linear Learner and XGBoost, were selected as performing well and were found to be well suited for the given multi-class classification problem. The hyperparameter tuning was also done using Amazon SageMaker i.e. by running a hyperparameter tuning job using the random strategy.
For the deployment of the algorithm an Amazon SageMaker endpoint, an AWS Lambda function, and an API gateway was created. The AWS Lambda function takes the data sent from the user, through the API gateway, transforms it to the right format and invokes the Amazon SageMaker endpoint. Following this, the prediction i.e. the category to be chosen is sent back to the user.
Results and Benefits
The results of the validation of the model showed high classification accuracy. Furthermore, the machine learning model bases its output entirely on how the human player plays the game, so it feels much more human.Given the success of the project work will continue, future goals include optimizing existing services, with a continuation of adding more ML AWS services.
About Miracle Mill
At Miracle Mill, we are passionate entrepreneurs and engineers, that work to utilise modern cutting-edge cloud technology. We are a cloud-first company focused on building scalable applications utilising AWS cloud services.
We provide cloud consulting services with an Agile iterative approach to software development using DevOps methodologies.