Artificial Inteligence

Discussion and feedback on Construct 2

Post » Mon Mar 12, 2012 10:32 am

Hello All,

Im currently trying to create a 2D fighting Engine (similar to Street Fighter) and would love to hear some ideas regarding how to aproach the AI

My intention is that the "CPU" is able to learn fighting Padrons and adapt to human player capabilities.


Im wondering if anyone has already tried to create some "Inteligent life" in construct2, i was thinking maybe it would be an interesting project to try an analise some Event sheets in order to maybe build a General but flexible Pluggin.

Any ideas?
B
28
S
2
Posts: 69
Reputation: 1,491

Post » Mon Mar 12, 2012 10:44 am

[QUOTE=rgros]My intention is that the "CPU" is able to learn fighting Padrons and adapt to human player capabilities.[/QUOTE]

Interesting... Are you familiar with machine learning?

BTW, "Inteligent life" might be different with machine learning. "Inteligent life" could be created by some fsm(finite state machine).rexrainbow2012-03-12 10:51:53
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Mon Mar 12, 2012 10:55 am

Yes im aware of the concept and that would be the direction to go i suppose.
But im worried of the amount of data that would be stored and the requirement to sort it to be usable.

maybe Repetition recording of Input in certain conditions would be one feature that could help to shortcut the amount of data required to store.

On a fighting game it would already take the dificulty to a "next level".

We have the Playtomic pluggin available i was wondering in what extend that can be used to record Input and behaviour data.

Im quite open to sugestions, but it would be interesting to have something on this level to enable some more realistic computer AI.


rgros2012-03-12 11:24:09
B
28
S
2
Posts: 69
Reputation: 1,491

Post » Mon Mar 12, 2012 11:02 am

It seems to have two questions:
1. store data.
C2 has webstorage to save string into browser. Or FileSaver plugin can save data into a file.

2. logic about machine learning.
Since you already has a "plutronic" plugin for this purpose. The only thing is to export string (or a binary) data out.
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Mon Mar 12, 2012 11:39 am

I meant "Playtomic" sorry my mistake, its a pluggin available at the Plugin section that could help achieving the 2 step.
B
28
S
2
Posts: 69
Reputation: 1,491

Post » Mon Mar 12, 2012 11:50 am

First, I don't want to sound pessimistic, but making a 2D fighting game is super hard, there's a lot of timing issues to do right and I don't talk about animation.
That said, making the computer adapt to your playing style. Hmmm how could this be done?
What is a playing style? A sequence of input that appears more often than other?
Maybe we don't need to go that far as to register input sequences but then register the prefered moves?

If we tackle the question from another angle, what is a good fighting game player? In my opinion it's a matter of timing. Doing the proper attack at the proper time, or doing the proper defense or counter.

So let say you managed to register the moves and you have a graph of what moves appear most often. What should the computer do?

When the player launch an attack doing a weighted random picking on possible defense or counter moves ?
And then when the computer choose (?) to attack, he will do a weighted random picking on each possible attack based on the defenses or counter the player does rarely ?

Ok why not. On the paper that seems doable. Now what kind of game would it be. It would be a game where, if you vary your attack the most you have better chances to win?
So the player will have to memorise what attack he already used and use others to keep the weighted random balance the more even possible. Or maybe volontarily making the same move over and over to the risk of being heavily countered and then switch to something else?

I wonder if it would be that fun. Maybe yes. Anyway, I'm really curious to see the result. I'm interested in IA adaptation so I hope you'll succeed (:
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon Mar 12, 2012 3:46 pm

@Yann

These are "machine learning". It need to design some kinds of experiments to find "patterns". I think it's not easily, not only how to design the experiments, but also the computing complex -- it might be some matrix multiplications.rexrainbow2012-03-12 15:47:05
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Mon Mar 12, 2012 4:49 pm

I don't think it has to be too complex mathematically, and if you figure how to space apart feedback, it might be doable with a neural network. I had considered making a neural network plugin for CC at one point and there were libraries for it for C++. I wouldn't be surprised if there are JS neural network libraries as well. It's not a magic automatic solution where you tell it to learn to fight and you're done. You'd have to study and experiment to find adequate starting weights for the nodes, how many inputs, etc, but I think that's the simplest approach to memorizing arbitrary patterns.

Fourier transforms are also supposed to be useful for the simplification and generalization of patterns, but you'd probably need to design alot more of the AI than for the neural network, and Fourier transforms really are computationally expensive.

Unless you're very interested in AI theory and want to do this for the sake of doing it, it'd be much easier to make fake learning. Program a stupidly hard AI that knows how to counter and dodge everything, and proper timing for effective attacks. Then dumb it down at the beginning of a round or game. Each time the player jump kicks, it increases the probability the AI player will "learn" that it's coming, and begin applying it's jumpkick counterattack behavior, randomizing timing, and mistakes will make it feel more natural. I believe this is how it's done in most fighting games. Even this approach would be timeconsuming, and it's probably the simplest of the three, but not impossible. Just know programming fun AI, even conventional AI will most likely be a long process.lucid2012-03-12 16:55:00
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Mon Mar 12, 2012 5:20 pm

Yeah sorting does play a big role in it, whether it be objects or conditions we could use some tools to make that easier, for each ordered, bubble sort, etc.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon Mar 12, 2012 5:41 pm

A while ago I found an article on Code Project about a Connect Four game that "learns".
http://www.codeproject.com/Articles/7787/Learning-Connect-Four
Obviously it's not the same game or writen in the same language, but I thought it might help.

[QUOTE=lucid]Program a stupidly hard AI that knows how to counter and dodge everything, and proper timing for effective attacks. Then dumb it down at the beginning of a round or game.[/QUOTE]
I made a Tic-Tac-Toe AI in a similar way. If it finds two in a row of your tile, it will block it. If it finds two in a row of its tile, it will win. Otherwise it will chose a random place. I dumbed it down by having it chose a random place sometimes.
B
25
S
8
G
8
Posts: 71
Reputation: 5,307

Next

Return to Construct 2 General

Who is online

Users browsing this forum: anty21ro and 14 guests