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

Limit to variables.

Status
Not open for further replies.
Level 2
Joined
Sep 23, 2008
Messages
8
Im planning a map in which each player controls one hero. How ever, due to the nature of the map, I may require each hero to have upto 30 variables, excluding player 12 (brown) who will act as "the enemy" and such. This will give a total of 330 Variables, before I even begin to create custom spell etc.

-Is this too much?

-If so could you give me a ball park number on an "acceptable" amount of variables.

Secondly, how important are leaks? Ive read up a lot on them lately, and see a lot of custom JASS scripts to destroy points etc, I was thinking if these were not originally included by blizzard;

-is it really that important to be pedantic about the destruction of potential leaks?


Many thanks,
Tyross
 
Level 17
Joined
Nov 18, 2008
Messages
1,538
-Is this too much?
Not for WE, but maybe for you to keep track of. Use arrays.

Secondly, how important are leaks? Ive read up a lot on them lately, and see a lot of custom JASS scripts to destroy points etc, I was thinking if these were not originally included by blizzard;

-is it really that important to be pedantic about the destruction of potential leaks?

Yes, nobody likes a laggy map. With that many variables it shouldn't even be too difficult to clean up leaks. And blizzard does use Jass scripts to destroy leaks.
 
Level 9
Joined
Apr 3, 2008
Messages
700
1. It's impossible that each hero requires 30 variables. You can optimize it. Use local variables and arrays.

2. Leaks cause lags. If your map is small and have not many triggers and custom spells, than you will feel no difference. But if you want to map a big map you have to remove leaks.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
"Is it really important to remove leaks ?"
Depends:
- Game Time: If its a long game you should remove it, because leaks stack and stack and stack so it starts to lag
- Leak Type: Special Effects leaks pwn you, others are not so important I guess
- Leak ammount/period: If your spell has a timer like executes everysecond or less then a second you should remove it for real, or if leak appears in a big loop

So for example its not so important in these conditions
You have a short game and you have a spell that moves your unit to a location with a moderate cooldown which leaks its location
 
Level 9
Joined
Jul 3, 2008
Messages
495
You can use the same variable for every player. I can't remember the
maximum size of an array variable, but I think its 8092.
Lets say that you we got 11 players who shares one variable. Then
they get 8092 / 11 = 735 arrays each.

Now we can use a little math to split the array variable into 11 parts.

This is for player 1
JASS:
local integer p = 0 //Player 1
Set udg_integer[1+(735*p)] = 10    // 735*p = 0 + 1 = 1
Set udg_integer[2+(735*p)] = 20    // 735*p = 0 + 2 = 2
Set udg_integer[3+(735*p)] = 20    // 735*p = 0 + 3 = 3

This is for player 2
JASS:
local integer p = 1 //Player 2
Set udg_integer[1+(735*p)] = 10    // 735*p = 735 + 1 = 736
Set udg_integer[2+(735*p)] = 20    // 735*p = 735 + 2 = 737
Set udg_integer[3+(735*p)] = 20    // 735*p = 735 + 3 = 738

And etc. etc. etc. For every 11 players
 
Level 2
Joined
Sep 23, 2008
Messages
8
Thanks for the feedback guys, I generally block all the leaks i humanly can with GUI, however my JASS is nonexsistant! So i may need to brush up on that!
 
Status
Not open for further replies.
Top