Author Topic: Quake 2 netcode and tick rate  (Read 3247 times)

Offline silikone

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • Rated:
Quake 2 netcode and tick rate
« on: May 21, 2017, 05:05:47 AM »
It is to my understanding that Quake 2 servers run at a tick rate of 10Hz. Now, this is of course an old game designed to support 28.8k modems, but the original Quake ran at 20Hz by default, and Quakeworld could variably send updates independently to each player. With this in mind, isn't this a downgrade? Are there any benefits of this approach?
Most importantly, is it possible to increase this rate while maintaining compatibility with vanilla clients?
« Last Edit: May 21, 2017, 05:28:54 AM by silikone »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline R1CH

  • Sr. Member
  • ****
  • Posts: 340
    • View Profile
  • Rated:
Re: Quake 2 netcode and tick rate
« Reply #1 on: May 30, 2017, 08:11:02 AM »
There isn't a way to increase it in a compatible way. I added experimental tick rate scaling to R1Q2, it can be controlled via sv_fps on the server and both R1Q2 and Q2PRO clients support it. However the general feeling was that it changed gameplay too considerably, eg the chaingun becomes ridiculously powerful when there wasn't as much built in latency.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline QwazyWabbit

  • Carpal Tunnel Member
  • ******
  • Posts: 1275
    • View Profile
  • Rated:
Re: Quake 2 netcode and tick rate
« Reply #2 on: May 30, 2017, 01:14:16 PM »
Another complication occurs when you consider how many mods exist for which we no longer have source code. Most mods, I dare say virtually all mods, used a hard-coded constant FRAMETIME in g_local.h that defines the time the mod expects the tick rate to be. The mods would need to change this compile-time constant into a function that would get the frame time from the sv_fps variable. If you don't have the sources you'd have to hack the mods in very many places in the DLLs to handle this.

You can send data down the pipe more often but if the game isn't thinking faster you're only sending redundant data, smaller deltas or smaller packets. What's the point of sending 20 or 50 fps down the pipe when the game is only updating at 10 fps?
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline Jay Dolan

  • Swanky Member
  • *****
  • Posts: 641
    • View Profile
    • Quetoo.org
  • Rated:
Re: Quake 2 netcode and tick rate
« Reply #3 on: June 04, 2017, 06:54:00 AM »
The client has some issues with increasing the framerate as well. Namely:

 * Simulation time is hard-coded to 100ms frame interval, which influences model animations, particle trails, etc..
 * Stair prediction (interpolation) is also hard-coded to 100ms interval
 
Lastly, and probably the most harmful thing that I noticed in refactoring Quetoo to run at 40Hz, is that while the client will correctly parse all pending server packets at each client frame, it actually only _processes_ the most recently received server frame. At 10Hz, it's rare to receive multiple server frames in a single client frame, because most clients are running at 6x or 12.5x the server frame interval. It would only happen on choppy, poor-quality connections, which already yield a lossy experience anyway.

But at, say, 40Hz, with a 60Hz v-sync client, it happens all the time: a client frame will read two or more server frames from the network. What Quake2's client would do in this case, is basically drop the first server frame to the floor, doing nothing with it, and interpolating only the last received frame. This would result in missed animations, missed sounds, missed effects, etc.. It was actually really problematic, and took me a while to understand.

The solution I came up with for this is to ensure that every server frame is interpolated, even if its result doesn't make it to the screen. When parsing a new server frame, I check if the previously parsed frame has been interpolated. If it has not, I force a "lazy lerp" on it. This ensures that animation changes, entity events (landing sounds, footsteps, etc), ..never fall through the cracks:


https://github.com/jdolan/quetoo/blob/master/src/client/cl_entity.c#L242

Anyway, yea, there's really no way to change Quake2's tick rate without some serious surgery, and willingness to cut compatibility with binary-only mods.

Offline Irritant

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Alien Arena
  • Rated:
Re: Quake 2 netcode and tick rate
« Reply #4 on: July 11, 2017, 10:37:30 AM »
Jay that is really good info.  I refactored Alien Arena some time ago to allow for servers/clients to run anywhere from 10-120 fps tickrates, and did not know that about the netcode dropping frames.

I haven't noticed those issues with animations.  Not sure about the sounds, but I'm sure it will miss some given what you've said.  Will definitely look at this code.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline Jay Dolan

  • Swanky Member
  • *****
  • Posts: 641
    • View Profile
    • Quetoo.org
  • Rated:
Re: Quake 2 netcode and tick rate
« Reply #5 on: July 17, 2017, 09:39:14 AM »
You know what? I just checked the Quake2 source code, and Q2 at least handled entity events (footsteps, falling sounds, respawn, etc) correctly by dispatching CL_FireEntityEvents at the end of CL_ParseFrame. I must have moved that call to somewhere downstream over years of refactoring. Probably had something to do with introducing a client-game module (ala Quake3), or attempting to multithread the client.

 :oops:

There may be other instances that do still affect vanilla Quake2 as described above. I guess my only advice is to make sure your client correctly deals with ALL server frames, and not just the last one to arrive at any given client frame.   :beer:

Offline Irritant

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Alien Arena
  • Rated:
Re: Quake 2 netcode and tick rate
« Reply #6 on: November 21, 2017, 08:04:49 AM »
So Jay, here is what I've been seeing now that we have a bunch of servers out there running at 40hz:

For the most part, servers at 40hz run really well, I had no problems even at 120 ping on a server with 10-12 people, but this was an instagib match.  I didn't experience too many issues with regular DM either, all seemed good. 

Where I ran into problems was on a Chinese server at 250 ping, at 40hz I was getting a lot of hitches, and yellow bars on the netgraph.  At 10hz, it was smooth.  I'm thinking packets were coming in out of order, which I guess at that rate is more likely to happen with a connection on the other side of the world.  Either that or the server is using hamsters to power it's net connections(it was an Azure VM I had set up).
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline Jay Dolan

  • Swanky Member
  • *****
  • Posts: 641
    • View Profile
    • Quetoo.org
  • Rated:
Re: Quake 2 netcode and tick rate
« Reply #7 on: December 08, 2017, 12:00:59 PM »
Yea, I mean, it sounds like the connection you had to that server became saturated with the higher packet rate. A lousy connection would probably do better with fewer, fatter packets than with 4 times as many packets that are, individually, a little smaller. Might be interesting to fire up a Quake3 server (30Hz, I believe) to see how that performs over the same connection.

 

El Box de Shoutamente

Last 10 Shouts:

-Unh0ly-

March 24, 2020, 05:42:49 PM
TEXTURE PAK UPDATE!!!!!

http://unh0ly.wordpress.com

Punk_FAS

March 23, 2020, 06:07:31 PM
That sucks... maybe (probably) that same person that loves to join the DM server with his script/bot (was going by equate last I saw).
 

Admin

March 23, 2020, 02:12:22 PM
Yes it's a DoS attack
 

Admin

March 23, 2020, 02:06:20 PM
Might be a Denial of Service attack of some sort. Something is making the DM server take 100% CPU. (Will investigate when I can, at work right now.) Restarting DM server didn't help.
 

Admin

March 23, 2020, 02:00:18 PM
How strange.

Punk_FAS

March 23, 2020, 01:59:50 PM
netgraph looks pretty normal from what I can tell too. I've taken a number of screenshots with it up - not sure if that's helpful or not.

Punk_FAS

March 23, 2020, 01:59:15 PM
It looks like we're having a LAN party wherever the server is located. Pings are like in the low single digits for almost everyone. Even the people who normally ping in the upper 100s are showing pings of like 25ish. This is on DM anyway.
 

|iR|Focalor

March 23, 2020, 01:57:11 PM
only DM, vanilla and railz running smooth

Punk_FAS

March 23, 2020, 01:49:52 PM
I changed it to 1 - let's hope that resolves the issue I was noticing.

Thanks for the replies.

Punk_FAS

March 23, 2020, 01:49:18 PM
m_directinput - I had that at 2, which is supposedly only necessary for very slow PCs. I was noticing that sometimes my mouse movements seem to be too fast for my mouse's sensor.

Show 50 latest
Welcome, Guest. Please login or register.
March 29, 2020, 10:58:02 AM

Login with username, password and session length