Thursday, July 16, 2009

News on ANNE

The toughest task in a programmer's life is not the actual algorithm but the bug hunting, I noticed that something was still weird in ANNE and I found some more bugs in my code, but well.

I implemented some improved trainers for XOR operation and for the emotion part, but this time not by running a fixed number of epochs, but by checking for the LMS (least mean squares) of the training sets, which actually works nicely so. When setting the trainer to 0.01% LMS: ann structure = input:(hidden layers): output

* XOR works after 11422 epochs with 2 hidden layers and it takes 11855 epochs with 1 hidden layer, 2:(2:2):1 versus
2:(2):1. Precision seems to be on par of both by 1%.

* Emotions are trained after 25201 epochs with 2 hidden layers and 18387 epochs for 1 hidden layer, the first is 6:(6:6):6 and the other is 6:(7):6. Their precision is about on par for learned values, but the first is much more precise towards one or the other emotion when interpreting new values, the second would allow for some more varied emotions (like primary and secondary).

My interpretation here is that while for most practical purposes a second layer is not required, it does add a lot of precision if you care for it and if you don't mind the extra time for the training.

I believe ANNE is now working correctly. Now I will start trying different AI scenarios for NPCs, it seems that ann's are suited to be the brains of a NPC, let's see.

Regards,

Sunweaver

3 comments:

Flodis said...

This is interesting. Hope you publish the results soon.

Should be NPC continue learning during the game is running or is the AI trained on a separate network?

Sunweaver said...

SMASH is meant to be a simulation, I hate static game worlds, so I would love to make it evolve by itself and have NPCs lead a life in the game world, like "Sims" meets "Simcity" meets "MMOs", yet most literature does not recommend to activate learning in run-time, as it may cause erratic behavior. I feel quite tempted to implement stuff like: a short term memory, that will make NPCs remember events and players for some time, this may slowly go into a long term memory, like "if surrounded by 5 or more Orc warriors, call for guards". Furthermore NPCs might also save data they did not understand, so a Supervisor (human) can teach it later on how to process that. I personally love http://aiplanet.sourceforge.net/ where entities do learn about their world and evolve, let's see how easy it is to implement. For the moment I am digging deep into ANNs + learning algorithms.

Lincoln said...

A lot of MMOs already have a crude short term memory in that NPCs keep track of who is on their 'hate list'. Basically the NPC will just keep a small list of players that it is currently encountering or has recently encountered, and targets those who have the highest priority on the list. NPCs with some degree of AI could certainly communicate the list to other NPCs to 'warn' them, essentially.

I'm curious though, what happens to an NPC's memory when it dies? Is that information lost forever?

Suppose you have a guard at your city gate. Lets name him Guard Erl and let's suppose that he dies from a horrific accident involving an Ork and a rusty spoon.

What happens to the poor guard? Does he respawn with his memories intact? Or is he replaced by his inexperienced, young nephew who is coincidentally also named Guard Erl?

On another note, it would be really fantastic to implement a hive mind of sorts (You know, typical Insect-like sentients)!

Wow, what a can of worms :)