I want to add a sensor to each of several "players" using the bge + python. Each sensor will need to have its own distance function, because each player has a different range of perception. This is how I add the players to the scene:
for i in range(world_config.initial_population_size):
pos = Vector((random.uniform(-10,10),
random.uniform(-10,10),
3))
p = Player()
t = own.scene.addObject("Player")
t["Player"] = p
t.worldPosition = pos
Now I would like to do something like.
t.addSensor(Distance=t["Player"].perception())
So that later I can compare which player sees the other in an interaction.