Hello all!
I've been working for quite a while on a RPG spell casting system for DOTS, called NZSpellCasting (WIP title).
My goals were:
- highly performant with up to 100k+ spell casters
- designer friendly, no programming skills needed
- strictly data oriented
- complexity of spells/skills/traits of at least AAA RPGs like WoW, FFXIV or GW2
- usable without any knowledge of DOTS, even in MonoBehaviour projects
- mobile friendly
It was not an easy feat and the first iteration started in 2018 for WoW only spells. Second iteration was for DOTS netcode and now I'm on my third iteration. Spell data has changed very little but annoying or hard to understand data was refined so complex spells are as easy and straight-forward to model as possible.
The overall spell logic has changed very little but the underlying code architecture of everything surrounding it has changed a lot with Entities getting more mature, rewriting everything for Burst, multi-threading and reducing every code path in read/write and general random memory access.
Currently I'm in the process of refining the last bits, extending my demo scene, eventually writing a custom editor and writing documentation with examples. I'll release NZSpellCasting as an asset on the Unity asset store but right now I sadly can't give an ETA.
Preamble aside, how are spells created in NZSpellCasting?
I think that way it's more interesting so I'll lead with a direct example out of FFXIV from the bard class which has a quite complex set of skills and interactions with their "ballads".
The goal is this, there are 3 ballads you can play, each ballad is a 30 second buff and has a different kind of benefit. All those benefits are triggered with a certain percentage on each DoT tick from 2 individual DoT effects. (Windbite, Venomous Bite)
Sounds complicated? Well, it gets better.
- 1st ballad: has a chance to reset the cooldown of 2 skills (Bloodletter and Rain of Death) - both these skills have a shared cooldown
- 2nd ballad: has a chance to increase "Haste" (global cooldown, attack speed, cast time) by 4% up to 4 times so 16%
- 3rd ballad: has a chance to grant a resource point (up to 3) for a skill called "Pitch Perfect". This skill can only be used while the ballad is playing and at least 1 resource point is available. For each resource point used, the damage will be higher.
Now, can this be made in NZSpellCasting?
The definition of Windbite:
Every spell has a base component called SpellBase. Basic data like name, id, class, required level, icon, description, resource costs, cooldown, cast time, etc... will be set here.
The other essential component is SpellTargeting which defines how targets will be chose for the spell. Either hostile, friendly, self, single target, multi target and shapes like point blank AoE, cone, etc...
To create a combat effect which lives for a certain time there's the Spell Combat Effects component. Combat effects and triggers can be set here with endless possibilities.
As Windbite has direct damage and a DoT effect there are 2 components used, Spell Amount and Spell Amount Periodic. Every amount can be additionally altered with either running effects, resource modifications and combos which are modified when a certain skill is used beforehand. Modifiers can be additive or multiplicative.
Reportoire is a placeholder spell that has a condition on it. Conditions are a very special and powerful tool in NZSpellCasting. Complex logics that could only be modeled with additional coding can be created with ease.
Several conditions and actions can be chained together with arithmetic logic. Conditions allow for checking for spells and traits while actions can fire create/destroy spells or lead into other conditions.
The triggered spell from the screenshot then has a simple ModifyCooldown component which resets both of the spells. Not shown here, the same component is used to create the "shared cooldown" between Bloodletter and Rain of Death. Blood Letter modifies the cooldown of Rain of Death and vice versa.
Also shown here are the events from the other ballads which either increase the stack size of the buff or gains a resource, in this case combo point.
And here's the Amount definition for Pitch Perfect
There's so much more to say about what NZSpellCasting can already do, from stat manipulation, complex traits, combat effects and conditions. I have basically modeled every WoW spell in the past as a stress test if my data layout can take it. But I'll bring this post to an end here.
Hope you found this interesting! If you got any questions feel free to ask here, PN or email. In case you want to be updated about the progress, I haven't set up the best communication yet but it's easiest if you just follow me on the Unity forum until I'm ready to publish the website.
Thanks for reading, have a great day!