Author Topic: TActivePlayer properties refresh rate  (Read 1673 times)

0 Members and 1 Guest are viewing this topic.

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
TActivePlayer properties refresh rate
« on: November 09, 2014, 08:03:47 pm »
At what rate are the properties of players refreshed? Is it 60 ticks? Cause when I changed TickThreshold to 20 ticks I got a feeling I'm not getting actual player's velocity but rather velocity he had a moment ago.

EDIT: I've been talking with Falcon about this. He says Soldat recalculates player's speed every tick and SC always hold actual info.
But me and my friend have a feeling that something's not right with the new TActivePlayer.SetVelocity() procedure. Let me explain.
I've been trying to introduce wind to the Ski Jumping script. So I generate random wind speed and add it to player's velocity every 20 ticks like this:
Code: [Select]
for i:=1 to Game.MaxPlayers do
begin
if(Players[i].Active)then
begin
if(Players[i].Team=1)and(Players[i].OnGround=false)then
begin
Players[i].SetVelocity(Players[i].VelX+windVelX,Players[i].VelY+windVelY);
end;
end;
end;
We've been testing this since yesterday and overall it does work. If the wind is favorable we get longer jumps, if it's not we fly shorter distance.
But sometimes even with unfavorable wind we get distances we couldn't achieve without the wind. We even tried setting wind speed to 0 and sometimes still get a very noticeable increase in our jumps.
Moreover after leaving my test server where we test this and joining my public SJ players sometimes seem to still be affected by the wind for a short while.
I can't really prove there's something wrong in SC cause SJ is very random but again, even with 0 wind speed added to player's velocity we get jumps far longer than previously possible.
« Last Edit: November 10, 2014, 07:44:12 am by JotEmI »

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: TActivePlayer properties refresh rate
« Reply #1 on: November 10, 2014, 07:41:11 am »
Up

Offline ExHunter

  • Inactive Soldat Developer
  • Soldier
  • ******
  • Posts: 154
  • Speedy go!
Re: TActivePlayer properties refresh rate
« Reply #2 on: November 10, 2014, 07:49:56 am »
Probably a simple reason (assuming it, tho):

ping. If you have a ping of 400 it takes 400 ms to send the package from the server to client.

But after 400 ms your speed on client should be lower sometimes. So it updates your client with the velocity you had 400 ms ago.

If you now have a good timing, then sometimes this will result in further jumps.

Probably I should add a procedure where you can add "relative" (=sending only the difference as value) velocity, instead of "absolute" (=sending the whole value) velocity

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: TActivePlayer properties refresh rate
« Reply #3 on: November 10, 2014, 07:54:39 am »
Thx, I actually was considering that but since we all had pings 16-50ms I didn't think it would make much difference.
Nevertheless, if someone has a high ping than it would affect the script in the way you described. So I guess the whole idea goes to trash...