in ,

AI And Gaming

Artificial intelligence has always been interested, from near or far, in the world of gaming. As early as 1949, a cryptographer by the name of Claude Shannon had indeed started to develop a chess game without a human player, on a computer.

Today, technological advances, including improved consoles, the cloud, connectivity, ultra-powerful graphics cards, virtual reality, headsets, and more, have continued to power AI by enabling not only an even more immersive experience but also game elements that mimic human behavior and intelligence.

But are these innovations only of benefit to the gaming industry, and is there absolutely nothing to fear from the use of artificial intelligence in the development of video games or casino software?

However, apart from a few rare exceptions designed as technical feats (such as OpenAI Five, which learned to play DOTA 2 on its own and beat many teams of professional players), video games do not technically use AI.

It is mainly a marketing term for a much simpler cousin of these programs, which govern most of the moving elements of a video game. However, they are important and often ubiquitous: here are the basics to understand them.

What is a video game AI?

A modern video game is most of the time composed of objects, models, and zones with different properties: character, wall, water lake, door allowing to change zone, etc…

In almost all games, there are also moving objects that move in the game space, such as NPCs, enemies, and bosses. In order for them to be able to move by themselves, they are associated with artificial intelligence that will vary according to the roles they have to play.

An AI is nothing more or less than an association involving several scripts, which will describe the actions that the object will take. One would expect the latter to be incredibly complex, but in reality, very simple designs can do the job in many games.

The classic enemies of the 2D Mario series are perfect examples. The artificial intelligence of a goomba can be summed up very simply by this:

-Go to the left

-If the goomba encounters an obstacle, turn around.

It is difficult to really talk about “intelligence” here. The program just runs without even really noticing the player. However, this is the basis of how any form of artificial intelligence works. The more complex ones will simply have many more actions under more conditions.

How does complex artificial intelligence work?

At its heart, the AI found in the vast majority of games is just a gigantic branch tree. At the end of each branch, we find one or more simple actions that the computer will perform, often according to a repository based on the terrain and its position to the player.

In the case of an enemy, for example, this could be a particular action, a straight line spell that targets the player’s character’s position, or a simple command to move away.

The creation of artificial intelligence is just a matter of programming these decisions so that the object in question makes decisions that are consistent with what it is supposed to do, its environment, and the player’s actions.

What will allow the AI to “choose” will be a simple verification of conditions or not. We start at the base, at the trunk of the tree, then at each branch, the computer will choose its path according to the conditions it detects. These conditions are often called “flags”.

The AI continues to go up to its priority tree and check parameters, following a kind of priority list. If the criteria are met, it performs the associated action. If not, it continues on its way until it waits for an action that meets all its conditions.

In short, it is simply a logical sequence that, when pushed to a certain point, allows a computer to make more or less correct decisions depending on the situation.

If you are trying to familiarize yourself with this principle through another video game, the gambit system of Final Fantasy 12 allows you to reproduce very summarily the workings of an artificial intelligence. By defining each action according to conditions, it is possible to set up your whole team to work automatically after a little work and a few levels.

Example :

We can synthesize the AI skeleton of a classic FPS enemy in the following way:

Priority #1: If a grenade is less than 5 meters away, stop all action and move away from the explosion.

Priority #2: If I’m not undercover, move to the nearest cover.

Priority #3: If the player has been static for too long and has not been hit by a shot in the last 10 seconds, throw a grenade.

Priority #4a (I have covered): If I am undercover, alternate between three seconds of being undercover, then two seconds where I stick my head out and fire at the player’s location.

Then start again.

Priority #4b (I don’t have a cover): Shoot where the player is if his or her position is more than two meters away. Make a hand-to-hand attack if it is less than two meters away.

A Place for Random

Of course, artificial intelligence tends to be more subtle and a little less predictable today. In order to replicate the hesitations or decisions of another human or to leave a little room for error for the gambler, most of the actions of artificial intelligence are subject to random factors.

The enemy in the previous example may not see the grenade. For example, it can be set up so that, even with all the conditions met, he has a chance of not getting out in time. If he is aiming at the player, he only has a certain percentage chance of hitting him, depending on different factors (distance, coverage of the player, if he is moving…).

Most RPG bosses and enemies have a probability of making each attack randomly, with these probabilities evolving over the course of the battle towards more lethal attacks.

This is a fine line to stand on. Leaving room for randomness makes interactions with the machine more lively, less predictable, and therefore leaves room for improvisation. However, it should not be made completely irrational either. The goal is to keep some consistency in the behavior of an AI and to make it more or less efficient depending on the desired difficulty.

What kind of AI should I plan for my game?

If artificial intelligence is rather easy to understand and to design on principle, all their subtlety lies in the finer settings, so that they behave as much as possible in accordance with the theme of the game.

For more “arcade” games (platform games, some action-adventure, MMOs, and RPGs)

If your game is not meant to be a realistic experience and is intended purely and simply as a gameplay experience, there is no need to lavish your characters with very complex artificial intelligence. On the other hand, it can be fully used to test the player’s abilities or to force him to vary his style of play.

If the player relies too much on a particular character on his team, casting a prison spell can encourage him to change it. Flying enemies in Mario make the player choose between dodging their projectiles or attempting some acrobatics to get rid of them completely.

For more realistic games (FPS, action-adventure, simulations, infiltration)

If your game seeks to emulate reality (or, in the case of robots, zombies, or aliens, to reproduce realistic behaviors), it may be useful to take a closer look at AI. In these cases, it is preferable to set the AI to behave reasonably compared to what it is supposed to represent.

We expect an enemy of the bandit type to be aggressive, to use some subterfuge to get the upper hand (ambushes, blindness…), or even to flee if he sees that the fight is lost in advance. An NPC met in a city will follow a certain path, stopping occasionally to talk to passers-by, carry or actuate something.

These behaviors don’t necessarily need to be very thorough, they just need to be consistent with what one would expect of them without being too interested in them.

In a competitive game (RTS, VS Fighter, strategy game)

In addition to the usual elements, if the player plays this kind of competitive game alone, artificial intelligence will take the place of one of his opponents. This is a special case because these AIs then have very similar possibilities to those of the player (adapted for his camp/character, of course).

These are probably the most difficult AIs to create because they have to be taught to play the game in different ways (very badly for easy difficulties and almost perfectly at expert level). They must not have access to gameplay elements inaccessible to the player (except in special cases, like some kind of boss).

In order to make this task easier, we will tend to associate to each playable character its own AI, which has a kind of “personality”, in a specific way to play. If the character is aggressive, the computer will try a riskier playstyle. If it is defensive, it will only move from its base when it has an undeniable advantage.

Points to expect when making an AI

Is it predictable enough and does it fit my game?

As said before, artificial intelligence only makes sense if it is not totally random. Ultimately, a gambler needs to be able to learn its subtleties, how it works in general, and what to expect. Assimilate the behavior of computers days directly into the learning curve of a game: there must be a logic that this exercise is satisfactory.

Unless a change is justified through the game’s diegesis (new enemy, new transformation, change of sides, etc…), it is better to avoid any drastic change in its evolution.

Is it worth investing resources in it?

Coding and developing artificial intelligence is a time-consuming process. It is costly in terms of time, and sometimes in terms of the processor resources used by the final game.

Creating an incredibly complex AI is rarely necessary. Before you start developing it, ask yourself if it is really necessary or if you can’t afford to use another gameplay mechanic that is just as interesting.

A platformer enemy, for example, requires no ulterior motive and can be considered entirely as a gaming tool without the need to dwell on it. It is better to concentrate these efforts on developing the behavior of the companion following the player everywhere, like Elizabeth from Bioshock for example.

Beware of bugs

The more time you spend playing with artificial intelligence, the more you realize that it doesn’t have much intelligence. Indeed, these programs are often very simple, subject to raw mathematical logic that will have difficulty adapting logically to all the parameters of a game session.

AI is therefore known to be the scene of many bugs and errors, the results of which vary from hilarity to annoyance depending on what they cause. Do not hesitate to test it under many conditions.

A rather famous example can be seen with Gandhi, the leader of India in Civilization 1. True to its real representation, the AI that embodies Gandhi is one of the most pacifists of the game. Its propensity to declare a violent war is the lowest in the game, 1 on a scale up to 10.

So low that when the computer adopts by default towards the middle of the game a doctrine that reduces its aggression again, this number drops again and goes into the negative. However, due to a programming error (underflow), this value would actually go back to the other side of the mouth, up to 10.

A computer playing Gandhi would typically start each game as a friendly neighbor, before suddenly turning into a crazy warlord, dropping atomic bombs on anyone who crossed his path.

The developers, however, liked this contest very much and kept this anomaly in all the other Civilizations. Gandhi remains a pacifist, but that does not prevent him from seeking nuclear technology as soon as possible to give weight to his words.

So not all players start strictly on an equal footing. However, it is possible to set up a game so that all characters have roughly the same chances of victory in the hands of competent players.

This method is extremely popular because it makes a game much richer, more complex, and unpredictable. It also allows players to choose which type of gameplay suits them best according to their preferences.

Examples: League of Legends, Overwatch, Team Fortress 2, World of Warcraft, Street Fighter

What approach to balancing the incomparable?

Games with asymmetrical gameplays are often much more difficult to balance than their more stable counterparts. This is the reason why most competitive titles using this principle today regularly patch their games to refine these parameters.

The primary goal when balancing an aspect of the game is to respect as much as possible its “game feel” the spirit of how a character, role, or faction is supposed to be played. If a character is designed to be highly mobile, or even elusive, it is important not to take away what makes it unique.

Generally speaking, the simplest option is to make each option have very strong strengths and weaknesses. None of them are universally good, but they specialize in a different style of play and different strategies, in order to make up for their shortcomings or to exploit their advantages.

The trick is therefore to create only powerful characters, even dominant in some aspects while giving players counterplay options to resist them.

Multiplayer game categories

There are several ways to design a game involving multiple players. Each category provides a certain type of experience, dynamics between players and needs different forms of balancing.

Cooperative (or co-op) games

In a cooperative game, the players are united in a common front. They all play on the same team and have the same goal, which is mostly a fight against the computer.

This is the case where the notion of balancing can be laxer, less conflict-prone. Having powerful abilities is not really a problem because they will all be used to make the group’s task easier.

Where developers come in here is to ensure that all members of the group have a role and importance, in order to strengthen the interactions between players. This can for example easily be done by specializing the different characters, making them capable of actions that the others can’t do, or less well.

The “trinity” of roles in most MMORPGs, implemented by World of Warcraft, is a good example. For more difficult challenges, groups are divided into three main roles, depending on the class and equipment of the characters:

Tanks, adventurers in heavy armor and with defensive abilities that will draw enemies to themselves rather than their companions. Healers, who focus on keeping the group alive, removing poisons, and warning them of dangers. DPS (damage per second), who does most of the damage and have more explosive abilities to quickly demolish their enemies.

Competitive games

Competitive games, on the other hand, focus on direct confrontation between players. (although sometimes artificial intelligence or chance can be used to spice up the games). It can range from a duel between 2 people, as in VS Fighter, to a free-for-all of several hundred players where only one player can remain, as in Battle Royale.

The designer’s goal here is to make sure that, among the wide variety of possibilities left to the player, each option is both unique, interesting to play.But above all has the same chances of victory as its opponents.

A competitive game is considered “balanced” when all its characters have, on a very large sample mixing all levels and matchups, about a 50% chance of victory.

This is often a very delicate balance, which depends very much on the abilities of the players involved. At a higher level, as in Esport, a character who wins 52% of the time will be over-represented and another at 55% or more will be dominant.

Competitive games, however, are designed to be balanced and fun only if they bring together players of equivalent levels. Today, the vast majority of online multiplayer games have an effective matchmaking system.It can determine a player’s average level (often using a derivative of the Elo system) and find them a suitable opponent.

Team VS team games

Finally, there is a more recent form of competitive video games, putting two teams against each other. These larger-scale games combine aspects of cooperative and competitive play, forcing players to organize themselves to beat their opponents.

In order to work, it is usually necessary to make the victory of one side more or less directly based on several factors and conditions. To be able to respond to these, the cogs of a team must work together, separating their tasks to be more effective than the opposing team.
Example

League of Legends is a solid example of how this works. Each player in these teams of 5 is assigned a well-defined role, guided by his character’s class.

Traditionally, the top layer is in charge of being the initiator, resistant, and able to engage the enemy team. The jungle will carry out surprise attacks from his concealed position. The mid laner is played by an offensive character who takes advantage of his central position to help his allies. Finally, at the bot lane, we find the carry, which will do most of the damage to the towers (which wins the game), and the support, a defensive character who is in charge of keeping his team alive.

Each role is essential in the team and penalizes the whole team if he is lagging behind or is badly played. This strategy then crashes against the opposing team, who may well use a different composition to gain surprise.

Written by Ottay

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading…

0
stock-exchange

Why Do Spillovers Matter?

IA-learning

The Brain And AI.