The power of the Attribute System

I want to show a nice powerful feature of the OpenMU Project - the Attribute System.

I want to show a nice powerful feature of the OpenMU Project - the Attribute System.

First, I want to describe some terms:

  • Attribute Definition: Describes the attribute itself. For example, we have definitions for each possible attribute, such as Strength, Agility, Character Level.
  • Stat Attribute: It's an attribute which is saved individually for a character. A stat attribute can be increasable by the player (e.g. Strength, Agility, etc.) or just increasable by the program code (e.g. Level, Current Health, etc.).
  • Attribute (Value): The value of an attribute of a game object, e.g. Character A has '50 Strength'. Values are all handled as 32 bit floats.
  • Attribute Relationship: It's possible to define relationships between attributes. For example, "1 Strength -> +0.25 Maximum Damage".
  • Attribute System: An object which holds and manages all attributes of a game object (e.g. Player, Monster). Every game object which attacks or can be attacked has an Attribute System object.
  • Item Option: An item option holds a so-called "PowerUpDefinition" which defines which target attribute is increased by which value. The value can consist of a constant value and/or attribute relationships. For example, you could define an option which increases the base damage by the character level.
  • (Passive) Skills: The master skill system of MU Online has some skills which give some power-ups when they're learned. These power-ups are also described with a "PowerUpDefinition", just like item options.
  • Attribute Requirements: It's possible to define attribute requirements for Items, Skills and Maps. E.g. 'Sword X needs 100 Strength to be equipped' or 'Skill Y uses 20 Mana' or 'Map Icarus requires the attribute "CanFly" greater than 0' (which is given by Wings or a Dinorant).

The attribute definitions, relationships, base values, requirements and item options are all defined as data in the database. So, as you can see, the system as a whole allows you to tune every tiny bit of your in-game formulas and to customize a lot without changing a line of code.

How to use

Attribute Relationships

One of the most important things are the attribute relationships. You can find these in the CharacterClass configurations of each character class. In the example above, 1 Strength is multiplied with 0.25 to get the additional value for the maximum damage.

Instead of multiplying, there are other operators available, too. You can do simple additions or even exponentiate the source attribute with a value. There is one limitation for attribute relationships, though: Stat Attributes can not be defined as targets. For Strength, etc. there are two attributes: BaseStrength (stat attribute) and TotalStrength (can be a target); There is actually a relationship which adds the BaseStrength to the TotalStrength.

Example 'Dynamical experience rate'

By dynamical, I mean calculating the rate based on some other attribute, such as the character level. Usually, game servers are configured with a fixed experience rate, for example 1x or 1000x which is applied in the same way to every character.

Since the 'experience rate' is an attribute of a character, it's possible to adjust it by defining additional relationships. The default attribute value here is 1. However, what about defining something like 'Add the square root of the character level to the experience rate'. For example, a level 9 character would be given an additional rate of 3, whereas an level 225 will get an additional rate of 15.

With the available exponentiate operator we can also calculate square roots, when we choose 1/2 as the operand.

To actually configure this, we need to navigate to the character class configuration in the Admin Panel:

  • First, navigate to the Game Configuration
  • Then, scroll a bit down to the Character Classes, expand them and click the edit button for one of them, e.g. Dark Knight:
Game Configuration
  • At the character class page, you'll find the list of attribute relationships (called AttributeCombinations) a 'Create' button when expanded. When you have opened the creation dialog, fill in the following:
Create a new attribute relationship

Hit Submit, Save and it's done. Well, a server restart is still required - I'm working on that ;)

The result

More use-case ideas

So, if you not already identified some more practical use-cases I want to give you some ideas:

  • Modify or add new item options
  • Giving new attributes to Items, Monsters, Character classes
  • Defining attribute requirements for Items, Maps
  • Modifying the damage calculations by changing the relationships in the character classes
  • Adding new attribute definitions and relationships to the game which you may use further to restrict Map access or give some new powers.