• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How many triggers/variables expected for an 'epic rpg' map ?

Status
Not open for further replies.
Level 5
Joined
Feb 1, 2009
Messages
111
My story:

I'm currently working on a map that combines the styles of tower defence and RPG - so a hybrid of the two. The map is 80% GUI

If I tell you the number of triggers and variables i have in my map so far no one would believe me, (lol), though I just wonder what the expected range of acceptable amount of variables/triggers ? I know it can depend on a number of things but here's what my map game/system involves so far :

1 - half a dozen heroes, which 4 abilities each

2 - 25 Creep-leveling areas so far, each with a smart-spawn system i developed (supports hero level to 100, and have used up 40% of the map space so far).

3 - a 'wave spawn' system where enemies approach to destroy the city

4 - a 'tombstone revive' system, so players have to wait until a timer expires to revive or be revived using the tombstone system

5 - item pickup and item buying restriction, class upgrade system, blacksmith forging and item upgrading system, and a mining system.


This is my first warcraft 3 map and it was my dying wish to make it an oRPG as i have no interest in any other map style. I'm proud to say the map is leakless from what I can tell though I could be wrong, or at least I'm confident that it is 95% leakless.. though with that many triggers even 99% wouldn't suffice haha.

I will cut down on the triggers ENORMOUSLY but as of now its what I have to work with.

.
.
I wasn't going to state the amount of triggers I have because it's embarrassing but here it is:
394

Are there any pitfalls to having that many triggers?

My number of variables:
1082

Are there pitfalls to having that many variables ?
 
It doesn't matter how many triggers or variables you have. What matters is the maintainability of the map's code.

An AoS of mine had about 180 triggers and 400 GUI variables (Which I could have potentially taken down to Zero since most of the GUI code was being rewritten as vJASS)
A TD of mine had about 30 triggers and no GUI variables.

Given the specs you've stated, you can actually take that trigger count down to something like 100-150. Likely even less. Depends on how you organized the code.

But again: It doesn't matter.

The need for that many variables is likely non-existent by the way. The problem is most probably at the level of your inadequate design. You'll be able to optimize later on.

Also, just a guess: Do you have shit like gold1, gold2, gold3, or are you using arrays properly? :V
 
Level 5
Joined
Feb 1, 2009
Messages
111
I am using a TON of arrays, I am indexing, I am also using hashtables. I am not that oblivious to triggering/jass so I am not making the kind of mistakes you're assuming though I know I can still avoid a lot of unnecessary triggers.

Although:

- I have many hashtables, 1 for each spell for example .. is that necesary?
- I have a unique variable for each spell
- For each player there is a separate trigger if a timer is to go off for a spell


And I did it this way becaus I was afraid that my map wasn't going to be MUI
 
Level 8
Joined
Nov 20, 2011
Messages
202
Obviously you need to care about the amout of variables and triggers in you map. If you got more than 42*42 vars and triggers the map will crash at the loading screen.

To avoid the crash you need the Wurst World Editor. This special editor has a build in sausage that absorbs alls the triggers and merge it.

GET WURST!!!

Okay let's be serios. Yes there is a limit of global variables and triggers. The limit of global variables depends, but i guess it is around 20k. The trigger limit is much higher. Wc3 crashes at 1 - 2mio handels, so if there are no leaks ect you can create 900k triggers.
 
If you have things like TempUnit and TempItem variables, assuming the spells were written to use these as ACTUALLY TEMPORARY STORAGE (meaning, the value is only required between a few lines of code and nothing really depends on the state of the value over time), then you can merge them all.

As for hashtables, if done correctly, you can use 1 hashtable for the entire map.
A hashtable has so much theoretical storage, assuming a perfect hash function used internally, you could store 64 Exabytes worth in it.
That's how much index space you have.
 
Level 5
Joined
Feb 1, 2009
Messages
111
Thanks for all the input. So I gather at this point that I am 'okay' in that if I am leak-free then I can continue in my current state of map creation lol.

I wish hashtables made sense to me but they just dont. I looked at the guide and its beyond the scope of my brain.

On a side note, I saw that many GUI spells are following a similar format of having 2 triggers - > one storing hashtable variables and another running on a periodic 0.03 timer trigger (depending on what the spell is doing ofcourse).

They are made from different authors but is there a template available that one can make spells according to this style ?
 
Status
Not open for further replies.
Top