I saw this post that @SuperNovaAO made:
and I was like
So I decided to use
On a X number of variables to see what happens.
But I couldn't use a simple for loop ingame because the game would recognize it as an infinite loop. So I wrote a simple C# program that made a lot of variables (source here, without the forms).
I first tried it with 1000 variables, and that went fine. Then I stepped it up a notch or two and tried 100k variables. Now the map wouldn't load because the filesize was over 9000kb. Error:
Then I tried 50k (or something), the file size was now less then 5MB so it could load... OR NOT. A new error appeared:
Then finally I tried 10k and it worked, the file size was only a bit over 900kb. According to game time it finished in less then a millisecond.
Conclusion: The game doesn't care about resources used, or how they are used. Gsc files are safe enough to use anything you want, you don't have to care about performance. You just have to be careful that your gsc doesn't exceed the 5MB limit and that it doesn't use/set too many strings.
Final file: http://cfgfactory.com/kc/pozzuh/20kcode.gsc (it was too big to put on pastebin)
The attached file is the program I made to make the big file. You can change how many arrays and values per array in the program.
(09-01-2011, 18:51)SuperNovaAO Wrote:C++ Code
while (int(bar) != bar) { bar = 10 * bar; }
To get 0 digits after the . after cutting the front of.
And yes, this is probably still faster than string manipulation since string manipulation the slowest thing possible is for computers (computers are made to calculate, not read).
and I was like
So I decided to use
C++ Code
- numfunc(num)
- {
- num += " ";
- num = StrTok(num,".");
- return int(num[1]);
- }
On a X number of variables to see what happens.
But I couldn't use a simple for loop ingame because the game would recognize it as an infinite loop. So I wrote a simple C# program that made a lot of variables (source here, without the forms).
I first tried it with 1000 variables, and that went fine. Then I stepped it up a notch or two and tried 100k variables. Now the map wouldn't load because the filesize was over 9000kb. Error:
Code:
Hunk_AllocateTempMemoryHigh: failed on 10022177 bytes (total 5 MB, low 0MB, high 9MB)
Code:
exceeded maximum number of script strings
Conclusion: The game doesn't care about resources used, or how they are used. Gsc files are safe enough to use anything you want, you don't have to care about performance. You just have to be careful that your gsc doesn't exceed the 5MB limit and that it doesn't use/set too many strings.
Final file: http://cfgfactory.com/kc/pozzuh/20kcode.gsc (it was too big to put on pastebin)
The attached file is the program I made to make the big file. You can change how many arrays and values per array in the program.
Spoiler (Click to View)