Git Product home page Git Product logo

Comments (4)

iradicus avatar iradicus commented on July 20, 2024 2

@ec- I only found an insta-unlagged server to try it on (in Germany), but with 150ms ping and auto-nudge 1 it felt like LAN game making rail shots no problem. I felt accuracy was better with auto-nudge on than off.

Since my original post I made some additional changes to the auto-nudge logic that I think make it more flexible.

  1. I made cl_autonudge a float (range 0 to 1.0) so it can be used as auto nudge factor of ping.
    So if you set cl_autonudge 0.333, and have avg ping of 150 then timenudge value becomes
    (150 * 0.333) =~ (50) * -1 = -50

  2. I changed the average ping calculation to use median average instead of mean average, due to cases of fluctuating ping with extreme highs and lows that could effect the average.

  3. I made CL_TimeNudge a function that returns either autoNudged value or cl_timeNudge depending on if autonudge is being used.

Here are the revised functions:

*
==================
CL_AvgPing
Calculates Average Ping from snapshots in buffer. Used by AutoNudge.
==================
*/
float CL_AvgPing( void ) {
	int ping[PACKET_BACKUP];
	int count = 0;
	int i, j, iTemp;
	float result;

	for ( i = 0; i < PACKET_BACKUP; i++ ) {
		if ( cl.snapshots[i].ping > 0 && cl.snapshots[i].ping < 999 ) {
			ping[count] = cl.snapshots[i].ping;
			count++;
		}
	}

	if ( count == 0 )
		return 0;

        // sort ping array
	for ( i = count - 1; i > 0; --i ) {
            for ( j = 0; j < i; ++j ) {
                if (ping[j] > ping[j + 1]) {
                    iTemp = ping[j];
                    ping[j] = ping[j + 1];
                    ping[j + 1] = iTemp;
                }
            }
      }

    // use median average ping
    if ( (count % 2) == 0 )
        result = (ping[count / 2] + ping[(count / 2) - 1]) / 2.0;
    else
	result = ping[count / 2];

	return result;
}


/*
==================
CL_TimeNudge
Returns either auto-nudge or cl_timeNudge value.
==================
*/
int CL_TimeNudge( void ) {
	float autoNudge = cl_autoNudge->value;

	if ( autoNudge != 0 )
		return (int)((CL_AvgPing() * autoNudge) + 0.5) * -1;
	else
		return cl_timeNudge->integer;
}

Then you just have to change one line of code in CL_SetCGameTime method:

// cl.serverTime = cls.realtime + cl.serverTimeDelta - cl_timeNudge->integer;
cl.serverTime = cls.realtime + cl.serverTimeDelta - CL_TimeNudge();

from quake3e.

ensiform avatar ensiform commented on July 20, 2024

While I'm sure many will like this, timenudge has a lot of placebo and lacking of empirical evidence that it does any good beside changing the ping number.

It does however have many caveats, including but not limited to prediction errors, and negative impact of timing delay vs the server.

from quake3e.

ec- avatar ec- commented on July 20, 2024

@iradicus how does it interacts with unlagged mods?

from quake3e.

ec- avatar ec- commented on July 20, 2024

Well, pretty much every improvement that increases FPS (for example) might be considered as unfair too so I don't see any problems here, it is a nice feature

from quake3e.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.