metal-crow / Dark-Souls-PvP-AI

AI for playing (and winning) in dark souls pvp
Other
328 stars 40 forks source link

Strange usage of fann #15

Open Seraphli opened 7 years ago

Seraphli commented 7 years ago

I find this in your code ann = fann_create_shortcut(2, fann_num_input_train_data(train_data), fann_num_output_train_data(train_data));

And according to the doc of fann, you set the learning rate to 2? But that is not good parameter in deep learning. And because you have some output in line 171, I think what you really want to do is to create a ANN with 2 hidden layers and given input/output number.

First I thought there might be a change in doc or API of fann, but I find the webpage in 2015, which shows that the doc is same as it from now.

So this makes me confused.

metal-crow commented 7 years ago

Ah, I believe the docs you're referencing are for an older version (<=1.2.0), because the FANN website's doc http://libfann.github.io/fann/docs/files/fann-h.html#fann_create_shortcut show the fann_create_shortcut function as taking the num_layers as the first parameter for FANN version >2.0.0. I'm using FANN 2.2.0, so it must have changed since that older version.

Seraphli commented 7 years ago

OK, but this is still strange that the network don't have a hidden layer. I thought you had two hidden layers.

metal-crow commented 7 years ago

Huh, you're right. How on earth has the network been performing reasonably at all without a hidden layer?

Checking the history it looks like I originally had a commit that specified //set up net without hidden layers, which I believe was an early commit when i was still testing the Neural Net idea. I guess what happened is when i decided to implement it fully, i copied that line without changing the layer argument, so I've been using a non-hidden layer NN all this time.

Wow, that's super odd. Nice catch, thank you! I'll fix that up soon, wonder how it'll affect the NN results.

Seraphli commented 7 years ago

I'm looking forward to see the result. 😄 BTW, the video link you given in the readme file didn't show very astonishing performance. But in the trailer it seems to perform quite good. I notice that the AI were using a different weapon. Do you have any other videos, which can demonstrate real time performance?

metal-crow commented 7 years ago

By "video link you given in the readme", do you mean the livestream (hitbox.tv)? While I definitely did some cherry picking for the trailer, the livestream should give a decent idea as to how well it can function (except against magic, it's bad with that). The different weapon doesn't really affect anything, I've tweaked some params for it to use the new (non-trailer) weapon, and it allows it to work somewhat better. What did you see that seemed non-astonishing?

As for another demo video, the only other one is https://www.youtube.com/watch?v=S65DWqqn5gE, which wasn't made by me.

Seraphli commented 7 years ago

Yeah, the link will redirect to smashcast. And in the video entitled {TESTING} Project King: Dark Souls PvP AI - Jan 28th #1, the AI seemed to just chase and attack the player. There are very few dodge and backstab movements shown in the video, but the AI clearly cannot perfectly dodge all attacks. I thought the AI could win most fights, but I saw a lot of defeats? Also, I was wondering why at the beginning of a fight, you can often see your enemy moving several seconds before the AI does. Does it wait on purpose?

metal-crow commented 7 years ago

Ah yeah, couple things about that video. It's really old, it from a still immature release (i was testing a new version at the time i believe), so what you see isn't near its current state (also why the AI would pause for a few seconds. The auto-invade wrapper was immature att). Also, often the opponent would heal on it, and the ai didn't yet have a counter-heal routine, so it was just getting whittled down as the opponent just would heal up. Even still, i think it does decently for some of the fights in those videos. Maybe i'm just seeing a different part of the 5 hour video, but it does a fair bit of backstabs and dodges.

For your question, technically you're right that the AI clearly cannot perfectly dodge all attacks, that was a bit of an exaggeration. It doesn't dodge some magics. However, it is capable of dodging any and all melee attacks, provided it is not locked in an animation at the time (say attacking). That's one of the big issues the ai has ATM. It doesn't know when to safely attack, and will often trade, taking more damage than it gives. That NN needs improvement.

Seraphli commented 7 years ago

Alright, I get it. :sun_with_face: Long may the Sun shine.