Forum

> > CS2D > Scripts > Addhook
Forums overviewCS2D overview Scripts overviewLog in to reply

English Addhook

9 replies
To the start Previous 1 Next To the start

old Addhook

Promaster
User Off Offline

Quote
Hi, I wonder if tons of addhook in a mod will cause more lag on server.

That would help me alot if you answer me as fast as possible. Please give me an explaination too.

///Thanks
edited 1×, last 14.07.14 06:27:11 pm

old Re: Addhook

VADemon
User Off Offline

Quote
The more things you compute the more time your server needs. You have <20ms per frame to execute your code, that should be enough if your code isn't crap.

As long you don't use 9000 addhook's everything's fine, on their own they'll probably never be a problem, but the code executed in those hooks will lag your server eventually.

old Re: Addhook

Promaster
User Off Offline

Quote
@user VADemon:


I got like 150 addhooks. Some of them are repeated like seconds and minutes. Will the server lagg lesser if i put the function into a function who got and addhook per second, and remove the functions addhook i have putted into the other function. If you know what i meant.

If you don't here is a more clearer explaination.
More >



Will this make lesser lagg?

old Re: Addhook

Zeik
User Off Offline

Quote
@user Promaster: I think it's the same thing. You are calling the function anyway... If you want better performance you will have to modify the function's code.

old Re: Addhook

Promaster
User Off Offline

Quote
user Zeik has written
@user Promaster: I think it's the same thing. You are calling the function anyway... If you want better performance you will have to modify the function's code.


you mean like i should make a funtion all together?

More >

old Re: Addhook

VADemon
User Off Offline

Quote
If you put all functions in a single hook then there will be a tiny difference, because CS2D is not really efficient when calling Lua functions. Nevertheless it's only 150 hooks so the difference won't be noticable (I think).

old Re: Addhook

Promaster
User Off Offline

Quote
@user VADemon:

so there is nothing I can do on my code that makes it lagg lesser? Cause I got like good internet (100mb/s download and 10mb/s upload speed) and still, people who joins pings more than 200 and some even got the screen frozen and get kicked out.

old Re: Addhook

VADemon
User Off Offline

Quote
You can optimize your old crappy code. That's all.

And I have no idea why people have problems with joining

old Re: Addhook

Promaster
User Off Offline

Quote
@user VADemon:
Can it be that the map is too large or smt? I got a map smt like 400x400 and there is some images and object in the map too.

old Re: Addhook

DC
Admin Off Offline

Quote
The map size doesn't really matter but the number of objects, items and Lua images matters of course.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview