[Tutorial] How to get better hit-registration(sync) without any includes/filterscripts/etc.
#1

Well, today I'm going to be teaching you exactly what the title of the thread states. Yes, I know there are some amazing includes out there that actually improve the hit-registration. Hell, two of these includes are actually extremely popular! Those being: Though these are extremely viable options for better hit-registration, many people would prefer to not have to use an external include or external code just to get better hit-registration. I'm here to tell you why you don't need these external includes just to get better hit-registration. Surprisingly, many people don't know that you can actually get better hit sync, vehicle sync, and just plain old on-foot sync just by editing some values in your default server.cfg file.

Let's take a look at the default server.cfg file for 0.3-DL:
Code:
echo Executing Server Config...
lanmode 0
rcon_password changeme
maxplayers 50
port 7777
hostname SA-MP 0.3 Server
gamemode0 grandlarc 1
filterscripts gl_actions gl_realtime gl_property gl_mapicon ls_elevator attachments test_cmds skinchanger vspawner ls_mall ls_beachside npc_record stunt_island stunt_island2 ospawner
announce 0
chatlogging 0
weburl www.sa-mp.com
onfoot_rate 80
incar_rate 80
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 10
logtimeformat [%H:%M:%S]
language English
useartwork 1
sleep 1
mtu 1400
This file actually has A LOT of useful data in it that you can adjust and tinker with to improve the overall stability, performance, and sync of your gameserver. Yet, for this tutorial, we're focusing on hit-registration. So, let's focus on the specific line that deals with hit-registration.
Code:
weapon_rate 40
Now, let's take a step back and learn about weapon_rate for a second. On the SA-MP wiki weapon_rate is classified under the "Client" section. This means that it deals with connected clients(users) and their specific rates. Now, by definition, weapon_rate is: "The time in milliseconds a client should update the server with new data while firing a weapon." Basically, what this means is that whenever a player fires a weapon it will take 40ms to send data to the server and update it's previous data. That's based on the rate in the default server.cfg, however.

Though 40ms may not seem like a long time, in terms of sync it can cause some issues or hiccups. We all have witnessed those times when we're DMing or just shooting in general and our crosshair is clearly on the opposing player and when we shoot it just seems to miss. This is caused by weapon_rate, packetloss, ping, and server stability. Yet, we're focusing on weapon_rate. If we look back at the SA-MP wiki, it also tells us under the "Client" section that: "Lower values of onfoot_rate, incar_rate and weapon_rate increases sync performance, but uses more bandwidth." Yes, lowering the value of weapon_rate will cause more bandwidth usage, yet that's expected considering we're going to be improving the sync of the server. Of course it will require more packets to be send back-and-forth since they'll be being sent faster to the server.

Now, before you go and set your weapon_rate down to 1 and think you're going to have the best sync ever let me stop you. We're going to have to use some common-sense. If we set the weapon_rate value to 1, this means that it will only take 1ms to update the server with data from the client whenever they shoot. Let's imagine the client is using a weapon that has a high fire-rate. An M4, AK-47, Tec9, Uzi, Mp5, Minigun, etc. This would cause the server to practically update instantly whenever the client fires a bullet. This will cause issues because it will hog up the bandwidth and possibly even cause the server to flood with packets(simulating a DDoS attack sort-of.) So let's be reasonable with the number we set the weapon_rate to.

Personal preference and just from previous experience, I'd say choose a number anywhere for 18-25. Though these numbers don't seem far from the original 40, it will genuinely make a huge difference. The best way to figure out what you want this rate to be is just by trial and error. Change the number down to something you think will work, try it out. If it's slowing down the server or causing the sync to be TOO precise for SA-MP, then bump it up. Keep testing new values and figure out which works the best for your server/community. I also suggest matching the onfoot_rate and incar_rate values to your weapon_rate values as that'll increase the overall sync for your community. If you're just a DM server that uses arenas, then the onfoot_rate and weapon_rate will be what you need to worry about. If you're a TDM server that uses vehicles, then you should worry about all three.

I know many people may not classify this as a tutorial, but I believe it is because it's informing people of something they didn't know about previously and teaching them. If you have any questions or concerns, please don't be shy. Leave a reply below, I'd be more than happy to converse about this and assist anyone in need. I hope someone finds this tutorial useful, have a great day!

tl;dr
lower the weapon_rate value in your server.cfg and figure out which value works the best for your community's needs/desires.
Reply


Messages In This Thread
How to get better hit-registration(sync) without any includes/filterscripts/etc. - by oSAINTo - 26.03.2018, 20:29
Re: How to get better hit-registration(sync) without any includes/filterscripts/etc. - by LMan - 27.03.2018, 04:10
Re: How to get better hit-registration(sync) without any includes/filterscripts/etc. - by oSAINTo - 27.03.2018, 12:31

Forum Jump:


Users browsing this thread: 1 Guest(s)