• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Release] My science project
#1
Lightbulb 
I saw this post that @SuperNovaAO made:

(09-01-2011, 18:51)SuperNovaAO Wrote:
C++ Code
  1. while (int(bar) != bar) {
  2. bar = 10 * bar;
  3. }


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
[Image: 9763578.jpg]

So I decided to use
C++ Code
  1. numfunc(num)
  2. {
  3. num += " ";
  4. num = StrTok(num,".");
  5. return int(num[1]);
  6. }

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)
Then I tried 50k (or something), the file size was now less then 5MB so it could load... OR NOT. A new error appeared:
Code:
exceeded maximum number of script strings
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.



Attached Files
.rar   SMS by Pozzuh.rar (Size: 4.6 KB / Downloads: 12)
[Image: MaEIQ.png]
  Reply
#2
Awesome
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

  Reply
#3
In english what does that do?
  Reply
#4
(09-04-2011, 20:35)Scripts18 Wrote: In english what does that do?

Make a lot of variables
[Image: MaEIQ.png]
  Reply
#5
(09-04-2011, 20:39)Pozzuh Wrote:
(09-04-2011, 20:35)Scripts18 Wrote: In english what does that do?

Make a lot of variables

For?

(I challenge you to explain it to me)
  Reply
#6
(09-04-2011, 20:41)Scripts18 Wrote:
(09-04-2011, 20:39)Pozzuh Wrote:
(09-04-2011, 20:35)Scripts18 Wrote: In english what does that do?

Make a lot of variables

For?

(I challenge you to explain it to me)

read the fucking topic
[Image: MaEIQ.png]
  Reply
#7
Confused what does strTok do?
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
  Reply
#8
Pozzuh I read it but its like chinesse for me
  Reply
#9
@AZUMIKKEL Splits up the string (first parameter) with a character (second parameter) and puts it in an array
[Image: MaEIQ.png]
  Reply
#10
Awesome
[Image: m9ljxv.jpg]
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  New Project Mibbix 11 6,091 02-20-2013, 11:41
Last Post: Mibbix
  [Release] ZombieS Project - outdated - barata 9 5,376 01-03-2013, 03:26
Last Post: barata
  [News] Operation 'Let's start on another project that we won't finish' JariZ 10 5,737 08-26-2012, 17:59
Last Post: Arteq
Rainbow Preview Project Dark Night Nekochan 7 4,229 08-07-2012, 11:43
Last Post: Arteq
  [Release] Project Nova SparkyMcSparks 29 16,229 07-03-2012, 18:01
Last Post: Snipermats
  SnD bg sounds project paok-atak 8 4,564 05-22-2012, 18:08
Last Post: JariZ
  Project Anti cheat Joan 18 9,574 05-09-2012, 09:15
Last Post: GscGunner
  Real Science House 1 1,758 03-19-2012, 15:52
Last Post: Yamato
  Iron Wolf Project SuperNovaAO 8 5,182 02-07-2012, 00:58
Last Post: kokole
Bug Preview First photoshop project!(: skata3000 8 4,671 01-20-2012, 15:26
Last Post: Ic3coldh20

Forum Jump:


Users browsing this thread: 1 Guest(s)