Live data from Hacker News

Street Fighter II's AI Engine

sf2platinum.wordpress.com

1–10 of 88 posts

Re: Street Fighter II's AI Engine

#2
That's pretty fun, thanks for sharing ;)

Actually with a machine learning approach it's not immediately obvious to me how to incorporate it. I suppose an RNN or reinforcement learning could be used, in principle, to learn good reactions to a given sequence from the opponent, but it would take so many failures to train it, which would have to be generated more or less manually. I don't see how it could be done easily, and certainly not in an "online" way without delivering a pretty terrible play experience.

Are there any good examples of computer-controlled players using an online (or offline) machine learning-based approach to player control, that doesn't suffer from these problems?

The image that comes to mind for me is a computer player that gets better and better at beating you, but the problem is that with reinforcement learning there is no guarantee that this happens reliably and in an amount of time and gradient that would provide a good playing experience -- and then you'd be faced with the problem of it getting "too good", equally not a particularly good play experience.

Perhaps something in between? A machine learning approach that helps select and maybe parameterize these "scripts"?

Re: Street Fighter II's AI Engine

#3
I wonder if knowing the different strategies would make pro-humans better at playing the game. I feel like they might already have internalized the different strategies the computer uses, but still pretty surprising to see how simple the source code is.

Also cool to think about would be AI-vs-AI street fighter competitions. Or SF AI that learns from live matches currently being played online.

Re: Street Fighter II's AI Engine

#4
post #3

I wonder if knowing the different strategies would make pro-humans better at playing the game. I feel like they might already have internalized the different strategies the computer uses, but still pretty surprising to see how simple the source code is. Also cool to think about would be AI-vs-AI street fighter competitions. Or SF AI that learns from live matches currently being played online.

> Also cool to think about would be AI-vs-AI street fighter competitions.

That's a fun idea. Provide an editor for the AI script files so you can program your own AI, then inject that into the ROM and pit AIs against each other.

Re: Street Fighter II's AI Engine

#5

That's pretty fun, thanks for sharing ;) Actually with a machine learning approach it's not immediately obvious to me how to incorporate it. I suppose an RNN or reinforcement learning could be used, in principle, to learn good reactions to a given sequence from the opponent, but it would take so many failures to train it, which would have to be generated more or less manually. I don't see how it could be done easily,…

They're fighting games. Why do we need to incorporate machine learning at all? If the computer wanted to they could always play perfectly because it could react to any input perfectly.

Re: Street Fighter II's AI Engine

#6
post #3

I wonder if knowing the different strategies would make pro-humans better at playing the game. I feel like they might already have internalized the different strategies the computer uses, but still pretty surprising to see how simple the source code is. Also cool to think about would be AI-vs-AI street fighter competitions. Or SF AI that learns from live matches currently being played online.

> I wonder if knowing the different strategies would make pro-humans better at playing the game.

Kinda. Some of the AI strategies are based on the behaviour of human players. For example, in the later versions when Ryu dizzies the opponent, he will whiff several jabs. This is widely regarded as a tribute to a combovideo maker known as TZW[1] who often did this in his videos. With regards to actual Fighting Game strategy, the AI in Super Street Fighter II absolutely uses tactics employed by real players.

These are a few off the top of my head:

- Tick throws

- Whiff aerial attacks into command grab

- Footsie spacing into whiff punish

- Fake footsie spacing into grab

- Low/Overhead attack mixup

- Left/Right attack mixup

Using Lua scripting, a compatible emulator and a rudimentary neural network it's completely possible to build a "better" AI. I believe a more advanced one was recently created for Super Smash Bros [2].

1. https://www.youtube.com/watch?v=M0CidJaVS0Q#t=4m48s

2. https://arxiv.org/abs/1702.06230

Re: Street Fighter II's AI Engine

#7

That's pretty fun, thanks for sharing ;) Actually with a machine learning approach it's not immediately obvious to me how to incorporate it. I suppose an RNN or reinforcement learning could be used, in principle, to learn good reactions to a given sequence from the opponent, but it would take so many failures to train it, which would have to be generated more or less manually. I don't see how it could be done easily,…

They're fighting games. Why do we need to incorporate machine learning at all? If the computer wanted to they could always play perfectly because it could react to any input perfectly.

'learning to fight against you, sort of like a human would' is a lot more fun than 'literally cheating and perfectly countering you'

Re: Street Fighter II's AI Engine

#8
post #4
post #3

I wonder if knowing the different strategies would make pro-humans better at playing the game. I feel like they might already have internalized the different strategies the computer uses, but still pretty surprising to see how simple the source code is. Also cool to think about would be AI-vs-AI street fighter competitions. Or SF AI that learns from live matches currently being played online.

> Also cool to think about would be AI-vs-AI street fighter competitions. That's a fun idea. Provide an editor for the AI script files so you can program your own AI, then inject that into the ROM and pit AIs against each other.

You can do it using the techniques employed here:

https://github.com/aikorea/strikersii_ai/tree/master/genetic

Demo:

https://www.youtube.com/watch?v=k6Ir8yd9iOk

In terms of FGs, you would store the relevant game state as inputs and build a reward function around health, time, damage done etc. A relatively simple (and useful!) SFII AI would be one that tries to win by only using crouching medium kick, sweep and throw.

Re: Street Fighter II's AI Engine

#9

That's pretty fun, thanks for sharing ;) Actually with a machine learning approach it's not immediately obvious to me how to incorporate it. I suppose an RNN or reinforcement learning could be used, in principle, to learn good reactions to a given sequence from the opponent, but it would take so many failures to train it, which would have to be generated more or less manually. I don't see how it could be done easily,…

This is just me bullshitting, but I imagine you'd want to continue shipping a simple interpreter and some kind of script for the computer opponents and use a hypothetical learning system to generate the scripts separate from the game you ship. The AI code in the game would be simpler, the scripts could be easily patched, users could generate their own scripts, etc.

I think you could probably generate and hand-tune a number of situational scripts and let a learning system decide how best to chain them for particular circumstances (e.g. if the opponent is Character A, the computer is Character B, the computer's relative health is much lower, and Character A has a full super combo gauge, then it learns a particular sequence of scripts that proves effective in replays).

Re: Street Fighter II's AI Engine

#10
post #3

I wonder if knowing the different strategies would make pro-humans better at playing the game. I feel like they might already have internalized the different strategies the computer uses, but still pretty surprising to see how simple the source code is. Also cool to think about would be AI-vs-AI street fighter competitions. Or SF AI that learns from live matches currently being played online.

[deleted]
Post reply on HN