TUVAZ as 0 . Performance impact ?
#1
Posted 21 June 2012 - 05:30 PM
My game being an RTS, in the midst of a battle tons of instances are created every seconds. With TUVAZ off, everytime these objects are created, 6 variables are initialized, 4 of them being 0s. With TUVAZ on, only 2 variables are initialized, the 4 others being rarely initialized (situational variables). Therefore, wouldn't that mean that with this option on the computer would have much less initialization to do overall, and therefore wouldn't the game run faster ?
Clearly I am mistaken somewhere, but I don't have the required knowledge of GML to understand what happens behind, so I'd be glad if someone could enlighten me. Thanks for your time ^^.
Tabc3dd
#2
Posted 21 June 2012 - 05:47 PM
#3
Posted 21 June 2012 - 06:30 PM
i stop useing this option from yesterday...i also think that it will set my programming speed fast,but when i gave my game's executable to my friend this make a huge error in game levels .. so i stored using this..and reprogramming my game...:'(Now before everyone starts, I know TUVAZ (treat uninitialized variables as 0) is a terrible option to turn on, causing weird issues and bad programming habit. However, I was wondering if turning it on could improve the speed at which the game runs. Here's my logic :
My game being an RTS, in the midst of a battle tons of instances are created every seconds. With TUVAZ off, everytime these objects are created, 6 variables are initialized, 4 of them being 0s. With TUVAZ on, only 2 variables are initialized, the 4 others being rarely initialized (situational variables). Therefore, wouldn't that mean that with this option on the computer would have much less initialization to do overall, and therefore wouldn't the game run faster ?
Clearly I am mistaken somewhere, but I don't have the required knowledge of GML to understand what happens behind, so I'd be glad if someone could enlighten me. Thanks for your time ^^.
Tabc3dd
#4
Posted 21 June 2012 - 08:00 PM
I don't see how initialization will make the game run faster or slower. Collision checks, loops, etc. can make the game run slower, but I don't think initialization will have a noticeable effect on the game. Since you aren't asking about whether or not uninitialized setting is good, I don't see why I have to further explain my standpoint.
Well when you have, say a 1000 instances being created every second, that's 4000 times "variable = 0" being executed. Surely that causes some lag no ?
#5
Posted 21 June 2012 - 08:23 PM
#6
Posted 21 June 2012 - 08:44 PM
if (variable_global_exists(""))
{
show_error("Uninitialized variables are treated as zero! "
+ "Uncheck the box for it in Global Game Settings --> Errors. "
+ "This is worse than division by zero.", true);
}It checks for a variable that cannot possibly exist, with an empty string as the name. If TUVAZ is on, the function will basically say "Yes, this variable exists" by returning true. At that point your game is screwed anyway, so it shows a fatal error and aborts the execution of the game.
#7
Posted 21 June 2012 - 09:05 PM
That would be incorrect to say. Only the programmer increases errors depending on whether or not the box is checked (and what the programmer's preference is). If the box is checked and you're testing if a variable exists, there's something wrong with you.and increases errors in the game.
Edited by smash ball, 21 June 2012 - 09:06 PM.
#8
Posted 22 June 2012 - 07:56 AM
I highly doubt all 1000 of those instances must be created, but that won't lag the game. Drawing everything and executing serious code will cause the game to slowdown.
Unfortunately they must, that's a 25 vs 25 ship scenario, each firing 20 rounds per second average :/ ... But you're probably right about the lag
I've read all your comments, thanks for the opinions, I'll turn it off ^^
#9
Posted 22 June 2012 - 08:07 AM
It's not that the check box is evil, it's that most of the people who use it are kids who don't know how to organize a program so that they won't end up with strange errors that they don't understand.
#10
Posted 22 June 2012 - 08:10 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











