Author Topic: Quake 2 netcode and tick rate  (Read 7104 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: 341
    • 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: 1357
    • 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: 644
    • 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: 644
    • 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: 644
    • 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:

 

|iR|Focalor

April 18, 2024, 02:55:33 PM
Quake 2 needs some pubic hair!

Sgt. Dick

April 17, 2024, 08:44:00 PM
This place is not what it used to be, but It can still be amusing at times  :D
 

Costigan_Q2

April 02, 2024, 07:49:21 AM
Quake 2 needs a public square.
 

|iR|Focalor

April 02, 2024, 06:38:09 AM
Deflection.
 

-Unh0ly-

April 02, 2024, 04:32:51 AM
 

Costigan_Q2

April 02, 2024, 03:22:32 AM
And now, as usual, we finally get to this pathetic buffoon, once again, pettily grasping at straws for any desperate tiny false 'victory' it genuinely believes it can win.
 

|iR|Focalor

April 02, 2024, 02:18:27 AM
"I freely admit to my faults but this degenerate can't even recognise his nevermind admit them."

I asked you why, and you only responded with "everyone's a sinner." That's less "freely admitting your faults" and more of a minimization of them. Just saying.
 

Costigan_Q2

April 02, 2024, 01:51:31 AM
I freely admit to my faults but this degenerate can't even recognise his nevermind admit them. :)

He'll never learn, just like Beaver...
 

Costigan_Q2

April 02, 2024, 01:30:11 AM
Yes, everyone's a sinner.

Didn't you know?

They've only banned my Costigan identity accounts. :)
 

|iR|Focalor

April 02, 2024, 01:24:14 AM
"Trolls get banned, that's universal"

I forget, maybe you can help me out... Which one of us is banned from Tastyspleen discord again? And why?

Show 50 latest
Welcome, Guest. Please login or register.
April 19, 2024, 04:16:57 AM

Login with username, password and session length