Server Optimization Question
#1

Hello,
I have a one gamemode, and I want to optimize this game mode but I don't know where to start.
I know a few things, but I know that it's not enough.
for example: check string values, check timer...

I would be very happy if you could make recommendations in such examples.


Note: Sorry, my bad english.
Reply
#2

You can check for data saving. This can cause a little lag to the players if you save too much data at the same time.
For example: You saving 1000 vehicle's data in a timer
Reply
#3

Quote:
Originally Posted by m4karow
Посмотреть сообщение
You can check for data saving. This can cause a little lag to the players if you save too much data at the same time.
For example: You saving 1000 vehicle's data in a timer
Thanks I got my note!
----------------------------------
I am looking for feedback from other users.
Reply
#4

Optimization is a very vague term or very broad, it really depends on your script.

Update data where needed, save where needed.
Use lesser number of variables, strings etc.
Re-define constants (MAX_PLAYERS, MAX_VEHICLES etc) if necessary.
Rewrite your code.
Break your single-timer code into multiple-timers.
Combine multiple statements (if, else-ifs) into one or use switch.
Don't abuse switch with large quantities (such as: case 1 ... 10000:) this will just increase the compile time.
Make use of timer instead of OnPlayerUpdate.

Most of these stuff just make difference of a milliseconds or microseconds.
Reply
#5

You can add Profiler Plugin which will help you in optimization.

https://sampforum.blast.hk/showthread.php?tid=271129
Reply
#6

Thanks!, I am looking for feedback from other users.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)