I am developing a game/simulation where agents are fighting for land. I have the situation shown in the picture below:
These creatures are walking around and occupying pieces of land they step on if they are free. To make this more interesting, I want to introduce "patrolling" behaviour, such that agents are actually walking around their land to patrol from any intruders who may want to take it.
On the technical side, each square is represented as a x,y
position as well as a dimension representing its side length. It also contains information on who occupies the square. All squares are stored in an ArrayList
.
How can I introduce patrolling behaviour? What I want is for each agent to patrol a certain portion of the area (they divide amongst themselves which areas they will patrol). The main issue I've found are as follows:
- The area of land is very random, as seen in the picture. It is rather difficult to understand where the bounds are in each direction.
- How they should agents split the regions to patrol?
- Areas of land may be disjoint, since the opposing team may take territory from the middle.
I had an idea of taking the furthermost square in each direction, treating those as the boundaries of the area, and divide regions based on those boundaries, but this might include lots of irrelevant land.
How should I approach this problem?