This is a prototype of my influence fields implementation using Unity JobSystem.
This demo has 3 types of agents: VIP, guard, and enemy. 
Each type emits influence on a set of fields, like the VIP field, guard field, enemy field, and proximity field.

Each agent has its simple brain scripts that add selected fields with some factor to the combined field end, and then chooses a spot with the best value. 
For example, for the guard agent, it adds VIP field * 2, enemy field * 1, guard field * -0.5, and proximity field * -0.5.  It makes guards try to stay close to the VIP, but also not too close to each other and approach enemies when they get too close.

I plan to add more sophisticated operations on those fields, like min value between two fields. It would be useful for a guard to use min between VIP and Enemy fields, to make them stand between VIP and enemies.

Fields  are visualised with colours:
- Red - Enemy field,
- Green - VIP field,
- Blue - Guard field.

You can control agents using a mouse click. To select an enemy agent to control, use 1-4 keys. To control a VIP, use the 5 key. You can toggle automatic mode using the F key. You can also control one of the agents in automatic mode by selecting it.

Even with this simple setup, agents have simple organic behaviour, but it can also be used with other AI techniques like behaviour trees, where influence fields are only a source of information for behaviours.

Right now, each agent sees the whole map, but I plan to add reading only a small portion of the map for each agent to make their decision-making more local.

If you are interested in the general idea behind influence fields, I highly recommend watching those two videos from Dave Mark. Those videos have inspired me to write my own prototype implementation.

https://gdcvault.com/play/1025243/Spatial-Knowledge-Representation-through-Modul...
https://www.youtube.com/watch?v=6RGquWxNock



Published 4 days ago
StatusPrototype
CategoryOther
PlatformsHTML5
Authormicz
Made withUnity
Tagsjob-system, Prototype, Unity

Leave a comment

Log in with itch.io to leave a comment.