DEV Community

Cover image for AI in Gaming
PixelPlex
PixelPlex

Posted on

AI in Gaming

#ai

Video games have been using artificial intelligence for many years now. Unfortunately, in 2D fighting games, artificial intelligence seems far less intelligent and more assisted because they are part of the game itself. There are a lot of consistently unfair benefits given to computer players in these types of games. From inputting moves and combinations faster than pro players, having frame one reactions, and seeing inputs before they appear on-screen. There are better ways to design the computer players in this genre, and that can be achieved by giving the computer the ability to adapt and make reads like the player.

The AI being impossibly fast with both inputs and reaction time can make players feel destined to lose. Even with all these tools at the AI's disposal, they can still be beaten consistently because of their exploits and how it does not adapt in matches. Adaptation and reads are a big part of why fighting games are still popular. In 2D fighters, adaptation is at the core of every match. When an opponent consistently jumps to attack, the other must realize they will jump and attack with a move that hits aerial opponents. If the player predicts or makes a read that he will jump forward again, they can adapt by attacking the space where he would jump. Eventually, they will realize they are getting hit, and they will adapt by choosing an option other than jump. This exciting push and pull between players come in many forms but is in every competitive match. Many people would agree that adaptation and reads are what makes fighting games worth watching and playing. It is also the aspect that needs to be ingrained into the AI to make playing against them more engaging and enjoyable.

In most 2D fighting games, the AI-controlled computers switch between several different hidden scripts that represent various mindsets. A few prevalent mindsets include rushdown, footsies, and zoning. Using RNG, a random number generator, they switch between different mindsets. Depending on the character, it may be more likely for them to be in one mindset than another. They may also stay in their preferred mindsets longer and completely omit others. The computer uses distance, opponent's action, and RNG to choose their next option. This "mindset" does not change at all, and RNG is not equivalent to adaptation. These types of AI have many exploits to beat them easily. Standing at a certain distance will make them taunt even though they are still in the range of being hit. In some scenarios, the computer will always respond to an action with the same move set every time. After realizing this, the player will set up a singular circumstance and get rewarded heavily for it. If the player jumps at an aerial computer opponent in Smash Bros. for Wii U, they almost always air dodge. Players can adapt to their air dodge, but the computer cannot adapt back and becomes vulnerable to attack. The only thing keeping these matches engaging is the fact that the AI has impossibly fast inputs and often starts reacting to a move before it shows up on the screen. Many fighting game developers make their computer-controlled fighters act in this manner, but this 30-year-old formula needs improvements.

Knowing the problem is halfway to solving it. So what changes can developers make to improve the AI of 2D fighter games? Let us start by looking at how people adapt their playstyle within a match. The AI will possess several different mindsets that will change based on the positioning for a match. A different mindset is used when the opponent is standing far away, near, mid-distance and must defend against corner pressure, or initiate corner pressure. Every single adaptation starts with gathering information. There is no way for a player to adapt to something without knowing why they are adapting. The computer should be the same way because the computer needs to mimic player behavior. When both characters are selected, the AI will recognize its opponent and alter all its mindsets. If they are fighting a grappler, the chance they will approach will be less, and when fighting a zoner, they will have a higher chance of approaching. As the round starts, the computer will have a midrange mindset. Staying just inside burst range and using low committal attacks. If the player is continuously pushing the computer further and further into the corner, the computer will have a growing chance to do an unsafe but rewarding option.

The Computer character will also keep track of what kind of pokes the opponent is doing and have a growing chance to react with a move that will counter it. Depending on what they got hit by, the computer will be more likely to choose behaviors that would have let them avoid or counter the hit. The earlier example is considering there is a balanced character in battle. A zoner in mid-range will use more projectiles and be more likely to back up further. Rushdown characters will focus more on approaching and close-range mix-ups. Easier said than done, but when realized, the AI would gather much praise.

This AI must be fine-tuned for each matchup a fighter can face, but each character would have its own slightly tweaked AI to do this right. In a day in age where fighting games have at least 20 characters and often much more, tuning adjustments to AI will require a lot of development work. BlazBlue Central Fiction has 33 characters, so if they put this much dedication into their AI fighters, they would have to make 1089 fine-tuned AI. That is a ludicrous amount and foolish to attempt. Similarities between characters can lower the number, but the game would have at least 800. A game with this experimental AI would need a minimal roster. However, fewer move sets mean fewer characters people are interested in, and it could harm sales. The only way I see this being done is with a cast of 5 or lower by a small team that wants to show off the AI instead of making a detailed and option rich fighting game. A new game series with few characters makes the workload plausible, but who would buy a fighting game with only five playable characters? Nintendo uses elite smash matches as a reference when balancing Super Smash Brothers Ultimate. If there was a way for the AI to understand and utilize the adaptations from online matches, it could program itself. This way, it will learn new technique as they are discovered and will not need to be modified during balance changes.

Computer players advanced decision-making will make them harder to exploit and give players a more significant challenge. It would be utterly unfair if they still had impossibly fast inputs and reaction time. Computers have these benefits to help them compensate for their lousy decision-making in matches. Once the AI has been improved, their reaction and input time need to be slowed down for balance. They will still be fast when it comes to reacting and inputting moves, but at a speed where people can reasonably copy.

In conclusion, 2D fighting games have used the same outdated AI principles for too long, where people actively encourage newer players not to play against them when trying to improve. The AI is flawed, and developers gave them inhuman input and reaction time to make up for it. While considering how humans play fighting games, I made a rough idea of a computer player that plays well without practically cheating. Unfortunately, it would be too much work to incorporate this type of AI in any modern fighting game. There needs to be one with a minimal cast to make the workload feasible. Whoever does use these principles in their game will be praised by many people within the fighting game community. Only then, it might seep into other games and improve the genre as a whole.

Top comments (0)