How does a bot know who is an enemy if "enemy" encompasses not only one player, which can be just hardcoded?
For example, in Warcraft 3, we can have two bot teams with faction alliances and they will treat each other as enemies.
What is the mechanism that chooses who is an ally and who is an enemy?
I suppose there is some Map<Team, List< Units >>
and every bot is assigned some Team
by default at the start, and when bot sees
someone and that unit is not in the bot's team it means it is an enemy? But here is no place for allies.
Edit: So I am working on 2d Farm Game and I plan to add another enemy to me fraction and some enemies for all fractions.
Currently I don't have any NPC but later I want to have some units that can gather resources/kill enemies. So I was thinking that there is no difference between my units and enemy units.So there should be some rules that define that this bot treats another bot as ally or an enemy.
PS: The reason I started thinking about that was that I started working on inventory and understood that ideally there should be no difference between me and an npc who gathered a particular resource, so there should be some way to add a resource to same inventory by player controlled character and a bot. This led me thinking that the same should be true for another team, the code should be the same. There shouldn't be FriendlyBot
and EnemyBot
.Just Bot script for example and some script that assigns team id and later using this team id bot will interact with an inventory.
It seems to me that two topics are pretty close to each other as both need a structure that would allow me to organize bots into teams and inventory belongs to the whole team.