Author Topic: Kohonen SOM in monster AI  (Read 7360 times)

Jacoo

  • Newcomer
  • Posts: 14
  • Karma: +0/-0
    • View Profile
    • Email
Kohonen SOM in monster AI
« on: August 15, 2013, 02:46:32 PM »
I'm currently pondering on implementing a Kohonen SOM in SurviveRL. The code for the neural network is done, and ready to integrate into the monsters.

Here's how I imagine it working:
  • Every combat action performed by a player is recorded in sequence until the monster dies
  • When a monster dies, the playes combat actions are used as input data to the SOM for that monster race. It updates the AI of that monster race on a new thread
  • When the AI has been updated, it flags an event in the game
  • All subsequent monsters in that race form a collective on that trained map, and immediately react to how to combat the player

In other words, the monsters learn the players attack pattern, and can base their attack on how a player is probably going to attack during combat.

I've got a network of 100,000 neurons training in around 1-2 seconds. Which is about the same size as a worm or ant or something.

Any comments?
« Last Edit: August 15, 2013, 02:49:53 PM by Jacoo »

miki151

  • Rogueliker
  • ***
  • Posts: 264
  • Karma: +0/-0
    • View Profile
Re: Kohonen SOM in monster AI
« Reply #1 on: August 16, 2013, 08:29:27 AM »
Interesting, give us an update when you have something working.

Question: does the network output specific monster moves or only serves as weight balancing for hardcoded AI?
KeeperRL, Dungeon Keeper in roguelike style:
http://keeperrl.com

Jacoo

  • Newcomer
  • Posts: 14
  • Karma: +0/-0
    • View Profile
    • Email
Re: Kohonen SOM in monster AI
« Reply #2 on: August 16, 2013, 09:50:42 AM »
I took the plunge and added in the neuron map to the monsters last night. At the moment though, its not used in the code. I'll connect it to the AI probably on Sunday or Monday after the weekend. So now they have the ability to learn unsupervised, but dont.

The 2D neuron map will be used as a weight matrix together with dynamic rules using expression trees. When it is necessary to choose a rule behaviour, it will use the neuron map as a part of the decision making.

Scenario:
If a player always seems to attack early on without magic for example, the monster race will have learnt this, and can decide on how to attack instead of just an uneducated rules set.

For the future:
I'll eventually put the AI in the cloud, and decouple it from the server and client, using it as a plugin. As players throughout the world play SurviveRL, it will train the collective cloud AI, so that all players will notice how the monsters have adapted based on the global player base.

This will be about 1 months work to do, and I'll do that in a few months from now, but is where I want to take the AI in SurviveRL.

It was a main reason why I chose an Ascii terminal for now, to concentrate on the mechanics.

Again, any comments on this appreciated. I'm capable of coding all of this quickly, but don't want to waste time if it seems overkill or not fun to play.


eclectocrat

  • Rogueliker
  • ***
  • Posts: 81
  • Karma: +0/-0
  • Most of your personality is unconscious.
    • View Profile
    • Mysterious Castle
    • Email
Re: Kohonen SOM in monster AI
« Reply #3 on: August 16, 2013, 01:31:40 PM »
I like the concept, I'm very curious to see what obstacles you run into.

Good luck, and post some of your progress here!