In the following article, I will be expanding upon the information I had given in my previous article by explaining how Dispersive Flies Optimisation can be used in a game environment such like Age of Empires.
The problem that I intend DFO to solve will be to create agents for a real time strategy game where they are able to improve their civilisation by collecting resources, creating new buildings to aid the civilisation and conquering new land. Now as this problem can get quite big and is very expansive so I’ll be focusing on the resource collection of the villagers, as this will focus more on DFO techniques.
Search Space and Parameters
As I will be focusing on how the villagers will behave when finding the best areas for resources and gathering said resources, the search space will bring that to light. The search space for these villagers would be the game map in order to find the resources that are needed to build the civilisation.
The parameters required for the villagers would be:
- Their X coordinate
- Their Y coordinate
- Their distance from the town centre
- Maximum Resources to Carry
The fitness function would be based on the villagers distance from the town centre and the number of needed resources in a particular area in the search space.
The number of resources in the game map will be finite and, as the villagers search for the best area for a particular type of resource, the resources will eventually be depleted. This means that as resources are being collected for a particular area, the fitness of that area would decrease and would become less desirable. The rule, then, from this would be the greater the number of resources in a given area; the higher the fitness for that area.
The fitness, however, would also factor in how far away from the town centre (resource collection point) the villagers are in the search space. If the villager was further away from the town centre, the lower the fitness would be. The reasoning for this is that if the villagers are far away and they find a lot of resources, it would take them a lot longer bringing them back to the town centre.
Due to this, I believe that it would be better to call this a maximisation problem as the villagers are looking for an area that is close but has a lot of the needed resources.
I believe that the swarm of villagers would look to their best neighbour, rather than the best villager, because this would allow the villagers to spread out further and find more places for resources.
Also, as the resources slowly get depleted this would mean that the disturbance threshold would be quite low. This is due to that the fitness of the current area would decrease as the villagers are using it and at some point they would find another location that has a higher fitness than the current area.
So overall, the villagers will base their fitness off of their best neighbour as they move away from the town centre. As the game world has a limited number of resources and the villagers are depleting those resources, the villagers would eventually collect enough to consider the current area to not be as good. This would then cause them to find a new area to collect resources until they have expanded out and taken all of the resources in the game map.