SpellCasting - Leveling up with a node based editor

I've been very busy since last I posted. Not the, I can't work on the project type of busy but the, working daily on this huge project.

When I thought this all works really well already I came up with even better plans and so months passed by when I already thought I would be done. The feature creep is real but it will be worth it!

The main points I worked on:
- Node based editor
- Stats
- Effects
- Triggers
- Turning every data into ScriptableObjects (classes, stats, conditions, stances, triggers, crowd control, effect tags, resources and spell elements)
- Performance

So, one of the best things that happened to NZSpellCasting was ditching the flat authoring components and creating a node based editor.
This is how it looks currently:
node based editor 

There's really a lot to show, so many more nodes and features but from the screenshot the versatility should be already apparent. Not only was the flat hierarchy ditched but pretty much every fixed value that was in such a component beforehand can be calculated now via nodes and be used a node input.

All the typical logical nodes are available and math operators up to logarithmic functions. I try to cover all the bases here so no coding is required.

Up next, turning everything into dynamic data/scriptable objects.
One annoyance was that a lot of data were enums and devs would have to add code to them. No more, everything can be created in the editor and an automatic ID resolver keeps track of it. Furthermore, code generation is used to optimize many paths in NZSpellCasting. For the designer this works with just the press of a button.

The same goes for the stat system. Every stat can be created in the editor and every stat can have their own data type. With StatSet definitions, these stats can be grouped and used in game. Stat sets exist for the purpose of not having player related stats on enemies or to have metrics running.

Wait, metrics? What does that have to do with stats?
Glad you asked! As the stat system was working so well the same data layout was used for what I call DynamicStats. It's for values like Health, Mana, Gold, Exp or even Time played and metrics.
Both stat types are packed tightly into their individual byte array with no waste in between.
Stats itself support flat, additive or multiplicative multipliers and are fully compatible with effects.
With NZSpellCasting it's very easy to create effects that increase a certain stat in multiple ways.

Effects have been streamlined a lot. The images from the initial post look like total nonsense compared to what they are now and the biggest factor here is the node based editor. Every base value of an effect like duration, interval, stack size is totally dynamic now and can be changed when the effect is already running. Effects can change the stat value they are buffing/debuffing every frame (if so desired) and support every mechanic that spells have. (Under the hood, every effect can be calculated like a spell based on the interval or trigger)

Triggers were already a big part of NZSpellCasting but now they are much more versatile. Every trigger can have a value that can be used in mechanics. For example, whenever the player crits, the OnCriticalHitDealt trigger reports the amount to spells that are "listening" to this trigger. With that you can design an effect that deals half the crit damage as AoE damage around the player.
Triggers can also be created with ScriptableObjects but they require coding which involves programming the moment were the trigger happens and binding the value, if any. I've split the project in logical parts so a coder should be able to add them quite easily. I'm already providing around 70 triggers, so best case, no new ones should be needed.

And last but not least, performance. Every path has been optimized to the best of my ability. Usually I'm testing with 250.000 spellcasters casting every frame. I wanted to hit 16.6ms but the more features I added the harder it got, especially with trigger events.

Currently I'm at 18ms for the full frame and the big downside here is that the boss target gets 250k hits every frame, which means, not being able to take advantage of multi threading, otherwise race conditions could happen.
Of course this is just a stress test and far from realistic.
With 10k spellcasters casting every frame, all systems and jobs from NZSpellCasting take around 1ms.
In realistic scenarios you won't even notice it's there. The base cost of all systems are around 0.35ms.

I'm targeting a release date around the end of 2023 or early 2024.
Hope you found it interesting and if you have any questions, I'm happy to answer them here. 

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.

tUFNokufv - Wednesday, November 22, 2023


PcqdWbTIyti - Wednesday, November 22, 2023


fMvJlpTxRoinHOPm - Wednesday, November 22, 2023


cniFRQUXtgz - Wednesday, November 22, 2023


rRnygeIdzvT - Saturday, October 21, 2023


ZXrtzVykmsEULn - Saturday, October 21, 2023


Cookie Policy

Please accept our Cookie Policy.