• 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.

[General] Small information regarding optimized map creation - Facts one should know

Status
Not open for further replies.

Ardenian

A

Ardenian

Hello,

so I wondered, seriously starting with a project, what are facts one should know to optimize a map from the very beginning ?

Facts like:
  • Don't use more than 3 ( 10) hashtables
  • Don't add more than 3 levels to an ability
  • Hashtable is faster than arrays, but should not be used for small things
  • Many loops with an interval of 0,03 slow down performance
  • Don't pre-place units in the WE

What else do you know ? Is there a collection of such information somewhere ? What else comes to your mind ?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
•Don't use more than 3 ( 10) hashtables
You can use any number of hashtables you like as long as you limit it to less than 256 (or was it 255?). If you use them for bulk data storage it is recommended to use many since their bucket array is not dynamic so they degrade towards O(n) performance with huge numbers of mappings.

•Don't add more than 3 levels to an ability
Leveling abilities is generally not scaleable map design anyway. The Heroes of the Storm approach of automatically scaling abilities with level is far more practical and easier to balance.


•Hashtable is faster than arrays, but should not be used for small things
As far as I am aware they are slower than arrays, but still within the same order of magnitude of speed. You can get 2-3 array lookups for the cost of a hashtable lookup.

•Many loops with an interval of 0,03 slow down performance
They are not really loops but more periodic timers.

•Don't pre-place units in the WE
Pre-placing is fine if done and managed right.
 

Ardenian

A

Ardenian

Hu, this is going to be a huge answer, I would be glad if you still answer.

DSG said:
You can use any number of hashtables you like as long as you limit it to less than 256 (or was it 255?). If you use them for bulk data storage it is recommended to use many since their bucket array is not dynamic so they degrade towards O(n) performance with huge numbers of mappings.
So: Hashtables with a lot of information -> split down it if possible, avoid having a lot in one hashtable

The 200,000 entry fps drop refers to entries in one hashtable ?

DSG said:
Leveling abilities is generally not scaleable map design anyway. The Heroes of the Storm approach of automatically scaling abilities with level is far more practical and easier to balance.
So you mean it is unavoidable to not have more than 3 ?
I read it heavily slows down loading speed or something if an ability has 4 or more levels.

Pre-placing is fine if done and managed right.
Could you/someone points it out further, please ? Does it mean units like shops, units not moving are okay ? reference to the Blizzard melee maps, gold mines and shops pre-placed.

Zwiebelchen said:
Only one:
Use Jass.

All optimizing is pointless if you use GUI anyway.
Why ? GUI is nothing else than an alternate presentation of JASS or should I convert GUI into JASS before .. 'releasing' a map ?

Daffa the Mage said:
Use variables for triggers, it saves A BUNCH OF TIME modifying stuffs. Recommended to use Temp variables for spells (careful with loops or you might get non-MUI spells)
Okay, one or another question here ( for everyone):

Variables for triggers: You mean for stuff like
  • Trigger - Turn on udg_Test
?

About LoopVariables in Loops, I have a question:
Can I use an LoopInteger[ARRAY] to avoid having many different variables ?


So one array for every different loop ?

Zwiebelchen said:
Avoid hardcoding stuff unless you can know for sure that you will never ever change anything about these mechanics later on.
One question here, can I use a variable for the integer slots with an array or, even better, can I use different integer variables for the slots ?


  • Hashtable - Save True as TempSlot[7] of Index in Hashtable
or
  • Hashtable - Save True as BooleanSlot of Index in Hashtable
?
 
Last edited by a moderator:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
The 200,000 entry fps drop refers to entries in one hashtable ?
FPS drops when WC3 fails realtime requirements. Hashtable access performance is O(1) as long as number of collisions is low. Testing shows that Hashtables do not expand their backing array as they tend towards O(n) performance for large numbers of entries.

Splitting such a hashtable into multiple hashtables restores performance as you can reduce the number of collisions. The actual programming solution is to use a hashtable with larger bucket array however WC3 gives you no control over that.

So you mean it is unavoidable to not have more than 3 ?
I read it heavily slows down loading speed or something if an ability has 4 or more levels.
I believe Heroes of the Storm uses catalog natives and upgrades to advance abilities. Each team level you get given an upgrade or some catalog triggers are called. These are SC2 only features so this is not possible in WC3.

In WC3 you probably have to trigger the abilities. That way you can formulate the damage based on the hero's level and possibly stats. This scales better because it allows abilities to improve with each level and supports exponential scaling which learning skills does not due to min-maxing selection. Hero learn skills only work for linear scaling as then each point spent gives the same benefit no matter the skill.

Could you/someone points it out further, please ? Does it mean units like shops, units not moving are okay ? reference to the Blizzard melee maps, gold mines and shops pre-placed.
In smallish maps the number of units does not hurt. It is also more convenient and solves pre-loading in larger RPG maps as long as you remember to remove most of the units at map initialization after their positions are saved.

Pre-placed units are only bad for massive maps (480*480) where the share number you can end up placing pushes the game to the limits of performance. In such a case dynamic unit spawning is recommended.

Why ? GUI is nothing else than an alternate presentation of JASS or should I convert GUI into JASS before .. 'releasing' a map ?
This is only true for SC2 where GUI converts very will into Galaxy.

In WC3 GUI converts like a joke into JASS removing core features of JASS (locals, loop control, functions, etc) and generating bloated code (unnecessary function calls, calls to function wrappers, etc). It does not even let you use all natives (no support for RemoveLocation and DestroyGroup). It also is less productive than JASS since you can copy/paste/cut JASS script but cannot do the same for GUI arguments.

Can I use an TempInteger[ARRAY] to avoid having many different variables ?
Yes you can but this is even slower as now an index must be resolved each time. I simply use several "RegInt" variables if ever I am forced to create WC3 GUI.

An array should only be used if you need to use a dynamic index. If you need to use a static index only it should be non-array.
 
Last edited:

Ardenian

A

Ardenian

Alright, I think my questions are answered, thank you guys!
 
GUI and JASS are symbiotic. GUI creates gg_type variables for you to use in your map. It is necessary to use JASS to remove locations/destroy unit groups/run things in a local player block.

GUI allows you to create udg_ variables which, along with gg_ variables can be tracked using Object Manager PROVIDED you use them in GUI and not raw JASS. Changing the name of a udg_ variable will update that variable name instantly through your script.

GUI cannot have syntax errors, but it is bound by a limited subset of functions while JASS has access to the full API in blizzard.j and common.j (post-processors like JassHelper even allow you to use the working common.ai natives like the excellent UnitAlive).

GUI crashes when you select certain unsupported hashtable functions from its trigger menu. JASS can also crash the editor when saving with a missing endblock. Saving your map before trying something new is always the best idea, but with the JASS one you'll need to install JNGP to avoid that calamity.

Don't optimize until you're done, unless you're creating things efficiently as you go.

GUI works with visual unit types, item types and uses colors and symbols to help you identify the style of functions you're using. JASS has syntax highlighters that color code common.j and blizzard.j natives/functions/variables.

GUI can take less time for the user to assemble than JASS, but JASS is faster for putting together complex arithmetic and string concatenation.
 
Last edited:
GUI can take less time for the user to assemble than JASS, but JASS is faster for putting together complex arithmetic and string concatenation.
Wrong. JASS is MUCH MUCH faster to assemble than GUI.
In the time you need to click and select the members of a single GUI action with lots of data fields from the dropdowns, I coded an entire spell.

Especially when using some of the excellent premade libraries, like http://www.hiveworkshop.com/forums/jass-resources-412/missile-265370/ http://www.hiveworkshop.com/forums/jass-resources-412/system-buffhandler-242121/ and http://www.hiveworkshop.com/forums/jass-resources-412/system-knockback3d-217056/ you can code even very complex spells in a couple of minutes.
The same spells created in GUI would takes hours to make, let alone the enormous difference in performance.

vJASS is superior and faster to write in every possible way.

Saying that GUI is just a dumbed down version of JASS anyway is the overstatement of the century. Yes, GUI converts into JASS. But that's about it. Especially all the stuff that vJass adds to the table makes this a difference of night and day.

And the worst nightmare of it all is that crippled abomination that is called GUIjass. GUI with some custom script thrown in to fix all the flaws that GUI comes with. It's like patching up a broken purchase with gaffa. It works, but you still regret buying it.

Is it so hard to just man up and learn programming? If you are good with GUI, learning simple JASS (and then expanding your knowledge to OOP programming) comes naturally. You still apply the same logic anyway, you just throw away the dropdown-menu support wheels holding you (back). And with TESH and Jasshelper, you still have a powerful security net guiding you if you fail.
It might throw your mapping progress back a week or two. But you will reach equilibrium of time investment so fast that it doesn't matter if your map is not just another piece of "I made this in 3 days" shovelware.

Literally, the hardest step in transitioning from GUI to JASS is making the decision, not actually learning how that damn thing works.


Here is a list of all the things you miss out on completely if you use GUI... and I intentionally only list those that actually matter in everyday life, not all those magnificent hacks that only 3 people care about:
  • local variables
  • timers
  • custom functions
  • breaking loops
  • structs
  • GetLocalPlayer()
  • dynamic triggers
  • not having to deal with locations
  • FirstOfGroup() loops
  • Easy import of systems
  • encapsulation
  • Structured dependency (including order of initialization)

GUI is good for exactly one thing: correlating object data to global variables. Instead of using cryptic rawcodes, you can actually select created abilities from a dropdown. It's great when your object data is a giant unordered mess. Then again, nothing is stopping you of actually bringing order into this mess by using object editor categories properly.
 
Last edited:
Keep going with the "everyone must evolve and code in vJass" philosophy. I talk about pros and cons to keep the discussion balanced and bridge the gap between novice users and experienced ones, hence porting many popular vJass systems to GUIJASS where many members of the community have benefited from it - but you would prefer those "crippled abominations" didn't exist. The laymans send their regards.

Edit: also, you do realize how many vJass systems I have created and am publishing, right? Some of my "I don't know programming" resources somehow managed to be among the most widely-implemented vJass systems on this site. It's best not to take sides, everything exists for a reason and just because you don't get along with one method doesn't mean that method isn't a sound option for many others. Just because someone isn't an "expert" (in your eyes) doesn't mean that person is causing problems.
 
Zwieb also thinks I code GUI using a mouse cursor. In my work I've been doing I only use the mouse cursor when I'm working with custom script while using the function list in JNGP (it doesn't recognize that I press the tab key or close when I press Esc).

What I meant when I said ir CAN be faster is for things like quick tests. My GUI assembly is very fast since it's consisting of arrow keys, tab, spacebar and Enter presses.
 

Ardenian

A

Ardenian

Bribe, I am very grateful you ported a lot of vJass systems into GUIJASS and GUI to allow users not being familiar with vJass or not using JNGP to make use of them.

I am always quite sad if I see a great new engine or system ( of yours or other coders) in The Lab allowing to reach new horizons and make use of new functions knowing I cannot use them since they are vJass and glad at least some basics were ported, I a very grateful, thank you.
 

Ardenian

A

Ardenian

Yeah, I know.
I will never use JNGP, deal with it, haters.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
•encapsulation
•Structured dependency (including order of initialization)
Both not supported by JASS and are vJASS on save compile features.

- modules
- better IF-THEN-ELSE structure.
- static ifs and debug mode
- Directly assigning handles instead of using Last Created something
- Linked list
- inject
- textmacros
Not actually JASS features again.

Not that using vJASS is bad, one must remember that such features are quite hackilly implemented. I have seen so many people run into vJASS and wonder why stuff is not working or making stupid comments (like "I refuse to mod WC3 to run vJASS") because they do not realise it all builds into standard JASS on save.

The problem with GUI is its WC3 GUI and not SC2 GUI. SC2 GUI is infinitely better than WC3 GUI. Ignoring Galaxy vs JASS features here is just a short list of the ways it is better.
  • Local variable support
  • Custom function support
  • Complete native list support (exception of some AI and Tactical AI natives).
  • Can copy function arguments.
  • Can nest folders.
  • More types of loop.
  • Easy to type comments.
  • Custom Script support for events, conditions, whole functions, as multi-line actions and even function arguments anywhere.
  • GUI function macros to concatenate strings or repeat the same numeric operation on any number of appropriate arguments.
  • Can copy around multiple actions, conditions and events.
  • Variables declared and organized like triggers.
  • More control over variables, including initial values accepting any appropriate function and custom script.
 
Level 26
Joined
Aug 18, 2009
Messages
4,099
Strive for constant complexity unless the initialization overhead would be exponential.

Object mods (WE object editor), especially string values, are slow to load and done so on first use. You can translate/write it in the native format (slk), that comes with other requirements however and is not supported to edit by the WE:

Avoid massing in general. If your map has performance issues, it's often not because you use hashtable instead of arrays - something like that is minor - but because you exaggerate something, triggered a bug, have a lot of data flow while leaking or simply your strategy is inefficient. Do not do too much at once.
 
Keep going with the "everyone must evolve and code in vJass" philosophy. I talk about pros and cons to keep the discussion balanced and bridge the gap between novice users and experienced ones, hence porting many popular vJass systems to GUIJASS where many members of the community have benefited from it - but you would prefer those "crippled abominations" didn't exist. The laymans send their regards.

Edit: also, you do realize how many vJass systems I have created and am publishing, right? Some of my "I don't know programming" resources somehow managed to be among the most widely-implemented vJass systems on this site. It's best not to take sides, everything exists for a reason and just because you don't get along with one method doesn't mean that method isn't a sound option for many others. Just because someone isn't an "expert" (in your eyes) doesn't mean that person is causing problems.
Just to clarify: I was not talking to 'you' specifically. Unfortunately, the english language has two meanings for the word 'you' and in that case, I chose the other one. The one that includes a whole group of people.

What I do is not bashing GUI users. I am encouraging people to learn JASS. I try to show them that JASS is not complicated or harder to understand than GUI. In fact, it is more logical, not less.
GUIJass does exactly the opposite of that: it encourages people to stay in their comfort zone instead of doing the right thing.

It's the pole vs. fish thing. GUIJass is giving people fish ("Here, let me solve that problem for you!"). Convince someone to learn JASS is the pole. It allows them to help themselves.
I appreciate what you're doing (bringing JASS solutions to the GUI masses), don't get me wrong; but that doesn't mean I have to share your philosophy.

Hiveworkshop is one of the most helpful and generous communities I have ever seen in my internet life. The amount of help one can receive here on a day-by-day basis even for extremely simple or vague stuff is astonishing.
I love to help people out with JASS problems, no matter how simple they are.
There are no dumb questions, after all.

The problem is: barely anyone even tries. And that is just sad.

Bribe, I am very grateful you ported a lot of vJass systems into GUIJASS and GUI to allow users not being familiar with vJass or not using JNGP to make use of them.

I am always quite sad if I see a great new engine or system ( of yours or other coders) in The Lab allowing to reach new horizons and make use of new functions knowing I cannot use them since they are vJass and glad at least some basics were ported, I a very grateful, thank you.
See what I mean? This is exactly the problem I was talking about:
Ardenian knows and appreciates all those neat new inventions in the lab section. Yet he won't use them. Why? I can only assume things here, but judging on his "I won't use Newgen. Period."-statement, I'm pretty sure it is because he likes his cozy little comfort zone and is afraid to learn something new.
If you (and yes, this time I'm talking to a single person specifically) would just try it even once, you would instantly notice that JASS is not more complicated than GUI. In fact, you will notice that most of your triggers will almost look the same, just in text form and that events are at the bottom, not the top.
Instead of scrolling through a GUI window to find an action, you just use the function browser and auto-complete.
Instead of clicking everything on a dropdown, you just write your variables directly into the function arguments.
Instead of being forced to create and edit globals for everything, you just declare what you need as locals directly in your function.

I'm pretty sure that 90% of the GUIers that create maps on Hiveworkshop would be able to write functional JASS if they would just try. And they would even learn a pretty valuable real-life skill in the process (programming).

I learned programming with the WC3 editor. I'm not joking. I learned by just trial-and-error. I never took any classes before that. I converted GUI triggers to JASS and started improving them until I understood how it worked. And that didn't take me weeks or months. It took me a couple of days.
Mind you, it took me a while before I understood how to use structs; but getting to a point at which my JASS triggers were better than GUI triggers took me ~3 days at most. You don't have to understand structs if you start out scripting. That is something you can learn later on. Just working with functions and the native objects alone will solve 99% of the problems any casual mapper will ever have.

Don't let your comfort-zone hold you back!
What are you afraid of? If you get stuck, just ask, that's what the trigger section is there for.
 
Last edited:
I agree with you on the giving VS teaching philosophy if it's applicable. Trust me when I say that I started thinking GUI was te finish line for me (2009) but went ham on JASS once Maker showed me local variables. I lost my sh*t because that was exactly the feature I was looking for. Then I got carried away and messed my map up way too much due to overzealous custom script converting that I was in no way prepared for.

I would love to one day bring a port of Table to GUI, in order to cut down on GUI Hashtable usage like NewTable allowed for.
 

Ardenian

A

Ardenian

@Zwiebelchen

I am not afraid to learn JASS, the other way around, I would love to, but how ?
Reading tutorials ? Taking a look on example spells and systems ? Of course, that is how it works.

When Flux used GUIJASS to help me out I learned in a few minutes more about programming than the whole time I had been triggering before.
Now, IcemanBo introduced me to functions in JASS and explained how to create a basic one and I am surely going to make use of it.

The problem is, you cannot learn JASS like you learn a real language, for example.
There are, of course, similarities in the way of learning, but you are a lot more dependent on experienced coders who can help you or informative tutorials, since it is a completely new world to learn of.

So what am I ? Lazy ? Afraid ? Making stupid comments ? Maybe a bit of everything.
 
@Zwiebelchen

I am not afraid to learn JASS, the other way around, I would love to, but how ?
Reading tutorials ? Taking a look on example spells and systems ? Of course, that is how it works.
Reading tutorials is a good way to start. You can also go a long way just by converting your GUI triggers to JASS and analyzing how they are build and how GUI translates to JASS.
When you think you got the hang of it, you can start building a JASS trigger from scratch, one by one. As a good exercise, build a spell in GUI, then try to rebuild it from scratch in JASS.

The problem is, you cannot learn JASS like you learn a real language, for example.
You can. All the basic programming principles apply.
You could set yourself all the classic "first goals" from learning conventional programming languages. You could start with a "hello world" trigger.

So what am I ? Lazy ? Afraid ? Making stupid comments ? Maybe a bit of everything.
You're trying to learn something new. That is never "stupid".

Why not start with this and see where it gets you?
http://www.hiveworkshop.com/forums/...als-280/beginning-jass-tutorial-series-30765/
Mind you, this tutorial is far from perfect... (actually it's ... uhh... quite terrible) but since you already know GUIJass, I'm pretty sure you will be able to follow it.

Actually... scrap that.
These tutorials are probably better:
http://www.hiveworkshop.com/forums/jass-ai-scripts-tutorials-280/jass-concise-introduction-62279/
http://www.hiveworkshop.com/forums/...80/converting-gui-into-efficient-jass-233227/
 

Ardenian

A

Ardenian

Zwiebelchen said:
Reading tutorials is a good way to start. You can also go a long way just by converting your GUI triggers to JASS and analysing how they are build and how GUI translates to JASS.
When you think you got the hang of it, you can start building a JASS trigger from scratch, one by one. As a good exercise, build a spell in GUI, then try to rebuild it from scratch in JASS.
Thank you, I am going to do this!

Zwiebelchen said:
All the basic programming principles apply.
That is exactly the point, how is someone not knowing anything about programming supposed to know the basics ? For JASS you should/ it would be better to know these basics.
Zwiebelchen said:
You could set yourself all the classic "first goals" from learning conventional programming languages. You could start with a "hello world" trigger.
Hm, going from the very first, let's see, I like the idea of JASS-retriggering a spell more than going to deep into programming, I fear I get stuck with it and never want to stop again ( it slightly happens with GUI, I don't want to imagine what happens with JASS or even Java or C++). It is a mighty power, the power of creation. It is often like a drug isn't it.

Thank you Zwiebelchen, your comment motivates me!
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
But it is extremely inconvenient to do it without JNGP, just a heads up.If you would do it in vanilla World editir, disadvantages would be
- No color coding (all are color black)
- No quick access to list of all functions and constants
- You can't declare your globals in the script. You have to use Variable Editor.
- No search and Replace function, you would have to copy it to a text editor to do that.
- No multi-line comment.


@DSG, the list you quoted are what you would miss if you continue to use GUI, it isn't JASS features list since most of them are vJass features.
 

Ardenian

A

Ardenian

Hm, there are indeed many disadvantages not using JNGP for JASS.

By the way, none ever created something like a 'JASS Writer' or 'JASS Creator' to solve the problems you mention above, Flux ? JNGP is the only tool allowing so ?
 
Thank you, I am going to do this!


That is exactly the point, how is someone not knowing anything about programming supposed to know the basics ? For JASS you should/ it would be better to know these basics.
You already know basicly programming. You know how GUI works, right? Basic programming is just that. Just without the dropdowns, text-based.

Instead of clicking on "if then else (multiple conditions)", you just write them down manually.


But, yes, I highly recommend using JNGP if you want to learn Jass. The syntax highlighting and the function browser alone will make it so much easier.
 

Ardenian

A

Ardenian

Zwiebelchen said:
You already know basicly programming. You know how GUI works, right? Basic programming is just that. Just without the dropdowns, text-based.
Of course it is, but nonetheless, many many little details about programming like 'works this with that' and 'how does that work appropriate' still show up all the time, at least for me.
Just posted in another thread the question how to use mathematical signs in GUIJASS, for example, whether there has to be a space or not. Questions like this.
 
Status
Not open for further replies.
Top