PDA

View Full Version : Ping and Sever Lag



MrBlackman
19th November 2012, 11:18 PM
Basics Understanding Ping and Lag

In this thread I would like to explain what ping is, and what is really causing the current lag on the server. Why am I doing this? To stop people from asking when the host will be changed, because this isn't the HOSTS fault.


Ping

Ping is a tool to measure how how long it takes for the server to send you a package(some data) and come back.Ping is measured in milliseconds, meaning if you have 98 ping it took 98 milliseconds to send the package to you and back.

Higher the ping, the more the game lags for you, especially sync wise more than chat lag(unless your ping is like 500).

What causes high ping? Well there can be more reasons, but the main two I can think of is your ISP being SHIT, and/or you are far away from the host.


Server Lag

Most people think the current server lag is caused due to the HOST, and them being far from the host so their ping is high. No this not true, the problem is the script.

Okay so what you need to understand first is SAMP is single threaded. Single threaded means it executes one command(I don't mean player commands) at a time. For example, if player 1 types a /me, and player 2 types a /me a millisecond later, player 2 will have to wait until the first /me is executed. Now a /me command takes less than a second to execute, so that's not the problem right now.

The biggest issue we have is loops. For example, "OnPlayerUpdate" is called MANY times per second. So think of this, if OnPlayerUpdate gets called right before you say something in the chat, your message won't be executed until OnPlayerUpdate is.

What does this mean? Nothing usually, probably a split second most of the time. But if the there are many functions under OnPlayerUpdate it will take longer, especially with over a 100 players. Why? Because the more players, the more time it takes to loop through them.

Another problem is strcmp, a so called "command processor". The original GF script uses strcmp, which SARP is based off of, so unless every single command was changed, we still use strcmp. What is the problem? Strcmp is much slower than other newer command processors, as it is not meant to be a command processor. Strcmp is simply a function that compares strings, but in the old days of SAMP they didn't know better so they used it as command processor. Which was fine back then, as scripts weren't complex and complicated, but as times goes by,scripts get bigger and more complex.


Conclusion

It is a bit complicated to understand, but I hope people get what I was trying to say here. So now that I've explained this, I hope you will already shut up about the host.

Also, I'd really like to thank the admin and development team for admitting that this is a script problem and not the host. I also know that they are working hard to get this fixed.

Todd Stark
19th November 2012, 11:50 PM
Nice guide.

Vinny Meadows
19th November 2012, 11:58 PM
Thank you for clarifying this :]

Cartorious.
20th November 2012, 01:29 AM
Nice guide , thank you.

MrBlackman
20th November 2012, 02:10 AM
Another thing I forgot to mention, is that if the server has a slight lag spike, it can stop executing commands(again I don't mean player commands, but script functions). This means the amount of commands needing to be executed stacks up, and SAMP being single threaded they have to be executed one by one. This is why there is so much chat lag when hackers are on.

All of this just shows how important code optimisation is needed.

Hollohan
20th November 2012, 02:42 AM
I understand what you're trying to say man

Batman.
20th November 2012, 04:42 AM
This even helps out the helpers team, since we didn't understand the issue that much, as we were only notified it was due to the script, not the host.Thank you, it's a great guide.

Hallar Maraz
20th November 2012, 06:14 AM
gj.
..

Zennor_Lock
20th November 2012, 07:05 AM
Thanks for this post, now all the bitchers have something to shut them up.

Bert
20th November 2012, 09:11 AM
NIce Guide coz I'm from GMT+8 and always lagging as fuck.

KrisYellow
20th November 2012, 09:18 AM
awesome

Mr.Silver
20th November 2012, 09:20 AM
ye okay, and how it can help me?

MrBlackman
20th November 2012, 10:01 AM
Well there's two reasons why I made this post. First is to inform people on how ping works so they understand it. Second is to explain why the sever is lagging, so they can stop asking. It can also help future developers not make mistakes that the ones before did, but I doubt the server would hire scripters that didn't know this.

So yea MrSilver this probably won't help with the actual lag, but now you understand it so there is one less person asking about it.

Claude™
20th November 2012, 10:12 AM
Great tutorial, it will make ''gamers'' without acknowledgment what SAMP is to understand what's going on. Great tutorial, a useful one.

KrisYellow
20th November 2012, 02:14 PM
cooooool

Aero__
20th November 2012, 02:51 PM
Ah, thanks for this!

Jay Westwood
20th November 2012, 02:56 PM
Good guide , thanks for this post mayne.

ST3V3©®
20th November 2012, 04:25 PM
Thank you for this nice information.

Fluffy
20th November 2012, 05:53 PM
Cool shit bro, I already knew this. But it's good for the people that didn't know that, and complaining in /n.

MrBlackman
20th November 2012, 07:42 PM
Thanks for all the positive feedback.

Donbot™
20th November 2012, 08:13 PM
you know all thses tutorials are great in this section; but sometimes i wonder if those who are struggling with stuff actually read these guides

Vinny Meadows
20th November 2012, 08:19 PM
ye okay, and how it can help me?

This is especially for people like you

MrBlackman
20th November 2012, 08:22 PM
you know all thses tutorials are great in this section; but sometimes i wonder if those who are struggling with stuff actually read these guides

Well that's a different story, this is for people who struggle but want to learn. This is a subject that most SAMP players probably don't understand.

Donbot™
20th November 2012, 08:29 PM
Well that's a different story, this is for people who struggle but want to learn. This is a subject that most SAMP players probably don't understand.

perhaps, cant judge as i have no idea who understand and who doesn't

Jorge
20th November 2012, 09:40 PM
Nice guide, keep it going :)

Justin Fakie
20th November 2012, 10:19 PM
I actually understood it. The server lag bit on chatlag and stuff really helped.
Probably one of the best guides imo

MrBlackman
20th November 2012, 11:49 PM
I actually understood it. The server lag bit on chatlag and stuff really helped.
Probably one of the best guides imo

Thanks, I really appreciated it. Would be nice if this was stickied, but mehh, enough people have read it to explain others already so it's all good.

TonyChappy
21st November 2012, 01:54 AM
gay faggots

Criss Mclarean
21st November 2012, 05:39 AM
Nice, i need this post because i lived on Philippines, kinda far away from the host..