• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

GUI Spell System

Status
Not open for further replies.

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
A few days ago, I started making my spell The Big Dipper and thought to myself, do I have to do all this stuff for every spell?

Development Process:

  • Started a project for handling the generic events and mundane variable assignment.
  • Integrated SpellEffectEvent with it to reduce handle count and erroneous evaluations from duplicate events and triggers.
  • Integrated struct indexing to make indexing less tedious.
  • Integrated a linked list to make indexing indices less tedious.
  • Removed the need to use dynamic caster/target locations by letting the system use MoveLocation and storing coordinates instead of a dynamic location.
  • Users no longer need to see the array syntax and can do everything using scalar variables.
  • Integrated the other spell events for completion.
  • By integrating the automatic process of Timer32, made the linked list syntax invisible to the user as it is a gruesome API in GUI.
  • Result is a GUI-form of Constant Timer Loop where indexing and timer handling are in sync.
  • Added the ability for users to set delays on how long it will take to run the timer loop trigger, merging the behavior of timers with data attachment.
  • Added additional functionality to store a group of dummies and/or a group of target units for each instance of the spell. Groups are automatically created and destroyed.
  • Integrated multi-phases with the system to help the user isolate different points of the spell's timeline.
  • Finally, finished The Big Dipper spell using this new system.

I am looking for feedback of any kind. IE, what's not described well-enough, what can be added/merged, simpler approaches, etc.

http://www.hiveworkshop.com/forums/pastebin.php?id=06i46k
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
That's an interesting and similar design in some core aspects. You and I have the same goal for indexing user variables for them, but a different approach as to what should be handled by the system VS what should be handled by the user. I like how you use generic arrays to store a higher amount of generic user data. I like how you are using the real variable event to hook when a user sets the tineout until the next spell is ready. Overall, your system and mine have more similarities than differences.

MUI could use improvements by giving variables more appropriate names. get_ is too generic and not specific enough to merit inclusion in such a fundamental resource. Even worse offenders are "trigger" and "timeout".

I like how you don't need to configure the spell-cast trigger and let it run with the natural event, but you have a missed opportunity to merge the events into one system trigger so that unnecesary conditions for spells aren't evaluated. By indexing the cast triggers to the ability ID's, you save lots of performance when an ability is cast.

MUI misses an opportunity to allow the indexing to work even without a timer. Allowing the indexing to work on-demand keeps it modular to be used in any situation.

I like that you don't have so many trigger exectutions. I will reduce the number of triggers the user needs to run by 2 by automatically setting the caster/target/etc before running the user trigger and merging the create/set vars triggers.

Thanks for sharing that!
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
do I have to do all this stuff for every spell?
No, all you have to do is use a system to power your spell.
The average spell of mine is about 20 lines of JASS code... and 90% of it is
"set <variable> = <value>".

Most standard things already have a system for it (Movement (Missiles,Jumps,etc), Damage over Time, Buffs, Healing, Spawning, Auras, Passive effects, Reviving, you name it).
But when you get to things that don't have a system yet, then you will make it form scratch before you know it. Instead of doing that, create a dynamic system that you will run and create all your nice effects in a few lines of code (maybe even 1).

Then, it is not a big deal to go through the "entire" process of calling 3 to 6 functions.

EDIT:

One other thing though...
I don't know what the Big Dipper was for but if it is for something of your own, then I do recommend you to leave configurables to only the things that are necessary... for example "Spell Ability Id", "Spell Order Id", etc. and remove all stuff like: "base damage", "damage per level", "mana cost", "mana cost per level", "AoE radius", "range", etc.

Let me take damage for example:
You only have "Base damage" and "Damage per level"...
But those are not the only ones:
Damage base

Damage increment per level (raw)
Damage increment per level (factor)
Damage increment per level (increment)
Damage increment per hp (raw)
Damage increment per hp (percent)
Damage increment per hp (max raw)
Damage increment per mp (raw)
Damage increment per mp (increment)
Damage increment per mp (max raw)
Damage increment per str
Damage increment per int
Damage increment per agi
Damage increment per ms
Damage increment per attack
Damage increment per armor

Damage factor by scale
Damage factor by current hp
Damage factor by current mp
Damage factor by unit type (list for each unit type)
Damage factor by attack type
Damage factor by armor type

Those are not even containing all the damage changing effects that are not in the standard WC3.
And neither are those containing special damage changing effects.

And that entire list doubled... one for source and one for target.

So, what other configurables do we have?

There are 0 spells that use all of them at once, but all of those are used in spells.
You will NEVER cover EVERYTHING by configurables... NEVER!
So why make 10,000 configurables if they dont contain everything?
A better way would be making functions that return the damage and take the spell instance id so you can customize it to your needs just like that.
 
Last edited:

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464

It is a good implementation of SpellEffectEvent and Constant Timer 32. Why is it deleted?

No, all you have to do is use a system to power your spell.
The average spell of mine is about 20 lines of JASS code... and 90% of it is
"set <variable> = <value>".

Most standard things already have a system for it (Movement (Missiles,Jumps,etc), Damage over Time, Buffs, Healing, Spawning, Auras, Passive effects, Reviving, you name it).
But when you get to things that don't have a system yet, then you will make it form scratch before you know it. Instead of doing that, create a dynamic system that you will run and create all your nice effects in a few lines of code (maybe even 1).

Then, it is not a big deal to go through the "entire" process of calling 3 to 6 functions.

EDIT:

One other thing though...
I don't know what the Big Dipper was for but if it is for something of your own, then I do recommend you to leave configurables to only the things that are necessary... for example "Spell Ability Id", "Spell Order Id", etc. and remove all stuff like: "base damage", "damage per level", "mana cost", "mana cost per level", "AoE radius", "range", etc.

Let me take damage for example:
You only have "Base damage" and "Damage per level"...
But those are not the only ones:
Damage base

Damage increment per level (raw)
Damage increment per level (factor)
Damage increment per level (increment)
Damage increment per hp (raw)
Damage increment per hp (percent)
Damage increment per hp (max raw)
Damage increment per mp (raw)
Damage increment per mp (increment)
Damage increment per mp (max raw)
Damage increment per str
Damage increment per int
Damage increment per agi
Damage increment per ms
Damage increment per attack
Damage increment per armor

Damage factor by scale
Damage factor by current hp
Damage factor by current mp
Damage factor by unit type (list for each unit type)
Damage factor by attack type
Damage factor by armor type

Those are not even containing all the damage changing effects that are not in the standard WC3.
And neither are those containing special damage changing effects.

And that entire list doubled... one for source and one for target.

So, what other configurables do we have?

There are 0 spells that use all of them at once, but all of those are used in spells.
You will NEVER cover EVERYTHING by configurables... NEVER!
So why make 10,000 configurables if they dont contain everything?
A better way would be making functions that return the damage and take the spell instance id so you can customize it to your needs just like that.

I agree that configurables can get pretty insane. In GUI, you don't have as many options, BUT your spell is more understandable by novice users who can change or add their stuff anywhere.

EDIT: I have released the system here, showcasing my first spell in a very long time, The Big Dipper: http://www.hiveworkshop.com/forums/spells-569/gui-spell-system-v1-0-0-0-a-273415/
 
Last edited:
It is a good implementation of SpellEffectEvent and Constant Timer 32. Why is it deleted?

I deleted my resources a day ago. Yeah sorry about that, most of my resources(after a hard work of checking) has some flaws which even Magtheridon96 and Maker didn't spot, and I'm too busy to fix them.

[edit]

Forgot to mention that Linked List Table has some structure errors which is TOO HARD to fix. Fixing a 2 year old resource is quite confusing to me (unlike you lol)
 
Status
Not open for further replies.
Top