Gaming Behind the Scenes – How Maths Makes Your Favourite Titles Work

sigmund-R401qwThw7w-unsplash

Some people are great with numbers, others not so much. Both are fine because the world needs a mix of talents and abilities to make it work smoothly and you can always invest more time into learning new arithmetical skills at college.

But, regardless of whether you can calculate the square root of 729 in your head or you perspire in the presence of a percentage, maths plays a crucial role in every part of our lives. From the obvious life moments like working out the cost of the goods we buy from shops, to hidden calculations like ensuring the bridges we drive on can handle the loads placed on them so that drivers are safe, numbers are everywhere.

The same is true for gaming. Everything from basic card and board games to the latest blockbuster Xbox releases use maths in some way or another, often out of sight of the players.

Of course, that doesn’t usually mean you need to whip out your calculator for games night (unless you’re playing Scrabble). It’s just that either the game is built around certain mathematical principles, or it’s performing some heavy number crunching to make it work. Here are some common uses to put it into context.

 

Ensuring Fairness

All casino games are built around numbers. Roulette has a wheel that’s covered in numbers, blackjack requires you to make a hand valued at 21, and craps involves adding the values of two dice.

For slots, however, you might think that numbers don’t come into it, since these games seem to only involve reels with colorful symbols and a level or button that spins them.

However, this isn’t the case. All video slots are programmed to stick to a particular return-to-player (RTP) rate. This is usually expressed as a percentage and explains roughly how much of your wagers you can expect to receive back if you played for a very long time.

Combined with a random number generator (RNG), these two mathematical tools allow slot players to enjoy their favorite games safe in the knowledge that they are fair.

 

Procedural Generation

For most of the history of video games, players have been afforded the ability to navigate through a pre-designed fictional world. In games like Grand Theft Auto, these worlds are vast and intricate, giving you hundreds of hours of fun exploring.

But over time, you eventually develop the ability to memorize these digital realms and it can become repetitive. That’s where another mathematical tool comes in – procedural generation.

Procedural generation uses algorithms (complex mathematical calculations) to design new maps every time a player loads up the game or to make the world seem infinitely large by drawing it on the fly.

Famous examples of this number-based map-making include Minecraft, Borderlands, Stardew Valley, and World of Warcraft: Shadowlands.

Pathfinding

Artificial intelligence is a technology that is still in its infancy. Yet, we often refer to the non-playable characters (NPCs) in video games as “AI”, without giving much thought to what that actually means.

In reality, the NPCs that run around a video game are almost never actually deploying AI to decide their behavior. Instead, the software is just doing some calculations behind the scenes.

The easiest way to explain this is to examine the pathfinding function. This is essentially the process of a computer-controlled character finding their way from point A to point B. If they’re not following a prescribed route, each NPC has a range of directions they can travel to arrive at their destination.

So to ensure they’re not left wandering aimlessly forever and waiting to randomly land in the right spot, the pathfinding function assigns “costs” to each possible route. The game will then add up all of the different options to decide which one has the lowest cost and then sends the NPC along it.

Pathfinding, therefore, uses both really simple calculations combined with very complicated mathematical principles to make video game characters appear more natural in their behavior.

The algorithm element has come a long way over the years. You can see this by comparing the movements of NPCs in games from previous decades to how modern characters get around a map. The difference is night and day.