Miarmy Crowd Simulation Documentation (English)

Detection Range Sphere

Detection Range Sphere is a useful and effective ways for having our agent to know other agents nearby and usually used to apply agents collision avoidance.

Each of agents has 2 intrinsic attributes detection sphere range and color.

Selecting any agent, you may notice it is located Maya channel box:

And these 2 attributes stand for detection range sphere's radius and color


sphere range attributes


Each of the agents has a sphere detection range itself. Like this:


The detection range sphere for agent

 

Notice: the detection sphere range is 3D sphere in space, for easier observatory, we just draw a cycle around agent, like all of the game engine.


With detection sphere language, we can get the nearby agent's position, angle, aiming, relative distance, relative speed information.

No matter what logic sentence you are using, before calculating, system will firstly find the agents in its range, then only calculate result based the in-range agents.

Like the picture shown blow,

  • CAN: the agent-Y can only detect agents B and C, whereas the agent-X can only detect agents C and A.
  • CANNOT: the agent-Y cannot feel agents A and X, and the agent-X cannot feel agents B and Y

And since the sphere range is a 3D range, it can detect the agent in top and bottom of it.


Cull (get) the agents in sphere detection range firstly


Note: There's a concept call subjective and objective, like the picture shown above, when we testing agent Y, the "Agent Y" is subjective agent, we call it "current agent (or I) (or My Sphere Range)", and this time "Agent A, B, C and X" are objective agents, we call them "others agents". The engine will iterate calculate every agent in scene, and each one of them have one chance being the "current agent (or I) (or My Sphere Range)"




After getting the agents in the sphere range of current agent, it will test them by specific sentence and return values.

The left-right angle will return the degree relative to the current agent. Look at the picture below,

The "(sphere range) someone in my sphere with angle" will return 45 for agent "A", -135 for agent "B". As for agent "C", because the C agent is not in range of sphere, so, there is no return. The final result will be an array which contents are [45, -135].

Using this array, we can combine the "fuzzy range", we can calculate out the sentence active.

Also see the picture below, for example, we are testing is there any agent in my left front, and the test range is 0 to 90, with a fuzzy value (the red gradient color). The results are [45, -135],

  • So the 45 make the sentence fully activate (1.0), and the -135 make the sentence nonactive (0.0), by default, it will find the maximum active value. Conclusion, the sentence active will be 1.0

The "(sphere range) someone in my sphere with angle" is testing others agents in horizontal space whereas the the (sphere range) someone in my sphere with up-down angle is testing others agents in vertical space


sphere range in plane example for current agent


The (sphere range) someone in my sphere aim to angle sentence tests the in-range agent's orientation.

Take a look at the following picture, the agent-A, angle is α, should be -60 degree; for agent B, the angle is β = 160, in this example, the input results contents are [-60, 160]

The (sphere range) someone in my sphere aim to angle is testing agents in horizontal space whereas the the (sphere range) someone in my sphere aim to up-down angle is testing agents in vertical space

 


sphere range agents orient example for current agent


someone in my sphere with distance sentence will return the every relative distances between the current agent and the others agents in sphere range.

Due to the return value will be relative value, the range is from 0 to 100 (from center to edge of sphere)

For the following example, only the agent A, B, C can join calculation.

Assuming that the sphere range of current agent if 25, the input results should be [d1, d2, d3], approximate [75, 65, 95]


sphere range distance example for current agent


someone in my sphere and his sphere color id sentence will return the each color of agents' spheres in current agent sphere range.

For the following example, the current agent can feel A and B, if the color of A's sphere is 3, the color of B's sphere is 5, the input results should be [3, 5]



sphere color example for current agent


You may notice, with sphere sentences, we can easily get the information from nearby agents and response, so it's usually can use to aiming near target (fight), of avoid close agent.

 

 

 

Basefount Technology