This patch currently adds a function which places additionnal food around player bases in a balanced way. It is a bit WIP, it can be improved due to (hopefully) feedback from other players, and there are 1 or 2 features missing.
It could also be extended to other resources.
The multiplayer community is interested in the balance of the game, and map balancing is an important part of it. Since mainland is the most standard map played online, it is the first map getting changed in this patch.
The biggest cause of imbalance in multiplayer games is the availability of additionnal food near the player base. Because this food is faster to gather than say fields, and because it can facilitate strategies such as cavalry rushing, you can see there is an interest of having each player get a similar amount of food around his base.
Wood availability is another cause of imbalanced which I will probably address some point later.
You can note that the code is perhaps a bit longer than what you would expect, with a few uses of random functions and differentiation between hunt and berries, that is because I not only want the map to be balanced but also to emulate the diversity we had with maps where resource distribution is completely random (so it is possible one player has hunt while the other has berries).
Despite it being a bit WIP, feel free to review the work already done from a code style / conventions standpoint.
A few things to note:
- I don't really know where the function getSurroundingAreas should be, but remember it could be extended to only keeping the area which doesn't intersect with other players area.
- foodAvailability and huntBerryRatio are arguments that would typically be set in the biome files.
For now mainland uses it, but as you can imagine it should be very easy to plug and play in many other maps.
Also forgot to remove debug line, don't mind it.