Question about senseCreaturesProperty 

Hi all,

My name is Gustavo and I am trying to do some simple experiments with Framsticks. One of them implies "sensing" each individual in a population individually, and performing some actions based on the values I measure. I've observed that senseCreaturesProperty() does the job, but only at the population level, not at the creature level, and I couldn't find in the API any function/example for doing that.

Trying to find out what the behavior is, I sampled values at different distances from a creature, and got that Framsticks is using a formula like 1/(ax^2+bx+c), but the values for a, b and c are weird to me, and I cannot find their relationship with the original creature's energy.

So, please, I would appreciate it VERY MUCH if someone could tell me either how to use the API to sample each individual in a population, or how this formula is computed, so I can implement my own version of senseCreaturesProperty() with the scripting language.

Thanks a lot!!!

dagush.-

Forums: 
Maciej Komosinski's picture

Dear Gustavo,

It depends on how you want to achieve your goal and what is your goal precisely. Do you want to design a neuron that senses individual creatures, or just write a piece of a script? If the latter, then you can simply iterate through Populations[0][i] where i is the index (number) of a creature. Such iteration gives you access to all Creature objects in population #0, and you can do pretty much anything with these objects (access their coordinates, energy level, etc.). Let me know if this helped!

Hi,

Thanks for the answer!!! But, actually, it is more the first option: I want a neuron that has "limited" senses, so it measures some creatures depending on some conditions I still am in the process of defining, and acts one way or the other (like eating a prey but escaping a predator, or something like that).
Thanks for the quick answer!!!

gus.-

Szymon Ulatowski's picture

You could try signals: this approach allows you to define completely different signal channels for predators and prey, and/or apply additional filtering based on how well the sender and receiver are tuned to each other. See the tutorial and scripts/fireflies.show for an example on how to use signals.

Great!!
I'll try this way!
Thanks!!

gus.-