• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Massing 'Set Variable' causes issues?

Status
Not open for further replies.
Level 18
Joined
Aug 23, 2008
Messages
2,319
I was just wondering. In my map, the Map Initialization trigger contains a rough 1500 'Set Variable' commands. Would such a mass of these commands cause lag? If so: Is this just minor lags that only affects low quality computers or does this kind of lag cause issues to all computers?

I can't test this, since other triggers are interfering and I got a computer above average, so I wouldn't have lag when others would.
 
Level 12
Joined
Mar 16, 2006
Messages
992
Just wondering, but why would you need so many variables set?

If it really bothers you, pause the map in the start to make sure slower computers have time to catch up. I personally don't think it makes much of a difference, though.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
I'll check if I can find someone with a stone-age computer then if nobody here has any.

By the way: It simply slipped my mind that those 1500 were just the item names. There will be 1500 more for ItemCount and ItemIcon, giving a total of about 5000 for the items. Don't know if I need any more variables set at Map Initialization, but I'll see about that when it comes to that.

@Vegavak: I do need that much. And many, many more. These are just the ones I set at Map Initialization.



EDIT: Just got it checked by Thrikodius who says he got a bad computer and he didn't noticed any lag at 4500 variables on Map Initialization. That should clarify it once and for all that Set Variables don't cause lag, even when made simultaneously in masses :thumbs_up:
 
Last edited:
Level 4
Joined
Nov 23, 2007
Messages
113
It is possible to crash the Initialization thread with a lot of code, which is why there is an initializer keyword to run library init code using ExecuteFunc() to run it in another thread. You're probably a long way off from that point yet, though. I tried stress-testing this a while back and it took a lot of iterations to crash the init thread.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
nah variable setting wont be a problem
say you have 200 vjass spells in your map and all spells have 10 variables for configuration and when you compile it all of them gets setted in initialization and it doesnt even make lag, I even think 100000 wont be a problem
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Im not sure
but you know 1 string variable with 1024 characters (which must be biggest variable you can make) is like 1kb and computers at least have 256MB ram (mine 4gb)
 
Level 4
Joined
Nov 23, 2007
Messages
113
Thanks all for the additional info and I think this problem is solved for anyone (except for Mannoroth, but he can ask his reply by PM ^^)

?? What are you talking about?


And just for the record, I've said nothing about lag or bugs for that matter. I simply stated that it is possible to crash the init thread in an attempt to provide you with additional info. If you are somehow disputing that possibility, then I guess you think Vexorian is full of BS. :/
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
It'll still cause lag and probably a thread crash if you'd set those 5000 variables to new units. Because that also means you're creating 5000 units. That's what I meant with "it depends from case to case". But thinking of it, since you're using GUI, you can't be setting variables to newly created units in 1 instruction...
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Mannoroth: You have just questioned powers of Captain Griffen ? You should better take it back...
 
Level 4
Joined
Nov 23, 2007
Messages
113
Mannoroth: You have just questioned powers of Captain Griffen ? You should better take it back...

Question what powers? I'd simply like a link to the info so I can read the technical write-up as I would be interested to know more about the threading structure internal to WCIII.

In order to know the number of ops, one would have to be privy to the object/intermediate (and ultimately the machine) code produced when jass is compiled, and this is something I have been seeking for quite some time (as I would like to design a C++ compiler to generate WC3 compiled code).
 
Level 4
Joined
Nov 23, 2007
Messages
113
Oh, you KNOW that do you? Well, I can tell you that you don't. And you can't make a C++ compiler to generate compiled Jass...

??? lol... that has to be one of the funniest (and uninformed) posts I've read in a while. Thanks.

A little primer for you:
If you use a C++ compiler, then the results would no longer be "compiled jass" since jass would not be the source language. It would be called "compiled C++" ;)

There are a number of websites which you might consider researching which explain the difference between a programming language, intermediate code, and machine code. Enjoy.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
If you use a C++ compiler, then the results would no longer be "compiled jass" since jass would not be the source language.

Jass compiles down to C++...

(as I would like to design a C++ compiler to generate WC3 compiled code)

Good luck at writing a game. Not to mention you can't actually know how Blizzard programmed it.
 
Level 4
Joined
Nov 23, 2007
Messages
113
Let's recount the events here.
I mentioned it is possible to crash the init thread, but it took a lot of iterations to do so (< 30,000 iterations). You responded with "300,000 ops" as if there was some knowable translation between the number of iterations (or as the OP inquired, variable assignment) and ops produced.

"Who says Jass is ever compiled down to machine code?"
Got me... who said it? Obama? See below...

"Who says you need the compiled code in order to find out op costs?"
If we were writing all this in assembly language instead of jass, you wouldn't. But since we are talking about jass here, the number of ops is useless info without knowing how many ops the language produces when it is eventually converted to machine code.

Machine code is the only code your processor can process. It knows nothing about different source code languages. That means that source code must eventually be converted to the machine code that the computer understands. This can be done through an interpreter at run-time (relatively slow and usually impractical for time-critical applications) or as is done with languages like C, compiled into intermediate code (obj files) which are then "linked" and assembled into machine code.

Now, with that said, as a matter of terminology, the number of "ops" would be the number of machine code operations (ops) performed. One line of "source code" (such as jass or C) may produce numerous "ops" (save assembly language, which is pretty much a 1:1 ratio).

So, how does this correlate to the OP's post or my post? It doesn't. Therefore, in order to know the exact amount of ops that are produced by the HLL, one would have to know how the language is broken down into machine code. Unless of course, you are referring to "ops" as something else and simply misusing the terminology. If so, please feel free to translate.

{EDIT 1}

There you go... that's all I asked for as it descibes the ops generated by jass. Wasn't that simple?

{EDIT 2}
Jass compiles down to C++...
Given it compiles into C++ intermediate code (obviously not source code), then perhaps your comment is directed toward Captain Griffin who seems to think a compiler that would generate C++ would not be possible (at least given his response to my post about creating C++ intermediate code from C++ source).

If jass compiles down to C++, then it seems odd people would find it either impossible or improbable to create a C++ compiler that takes C++ source code and generates C++ intermediate code for WCIII.

I think you guys are jumping to conclusions before actually having read the posts in their entirety.

I simply said I would like to create a C++ compiler that generates WC3 compiled code (and according to your statement, that would be C++ - seems natural enough, doesn't it?).

Captain Griffin referred to it as an attempt to create "Compiled jass". Where that came from is anyone's guess.


Not to mention you can't actually know how Blizzard programmed it.
I'm not sure what you are trying to say here.

Are you trying to say you can't write a game if you don't know everything about how another game was written? If so... if people at Blizzard aren't privy to all the assets used in creating a racing sim (for example) and all its source code, then how on earth did they ever manage to write WCIII given your logic?

Or are you trying to say the C++ compiler can't be done because no one knows how "Blizzard programmed it"? In that case, you've already contradicted your above statement by saying it is compiled into C++ (how could you know if no one knows?). Obviously it's not impossible to produce the assets that Blizzard uses or reverse engineer the file format.

Good luck at writing a game.
Then I suppose luck has already been on my side since 1998. *shrug*


Edit: And as a side note, I would think being able to use full OOP C++ in writing map/ai code would be a welcome addition to the tools already available, given C++ popularity. Evidently, there are some here who would not appreciate it, however using it would not be compulsory.
 
Last edited by a moderator:
Here is my experience:
Due to my oldest and one of my first maps, SUnken ForceStrike, which has been deleveoped in 2003 I have been working around initialysing and loadtime / ingame loadtime for a while. I have now in my newest and latets map,Templar Arena, an ingame loadsystem which loads data currently ingaem after chosing the modes. Thats required because of the high volume of data which must be loaded, and because I want to remove loading time of the map aslong it will keep users away from a new map because of leavers which leave while waiting.

My Sunken ForceStrike has about 4500 Variables to be set up, while I haven't included AI yet. It may be that it is higher as 6k, but I don't knew anymore.

Well about your problem: Its diffrent from map to map and editor to editor and from pc to pc if it causes bugs or not. My Footman had no bugs with it, but it surely freezes abit when you load them ingame. Preinitialysing will save ingamelagg, but drastically increase loadtime where guys will might leave.

Its up to you what you do. I prefer making an ingame system which loads all needed variables ingame.
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
It's interpretted by a VM. It is never compiled down to C++ or machine code but byte code that is then interpretted - but Jass never gets turned into machine code. The op limit is obviously a VM rather than machine code thing (what, you think your processor gets to 300,000 ops in a thread and then decides that's enough...?).
 
Level 4
Joined
Nov 23, 2007
Messages
113
It's interpretted by a VM.
It is never compiled down to C++
Apparently, you and GhostWolf are at odds on this one. Since he figures if no one knows it is compiled into C++, then "good luck writing a game", it would appear his comment is also directed toward you (since given his logic, if you don't know it's compiled into C++, then you couldn't possibly have the smarts to program anything else).

Who's right? Him or you? Hmmm... pick a winner. My bet would have to go with compiled byte code since that is typical of interpreters. ;)

You're both trying to argue with me (simply for the sake of argument since all you end up doing is arguing on a point that was never stated or confirming statements I have made using different terms) and at the same time, contradicting each other. Perhaps you should both get together on the same page before arguing with someone over misinterpreted and/or non-existent statements.

...or machine code but byte code that is then interpretted
Given I've said above that it would need to be interpreted and/or compiled, I'm not sure why you are reiterating a point I've already made. Unless you misread my post, which doesn't say jass gets "compiled" into machine code, but rather, is eventually converted to it (by way of execution by the VM).

Since jass is a scripting language, a VM is a pretty safe assumption. Not sure why you felt the need to state the obvious.

"byte code that is interpreted"
"- but Jass never gets turned into machine code"
What do you think that byte code gets interpreted into?
At some point it has to be executed via translation of the VM by your processor. The result of that translation is machine code.

"And you can't make a C++ compiler to generate compiled Jass"
If jass can be compiled into byte code, so can any other source (such as C++) be compiled into that same byte code. I'm not sure why you think these assets cannot be produced by any other means.

The op limit is obviously a VM rather than machine code thing (what, you think your processor gets to 300,000 ops in a thread and then decides that's enough...?).
lol... Well, of course that would be the source of the limitation. Since this was the entire basis of my initial inquiry, it's clear you didn't read well enough before writing this. Apparently intended as a self-serving statement, which of course does nothing but restate the purpose of my original inquiry. :/
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
Jass is never compiled into machine code. It is run by the VM using its machine code; it does not use JIT compiling (unfortunately).

Why the hell are you bringing in GhostWolf's arguments as if they are mine? GhostWolf knows nothing about this, and is not at all affiliated with me.
 
Level 4
Joined
Nov 23, 2007
Messages
113
Jass is never compiled into machine code.
For the third time, I never said it was... please read prior to responding.

Why the hell are you bringing in GhostWolf's arguments as if they are mine? GhostWolf knows nothing about this, and is not at all affiliated with me.
I didn't bring them in as if they were yours. They are clearly noted as his statements.

He certainly professes to know something about this to make such bold and condescending statements. He affiliated himself when he joined in the conversation by providing "facts" contradictory to yours.

Eh, guys...
Aren't you getting a little bit off-topic here? This problem has been solved already.
I agree. I don't know why a simple request to a link for information or the mention of a C++ compiler prompted such a response. As if it somehow threatened someones self-defined forum God status... Got me. *shrug*
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
For the third time, I never said it was... please read prior to responding.

If it never goes to machine code, then there is no such thing as Jass compiled machine code, hence you cannot make a compiler for it...

He certainly professes to know something about this to make such bold and condescending statements. He affiliated himself when he joined in the conversation by providing "facts" contradictory to yours.

Affiliation's a two way thing.

I agree. I don't know why a simple request to a link for information or the mention of a C++ compiler prompted such a response. As if it somehow threatened someones self-defined forum God status... Got me. *shrug*

I'm just trying to stop people like you spreading misinformation.
 
Last edited by a moderator:
Status
Not open for further replies.
Top