Computer opponents “cheating” in games is nothing new. Though the bonuses an AI player gets are more to address the fact it can’t think outside the box like a human can, rather than an attempt to smash you senseless every time. The bits and bytes of Street Fighter 2‘s brains were no different, relying one a single-frame advantage to get ahead of competent, flesh-and-blood combatants.
SF2 Platinum is an attempt to reverse engineering Street Fighter 2 and code it from the ground-up for modern systems, using a combination of C and OpenGL. Here’s a sneak peek.
As the developer has worked through the innards of SF2‘s logic, he or she has made some interesting discoveries. For example, a recent blog post on the project’s site details how the game’s artificial intelligence worked:
Moves made by computer opponents are not made independently but are instead grouped into small scripts, written in a bytecode similar to machine language. A computer avatar has a repertoire of different scripts for each opponent they could face in the game, and set of circumstances, such as a nearby fireball. Instructions in the scripts can command the avatar to execute an attack (punch/kick/special/throw), walk or jump somewhere, and wait — either for a timer, or some condition such as the ability to throw another fireball.
The post goes on to mention that the instructions could go so far as to have “primitive IF…END blocks” so opponents could be flexible based on the player’s actions (or lack thereof):
Here’s one of Ryu’s typical ‘easy’ attack routines: Throw three fireballs at you, and if you’re somehow silly enough to catch all three and get dizzy, run up to you and throw you.
But this doesn’t answer the question about how SF2 cheats. The main way is reading your mind… sort of. When the player inputs a button press or joystick movement, the game uses that information to help the AI make its next move… before your character does:
Each frame of animation for both avatars and projectiles contains a value for the yoke in the metadata, which the AI peeks at to select a script suitable for responding to that attack. The computer sees the yoke of your move as soon as you have input it, before the first animation frame has even displayed. As such it gets one more frame of advantage on top of your reaction time.
It also cheats in more obvious ways:
Charge moves such as blade kicks are simply executed as instructions, so they cannot fail. Guile can do a bladekick from a standing position simply because that’s what’s in the script.
Hit up SF2 Platinum’s post below for even more details. There’s some more technical stuff in there, but as you can see from the snippets above, a lot of it is easy to understand.
The AI Engine [SF2Platinum]