This article contains information for Programmers working or interested in working for The Mana World
This article is currently only a proposal
The features or design guidelines described in this article are only a proposal made by one or some persons. It has not been evaluated or accepted by the core development team yet. Feel free to add your personal opinion about them or make counter proposals.
What the AI has to do
- Make decisions if the monster it controls should attack a specific target, flee or wander around
- When attacking maneuver the monster into a good attack position
- Choose and perform an attack when an enemy is in range
- When fleeing determine the safest direction
Information the AI needs
- Everything there is to know about the monster it controls
- The walkmap of the surrounding
- Positions of enemies and friends nearby
- Who inflicted how much damage on who in the last few game ticks
Standard attack algorithm
This algorithm should be executed when the creature decides to fight.
- Get a list of potential targets and their priority. The priority depends on the following factors where the weight of each factor should depend on the personality of the monster:
- Damage it dealt to the controlled monster in the last few game ticks
- Damage it dealt to other monsters around in the last few game ticks
- How easy it appears to be killable
- Create a list of positions from which these targets can be attacked
- Calculate a rating for each of these positions. The rating of each position depends on the following factors where the weight of each factor should depend on the personality of the monster:
- Priority of the target(s) that can be attacked from it
- How far the creature has to walk to reach it
- Danger on the position
- Find a path to the best position and follow it
- When the position has been reached determine what attack types are available and which of those can hit the target(s) from this position. When more than one attack type is available choose a random one depending on the preferences of the monsters personality.
- Perform the attack after a random delay to represent the reaction time of the creature (without a delay monsters would only attack when they know that they hit. It would be a bit frustrating when the players would never see a monster hit in the air).
Standard flee algorithm
This algorithm should be executed when the creature decides to flee.
- Create a list of enemies that pose a thread to the controlled monsters
- Find the map position in range that is furthest away from each of these enemies
- Move to that position
Monster Behaviors
This is a list of monster behaviors that the AI system should be able to do properly.
Spore Mushroom
When attacked the mushroom flees while spilling poisonous spore clouds on its way that stay for a while. Although the attackers are faster than the monster they have to walk around the spore clouds to avoid damage.
Required features: Skills that are used while fleeing.
Strategical Fighter
Flees when outnumbered but attacks when together with other monsters or when fleeing is impossible.
Required features: Analysing the danger of the current situation based on enemy strength and strength of allies.
Sniper
Attacks from distance. Attempts to flee when the enemy is too close.
Required features: Prefered minimal and maximal attack distance.
Supporter
Uses support spells like heals and buffs on friends that are in combat.
Required features: Getting the status of friendly beings nearby to determining if it is useful to use support spells on friendly units (don't heal when full hp, don't cast buffs that are still active).
Guardian
Protects an area or another being by trying to stay inside a specific radius around a location or being.
Required features: Setting an object the being protects. This can either be an invisible map marker or another being. When such an object has been set make the being avoid actions that increase the distance to the object.