 |   |  |  |
 |
10-16-2008, 04:40 AM
|
#1 (permalink)
|
Winning is for winners.
Join Date: May 2006
Posts: 280
|
Can a loop occur more than 8000 times?
Referring to this post:
http://www.hiveworkshop.com/forums/876954-post6.html
My question is, if it isn't an infinite loop, and instead very large reoccuring one, can I do
exitwhen i > 7999 set i = i + 1
Or will that be recognized as an infinite loop and canceled?
|
|
|
10-16-2008, 05:25 AM
|
#2 (permalink)
|
Fast Learning retard
Join Date: Apr 2008
Posts: 1,064
|
Infinite loops are not ones that have more than 8k executions. This is a very varing thing.
Put simply if wc3 executes too much code between frame rendering(i.e. in one function(thread) without triggersleepaction calls) it will just crash. Grimmore has a nice feature war3err which tracks how much code has been executed in between frames and if it is too much, it terminates the code, keeping wc3 stable and telling you where the error is(Reached OP limit in function blah)(this is only for map testing).
There is almost no point in doing that(i<7999) - 8k will do only if the loop is empty(for instance) and it is just simpler not to make infinite/long loops.
Last edited by spiwn; 10-16-2008 at 01:29 PM.
|
|
|
10-16-2008, 08:32 PM
|
#3 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,900
|
It doesn't crash normally, it just halts the thread.
|
|
|
10-16-2008, 11:01 PM
|
#4 (permalink)
|
EmoTauren (-.\\)
Join Date: Nov 2006
Posts: 6,601
|
Infinite loops crash depending on how much memory wc3 uses. Once it's got some certain amount, it crashes. When you infinite loop, you make the processor lag more and more, to the point where it is unberable, and it crashes... so it varies. It is also important WHAT is in the loop, if it is just set i = i + 1 than you'd need MANYMANY loops to crash, if you create unit each time, you won't need more than 10000 loops before crash.
|
|
|
10-16-2008, 11:16 PM
|
#5 (permalink)
|
I own you. Get over it.
Join Date: Aug 2005
Posts: 2,445
|
Quote:
Originally Posted by HappyTauren
Infinite loops crash depending on how much memory wc3 uses. Once it's got some certain amount, it crashes. When you infinite loop, you make the processor lag more and more, to the point where it is unberable, and it crashes... so it varies. It is also important WHAT is in the loop, if it is just set i = i + 1 than you'd need MANYMANY loops to crash, if you create unit each time, you won't need more than 10000 loops before crash.
|
I doubt it. When the OP limit is reached, the thread is halted. When you have a loop creating a unit each time, the OP limit will be reached faster and it still will not crash.
|
|
|
10-16-2008, 11:20 PM
|
#6 (permalink)
|
EmoTauren (-.\\)
Join Date: Nov 2006
Posts: 6,601
|
infinite loop doesn't crash for you? Strangely enough, it does for me.
|
|
|
10-17-2008, 12:32 AM
|
#7 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,900
|
A non-threaded infinite loop simply halts the thread it's in. A threaded infinite loop (say, a trigger firing itself), however, does crash warcraft, as there is no clear point to stop it.
|
|
|
10-17-2008, 05:03 AM
|
#8 (permalink)
|
Winning is for winners.
Join Date: May 2006
Posts: 280
|
Good to know thank you I get it now, its not about a loop firing 8000+ times, it's just sort of wc3 recognizing too much information passing.
+reps of course
|
|
|
10-17-2008, 10:25 AM
|
#9 (permalink)
|
******
Join Date: Nov 2005
Posts: 751
|
Quote:
Originally Posted by Eleandor
I doubt it. When the OP limit is reached, the thread is halted. When you have a loop creating a unit each time, the OP limit will be reached faster and it still will not crash.
|
An infinite loop creating a new unit each time would crash the game due to excessive units long before the op limit of 300,000 op calls was reached.
__________________
 | Quote: [20-00-13] MasterHaosis: Because I am retarded douchebag [20-15-23] MasterHaosis: I am faggot, retard and such.. [20-21-22] MasterHaosis: because I am chat moderator. And you dont have right to speak against me ~Void~: Knock it off, for fuck's sake. Get that bullshit out of your signature and stop being so immature. Let it die out. | |
|
|
|
10-17-2008, 02:22 PM
|
#10 (permalink)
|
I own you. Get over it.
Join Date: Aug 2005
Posts: 2,445
|
Quote:
Originally Posted by Captain Griffen
An infinite loop creating a new unit each time would crash the game due to excessive units long before the op limit of 300,000 op calls was reached.
|
I've actually done this. Well, not an infinite loop, but a loop from 1 to 32k creating 1 unit per iteration. Warcraft 3 didn't crash, only a few thousand units were actually created before the OP limit was reached and the thread was halted. Then I've added sleep actions every 1000 iterations and 32K units were created, without any crash. Granted, it was pretty laggy, but that's not to the point.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|  |  |  |  |   |  |
|