Crashing the AI Heart: A Deep Dive into Creating a Street Fighter 2 AI
In the world of gaming, few titles have stood the test of time like Street Fighter 2. But with the advent of AI, the question on everyone’s mind is: can a machine surpass human prowess in this iconic fighting game? In this article, we’ll delve into the creation of a Street Fighter 2 AI, and explore the technical details behind its development.
The Birth of a Champion
Meet Gyroscope, the mastermind behind this AI project. With a passion for game development and a knack for artificial intelligence, Gyroscope set out to create an AI that could take on the best human players. And so, the “Street Fighter 2” AI was born.
Observation Space: The Key to Success
To create an AI that could compete with humans, Gyroscope knew that observation space was crucial. The observation space is the set of data that the AI uses to understand the game environment. In the case of Street Fighter 2, this includes:
- Each character’s X and Y coordinates
- Blood levels
- Jumping and squatting status
- Mobile command status
- Absolute distance between characters
- Game time
The observation space is massive, with at least several trillion parameters. To simplify this, Gyroscope defined a manual observation space that includes:
- X and Y coordinates
- Blood levels
- Jumping and squatting status
- Mobile command status
Action Space: The Art of Movement
Once the AI has observed the environment, it must take action. The action space is the set of possible movements that the AI can make. In Street Fighter 2, this includes:
- Up, down, left, right, A, B, X, Y, L, and R buttons
- High kicks, wrestling, and other special moves
To simplify the action space, Gyroscope reduced it to a combination of direction keys and buttons, resulting in 35 possible actions.
Reward System: The Key to Learning
The reward system is the heart of the AI’s learning process. In Street Fighter 2, the reward is simply the amount of blood the AI can inflict on its opponent. If the AI inflicts damage, it receives a reward; if it fails, it is penalized.
AI Training: The Long and Winding Road
To train the AI, Gyroscope used a combination of reinforcement learning and neural networks. The AI was trained on a dataset of games, with the goal of maximizing the reward. The training process was long and arduous, with Gyroscope tweaking the observation space, action space, and reward system until the AI was able to compete with humans.
The Simulator: A Crucial Tool
To train the AI, Gyroscope needed a simulator that could mimic the game environment. The simulator was built using the BizHawk emulator, which provides a range of tools for game development and AI training. The simulator allows the AI to interact with the game environment, making it possible to train the AI in a realistic setting.
Intrusion Memory: The Key to Success
To read data from memory, Gyroscope used the BizHawk emulator’s memory monitoring tool. This allowed the AI to read data from memory, such as the opponent’s health and the game time.
Code: The Heart of the Matter
The code for the AI is written in C#, with a simple interface called EmulatorController. The code is designed to work with the BizHawk emulator, and allows the AI to interact with the game environment.
Training Results: A Champion is Born
After weeks of training, the AI was finally ready to take on the best human players. The results were impressive, with the AI achieving a winning percentage of 90% against human opponents.
The Future of AI in Gaming
The creation of this Street Fighter 2 AI is a significant milestone in the development of AI in gaming. It demonstrates the potential of AI to surpass human prowess in complex games, and opens up new possibilities for game development and AI research.
Conclusion
The creation of a Street Fighter 2 AI is a testament to the power of artificial intelligence and game development. With the right tools and techniques, it is possible to create an AI that can compete with humans in even the most complex games. As we look to the future, it will be exciting to see how AI continues to shape the gaming industry.