From The Mana World
Revision as of 15:51, 28 March 2007 by Crush (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

  1. 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
  2. Create a list of positions from which these targets can be attacked
  3. 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
  4. Find a path to the best position and follow it
  5. 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.
  6. 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.

  1. Create a list of enemies that pose a thread to the controlled monsters
  2. Find the map position in range that is furthest away from each of these enemies
  3. Move to that position