How to: Create a new spell - Kyoril/mmo GitHub Wiki

Introduction

On this page I wanted to explain in a step-by-step guide how you can create a new spell which will then be usable in the game! To get started, you first need to have the repository checked out and built. You can also use one of the precompiled release builds if you like.

I assume that you have the game editor up and running, which will look something like this when opened and working correctly: image

Where things are stored

All static game data is stored in so called .data files. These files are basically just binary files created by google protobuffer using the protobuffer files which describe what kind of information is inside: https://github.com/Kyoril/mmo/tree/develop/src/shared/proto_data

So basically you don't really need to game editor to modify these but could do so with your own tools if you want to. The protobuffer files can be used to read and write these files quite easily.

The data files are stored in the editor data repository here: https://github.com/[Kyoril/mmo-editor-data](https://github.com/Kyoril/mmo-editor-data) This repository is also embedded as a git submodule in the main repository and the editor as well as the servers need to know where to load the .data files from.

If you want to share your changes, you need to share your modified .data files, although this can become quite difficult right now as these are binary files which can not be easily merged right now - this is where improvements are needed. We could write tools for importing and exporting these data files to mysql tables or simply json files for example, which would make merging much easier.

These binary files are binary files so that they can be loaded VERY fast by the servers. Imagine having tens of thousands of items, quests, spells etc. in a fully fledged mmo. Loading that many entries from a database on each start of a server application would be an insane overhead!

Client assets

A spell not only consists of the static data entries in the data files, but also some assets on the client side. For now lets use what's already available in the existing repository. Icons are located in the Interface/Icons/ folder, spell icons specifically under Interface/Icons/Spells/. To add new icons to the game, just open the folder in the editors asset browser and drag and drop the image file into the asset browser window (for example a .png file). Keep in mind to keep icons at a resonable image size (not smaller than 32x32 pixel but not bigger than 128x128 pixels! These things cost memory after all and won't probably ever be displayed with larger resolution on screens!).

There are more client assets related to spells like character animations, particle effects, sounds etc. But for now, lets keep this guide simple.

Adding the spell

After all this basic stuff, lets click on the "Spells" button in the top bar of the editor window. The spell editor window will open. image

1: Here you can add new spells or remove the selected one from the list 2: Spell list. Select the spell you want to view, edit or remove. 3: New rank: You can add a new rank of the selected spell. This will duplicate the selected spell and create a new spell with the same attributes but a higher rank. It will also set the base rank and base spell property in the selected spell if not already done. 4: Basic details like spell name, description, rank, spell school etc. etc.

I won't go into all the details for all properties in this guide, you will have to experiment with it yourself. If you want, look at the existing spells to get an idea of whats possible and how it is done.

Spell descriptions

As you see, a spell description contains placeholder strings like $s0 or $D. These are automatically handled by the client and replaced with actual values based on the spells properties. Here is a list of placeholders and what they will do. Keep in mind that # in the list stands for a number, so $s# could be $s0, $s1, $s2 etc. (you get the idea).

  • $s#: The value of spell effect index #. If the value is a range, it will be translated into something like: min - max, otherwise it will simply be the flat value.
  • $D: The duration of the spell, rounded to whole seconds, minutes etc. So 2.5 seconds will be "2 seconds".
  • $d: The duration of the spell precise (with floating point numbers). So 2.5 seconds will be "2.50 seconds".
  • $m#: The min value of spell effect index #.
  • $M#: The max value of spell effect index #.

More values might follow.

Casting attributes

image

  • Cost This tells the game how much using the spell costs the player.
  • Power type This tells the game which resource is used by the spell. This references the Cost property. A cost value of 15 with Power Type Mana means using the spell costs 15 Mana. There are currently 3 power types implemented:
    • Mana A resource which regenerates slowly over time while the player was not using mana for spells for at least 5 seconds.
    • Rage A resource which declines over time while not in combat. Each weapon swing will give rage as well as taking damage.
    • Energy A resource like mana but it regenerates relatively fast, and also while being in combat and using it.
  • Base Level The base level of the spell. Used for spell effect scaling. All spell effect values will take this base level as reference point.
  • Spell Level Level the spell requires to be used.
  • Max Level The maximum player level to which spell effects will scale. Useful to limit automatic spell effect scaling and force the player to get new ranks of the spell in order to further improve it.
  • Cooldown The cooldown time of this spell in milliseconds. So 1500 means 1,5 seconds cooldown.
  • Cast Time The cast time in milliseconds. A value of 0 makes this an instant spell, whereas everything above makes this a castable spell.
  • Duration The duration of auras from this spell in milliseconds. Indicates how long auras will stay on the target.
  • Range The spell range. If set to none, the spell has infinite range. Spell ranges are a separate data entry.

Interrupt flags

image

  • Movement If checked, the spell cast will be interrupted by player movement. The spell will also not be castable as instant cast spell while the player is moving!
  • Auto Attack When the player is being attacked by attack swings, this will interrupt the spell cast if checked.
  • Damage When checked the spell cast will be interrupted on any damage taken.
  • Push Back When checked the spell cast will be pushed back (delayed) when taking damage.
  • Interrupt When checked, the spell cast can be interrupted by an enemy spell with the Interrupt spell effect. If this is not checked, the spell cast can not be interrupted by said enemy spells.

Attributes

  • Channeled When checked, instead of casting the spell the spell will be channelled. The cast time property will then indicate how long the spell will be channeled onthe target.
  • Ranged Indicates that this spell is actually a ranged auto attack spell.
  • On Next Swing Indicates that when activated, the spell effects will be executed on the next attack swing instead of the actual attack swing.
  • Only one Stack Total Indicates that there might only ever be a single stack of this spell on the target.
  • Ability Checked to indicate that this is a player ability spell.