Improve mouse delta input pipeline for higher resolution

I regret not doing this while I was still on client team, but I didn’t notice the problem at the time.

It would appear that mouse input is very low resolution as-is. GetMouseDelta() and the equivalent InputObj.Delta seem to go down to values of 0.5, but this still appears to correspond to whole-pixel increments at Roblox’s current render resolution. The result is that fine movements in a first-person setting are really choppy compared to games not made with Roblox.

I think it’s pretty obvious that this is why we don’t see a lot of successful FPS games on Roblox - it’s not a pleasant experience.

If I were the one to implement this, I would probably propose an extra API for it to not interfere with existing uses - something like Vector2 UserInputService:GetMouseDeltaRaw(). I understand that the implementation details might get messy, and I personally have no idea where you’d start for the Mac client. However, I did find this:

I don’t know what the input pipeline looks like these days (haven’t been there since Feb 2019) but I think it should be doable. I’d recommend the WM_INPUT method over DirectInput, personally.

The ultimate goal here is to have access to the highest resolution mouse motion data possible - I don’t really care if the API does some mapping to try to get it normalized across different hardware as long as the precision isn’t lost. This is really important to having successful first person experiences on Roblox.

9 Likes

In the interest of making Roblox a more fun place, I’m going to share some code I cobbled together that somewhat mitigates the issue, or at least makes it less noticeable.

local function mouseMovementCurve(x)
	local sign = math.sign(x)
	x = math.abs(x)
	
	local y = x
	if x < 1 then
		y = (x^3 - 2 * x^2 + x) * 0.3 + (-2 * x^3 + 3 * x^2) * 1 + (x^3 - x^2) * 1
	end
	return y * sign
end

Simply pass your mouse delta coordinates through this function. It’s somewhat sensitive to magnitude of the numbers - I’m multiplying the input from Roblox by 0.15 and treating the result as degrees of rotation.

Some diehard FPS players will probably complain about this, but it’s better than jerkiness.

3 Likes