Interestingly, I created what you describe in Python.
Here pic:

Green dots are food, and red dots are organisms that must evolve and learn how to eat food blocks.
The best source of inspiration and guidance for something like this is, of course, Polyworld: youtube.com/watch?v=_m97_kL4ox0 .
Another great example that helped me learn about backpropagation, which I suggest you also learn about here: arctrix.com/nas/python/bpnn.py .
Here are my blog posts regarding this exact issue: jancorazza.com/2012/09/introduction-to-atlas and jancorazza.com/2012/09/the-world-atlas .
Although this question is too vague for the correct answer, the general advice is that you first get a solid foundation for the ANN function, and then create a program using this general algorithm:
- Check the user input (if the camera moves? If the program stops?)
- For each organism:
- Check if he is alive, etc.
- Take data from the world
- Rate your neural network
- Apply results to the physical body
- Apply positive or negative feedback (as you will see, it comes down to the following)
- Refresh the world (you can use the physics engine)
- Optional draw the world
For example, your input neurons may correspond to physical or visual stimulation. Is there something in front of me? Then set neuron X to 1, otherwise 0.
And your weekend neurons could be a force. Is neuron Y active? If so, apply momentum to this organism in this world cycle.
I also recommend that you do not use other people's libraries to calculate the neural network, because this is a great way to learn how to implement them yourself. You can Pygame for rendering and PyBox2D for physics.
Now about the "vision" of other organisms ... These problems are best solved when they are isolated. You need a good software design that will allow you to divide the whole problem into many subtasks that are easier to solve.
In general, vision can be done by raycasting. Create a directional, normalized vector (length 1 unit, i.e. sqrt(x*x + y*y) == 1 ), and then scale it ( x *= factor; y *= factor; ). This way you get a line that extends outward. Before you scale it, you can scroll through all the organisms in the world (you will need to optimize it) and check whether the vector is inside them. If so, calculate its length, and your body has some information about its surroundings.
There are many easier ways. For example, divide the space around each organism into four quadrants, four of which are the eyes (X - up, right, down, left of the body). Then calculate the length from the organism to any other organism (optimize!). Find the nearest organism. Find out which quadrant it is. Voila, active eye!
Hope I was helpful, but you need to be more precise and come back when you have a real problem. Read the FAQ .