Jump to content

Arena Breakout: Infinite

Hipfire is added, aims coming soon!
Read more...

Project L33T

See the game notes for instructions on how to disable smoothing.
Read more...

Twilight Town: A Cyberpunk FPS

Just added.
Read more...

Contain

See the game notes for instructions on how to disable smoothing.
Read more...

Vomitoreum

Just added.
Read more...

Unreal Engine 4 Editor


DPI Wizard
Default sensitivity for the Unreal Engine 4 Editor added!

User Feedback

Recommended Comments

  • Wizard
19 minutes ago, TheNoobPolice said:

Have you been able to decipher why so many games drop packets above 500hz with this engine? 

Yeah, it's the smoothing function that many devs leave on because it is on by default. In most cases it only affects 1000Hz, but in some cases also 500Hz and even 250Hz.

image.png

I haven't invested any effort into deciphering exactly what it does, but what I could find in the documentation is this:

Quote

And tick time is described as

Quote

Which might also explain why some UE4 games have the sensitivity directly tied to the FPS.

It's a horrible function and a mystery to me why it exist today, let alone being on by default. Mouse smoothing is an artifact from the past to try to fix issues with ball mouse. It solves nothing on modern computers, it only causes a bad user experience.

Link to comment

Does seem strange why such a modern engine has chosen such antiquated defaults. I can only imagine they expect devs to be more interested in having a perfectly smooth camera presentation in all circumstances as more paramount than mouse input accuracy.

Link to comment
On 4/1/2021 at 6:30 PM, DPI Wizard said:

I haven't invested any effort into deciphering exactly what it does, but what I could find in the documentation is this:

here is the function for mouse smoothing:

 

aMouse = raw mouse input

DeltaTime = real world time between previous and current tick (seconds)

TimeDilation = in game time between previous and current tick (seconds)

SampleCount = number of samples between previous and current tick (seconds/sample)

 

void UPlayerInput::ClearSmoothing()
{
	for ( int32 i=0; i<2; i++ )
	{
		ZeroTime[i] = 0.f;
		SmoothedMouse[i] = 0.f;
	}

	const UPlayerInput* DefaultPlayerInput = GetDefault<UPlayerInput>();

   	MouseSamplingTotal = DefaultPlayerInput->MouseSamplingTotal;
	MouseSamples = DefaultPlayerInput->MouseSamples;
}


float UPlayerInput::SmoothMouse(float aMouse, uint8& SampleCount, int32 Index)
{
	check(Index >= 0);
	check(Index < UE_ARRAY_COUNT(ZeroTime));

	UWorld* World = GetWorld();
	if (World)
	{
		check(World->GetWorldSettings());
		const float EffectiveTimeDilation = World->GetWorldSettings()->GetEffectiveTimeDilation();
		if (EffectiveTimeDilation != LastTimeDilation)
		{
			LastTimeDilation = EffectiveTimeDilation;
			ClearSmoothing();
		}
	}

	const float DeltaTime = FApp::GetDeltaTime();

	if (DeltaTime < 0.25f)
	{
		check(MouseSamples > 0);

		// this is seconds/sample
		const float MouseSamplingTime = MouseSamplingTotal/MouseSamples;
		check(MouseSamplingTime > 0.0f);

		if ( aMouse == 0 )
		{
			// no mouse movement received
			ZeroTime[Index] += DeltaTime;		// increment length of time we've been at zero
			if ( ZeroTime[Index] < MouseSamplingTime )
			{
				// zero mouse movement is possibly because less than the mouse sampling interval has passed
				aMouse = SmoothedMouse[Index] * DeltaTime/MouseSamplingTime;
			}
			else
			{
				SmoothedMouse[Index] = 0;
			}
		}
		else
		{
			ZeroTime[Index] = 0;
			if ( SmoothedMouse[Index] != 0 )
			{
				// this isn't the first tick with non-zero mouse movement
				if ( DeltaTime < MouseSamplingTime * (SampleCount + 1) )
				{
					check(SampleCount > 0);

					// smooth mouse movement so samples/tick is constant
					aMouse = aMouse * DeltaTime/(MouseSamplingTime * SampleCount);
				}
				else
				{
					// fewer samples, so going slow
					// use number of samples we should have had for sample count
					SampleCount = DeltaTime/MouseSamplingTime;
				}
			}

			check(SampleCount >= 0);
			if (SampleCount == 0)
			{
				SmoothedMouse[Index] = 0;
			}
			else
			{
				SmoothedMouse[Index] = aMouse/SampleCount;
			}
		}
	}
	else
	{
		// if we had an abnormally long frame, clear everything so it doesn't distort the results
		ClearSmoothing();
	}

	SampleCount = 0;

	return aMouse;
}

 

Link to comment
On 4/1/2021 at 6:30 PM, DPI Wizard said:

I haven't invested any effort into deciphering exactly what it does, but what I could find in the documentation is this:

here is the function for mouse smoothing:

https://pastebin.com/LUSnPfat

 

aMouse = raw mouse input

DeltaTime = real world time between previous and current tick (seconds)

TimeDilation = in game time between previous and current tick (seconds)

SampleCount = number of samples between previous and current tick (seconds/sample)

 

Just looking at this function, it shouldn't cause any problems, but there is one possibility. They added a framerate check at the beginning to see if the user's framerate drops below 4fps. If this check fails, it stops the smoothing "so it doesn't distort the results". It could be possible that the framerate drops and distorts the results but doesnt trigger the 4fps check. So like, it could drop to 5 fps and smoothing would not get disabled.

I think the real culprit here is "Smooth Framerate" which is also in project settings but is not on by default. I'm guessing some developers turn it on while others dont and this somehow messes up the DeltaTime calculations, which this whole function is based on.

I'm going to mess with all the settings and try to reproduce this problem. If i'm able to reproduce it, I could submit this as a bug report and it would almost certainly get fixed at some point, theyre really good about fixing bugs.

For any UE4 developers that see this, I made a blueprint script that lets players enter their desired inches/360 and DPI, and gives them their sensitivity:

https://blueprintue.com/blueprint/tqbz02_t/

Link to comment
  • Wizard
3 hours ago, Wheaks said:

@DPI Wizard May I know what exactly FOVScaling and FOVScale's value does?

It's a multiplier to the FOV.

3 hours ago, Wheaks said:

Also, why does the fov rounds up to 120.691597 after I entered 120.691596?

In the calculator? Can you share a link?

Link to comment
1 hour ago, DPI Wizard said:

It's a multiplier to the FOV.

I mean how does the multiplier works? What happens if I uncheck FOVScaling? What's the difference between... let's say 0.1 and 0.2 of FOVScale value?

1 hour ago, DPI Wizard said:

In the calculator? Can you share a link?

In ue4 not the calculator

Link to comment

If I changed the fov scaling to hor+ instead of ver-(original), Do I have to change the fov type in the calculator too? If yes, which one?

Link to comment

As a UE5 Dev, I just wanted to thank everyone in this thread for the help. I was having trouble with my sensitivity values, turned out mouse smoothing and FOV scaling were the culprits.

Link to comment


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...