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

Variable help

Status
Not open for further replies.
Level 13
Joined
May 11, 2008
Messages
1,198
you're talking about setting 3250 strings to a single variable right? and all the strings are 336 characters? what are you going to use all those characters for? how much is that ammount anyway?

anyway i'm pretty sure that the variable is only going to hold one of those strings at a time...other than that...i think strings are kindof the least of map maker's problems but whatever.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
I want to store a 3250 "336 character" strings in a single array. Would warcraft 3 kill me? :p

Yes it would, infact it would die the very first string used as any string longer than 256 crashes the game last time I heard.
However I can advise you to use 4283 string array indexes with 255 characters each. It should not slow WC3 down at all much. But remember to do them a few at a time otherwise you may hit WC3's opt limate and so skip the rest.
 
Level 4
Joined
Dec 10, 2005
Messages
73
lol, characters = letter/numbers. Not units.

Well It's a guess that my system would not exceed. ( it's a top secret project) If nothing wrong with it then I can continue to work on this script. It's all strings, just 336 numbers in a row. I'm using it as indicators.

I can advise you to use 4283 string array indexes with 255 characters each. It should not slow WC3 down at all much.
What, only 255 character. I might go check this.
And don't worry, the max I would use is 5 strings from the entire array per trigger run.

I've relooked and may now only need 1000 * 224 character string. But this mean my script would only be for 6~8 players.

Another question. How fast is warcraft at checking two 224 strings? GUI triggers btw.


Thanks for helping me with this crazy stuff:p
 
Level 4
Joined
Dec 10, 2005
Messages
73
Well ok, it's sound crazy but I'm trying to build an anti blocking system for multi-waypoint td. :)
The only problem I'm having is trying to allow sell mode.
 
Level 4
Joined
Dec 10, 2005
Messages
73
Thanks, but what I'm making is different. What I mean is a disconnection from the maze. When a wall is broken. My system atm can handle additional tower to the maze but removing tower is a bit harder. Still trying to run through the logic of it.

The string store information and is used to check if a block has been made. I can't keep checking every tower, that too ugly. I have narrow it down to 4 bits per waypoint. So if there's 8 players and 7 waypoints then the number of bits to store = 4*8*7 = 224 bits.
And then I need lots of these string for each tower/branch of towers.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
28 ASCII characters = 7 integers = 224 bits thus I am confused why you are having storage problems.

What is a waypoint and what has it got to do with towers? Why is it 4 bits each as that is only a number in the range of 0-15? What is this whole branch tower thing you are talking about?
 
Level 4
Joined
Dec 10, 2005
Messages
73
Sorry for using terms loosely.
A waypoint is a checkpoint that a unit/creep must reach. The unit will continue to touch these through the maze contructed.
I need 4 characters, eg 0000 or 3211, ( I called them bits) to mark the information how the maze in created. Therefore make checking blocks easier.
The branches refer to tower with the same information.

The reason why I started the thread is to approximate the number of strings I might need and if it's possible to make in warcraft, given my script works.

Thanks anyways. I'll try making the script now and ask later if I get into trouble.
 
Level 4
Joined
Dec 10, 2005
Messages
73
More help, this time with memeroy leak. Just read up on it and see wise to do so.

If I create a temp rect via a temp point, Do I need to store and delete both?

And Can I run a GUI trigger than is turned off via trigger run (ignoring conditions)?
 
Level 4
Joined
Dec 10, 2005
Messages
73
Thanks

Another one
When I'm performing this comparison
(X of (Position of (Triggering unit))) Less than (X of (Center of SW2 <gen>))
Does that leak since it uses dynamic points?
 
Level 4
Joined
Dec 10, 2005
Messages
73
I got another question. If a set a global array, eg Hi[600] in the variable list, will warcraft:
a) allocated memeroy space for all 600 in the array or
b) only use space for those variable in the array that have data in them?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Logically it allocates space for all members in the array. The size space allocated in an array is based on the highest index used and is rounded up to the next power of 2. However keep in mind that each array is a 32 bit array and so no matter the type, an array of a certain size will always use the same storage space. With strings, they are stored as a separate custom array and the variable purly holds a reference to the string array. Thus all string variables are 32 bit, but there is also the size of the string which is being stored on top of that.

However for efficency, 2 strings with the same content will reference the same content, thus you can not get duplicate string content so 2 variables storing the same string will only use 32 bits more than 1 variable referencing the same string. A maximum size array in wc3 (an index used in the range of 4096 to 8191) is only 32 KB, and concidering modern PCs atleast have 1 GB it is hardly noticable. Infact, using a different model or a model once will use more space than a full array. But be aware that this is the space just for the array and not the objects which may be represented by the values in the array (handles and strings).
 
Level 4
Joined
Dec 10, 2005
Messages
73
wow, thank you. This makes me feel better that 3 1000 arrays won't impact greatly. Will work on speed then.

However for efficency, 2 strings with the same content will reference the same content, thus you can not get duplicate string content so 2 variables storing the same string will only use 32 bits more than 1 variable referencing the same string.

Bit confused here. Does war craft automatically detect duplicate string and assign the two variables to reference the same point. OR are you saying to just to use the one if the stuff is the same?

P.S why does our avatar rotate anticlockwise? I feel like going backwards.
 
Status
Not open for further replies.
Top