Lag optimization fix

alsteralster Join Date: 2003-08-06 Member: 19124Members
Problem now:

Players with low and high ping experience and complain about lag at certain times when there is a spike in ping or drop in tick rates. This occurs when the client or server has to load or send data, eg. loading graphics, players joining, large number of players - constructs in one area, etc. It's almost bound to happen no matter how optimized network code becomes.

Combat between large groups with constructs in the area is especially laggy almost unplayable to a point.

Solution:

Lag "compensation" ... excuse my caveman code :) .... all numbers used are just random examples

max_marine_speed = 200
max_skulk_speed = 220
max_marine_turn_speed = 100
max_lmg_fire_rate = 30
max_lerk_spike_fire_rate = 10

lag_marine_speed = max_marine_speed - (ping/10) - (100/tick)
lag_marine_turn_speed = max_marine_turn_speed - (ping/50) - (20/tick)
lag_lmg_fire_rate = max_lmg_fire_rate - (ping/500) - (10/tick)

if player1 ping < 300 and player1 tick > 50 then "player 1 normal lag free speed"
marine_speed(player1) = max_marine_speed
marine_turn(player1) = max_marine_turn_speed
marine_lmg_fire_rate = max_lmg_fire_rate
lag_counter(player1) = 0

else "player 1 too much lag - slow him down"
marine_speed(player1) = lag_marine_speed
marine_turn(player1) = lag_marine_turn_speed
marine_lmg_fire_rate = lag_lmg_fire_rate
+1 to lag_couner(player1)

if lag_counter(player1) > 50 then "player 1 keeps lagging for too long"
message(player1) "You have a connection problem!"
lag_counter(player1) = 0

Sounds logical? I hope it makes sense.
It should also make lag free players look like they move faster than lagged players by increasing the lag free players speed and animation when they travel from point A to B when the server updates their position to the lagged players instead of the lag free players suddenly jumping from point A to B. Another side effect is lag free players look like they shoot and turn faster to the lagged players.

What players experience:

Gameplay is kept smooth instead of freezing, jerkiness, sudden turn spins, players appearing suddenly, bullets firing fast but not hitting anything, players can accurately aim a little slower during combat with high numbers of players or constructs in the area.

Most players will probably never know that their ping spiked and they have been "lagged compensated" unless of course they really have a bad connection for a long time.

Finally, players won't have to rage so much about the lag anymore. ;)

Comments

  • ItharusItharus Join Date: 2010-07-16 Member: 72460Members
  • spellman23spellman23 NS1 Theorycraft Expert Join Date: 2007-05-17 Member: 60920Members
    ......

    I hate to sound pretentious, but.... um.... this is like netcode 101 and if it isn't in NS2 already they have failed as programmer, developers, and so on.

    Mind you not your exact implementation, but lag compensation and correction is basic stuff.
  • intellixintellix Join Date: 2008-03-24 Member: 63950Members
    Mmm, you've learnt net code and now you've got to tell the whole world and pretend that its no big deal by throwing aload of numbers at us like it's common sense and that anyone who doesn't understand it isn't as smart as you :P I know your kind! I get it on a daily basis in fact lol
  • RobBRobB TUBES OF THE INTERWEB Join Date: 2003-08-11 Member: 19423Members, Constellation, Reinforced - Shadow
    I allways hate lag compensation.
    Nothing is as disappointing as evading a volley of bullets by jumping around a corner - and still dieing.

    If you don't have broadband, annoy the people responsible. Not fellow players.
  • RuntehRunteh Join Date: 2010-06-26 Member: 72163Members, Reinforced - Shadow
    <!--quoteo(post=1814359:date=Dec 8 2010, 04:20 PM:name=RobB)--><div class='quotetop'>QUOTE (RobB @ Dec 8 2010, 04:20 PM) <a href="index.php?act=findpost&pid=1814359"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I allways hate lag compensation.
    Nothing is as disappointing as evading a volley of bullets by jumping around a corner - and still dieing.

    If you don't have broadband, annoy the people responsible. Not fellow players.<!--QuoteEnd--></div><!--QuoteEEnd-->

    The positives far outweigh the negatives. If anyone used to play quake on 56k, you had to lead targets. Not only that, but when you joined you had to fight for a bit to work out how much to lead the targets based upon the ping.

    Also, you had to lead further in front the quicker they were going.
  • McGlaspieMcGlaspie www.team156.com Join Date: 2010-07-26 Member: 73044Members, Super Administrators, Forum Admins, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Onos, WC 2013 - Gold, Subnautica Playtester
    The lag issues aren't related to the netcode (basically) of Spark. It's how efficiently the dedicated servers (both Lua and C code) are processing the "Game Loop". There are various aspects that the server can choke on right now. The obvious example is Sentries / Hydras. Long story short, the server is spending so much time processing certain things that it delays how often it sends data to each client. This results in the "lag" everyone is reporting. Typically, lag is due to how long (round trip) it takes a single packet to be sent to the server and in turn receive a response by a client.

    What this comes down to is the efficiency of the servers. They still need heavy optimization. Once that's done, I doubt people will be complaining about lag issues. I've played several games where I've had a 190-250 average ping and it was playable. The current Technical items on the Progress page will provide MUCH greater optimization to server performance than the OP's proposed idea. No need to reinvent the wheel here.
  • RobBRobB TUBES OF THE INTERWEB Join Date: 2003-08-11 Member: 19423Members, Constellation, Reinforced - Shadow
    so we get paralellization that late in the development process? that's not good imo.
Sign In or Register to comment.