Machine Learning in Game Development

Rate this content

In this talk, I will share my experiences with using machine learning to identify cheaters in multiplayer games. We will also discuss the potential of machine learning in game development.

18 min
28 Sep, 2023

Video Summary and Transcription

Today's Talk explores cheating in video games and the role of machine learning in detecting and preventing it. Trust and fairness are crucial in gaming, as players invest time and emotion into virtual worlds. Traditional rule-based models assess player actions, while machine learning can detect complex and evolving cheating methods. Training models and organizing data are key challenges in utilizing machine learning for cheating detection. The future lies in collaborative security systems that combine rule-based models with machine learning to protect against cheating.

Available in Español

1. Introduction to Cheating in Video Games

Short description:

Today I'd like to share insights and discuss a prevalent issue in the gaming world – cheating. More importantly, I want to delve into how machine learning can be our ally in preserving the genuine essence of competition and fun in video games. Trust is super important when playing games. Players are not just watching from the side. They are really part of the game. They put a lot of time, work and emotion into these virtual worlds.

Hi there, my name is Denis. I'm a software engineer at My Games. Today I'd like to share insights and discuss a prevalent issue in the gaming world – cheating. More importantly, I want to delve into how machine learning can be our ally in preserving the genuine essence of competition and fun in video games.

Trust is super important when playing games. Players are not just watching from the side. They are really part of the game. They put a lot of time, work and emotion into these virtual worlds. It is more than just playing. They try to understand how the game works. They think of ways to improve. And they also make friends inside the game.

On top of that, they sometimes spend money on things within the game to make their experience more enjoyable. However, when they come across players who cheat, it is more than just a small issue. It can make them feel like the game isn't being fair for everyone. It becomes really difficult for them to enjoy the game when they think that everyone is not following the same rules.

Keeping players interested for a long time is important for online games. In order to stay alive and do well. If players keep coming back, the game community stays alive and games can make more money. This is especially true for games where players buy things inside the game or play regularly to play. If there are cheaters, it can ruin the fun for other players. Instead of being fun or relaxing, games become annoying and players become frustrated.

There are various ways players can cheat in video games. Game developers need to identify whether a game might be vulnerable or have loopholes as well as identifying certain gameplay rules that could potentially be sidestepped. A prevalent hacking method in online games involves manipulating a participant state. Since a significant portion of the gameplay occurs on the player's own computer, hackers tamper with this by altering the game's local data. For instance, they might modify the bullet count in a gun's magazine, enabling the player to fire continuously without reloading, or amplify the available in-game items like grenades or health packs. There are more complex ways of cheating in games. Aimbot, aim assistant, or automatic aim — all these are different names for the same thing. Aimbot helps the user to track other targets by controlling the player's aiming.

2. Cheating Types and Rule-Based Model

Short description:

The cheat operates by extracting game stage information to assist the cheater in aiming, surpassing human capabilities. Another cheat, TRIGGERBOT, auto-fires when the player's crosshair is on an opponent. Overlay cheating includes wall hack and radar hack. Traditional methods like the rule-based model assess player actions for fairness. Reports and analysis of actions help determine if players adhere to standards. A cheating rating system assigns points based on rule violations, which decrease over time with fair gameplay.

The cheat operates by extracting game stage information that other players can't access. With this information, the bot then assists the cheater in aiming. By using an aimbot, a user surpasses human capabilities in shooter games.

Another cheat, called TRIGGERBOT, works the opposite way. While an aimbot automatically directs the crosshair at an opponent, TRIGGERBOT simply auto-fires when the player's crosshair is on an opponent. This means the player still has to aim at the enemy themselves, but as soon as they do, the TRIGGERBOT instantly activates, providing a perfect shot without delays that might arise due to human reflex.

Due to the peer-to-peer approach, each player's client has to contain up-to-date information about all other players. Naturally, the game standard interface hides all this information, showing only what the developers intended. Unfortunately, the mere presence of this information on the client paves the way for a type of cheating called overlay. One of these is wall hack, where a player can see the enemies through obstacles, be it walls, boxes or anything else. This gives the user an unfair advantage as they can prepare in advance for an encounter with an opponent, or even kill them while remaining unnoticed. Another similar example is radar hack. Instead of making walls transparent, this cheat displays the location of all players on the in-game radar or mini-map.

Of course there are other types of cheating as well, but let's move to the next point. Many of the often mentioned types of cheating can be controlled using traditional methods. We refer to this method as the rule-based model. The basis of this model is a set of rules that assess a player's actions for fairness. Let's delve deeper.

Players should send reports after each session. These reports include data about the actions of all participants. For example, we can see how many consumable items each player used by comparing this information with the player's account state on the server. We can check whether they had such resources. Another example is analyzing the number of shots and the time between them. This allows us to determine if the player adhered to the necessary reload time and whether the fight rate is consistent with the standards.

Some rules may directly indicate the use of cheats. Other rules provide only indirect evidence, for instance, temporary internet connection issues can affect data. So, it is a good idea to implement a cheating rating system, where each rule adds a certain number of cheating points. Some rules may contribute more points, while others add fewer, depending on the severity of the offense. If a player behaves fairly, their cheating rating decreases over time. Thus, occasional network issues might give a player a small number of points, which will be offset by fair gameplay.

3. Machine Learning for Cheating Detection

Short description:

Not all cheats can be detected through rules. Machine learning offers a powerful solution for complex cheating detection tasks. Models based on machine learning can adapt to changes and identify new forms of cheating. Machine learning can process immense volumes of data and detect subtle patterns in player's behavior. It can also detect new, previously unknown methods. Using machine learning to identify anomalous behavior of players was a challenge. The minimum necessary data was identified to detect cheaters using aimbot. The biggest problem faced was not having labeled data.

A genuine cheater, however, will quickly accumulate enough points to raise suspicion. However, not all cheats can be detected through rules. For example, detecting the use of aim bots is challenging. If we merely analyze the ratio of headshots to the total number of shots, we risk falsely accusing a skilled player of cheating. This is where machine learning methods come into play.

Machine learning offers a powerful solution for complex cheating detection tasks, especially where traditional methods face limitations. One of the key advantages of machine learning is its ability to adapt to the dynamic and intricate behavior of players. Players continuously change their strategies and skills, which can make certain behavior patterns less apparent. Models based on machine learning are capable of adapting to these changes, identifying new forms of cheating.

Moreover, the volumes of data generated by games are often immense and machine learning can effectively process and analyze this information. This allows for the detection of subtle and intricate patterns in player's behavior, which might escape a basic analysis. With the right algorithm and sufficient data for model training, machine learning can provide high accuracy in detecting cheating, reducing the likelihood of false alarms.

It's also worth noting the proactive nature of machine learning. While many traditional methods respond to already known forms of cheating, machine learning can detect new, previously unknown methods. This adaptability and the ability to detect new threats quicker make it an ideal tool in the fight against cheaters.

Let me share my experience of using ML to detect cheaters. The idea behind my research was to use machine learning to identify anomalous behavior of players which would detect cheaters using aimbot. One of the first tasks was to figure out how to represent the behavior of players as digital data on which the model would be trained. Another task was to minimize the volume of this data to ease server workloads and reduce user traffic.

The challenge was to identify the minimum necessary data left to survive the game I'm working on is a specific mobile shooter. Players move through the scene as if on rails, hence the decision to not use movement data but focus more on aiming seemed evident. The theory was that difference in behavior between a player and an aimbot would be most noticeable in compensating for gun recoil. After numerous experiments, an optimal dataset was identified which produced commensurable results. A feature vector was determined which captured crosshair movement across both axes at 0.5 seconds before and at 0.25 seconds after the player fired as well as information on whether the shot hit an opponent. These feature vectors were only considered when a player was using a rapid-firing weapon.

I am primarily a game developer, not an experienced machine learning developer. To be honest, I faced numerous challenges during my research. The biggest problem was not having labeled data. To teach a model to sport if data is about cheating, you need data that is already labeled as cheating or not cheating. This means splitting the data into two groups, normal behavior and cheating behavior.

4. Utilizing Machine Learning for Cheating Detection

Short description:

Without a trained model, distinguishing between cheats and normal behavior becomes a challenge. Organizing data for machine learning requires a technique to make it suitable. Anomaly detection on initial data sets can train a model for classifying data. Formulating clear and relevant player behavior data and selecting the simplest machine learning model are crucial. Machine learning is a key tool for countering fraudulent activities in video games. Traditional rule-based models complement detection systems developed with machine learning. The future lies in flexible security systems that collaborate seamlessly to protect against cheating.

However, without a trained model, distinguishing between these two becomes a chicken and the egg problem. Okay, I eventually determined how to collect the data and represent it, but this data wasn't labeled. I need a technique to organize this data so it would be suitable for machine learning.

Sometimes after thinking about a problem for a long time, the answer is surprisingly simple. That's what happened there. I had some basic idea about the data I was looking at. I thought that the cheat data would be much smaller than the normal data, making it stand out. Thus, one can use anomaly detection on this initial data set to train a model for classifying data.

The pivotal aspect of utilizing machine learning to detect cheats was to formulate clear and relevant data depicting player behavior and selecting the most appropriate and simplest machine learning model for the task. However, for my vantage point, as a game developer, this indeed was the most challenging part of the entire process.

Despite the fact that the machine learning functionality for detecting cheaters, which I discussed today, is still in active development, its potential is already evident. In today's rapidly evolving technological world, machine learning has become a key tool for detecting and countering fraudulent activities in video games. Such advances foster optimism that the gaming industry will soon develop even more advanced and efficient anti-cheat systems.

Nevertheless, it's crucial to recognize that the advent of new methods in machine learning doesn't negate the importance of time-tested traditional approaches. Rule-based models, a classic method for detecting cheaters, remain relevant. These models granted in clearly defined rules complement and amplify the effectiveness of detection systems developed with machine learning algorithms. The blend of tried-and-true methods with innovations in machine learning can offer the best results in combating dishonest players.

I firmly believe that the future lies in flexible security systems where each component collaborates seamlessly with others, ensuring robust protection against cheating. And thank you for your attention today. I'm hopeful that as we continue to advance in machine learning technologies, we'll develop increasingly effective ways to maintain the integrity of the gaming experience we all hold dear. Let's keep pushing the boundaries to create more secure, enjoyable and fair games for everyone involved.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

JS GameDev Summit 2022JS GameDev Summit 2022
33 min
Building Fun Experiments with WebXR & Babylon.js
Top Content
During this session, we’ll see a couple of demos of what you can do using WebXR, with Babylon.js. From VR audio experiments, to casual gaming in VR on an arcade machine up to more serious usage to create new ways of collaboration using either AR or VR, you should have a pretty good understanding of what you can do today.
Check the article as well to see the full content including code samples: article. 
React Summit 2023React Summit 2023
32 min
How Not to Build a Video Game
In this talk we'll delve into the art of creating something meaningful and fulfilling. Through the lens of my own journey of rediscovering my passion for coding and building a video game from the ground up with JavaScript and React, we will explore the trade-offs between easy solutions and fast performance. You will gain valuable insights into rapid prototyping, test infrastructure, and a range of CSS tricks that can be applied to both game development and your day-to-day work.
6 min
Charlie Gerard's Career Advice: Be intentional about how you spend your time and effort
Featured Article
When it comes to career, Charlie has one trick: to focus. But that doesn’t mean that you shouldn’t try different things — currently a senior front-end developer at Netlify, she is also a sought-after speaker, mentor, and a machine learning trailblazer of the JavaScript universe. "Experiment with things, but build expertise in a specific area," she advises.

What led you to software engineering?My background is in digital marketing, so I started my career as a project manager in advertising agencies. After a couple of years of doing that, I realized that I wasn't learning and growing as much as I wanted to. I was interested in learning more about building websites, so I quit my job and signed up for an intensive coding boot camp called General Assembly. I absolutely loved it and started my career in tech from there.
 What is the most impactful thing you ever did to boost your career?I think it might be public speaking. Going on stage to share knowledge about things I learned while building my side projects gave me the opportunity to meet a lot of people in the industry, learn a ton from watching other people's talks and, for lack of better words, build a personal brand.
 What would be your three tips for engineers to level up their career?Practice your communication skills. I can't stress enough how important it is to be able to explain things in a way anyone can understand, but also communicate in a way that's inclusive and creates an environment where team members feel safe and welcome to contribute ideas, ask questions, and give feedback. In addition, build some expertise in a specific area. I'm a huge fan of learning and experimenting with lots of technologies but as you grow in your career, there comes a time where you need to pick an area to focus on to build more profound knowledge. This could be in a specific language like JavaScript or Python or in a practice like accessibility or web performance. It doesn't mean you shouldn't keep in touch with anything else that's going on in the industry, but it means that you focus on an area you want to have more expertise in. If you could be the "go-to" person for something, what would you want it to be? 
 And lastly, be intentional about how you spend your time and effort. Saying yes to everything isn't always helpful if it doesn't serve your goals. No matter the job, there are always projects and tasks that will help you reach your goals and some that won't. If you can, try to focus on the tasks that will grow the skills you want to grow or help you get the next job you'd like to have.
 What are you working on right now?Recently I've taken a pretty big break from side projects, but the next one I'd like to work on is a prototype of a tool that would allow hands-free coding using gaze detection. 
 Do you have some rituals that keep you focused and goal-oriented?Usually, when I come up with a side project idea I'm really excited about, that excitement is enough to keep me motivated. That's why I tend to avoid spending time on things I'm not genuinely interested in. Otherwise, breaking down projects into smaller chunks allows me to fit them better in my schedule. I make sure to take enough breaks, so I maintain a certain level of energy and motivation to finish what I have in mind.
 You wrote a book called Practical Machine Learning in JavaScript. What got you so excited about the connection between JavaScript and ML?The release of TensorFlow.js opened up the world of ML to frontend devs, and this is what really got me excited. I had machine learning on my list of things I wanted to learn for a few years, but I didn't start looking into it before because I knew I'd have to learn another language as well, like Python, for example. As soon as I realized it was now available in JS, that removed a big barrier and made it a lot more approachable. Considering that you can use JavaScript to build lots of different applications, including augmented reality, virtual reality, and IoT, and combine them with machine learning as well as some fun web APIs felt super exciting to me.

Where do you see the fields going together in the future, near or far? I'd love to see more AI-powered web applications in the future, especially as machine learning models get smaller and more performant. However, it seems like the adoption of ML in JS is still rather low. Considering the amount of content we post online, there could be great opportunities to build tools that assist you in writing blog posts or that can automatically edit podcasts and videos. There are lots of tasks we do that feel cumbersome that could be made a bit easier with the help of machine learning.
 You are a frequent conference speaker. You have your own blog and even a newsletter. What made you start with content creation?I realized that I love learning new things because I love teaching. I think that if I kept what I know to myself, it would be pretty boring. If I'm excited about something, I want to share the knowledge I gained, and I'd like other people to feel the same excitement I feel. That's definitely what motivated me to start creating content.
 How has content affected your career?I don't track any metrics on my blog or likes and follows on Twitter, so I don't know what created different opportunities. Creating content to share something you built improves the chances of people stumbling upon it and learning more about you and what you like to do, but this is not something that's guaranteed. I think over time, I accumulated enough projects, blog posts, and conference talks that some conferences now invite me, so I don't always apply anymore. I sometimes get invited on podcasts and asked if I want to create video content and things like that. Having a backlog of content helps people better understand who you are and quickly decide if you're the right person for an opportunity.What pieces of your work are you most proud of?It is probably that I've managed to develop a mindset where I set myself hard challenges on my side project, and I'm not scared to fail and push the boundaries of what I think is possible. I don't prefer a particular project, it's more around the creative thinking I've developed over the years that I believe has become a big strength of mine.***Follow Charlie on Twitter

Workshops on related topic

JSNation 2023JSNation 2023
116 min
Make a Game With PlayCanvas in 2 Hours
Featured WorkshopFree
In this workshop, we’ll build a game using the PlayCanvas WebGL engine from start to finish. From development to publishing, we’ll cover the most crucial features such as scripting, UI creation and much more.
Table of the content:- Introduction- Intro to PlayCanvas- What we will be building- Adding a character model and animation- Making the character move with scripts- 'Fake' running- Adding obstacles- Detecting collisions- Adding a score counter- Game over and restarting- Wrap up!- Questions
Workshop levelFamiliarity with game engines and game development aspects is recommended, but not required.
JS GameDev Summit 2022JS GameDev Summit 2022
121 min
PlayCanvas End-to-End : the quick version
Top Content
In this workshop, we’ll build a complete game using the PlayCanvas engine while learning the best practices for project management. From development to publishing, we’ll cover the most crucial features such as asset management, scripting, audio, debugging, and much more.
JS GameDev Summit 2022JS GameDev Summit 2022
86 min
Introduction to WebXR with Babylon.js
In this workshop, we'll introduce you to the core concepts of building Mixed Reality experiences with WebXR and Balon.js.
You'll learn the following:- How to add 3D mesh objects and buttons to a scene- How to use procedural textures- How to add actions to objects- How to take advantage of the default Cross Reality (XR) experience- How to add physics to a scene
For the first project in this workshop, you'll create an interactive Mixed Reality experience that'll display basketball player stats to fans and coaches. For the second project in this workshop, you'll create a voice activated WebXR app using Balon.js and Azure Speech-to-Text. You'll then deploy the web app using Static Website Hosting provided Azure Blob Storage.
React Advanced Conference 2021React Advanced Conference 2021
168 min
How to create editor experiences your team will love
Content is a crucial part of what you build on the web. Modern web technologies brings a lot to the developer experience in terms of building content-driven sites, but how can we improve things for editors and content creators? In this workshop you’ll learn how use to approach structured content modeling, and how to build, iterate, and configure your own CMS to unify data models with efficient and delightful editor experiences. It’s intended for web developers who want to deliver better content experiences for their content teams and clients.