Sunday, November 18, 2007

CPU Level 10

Practice against human opponents will always be far superior to that of practice against computer opponents. This is true no matter how good the enemy AI is because computers rarely act like humans, and humans are what humans compete against. With the advent of WiFi matches, there is even less need for computer opponents. Despite all this, I thought it would be fun to concoct a new form of smash character AI. (Don't I write the greatest introductions?)

Of course, I have never seen the AI code used in Melee, but everyone can agree that it is pretty bad. At level 9 (the maximum setting), the AI demonstrates superhuman reflexes and amazing timing but walks into just about any attack. The player can simply charge a smash attack and have the opponent walk into it (yes, even at level 9). While I am no expert on designing learning algorithms, I have a few ideas on how to improve the computer's chances of winning, thus unveiling my version of "CPU level 10".

Ideally, Nintendo could take the time to script an algorithm unique to each character, but I propose a more efficient system. First off, the computer would need to be able to understand its own character in terms of each individual available move. It would evaluate each move in terms of startup time, lag, and how it repositions the character. Then, it would evaluate various strings of moves and rank those strings just as if it were chess game. This way, the computer would focus more on successful results rather than simply using a variety of moves. In Melee, the CPU seemed only able to see one or two moves ahead. Preparing multiple move strings that deliver results would (theoretically) bring out a sort of artificial creativity.

Also similar to chess algorithms, the computer could flag certain move strings if they fail a set number of times. This would help to instill a sense of learning into the CPU opponent. By flagging failed strings, the CPU (hopefully) refrains from making the same mistake. In contrast, marking successful strings would encourage reuse. To prevent any inherent stupidity, there would have to be a few higher level logics in place. For instance, even if all viable options have been flagged as failures, the computer should still make an attempt at one of them as opposed to just standing there.

Now to make sense of the madness, here is a real example. Let us imagine I am playing Roy against the computer's Fox. Fox flags dash attacks and dash grabs as bad choices after I sidestep both kinds of attempts. The computer proceeds to ask itself: what is the next fastest way to approach the opponent? There are two good options. Fox can throw a random short-hop and fast fall into the approach just to make the move string new. Another choice would be to dash away before dashing toward (a pivot or single dash dance). In other words, Fox takes a mathematical approach to mind games.

In the end, there will always be flaws in any repeating algorithm. Computers are predictable by nature since they follow preset rules, but a better algorithm would prove a useful challenge for those lacking in smash neighbors.

1 comment:

Meta Knightmare said...

Wow... Amazing idea, but probably a huge pain to program... (look, brawl is now on the 29th of feb.)