Hi, my game is getting a little silly in the way of too many global variables, Will having a load of Globals adversly affect my CPU?
Many Globals
Blitz3D Forums/Blitz3D Programming/Many Globals Nope!
But a small tip is to have all your global variables in a type, that way you avoid problems with mistyped variable names :)
But a small tip is to have all your global variables in a type, that way you avoid problems with mistyped variable names :)
I use this technique all the time. VERY helpful and cuts down on coding errors.
Interesting technique, I may try this
Awsome, it works!!! looks a little better, and my computer seems to run faster :o\
Are You sure its faster?
I've done a little test and its seems to me that globals ( and constants) are 100% faster...
Buts its indeed handy to track typos!
I've done a little test and its seems to me that globals ( and constants) are 100% faster...
Buts its indeed handy to track typos!
You could probably do a find and replace to convert the type fields back to proper globals for the release version.
FYI: I vaguely remember that someone found that there was a limit to the number of globals that could be used in a program, but I believe the number that they were using was some ridiculously large amount.
FYI: I vaguely remember that someone found that there was a limit to the number of globals that could be used in a program, but I believe the number that they were using was some ridiculously large amount.
I would warn to be careful using lots of Globals (to include Global Custom Types) if at all possible. I ran into some bugs that were painfully difficult to find due to overwritting global data. In fact the bugs, were so painful that scrap weeks of work to start over:(