The article isn't talking about for loops, but for each loops, which blizzard has provided in the form of "pick each unit in unit group" and "for variable in such and such group".
How much closer can you get to arbitrary iteration than a loop? That is what they are describing even though it uses that term to describe looping more generally.
When he says "Although this was a fairly drastic solution, most games do not need arbitrary iteration in their scripts." he means general purpose loops.
What it describes is a design pattern. A general rule of thumb that makes the design better. And no, it's not just for dummies, arbitrary looping in a game is expensive when you do it over and over for no reason.
The article was for the purpose of showing the performance hit of looping in scripting, it just happened to turn around and mention blizzard's solution to the problem on a low level which was a bonus. (I swear I found this just looking on the internet when I saw this post, I typed in "game scripting loop" and it was right there.)
I could compare Blizzards scripting system to Dawn of War's SCAR and it was a headache trying to get functionality into that game. You had to add a rule that had an update called by the game loop and had to implement all of the event handling yourself, one wrong implementation would slow the game down because you couldn't stop it from calling your trigger every update rather than being called by a message system, it was like having nothing but a game loop and a set of functions and everything you added to the game showed a performance hit, you had to use time slicing. All of the performance would fly out the door if you tried to use a loop all at once because it would be called over and over again.
Go look at blizzard's list of implemented for loops and look at the options that allow you to iterate over a searched set. Those are there for performance reasons.
I posted link, which is not a blizzard link, it is an article from a respected Computer Science website which explicitly mentions blizzard when talking about iteration and effective game scripting techniques.
http://queue.acm.org/detail.cfm?id=1483106
If you want to learn to be a good modder then you should consider what it means to be a good scripter. A good scripter has at least some clue of the limitations of the engine and the purpose and capability of the scripting language.
Basically what the article is saying is that it is admiring blizzard's implementation of for loops in their natives because they are very streamlined at iteration because they don't iterate arbitrarily, they only iterate over fixed numbers of things. So yes it is better to use blizzard's for loops because the engine only makes you think it's doing arbitrary iteration but it's really doing is establishing a collection that it iterates over so that it can optimize the wazoo out of your scripts.
You shouldn't think in terms of how much code you generate but how fast your code runs, which doesn't always mean more lines of code means less performance. Keeping branch prediction happy is the aim of the game when you want speed and that sometimes means expanding code.
Branch prediction happens on modern processors and is the key to making things happen really quickly, when a processor can rely on it's branch prediction it can execute operations in a timely manner but if you nest a whole bunch of loops or if statements it becomes hard for branch prediction to work.
I do modeling on occasion and know how hard it is to create anything that is animated and textured effectively, not to mention a degree such as this. Great work!
Edit: animation from crypt lord, amazing none the less, would be nice to know what tools you used to get the animations over to maya seeing as the art tools for wc3 were for a really old version of max :(.
It has little to do with being user friendly and a whole lot to do with keeping the game from hanging or freezing.
Heck, the code expansion and the limit might even be a "keep dummies from breaking this" kind of fail-safe for GUI users because they don't know that you can break a game by doing too much at once.
A for loop is just a while loop with a variable for iterating and a break inside of an if statement when the iterator gets too big.
The increase in code size is probably because of nested loop optimization which are signs of good programming rather than any kind of bug or mistake.
Why use nested loops in scripting any way? Any system you create doing that for even moderately sized data sets is going to tear apart the game logic time frame. Find some other way to do it, use a data structure that you update or poll.
Damage effects, change the search filters so that they exclude ally and self.
Eh, nm, that's just for damage not targetting. Looks like Borg has it. I need to pay attention >.<.
Edit: Another thought, if that doesn't work is to use a work around by giving allied units a behavior that uses a small area search effect to apply a hidden dummy buff (like an aura) to nearby enemies that tanks have a validator for that keeps them from attacking those targets.
Have you tried weapon options and un-checking only fire at attack target? Might help to look at battle cruisers since they seem to have weapons that attack multiple targets.
Persistent effect that has a set duration and in it's period effect it applies a buff that disables the unit and makes it invulnerable for a short time so that it has to be reapplied periodically by the persistent effect and then when the persistant effect expires it uses it's expire effect to teleport the unit.
0
Nice choice of RPG :P.
0
@ZarafFaraz: Go
The article isn't talking about for loops, but for each loops, which blizzard has provided in the form of "pick each unit in unit group" and "for variable in such and such group".
0
Good luck, I had a little scare there with firefox adobe flash crashing :(. But looks like I got it to work with internet explorer for a change >.<.
I think my map has promise but I have no idea what I am up against as I haven't seen anyone else's map.
0
How much closer can you get to arbitrary iteration than a loop? That is what they are describing even though it uses that term to describe looping more generally.
When he says "Although this was a fairly drastic solution, most games do not need arbitrary iteration in their scripts." he means general purpose loops.
What it describes is a design pattern. A general rule of thumb that makes the design better. And no, it's not just for dummies, arbitrary looping in a game is expensive when you do it over and over for no reason.
The article was for the purpose of showing the performance hit of looping in scripting, it just happened to turn around and mention blizzard's solution to the problem on a low level which was a bonus. (I swear I found this just looking on the internet when I saw this post, I typed in "game scripting loop" and it was right there.)
I could compare Blizzards scripting system to Dawn of War's SCAR and it was a headache trying to get functionality into that game. You had to add a rule that had an update called by the game loop and had to implement all of the event handling yourself, one wrong implementation would slow the game down because you couldn't stop it from calling your trigger every update rather than being called by a message system, it was like having nothing but a game loop and a set of functions and everything you added to the game showed a performance hit, you had to use time slicing. All of the performance would fly out the door if you tried to use a loop all at once because it would be called over and over again.
Go look at blizzard's list of implemented for loops and look at the options that allow you to iterate over a searched set. Those are there for performance reasons.
0
@TheFallenOne222: Go
I say it is, it doesn't surprise me that their code expands when you deeply nest loops and if statements.
0
I posted link, which is not a blizzard link, it is an article from a respected Computer Science website which explicitly mentions blizzard when talking about iteration and effective game scripting techniques. http://queue.acm.org/detail.cfm?id=1483106
If you want to learn to be a good modder then you should consider what it means to be a good scripter. A good scripter has at least some clue of the limitations of the engine and the purpose and capability of the scripting language.
Basically what the article is saying is that it is admiring blizzard's implementation of for loops in their natives because they are very streamlined at iteration because they don't iterate arbitrarily, they only iterate over fixed numbers of things. So yes it is better to use blizzard's for loops because the engine only makes you think it's doing arbitrary iteration but it's really doing is establishing a collection that it iterates over so that it can optimize the wazoo out of your scripts.
You shouldn't think in terms of how much code you generate but how fast your code runs, which doesn't always mean more lines of code means less performance. Keeping branch prediction happy is the aim of the game when you want speed and that sometimes means expanding code.
Branch prediction happens on modern processors and is the key to making things happen really quickly, when a processor can rely on it's branch prediction it can execute operations in a timely manner but if you nest a whole bunch of loops or if statements it becomes hard for branch prediction to work.
0
@vjeux: Go
Why would they do that?? Hidden morph is used for thor wreckage.
Better fix would be for the game to ignore instructions from players that are not on the command card.
0
Read the link i put on the b.net thread. The guy who wrote that writes software for VMWare.
[Edit]Nm. That was another article, but anyway, virtual machines have performance and interactivity limitations.
0
Check the morph ability rather than the units maybe?
0
Awesome.
I do modeling on occasion and know how hard it is to create anything that is animated and textured effectively, not to mention a degree such as this. Great work!
Edit: animation from crypt lord, amazing none the less, would be nice to know what tools you used to get the animations over to maya seeing as the art tools for wc3 were for a really old version of max :(.
0
I made a post on the b.net thread.
It has little to do with being user friendly and a whole lot to do with keeping the game from hanging or freezing.
Heck, the code expansion and the limit might even be a "keep dummies from breaking this" kind of fail-safe for GUI users because they don't know that you can break a game by doing too much at once.
0
A for loop is just a while loop with a variable for iterating and a break inside of an if statement when the iterator gets too big.
The increase in code size is probably because of nested loop optimization which are signs of good programming rather than any kind of bug or mistake.
Why use nested loops in scripting any way? Any system you create doing that for even moderately sized data sets is going to tear apart the game logic time frame. Find some other way to do it, use a data structure that you update or poll.
0
Damage effects, change the search filters so that they exclude ally and self.
Eh, nm, that's just for damage not targetting. Looks like Borg has it. I need to pay attention >.<.
Edit: Another thought, if that doesn't work is to use a work around by giving allied units a behavior that uses a small area search effect to apply a hidden dummy buff (like an aura) to nearby enemies that tanks have a validator for that keeps them from attacking those targets.
0
Have you tried weapon options and un-checking only fire at attack target? Might help to look at battle cruisers since they seem to have weapons that attack multiple targets.
0
Persistent effect that has a set duration and in it's period effect it applies a buff that disables the unit and makes it invulnerable for a short time so that it has to be reapplied periodically by the persistent effect and then when the persistant effect expires it uses it's expire effect to teleport the unit.