Toribash
Ah right, so if you mean algorithms then just say so. No, it's not hundreds. You would need millions or billions of generations to beat a player. You seem to be a bit misinformed about how it works. The most common AI learning is stacking a massive database about every possibility with given controls. At first is literally just spamming every combination possible and seeing what happens. Now let's come back to the chess. In chess there are 400 different positions after each player makes one move apiece. There are 72,084 positions after two moves apiece. Since TB has 18 joints and 4 states each as we established, that's 72^72 of combinations, so in toribash there are 5.3E133 different positions EVERY MOVE. So, it would take billions of generations for an AI to beat a player in Toribash, and even that is very optimistic since I'm still not involving the fact that the machine has to predict other player, which would probably take millions of games to build up big enough database about how typical player acts.

So yes, as you said 100kb for an average aikido game, now let's include the database of moves to predict + the database of all the past moves to reference and you're looking at thousands of gigabytes of data. Can your home computer process that much information in around 20 seconds that the frame allows you to edit your tori? Even a supercomputer would probably need some personalised tweaking to run an AI such as this one.

Btw in GTA you don't need to predict where other cars are going in a way that they are other, hard coded AIs with very predictable patterns.

And you're right, I don't have any experience at machine learning, it's just my own research and common sense.
Last edited by Smaguris; Jul 4, 2018 at 11:50 PM.
I looked into this a while ago. First thing I did was research existing work done and found out some guys put together a pretty solid artifical move maker using genetic algorithms and lua scripts for a research project. Pretty neat, but not what we're after.



My vision was to create a program though that would take in a load of replays and learn from those to be able to play a particular mod for example. The first problem with something like that is just amassing enough data to actually train the model in the first place. I put in a request to get a download of all/any aikido games played that were cached or saved anywhere but apparently nothing like that exists.

So we're stuck at the first hurdle there.
Two possible solutions to kick off that first step:
1. Community source the replays. Get as many people as possible to upload all their replays that meet the parameters of what we're looking for. The main issue is that there probably still wouldn't be near enough data and it requires effort for people to contribute. Even if you made a script to crawl the replays section and grab all replays and later filter them for desired parameters you'll probably be short.

2. Create a script that connects to the toribash servers and "watches" games being played in rooms. This involves knowing the protocol to connect to the servers and read game data into a usable format that we can then use to train our machine. I did look into this back a bit and I think with a bit of work should be possible. Then let it run, recording games of the mod you want until you have enough data.



Then from there try to see if we can teach the machine.



This is still not at all trivial. Unlike something like chess where one piece moves to one location each turn, Toribash has 2 players moving simultaneously in 3D space with lots and lots of possible combinations each turn.


For each player:
21 joints with 4 states each = 4^21
And then x2 and x2 for hands gripped/ungripped.
That's...a lot of possible states, and just for one player.



I'm not super well versed in machine learning so I can't really comment on how much of a problem that is but my guess would be that it's on the side of making things harder rather than easier.
Of course its possible with appropriate qualifications.There is a lot of AI's with very effective learning program.I think chess is more competitive ,but its nothing for the AI with "Artificial Intelligence"
I was reading a post about the facebook Artificial Intelligence.This program was stopped by the scientists.The AI created his own language wich is very dangerous.
Of course the toribash AI will be way easier than this.

Solax idea is possible but I think its a little harder than this
LEADER OF ABSOLUTE SANCTUM
RECORD HOLDER
Originally Posted by Solax View Post
So we're stuck at the first hurdle there.
Two possible solutions to kick off that first step:
1. Community source the replays. Get as many people as possible to upload all their replays that meet the parameters of what we're looking for. The main issue is that there probably still wouldn't be near enough data and it requires effort for people to contribute. Even if you made a script to crawl the replays section and grab all replays and later filter them for desired parameters you'll probably be short.

2. Create a script that connects to the toribash servers and "watches" games being played in rooms. This involves knowing the protocol to connect to the servers and read game data into a usable format that we can then use to train our machine. I did look into this back a bit and I think with a bit of work should be possible. Then let it run, recording games of the mod you want until you have enough data.

The issue with this is that the machine doesn't learn from itself at all in both scenarios. While "studying" replays isn't half bad idea, it means it could pick up just as many bad tactics and moves as good ones, which would get it nowhere.

Starting off with sourcing few thousand replays is definitely the right thing to do, but it's only the first and smallest step. The machine would still have to play tens of thousands of games to "realise" which moves are superior to others or how to counter a certain move. The "countering" part would probably be extremely hard to overcome because it requires acting against what ghost is suggesting. It creates a massive spiral of checking previous games to guess what the opponent is going to do, and even then all it can act against is the most statistically probable outcome. Anything that the opponent does out of the ordinary instantly throws off the AI because it can't act on statistical probability no more.

Idk to me it seems like all too much for a system to handle at this point. Maybe after 10-20 years this would be possible from a home computer, but now it would require loads and loads of processing power. This sort of AI would have to update its database constantly with no end to it since there are infinite sets of moves that can be done every match.
Last edited by Smaguris; Jul 5, 2018 at 10:45 PM.
I'm a software engineer, and creating an AI for TB really depends on what information can you extract from the API, if there is even one.
You have to take into account the 4 joint states of all the joints to map what might happen in the next x frames the mod is set to use in a turn, plus you have to factor in collision effects, but otherwise there is a limited number of states (4^40 = 1208925819614629174706176, basically a metric fuckton) you'd have to investigate if you want your bot to have the best winrate possible.
If it was possible to have this done in a reasonable amount of time, what you'd need to do is see which state gets you closer to victory in the majority of scenarios (so 4^20 per state you can choose, 4^40), be that more points or your opponent getting closer to disqualification and just roll with that. Optimal (short term) play by the bot would follow. You can improve this by calculating each possibility for the next turn, and the next turn, and so on, and choose your move based on that extended map instead.
Really resource-intensive, but this bot could play TB even if the guy making it couldn't.
You can simplify this model by introducing openers / pre-set moves, limiting the scenarios you investigate per turn, etc.

Edit: fractures and DMs obviously reduce the amount of calculations needed.
Last edited by ynvaser; Jul 8, 2018 at 02:52 PM.
Toribash is definitely not as complex as Dota, but it has so many possible combinations for moves that machine learning is pretty much the only solution. Since replays are not recorded (and it would literally take years to gather enough replays even with a script), self-learning seems to be the best option. This would be much easier if there was a built-in AI (not machine learning) to play against at the start, but not having one would just mean playing more games against itself.

I'm pretty positive that such an AI is in reach without having an insane amount of resources as long as Toribash has enough information in their an API (as ynvaser said). I think a lot of you guys are not considering how quickly a Toribash AI could train itself. Sure, there are a TON of possibilities in this game but even for players a typical ABD game takes like 5 minutes, and an AI wouldn't need the reaction time—it would come up with a move in less than a second. The only information you need is the state of all 21 joints for each player for each frame. That's not intensive at all and can easily be handled by a decent computer.

I would think of a Toribash AI as being essentially the same as chess, except every piece can move every turn. Moving at the same time vs. taking turns actually doesn't make a difference at all since they're both turn-based, either way you're just trying to predict what your opponent will do next. You would almost certainly use a Minimax algorithm as well. With how much machine learning has progressed in the recent years and the libraries available to the public, I don't think this would be nearly as hard as you guys think it is.
Last edited by Laser; Jul 13, 2018 at 05:46 PM.
S A D B O Y S
Originally Posted by Laser View Post
Toribash is definitely not as complex as Dota, but it has so many possible combinations for moves that machine learning is pretty much the only solution. Since replays are not recorded (and it would literally take years to gather enough replays even with a script), self-learning seems to be the best option. This would be much easier if there was a built-in AI (not machine learning) to play against at the start, but not having one would just mean playing more games against itself.

I'm pretty positive that such an AI is in reach without having an insane amount of resources as long as Toribash has enough information in their an API (as ynvaser said). I think a lot of you guys are not considering how quickly a Toribash AI could train itself. Sure, there are a TON of possibilities in this game but even for players a typical ABD game takes like 5 minutes, and an AI wouldn't need the reaction time—it would come up with a move in less than a second. The only information you need is the state of all 21 joints for each player for each frame. That's not intensive at all and can easily be handled by a decent computer.

There are actually several factors that would make this AI harder to develop than the DOTA one. Just think about this simple concept: in Dota, let's say, an enemy attacks the AI with a skillshot. Using its processing power the AI can make a split second calculation on how to dodge that skillshot, and also if it can fire anything back meanwhile. Now if you look at similar scenario in toribash, the combat works in much more limited way, because both players play out their set of moves at the same time, which doesn't give space for any perfectly calculated moves or counters. In basic terms, Dota can be almost 100% calculated, while Toribash is a game of guessing and predicting. Even if AI knew the joint states of the opponent, it wouldn't help unless it was real time states, something like realtimeghost.

Now when you factor that in, and how Dota AIs were being trained on 100,000 CPUs at the same time, you can realise how big of a scale this project would have to be.

Originally Posted by Laser View Post
Moving at the same time vs. taking turns actually doesn't make a difference at all since they're both turn-based, either way you're just trying to predict what your opponent will do next.

That is extremely wrong. Moving at the same time is massively more complicated than taking turns. You can't even compare chess to Toribash because of how primitive chess is in comparison. Imagine if in a first turn of Toribash your opponent was T-posing and not moving at all. You would most certainly decap or otherwise gain a huge advantage over your opponent, this is how much different it is.

In the game of chess you have the whole board in front of you to make your decision for next move. Nothing changes on the board between you observing the positions, making a decision and moving the piece until the opponent's turn. This way you can make an informed move. In toribash you can never make an informed move, it just wouldn't be possible until you were 100% certain that your opponent is afk or not moving otherwise. Honestly I don't think I need to go on because anyone could figure out by themselves why it's such a huge difference.
Originally Posted by Smaguris View Post
That is extremely wrong. Moving at the same time is massively more complicated than taking turns. You can't even compare chess to Toribash because of how primitive chess is in comparison. Imagine if in a first turn of Toribash your opponent was T-posing and not moving at all. You would most certainly decap or otherwise gain a huge advantage over your opponent, this is how much different it is.

Yeah my wording was retarded they're obviously not the same, I just meant that they're both reaction-based. Sure there is always an element of unpredictability in Toribash, but at least in ABD you can usually tell when someone is going for a kick or a flying knee etc. and it wouldn't be very difficult for an AI to recognize. I fail to see why the AI couldn't just prepare for the ideal move (what it would do in their situation) as this is exactly what top players do and are usually successful (at least I would assume). Some of the best Toribash players play with intuition rather than analyzing their opponent too heavily as well.

Originally Posted by Smaguris View Post
There are actually several factors that would make this AI harder to develop than the DOTA one. Just think about this simple concept: in Dota, let's say, an enemy attacks the AI with a skillshot. Using its processing power the AI can make a split second calculation on how to dodge that skillshot, and also if it can fire anything back meanwhile. Now if you look at similar scenario in toribash, the combat works in much more limited way, because both players play out their set of moves at the same time, which doesn't give space for any perfectly calculated moves or counters. In basic terms, Dota can be almost 100% calculated, while Toribash is a game of guessing and predicting. Even if AI knew the joint states of the opponent, it wouldn't help unless it was real time states, something like realtimeghost.

Now when you factor that in, and how Dota AIs were being trained on 100,000 CPUs at the same time, you can realise how big of a scale this project would have to be.

I'm not going to claim to know a lot about machine learning, but I do know a lot about Dota. Skill shots are an extremely small component of Dota and OpenAI themselves stated that their bot is coded to have the reaction time of an average human to not make it unfair. Also, OpenAI purposely created an extremely vague neural network so that it could be reused for purposes other than being good at a video game which would not be an issue for a Toribash AI, and would speed up the process exponentially.
I may be understating how hard a Toribash AI would be to make without insane amounts of resources, but there is no way it can be more complex than Dota. There are so many mechanics that their AI had to perfect in order to beat the best players in the world. Abusing hero turn rate, keeping creep equilibrium, predicting where the enemy would be when they're under fog of war, etc. Their AI actually taught the best players new 1v1 strategies.
S A D B O Y S
Originally Posted by SkulFuk View Post
Vox had a WIP script that sorta did it years ago (it controlled both toris), but it took days of leaving the game running before it would figure out staying upright let alone managing to fight properly.

Either way it was interesting to watch them slowly improve. The file it created did get horrifically big though since it stored everything that happened through thousands of matches.

No idea if anyone still has a copy of it handy though, it's from 2011/12 and was only passed around the staff on IRC.

The script was uploaded to one of the older dropboxes, ask snake, pretty sure he got hold of it
Now doing recoloring for people not in the clan as-well, PM for more info!
PROUD OWNER OF THORN'S GOOD ENOUGH WRITER AWARD!



Maybe in the future, that kind of AI would be implemented in Toribash Next ;)

My Youtube channel : Mocucha Toribash