Toribash
Original Post
NN's
http://verveproject.blogspot.com/200...-humanoid.html

Watch and behold
Neural Networks are really not that advanced, and training it can easily be done with genetic algorithms, a "the fittest survive" kind of deal.

I think it would be awesome if some people got together to try and put together an AI with this principle. I'm not gonna try my hands on this until LUA has become a more established part of Toribash (I hope Hampa is working on this =)), but I would like to know if there's guys here interested in this stuff.

If you're interested in this, you really should read

this: http://www.ai-junkie.com/ga/intro/gat1.html

and this: http://www.ai-junkie.com/ann/evolved/nnt1.html

So, is there interest?
Erm, read the Uke-bot threads. It's already done. (Albeit a bit simpler due to not having proper inputs on Uke's part)

Problem is, to use Neural Nets you need I/O. Once you get I/O, it'll be pretty easy.

Also, look for NERO the game. It's a game based around Neural Nets and training them. Just playing it and understanding the mechanics made NN's simple for me. : )
Originally Posted by SSJokker View Post
Erm, read the Uke-bot threads. It's already done. (Albeit a bit simpler due to not having proper inputs on Uke's part)

Problem is, to use Neural Nets you need I/O. Once you get I/O, it'll be pretty easy.

Also, look for NERO the game. It's a game based around Neural Nets and training them. Just playing it and understanding the mechanics made NN's simple for me. : )

I've seen your bot
I just meant taking it further, but that's not possible yet, as you have too little information (as you said). I'm a NN novice, but they're damn simple (atleast on the surface, I'm sure there's lots of cool algorithms to use/develop)

Oh, and I'll check out that game, it sounds cool .
I'm taking a course on NN's. Not sure if you guys are doing the math, but I know I am.
Anywho, what are the limitations on commands on multiplayer?
I already know I can't
for i = 0,19 do
for x,y in pairs(get_joint_info(enemy,i)) do
Although, maybe you can train it from your own actions?
And another question, are we trying to find? A "pattern" of winning move sets? Secondly, freeze1 and freeze2 are dependant events. How should we treat that?

I started my own AI, without realizing I/O problem. I had a different idea than a real NN.

Yes, I know this is an old post, but AI's will always get some ones attention.
Last edited by FNugget; Jan 13, 2008 at 05:56 AM.
Ok well I have a little experience with NN but not so much with Tori and the lua system so maybe people can answer some of my questions and we can get something done.

The SDK provides the ability to get information about the world state (such as joint position for either player, damage), so I dont know what SSJokker is talking about when he says there is no I/O: use LUASOCKET!!!!!!!

Luasocket is a lua library which will enable you to send UDP packets back and forth to JNEAT (a very nice and modular java neat implementation) which is what does the heavy lifting for you.

Heres the bottlenecks to getting this thing working as I see it:

NEAT is very hungry for fitness tests. To get a reasonable solution it needs many generations of fitness tests; each generation will have a population ranging from 100s to tens of thousands.

That means with an initial pop. of 1000 controllers, 20 generations in we require over 20000 matches of Toribash to take place.

Getting the information from Toribash to JNEAT isn't the problem here, its getting a reasonable amount of tests done in a very limited timespan.

Another thing occurs to me: NN fail when they are applied to finding a complex solution right off the bat.
To make this work well, the best bet is first teaching the NN something relatively simple, like not falling over, then moving up to walking, then moving up to hurting the enemy. That means we need our fitness tests to become progressively harder once one of the neural nets stumbles upon an optimal solution.
Last edited by tripwire; Feb 27, 2008 at 03:44 AM.
Originally Posted by tripwire View Post
Ok well I have a little experience with NN but not so much with Tori and the lua system so maybe people can answer some of my questions and we can get something done.

The SDK provides the ability to get information about the world state (such as joint position for either player, damage), so I dont know what SSJokker is talking about when he says there is no I/O: use LUASOCKET!!!!!!!

Luasocket is a lua library which will enable you to send UDP packets back and forth to JNEAT (a very nice and modular java neat implementation) which is what does the heavy lifting for you.

Heres the bottlenecks to getting this thing working as I see it:

NEAT is very hungry for fitness tests. To get a reasonable solution it needs many generations of fitness tests; each generation will have a population ranging from 100s to tens of thousands.

That means with an initial pop. of 1000 controllers, 20 generations in we require over 20000 matches of Toribash to take place.

Getting the information from Toribash to JNEAT isn't the problem here, its getting a reasonable amount of tests done in a very limited timespan.

Another thing occurs to me: NN fail when they are applied to finding a complex solution right off the bat.
To make this work well, the best bet is first teaching the NN something relatively simple, like not falling over, then moving up to walking, then moving up to hurting the enemy. That means we need our fitness tests to become progressively harder once one of the neural nets stumbles upon an optimal solution.

You can't use separate libraries with TB Lua. It's restricted. Or at least used to be when I wrote that post saying there's no I/O. At that time you couldn't write any files at all.

Also, always check dates, this is a way old thread.

Also, JNEAT isn't exactly the best solution. Making your own, specifically for TB, would be better.
Originally Posted by Jok View Post
You can't use separate libraries with TB Lua. It's restricted. Or at least used to be when I wrote that post saying there's no I/O. At that time you couldn't write any files at all.

I was under the impression that you could import libraries in Lua but I didnt know this was restricted in TB (obviously I am a beginner at TB which is why I'm trying to get some help). Still, sockets are only one way of interprocess communication.

Also, JNEAT isn't exactly the best solution. Making your own, specifically for TB, would be better.

??

Making my own what?
Do you even know what exactly NEAT is? It's just an algorithm for evolving neural nets which happens to be fast and very general purpose. Theres newer iterations on that theme (for example CPPN/HyperNEAT which uses arbitrary activation functions and models neural nets along multidimensional substrates) but those are not necessary to make a good Tori AI.

JNneat is already made, it works and its proven.

Whats more, it only requires the code for the fitness test to be plugged in.
That means all I need to get this working is some way of communicating lua function values to JNEAT.

You said theres file handling in TB now, right? Well I can easily write some java code to communicate to TB through a file.

Can you tell me how to/point me to a link explaining file handling in TB's implementation of LUA?
Originally Posted by tripwire View Post
I was under the impression that you could import libraries in Lua but I didnt know this was restricted in TB (obviously I am a beginner at TB which is why I'm trying to get some help). Still, sockets are only one way of interprocess communication.

??

Making my own what?
Do you even know what exactly NEAT is? It's just an algorithm for evolving neural nets which happens to be fast and very general purpose. Theres newer iterations on that theme (for example CPPN/HyperNEAT which uses arbitrary activation functions and models neural nets along multidimensional substrates) but those are not necessary to make a good Tori AI.

JNneat is already made, it works and its proven.

Whats more, it only requires the code for the fitness test to be plugged in.
That means all I need to get this working is some way of communicating lua function values to JNEAT.

You said theres file handling in TB now, right? Well I can easily write some java code to communicate to TB through a file.

Can you tell me how to/point me to a link explaining file handling in TB's implementation of LUA?

Making your own neural net handling script. Made entirely in Lua. Trying to basically integrate Java into Lua will NOT work. It will simply bug to hell.

File handling in TB Lua is like in any kind of Lua, however restricted to the data/scripts directory.

Lua is too slow to be of any use to JNEAT, and would take AGES, especially seeing as how you'd have to actually play thousands of games to train even the most basic thing.

Also, you'd have over a hundred inputs to the neural net, the hidden layer would go over a thousand, and the output would be 21, being the joint states. It's not plausible to make something like this. It's been tried. By me. You won't be able to do any better until some restrictions placed in Lua have been removed.
Originally Posted by Jok View Post
Making your own neural net handling script. Made entirely in Lua. Trying to basically integrate Java into Lua will NOT work. It will simply bug to hell.

File handling in TB Lua is like in any kind of Lua, however restricted to the data/scripts directory.
Lua is too slow to be of any use to JNEAT, and would take AGES, especially seeing as how you'd have to actually play thousands of games to train even the most basic thing.

Don't take this personally, but every point you make here is kind of irrelevant. This is understandable because I havent given you a full explanation of what I'm doing and so I guess you are filling in the blanks.

I do not require my own neural net handling script. This is taken care of by JNEAT.

I do not NEED to integrate java and LUA. There will be no references in my LUA scripts to java; LUA and JAVA will not touch directly in any way.

I do not require LUA to be fast for JNEAT. LUA is not slowing anything down right now: the interface between JNEAT and Toribash is SYNCHRONIZED: this means everything will happen in order, no matter what. JNEAT will wait until toribash is finished with a test, then it will do its thing, and not a moment before. My lua script is not doing ANYTHING except for pulling a variable from Toribash's world state and writing it to a file.

You are correct that I would need thousands of matches of Toribash to get anything useful. I don't see this as being impossible to achieve; in the worst possible case I can write a dummy openGL driver to speed it up. With some luck, there might be another easier way; I'm hoping Hampa might be able to shed some light on that.


Also, you'd have over a hundred inputs to the neural net, the hidden layer would go over a thousand, and the output would be 21, being the joint states. It's not plausible to make something like this. It's been tried. By me. You won't be able to do any better until some restrictions placed in Lua have been removed.

You should really try NEAT out, because it's a lot better than you think. It scales to HUGE amounts of input and output neurons without getting bloated.
http://www.cs.ucf.edu/~kstanley/neat.html#FAQ2

Here is a "hopper" which uses 12 inputs and 2 outputs. Think of it as a dismembered arm in toribash if you like.
http://www.hypeskeptic.com/Mattias/E...NEATHopper.asp
NEAT is able to generate a neural net that balances in one spot without falling over, and in only 5 generations (thats about 3000 fitness tests).


Wait, theres more! What's that you say?? Over a hundred inputs is too much?? How did these guys use 280 inputs then? Not only that, but they did all of their fitness tests in real life using a physical robot!!! It took them roughly 2 minutes of real life time for a succesful fitness test and yet using NEAT they were able to evolve a controller which can succesfully drive a car
http://nn.cs.utexas.edu/project-view.php?ProjID=128


It's hard to read why you are saying, and see research that says the exact opposite and not conclude that you don't know what you are talking about.
Last edited by tripwire; Feb 28, 2008 at 10:13 PM.
Originally Posted by tripwire View Post
Wait, theres more! What's that you say?? Over a hundred inputs is too much?? How did these guys use 280 inputs then? Not only that, but they did all of their fitness tests in real life using a physical robot!!! It took them roughly 2 minutes of real life time for a succesful fitness test and yet using NEAT they were able to evolve a controller which can succesfully drive a car
http://nn.cs.utexas.edu/project-view.php?ProjID=128


I'll concentrate on the bit that I haven't handled already in my other post in the other thread.

When I said over a hundred inputs, I didn't mean 101. I meant well over 280. Let me list the few categories you'd have to include.

+ Body part positions, both players (100 at least)
+ Former body part positions, both players (100 at least)
+ Joint positions, both players (42)
+ Former joint positions, both players (42)
+ Joint speeds, both players (42)
+ Former joint speeds, both players (42)
+ Body part angles according to ground level, both players (100 at least)
+ Body part angles according to EACH OTHER, both players (well over a thousand if you were to take each body part in accordance to each other)
+ Whatever else I forgot.
+ Environment objects positions/angles/speeds when Lua allows it. (50 or so)

What's that, well over a thousand inputs? Well, yeah, NEAT can handle it. Sure, but how do you think NEAT and Toribash will work together if NEAT takes 5 minutes to pass through the calculations, and Toribash has to wait for said 5 minutes. An exaggeration, but still.

Find an algorythm you can use, instead of using basic NEAT. Modify NEAT to work for you better, or simply make your own.

Granted, proof of concept/first alpha's can use the basic NEAT system, but eventually you'll HAVE to optimize it for Toribash.



Also, I forgot to state in the other posts, a second way you could get fast simulations would be getting in touch with hampa, and redoing the Toribash physics system (exact values and all) and using your own simulation to train it. That would make it very plausible.