Need economic assistance -
nesty - 04.02.2010
hi there!

My script is almost done but I have a fundamental very Big Problem!
Because my script is beautiful designed in my opinion and I've a lot of thinks inside it.
But It is very slowly so the multiplayer synchronization is almost 2 seconds delayed. It's really a problem! (3791 Lines)

I need help! Maybe with some tipps to change my script in a economically way.
My scripting knowledges are ending here so i hope some good scripters will help me and give me tipps.
Re: Need economic assistance -
Goobiiify - 04.02.2010
Don't use OnPlayerUpdate to much + Timers delay may not be to low.. Good luck!
Re: Need economic assistance -
nesty - 04.02.2010
thanks but i've only about 5 timers and I never used onplayerupdate

lol
but I've about 30 "if instruction" in one function.
Is there a way to reduce this or anything like this?
Re: Need economic assistance -
MadeMan - 04.02.2010
Are you sure it's not server lag?
Re: Need economic assistance -
nesty - 04.02.2010
no because first I scripted at a base system like battlefield2 and with one base or two there weren't any lags or something like this but when I added my 6 Bases the game gets slowly (and lol my "second timer" just is a "3 second timer" now ) and this all happens because I've added 4 bases more.

(my many if instruction (=the encapsulation)) hope for solutions or more tipps.
Re: Need economic assistance -
Calgon - 04.02.2010
I think you mean
algorithmic efficiency.
Re: Need economic assistance -
nesty - 04.02.2010
First thanks for the webside

I have to find out more about the effeciency way of optimize my script.
Code:
Header size: 3796 bytes
Code size: 143416 bytes
Data size: 159888 bytes
Stack/heap size: 16384 bytes; estimated max. usage=4707 cells (18828 bytes)
Total requirements: 323484 bytes
thats my code size! lol
1. Question.
What's the lowest bytes I can use here:
pawn Code:
new string[64]; // <= I mean this array
new string2[64]; // <= I mean this array
format(string,sizeof(string),"~w~Base HOSPITAL ~b~%i ~w~Percent",PERCENTAGE_HOSPITAL);
GameTextForPlayer(i, string, 3000, 4);
format(string2,sizeof(string2),"%i Percent",PERCENTAGE_HOSPITAL);
Update3DTextLabelText(TEXTLABEL_HOSPITAL2,COLOR_YELLOW, string2);
2. Question Is there a
effeciency differance between a variable called
and
pawn Code:
new variable_base_hospital;
3. Question
Is there a
effeciency differance between this
pawn Code:
if(a==1)
else if (b==1)
else if (c==1)
else if (d==1)
or
pawn Code:
if(a==1)
if (b==1)
if (c==1)
if (d==1)
hope for anwers (Interesting Topic in my opinion)
Re: Need economic assistance -
nesty - 04.02.2010
(i've forgotten)
4. Question
I use over
225 global variables! Is that too much? thanks for replies
Re: Need economic assistance -
CrucixTM - 04.02.2010
I might be Captain Obvious now, but are there like a ton of vehicles spawned, in the same area?
Re: Need economic assistance -
nesty - 04.02.2010
no I didn't add really much cars