-2

I just started working on an artificial life simulation (again... I lost the other one) in Python and Pygame using Pybrain, and I'm planning how this is going to work. So far I have an environment with some "food pellets". A food pellet is added every minutes. I haven't made my agents (aka "Creatures") yet, but I know I want them to have simple feed forward neural networks with some inputs and the outputs will be its' movement. I want the inputs to show what's in front of them, sort of like they are seeing the simulated world in front of them. How should I go about this? I either want them to actually "see" the colors in their line of vision, or just input the nearest object into their NN. Which one would be best, and how will I implement them?

1 Answers1

0

Having a full field of vision is technically possible in a neural network, but requires a LOT of inputs and massive processing; not a direction you should expect to be able to evolve in any kind of meaningful way.

A neural network deals with values and thresholds. I'd recommend using two inputs associated with the nearest individual - one of them has a value for distance (of the nearest) and the other its angle (with zero being directly ahead, less than zero being on the left and greater than zero bring on the right).

Make sure that these values are easy to process into outputs. For example, if one output goes to a rotation actuator, make sure that the input values and output values are on the same scale. Then it will be easy to both turn toward or away from a particular individual.

If you want them to be able to see multiple individuals, simple include multiple pairs of inputs. I was going to suggest putting them in distance order, but it might be easier for them if as soon as an organism sees something it always comes in to the same inputs until it's no longer tracked.

Charles Ofria
  • 1,936
  • 12
  • 24
  • When you say to make the input and output values the same scale, do you mean if the output is range 0 - 1 the input should range from 0 - 1. Also how can I input color? Colors in Pygame are a tuple with three values in it ranging 0 - 255. – Justin Davis Nov 14 '16 at 19:05
  • By "same scale" I simple mean that if the input angle is -1 to 1 than the output rotation actuator should be -1 to 1, thus linking the input directly to the output would all for turning toward the target shape. In regards to color, you're probably right that this would require three additional inputs. I recommend using HSL rather than RGB if possible. In many cases, they might just want to pay attention to hue, for example. – Charles Ofria Nov 19 '16 at 19:35