• 🏆 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!

[General] Variable name to string.

Status
Not open for further replies.
I think variables names usually are removed after code has been read, and replaced by some kind of id because their names are not needed at all for the game running.

Edit:
Maybe you could try to save variables names as strings into hashtable in key of Id of "triggering unit" for example. And later load string of key of Id of "triggering unit".. or it's null, or its name. But would need to save after each variable change again in hashtable :s
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
No. There are three main steps in reading code (in wc3)

Code is written by the coder (vJass, gui, jass) (world editor)>
Code is compiled into war3map.j (jass) (save button) >
Code is compiled into bytecode (bytecode) (during map loading process) > Variable names are lost here.

@TheHerb i'd have to assume for debugging

@Chaosy the names of variables in C# are cached and stored relative to their memory address, similar to how its done in java
 
You should check out the debugging features of SharpCraft.

http://i.imgur.com/y1H15C2.jpg


y1H15C2.jpg

 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Code is compiled into bytecode (bytecode) (during map loading process) > Variable names are lost here.
You sure about that? I remember stepping through WC3 and it seemed to be resolving every jass name each time it was referenced, multiple times. In fact this is why JASS variable name length impacts execution speed.

Long names -> slower hashes -> slower execution
Short names -> faster hashes -> faster execution

One would think it would remove all names during run time, but it keeps resolving them each time a reference is made which is why jass is interpreted and why jass is so slow. It does seem to byte code overall line functionality but continues to resolve each given name.

SC2 fixed this by finally converting all variables and functions into byte code so that their names are truly lost at run time except if the debugger is in use.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I'm pretty sure DSG is right.

If the variable names were lost then SharpCraft wouldn't be able to tell you which null variable is being accessed.

Is it able to? In the picture, all that was stated was "uninitialized variable read". It might all be true, its mostly speculation on my part.
 
Status
Not open for further replies.
Top