31
Programming / Re: Modular monster intelligence system
« on: January 08, 2013, 09:40:17 PM »I think it's not necessary to run the UseTheBrain for every creature every single turn. You may want to make creatures reconsider their actions only every x turns (and additionally in case of an event like being stabbed in the back or something so that only a fraction of creatures uses their brains every turn. This may also make it more natural and avoid situations in which a creature does something like:
Turn 1 = I see a precious ring -> I'm going North. Turn 2 = I'm to close to the enemy -> I'm fleeing South. Turn 3 = I see a precious ring -> I'm going North, etc...
The one problem with this approach that I see is that the monster will not be able to react to new inputs very well. Perhaps the goblin is going for the the shiny ring, sees the player, but has to wait x turns to avoid the player, making the goblin essentially perform suicide-by-player. Of course you could hard code all the various events that could trigger the UseTheBrain function, but by the time you have considered all the possible UseTheBrain triggers, you might as well ditch the neural net and go with a more traditional state based or switch based approach.
An alternate approach that might allow you to use a neural network is to consider a very simple recurrent neural network. The basic idea is that the network feeds outputs from one turn back into the network on the next turn. Perhaps the RunAway neuron fired very strongly last turn, causing the goblin to retreat from the shiny ring out of the player line of sight. With the recurrent network, that strong firing from previous turns could continue to influence the goblin so he doesn't forgot about the player and go back for the ring (and certain death).
Of course this adds more complexity to the network, particularly if you are hard coding weights by hand rather than training using whatever technique you learned about in your machine learning class. Still though it shouldn't be too difficult to do if you were willing to hard code the original non-recurrent network in the first place...