This proposal has been accepted
The development team has discussed the contents of this article and has decided that it should be implemented as described. But the implementation is not finished yet. You can help to bring the features described here into the game.
This is the documentation of the new XML-based monster database which is shared between the new server and the new client. For understanding this article you should be familiar with damage calculation, hitting and dodging, and the skill system.
Example file
Complete version
<monsters> <monster id="1" name="Maggot" targetCursor="small"> <sprite>monster-maggot.xml</sprite> <sound event="hit">maggot-hit1.ogg</sound> <sound event="hit">maggot-hit2.ogg</sound> <sound event="die">maggot-dying1.ogg</sound> <drop item="505" percent="8"/> <drop item="518" percent="4"/> <drop item="501" percent="1.5"/> <drop item="533" percent="1.5"/> <drop item="502" percent="0.7"/> <drop item="522" percent="0.1"/> <attributes hp="100" size="8" speed="4" attack-min="10" attack-delta="2" attack-magic="0" hit="10" evade="10" physical-defence="5" magical-defence="0" mutation="20" /> <vulnerability element="fire" factor="1.5"/> <vulnerability element="earth" factor="0.7"/> <exp level="2">10</exp> <behavior aggressive="false" cowardly="false" track-range="8" stroll-range="4" attack-distance="32" /> <attack id="1" priority="1" type="physical" pre-delay="10" aft-delay="5" damage-factor="1" range="32" angle="10" animation="attack" /> </monster> </monsters>
Censored client version
<monsters> <monster id="1" name="Maggot" targetCursor="small"> <sprite>monster-maggot.xml</sprite> <sound event="hit">maggot-hit1.ogg</sound> <sound event="hit">maggot-hit2.ogg</sound> <sound event="die">maggot-dying1.ogg</sound> <attack id="1" animation="attack" /> </monster> </monsters>
Documentation
"required" means that the tag/attribute MUST be defined. When a required tag/attribute is missing the whole parent tag should be ignored by the parser.
"recommended" means that the tag/attribute can be omitted but it is usually not advisable to do so. When a "recommended" tag/attribute is missing the parser should output a warning but process the entry normally.
"optional" means that the tag/attribute is not necessary in every case.
"Client" means that the tag/attribute is client-sided and can be omitted from the server file. "Server" means that it is server-sided and should be omitted from the client file to avoid spoilers. "Client+Server" means that the information is used by both the server and the client and has to be identical.
monster
One monster entry in the database.
- id
- (Client+Server, required) Unique monster type ID used to identify the monster type in the netcode.
- name
- (Client, recommended) Name that is displayed when the monster is targeted.
- targetCursor
- (Client, recommended) Size of the target cursor.
sprite
(Client, recommended) The sprite definition file which is used as a graphical representation of the sprite (relative to data/graphics/sprites). There should only be one sprite tag for each monster.
sound
(Client, optional)
- event
- (required) The situation in which the sound is played. Possible values are "hit" (the monster attacks), "hurt" (the monster is hit by an attack) and "die" (the monster dies).
A sound file relative to data/sfx which is played at various events related to the monster. There may be any number of effect tags. When there are multiple sound tags for the same event a random one of them is played.
drop
(Server, optional)
- item
- (required) ID number of the dropped item as listed in items.xml
- percent
- (required) Probability of item drop in percent.
An item the monster can drop when it is defeated. Every monster can have an infinite amount of drops.
attributes
(Server, required) The character attributes of the monster. The basic attributes like strength, vitality and so on are derived from these attributes instead of the other way around like it is done for player characters. It is easier for the server administrator to assign reasonable attributes to the monsters when doing it this way. All properties are required.
- hp
- Initial and maximum hit points of the monster.
- size
- Radius of the bounding circle of the monster in pixels. A Monster is affected by attacks and other area-of-effect effects when its bounding circle overlaps with their area of effect. For comparison: A player character has a bounding circle radius of 16 pixel.
- speed
- Movement speed of the monster in pixels per second
- attack-min
- Minimal damage of attacks with a damage factor ot "1"
- attack-delta
- Difference between minimal and maximal damage of attacks with a damage factor ot "1"
- attack-magic
- Magical attack power
- hit
- Hit accuracy of physical attacks
- evade
- Evade accuracy against physical attacks
- physical-defence
- Defence against physical attacks
- magical-defence
- Defence against magical attacks
- mutation
- (optional) Mutation factor of the monster in percent. All attributes of every spawned monster of this type are randomly modified up or down inside this range.
vulnerability
(server, optional) Defines an elemental vulnerability or resistance.
- element
- (required) Name of the element the monster is vulnerable/invulnerable against
- factor
- (required) All damage the monster receives from the element is multiplied with this value.
exp
(Server, recommended) Experience reward for defeating the monster.
- level
- (optional) Maximum skill level after which experience gets a penalty. Setting to "0" (or omitting) means that there is never an exp penalty through skill level for this monster.
behavior
(Server, required) General behavior of the monster AI
- script
- (optional) Filename of a Lua script that controls the monsters behavior. Should only be used for rare monsters to reduce server load. (makes all other tags unnecessary)
- aggressive
- (required) Does the monster attack without being provoked? Values are "true" or "false".
- track-range
- (required) Distance in tiles the monster tracks enemies in (pathfinding algorithmn is used for calculating distance).
- stroll-range
- (required) Distance in tiles the being chooses new destinations in when not fighting.
- cowardly
- (required) Does the monster flee when attacked? Values are "true" or "false". Combining aggressive="true" with cowardly="true" results in a monster that uses hit&run tactics (attacks unprovoked and flees when the target fights back).
- attack-distance
- Prefered distance to the enemy the monster tries to reach when in combat (horizontal or vertical)
attack
(Client+Server, optional) An attack the monster can perform. A monster can have multiple different attacks.
- id
- (client+server, required) Id number of the attack (unique for each monster) used to identify the monster type in the netcode.
- priority
- (server, optional) How likely the monster is to choose this attack when it got multiple attacks it can use in the current situation.
- type
- (server, required) Type of attack. Values are "physical" and "magical".
- pre-delay
- (server, required) Delay in game ticks* between the decision to perform this attack and performing it.
- aft-delay
- (server, required) Delay in game ticks* after the attack until the monster can act again.
- damage-factor
- (server, required) Multiplier applied to minimum and maximum damage as they have been calculated by using the monster attributes.
- range
- (server, required) Range of the attack.
- angle
- (server, required) Angle of effect of the attack.
- animation
- (client, recommended) Animation that is played when the monster uses this attack.
- particle-effect
- (client, optional) Particle effect that is initialized when the monster uses this attack.
* 10 game ticks = 1 second.
script
(Server, optional) Defines a script file with the scripts for the monster.
Implementation status
Todo List:
spritesounddropattributes- vulnerabilities
exp- behavior
aggressive- cowardly
track-rangestroll-rangeattack-distance
attacksscript
Vulnerabilities should wait until player characters got the possibility to inflict elemental damage so that this feature can be properly tested.
Regarding cowerdly behavior: I am still unsure how a monster could calculate the optimal escape route.
Content XML files |
---|
Databases effects.xml | emotes.xml | hair.xml | items.xml | monsters.xml | maps.xml | npcs.xml | runes.xml | skills.xml | status-effects.xml |
Filetypes Particle XML files | Animation XML files | GUI window skin XML files |