When using com.jme.input.AbsoluteMouse with a setting setUsingDelta(true), then on low fps mouse looses responsiveness. You can see that something wrong at about 50 fps. At 10 fps, mouse starts moving really slow.
Here is a test to replicate the problem:
Press F to limit fps, press D to toggle mouse.isUsingDelta().
Notice that everything works fine with usingDelta = false on any fps. Notice how fast the mouse speed drops with usingDelta = true as fps becomes lowers.
mouse = new AbsoluteMouse("Test Mouse",
display.getRenderer().getWidth(),
display.getRenderer().getHeight());
mouse.setSpeed(sensitivity);
mouse.setUsingDelta(true);
mouse.registerWithInputHandler(input);
TextureState ts = display.getRenderer().createTextureState();
// replace null with something else if you want an actual cursor
ts.setTexture(TextureManager.loadTexture(null));
mouse.setRenderState(ts);
rootNode.attachChild(mouse);
Yeah, that's why it's not the same, because of this bug…
The test calculates speed dynamically based on the actual mouse motion.
And according to the test the speed is nearly the same at super-high fps (around 500 fps). Around 100 fps you can feel its lower when using delta. The problem is the mouse speed drops very noticeably when you are around 50-30 fps. Around 10-15 fps you can barely move the mouse.
On top of that the mouse movement becomes jerky when fps fluctuates, say 50 fps ±10.
The mouse moves have to become jerky, because so has the fps… also, I am not so much interested in your computation of the dynamic speed of the mouse as much of the perceived speed (I assume you are doing it the right way ;)).
Instead, just try to move the mouse at constant speed with your hand, and toggle the delta on/off while the fps are not being limited and you should sense the difference I talked about.
@duenez: I've run the test and hit D (toggle delta) while moving mouse smoothly across the screen. I don't see or fee any difference when the fps is not limited (at 500fps). Maybe it's the matter of faith
As for the mouse being jerky on jumping fps: it's a different kind of jerky alltogether (not beef). What happens is that mouse goes slower then faster when fps jumps hence making it hard to predict where the cursor will end up. Makes for a rather frustrating user experience. As opposed to constant speed mouse motion: even on low fps you know where the mouse is gonna go. I should write another test to demonstrate the effect of jumping fps… here is is:
Now, try moving your mouse around and tell me if you feel in control. Notice, the test doesn't touch the mouse settings, all it changes is fps. Hit D to switch to delta=false and notice how much better it is, even on jumping fps.
mouse = new AbsoluteMouse("Test Mouse",
display.getRenderer().getWidth(),
display.getRenderer().getHeight());
mouse.setSpeed(sensitivity);
mouse.setUsingDelta(true);
mouse.registerWithInputHandler(input);
TextureState ts = display.getRenderer().createTextureState();
// replace null with something else if you want an actual cursor
ts.setTexture(TextureManager.loadTexture(null));
mouse.setRenderState(ts);
rootNode.attachChild(mouse);
sb.delete(0, sb.length());
sb.append("J for jumping fps, D to toggles delta (now=");
sb.append(mouse.isUsingDelta());
sb.append("), F to limit fps (sleep=");
sb.append(sleep);
sb.append("ms).");
infoTest.print(sb);
My guess would be that some deltas are missed on low fps. But with your tests I cannot reproduce the behavior you described. It feels alright for any fps (even jumpy) - no difference between with and without using delta. Even the calculated mouse speed it always ~1.5
That does the trick! It steel doesn't feel as good as when not using delta (by now its probably a personal impression rather than an observed fact), but infinitely better.
This behavior must only manifest on my system… maybe it affects more Linux machines?
I've measured the total distance traveled for absolute mouse and mouse input. The absolute mouse starts at the edge of the screen, and doesnt report changes, so initially they start off differently. Also i keep moving mouse far away from the edge as any delta over the edge will not translate into mouse motion and will not be added to the distance traveled for the absolute mouse. The test prints the total distance traveled every 5 seconds.
Here is what I get after your patch (on jumping fps simulation):
Well if that patch hurts nobody and it's important for you I can commit it. But as you suggested we should do more testing before that, as I cannot reproduce the problem over here (neither windows nor linux) - maybe it's the mouse hardware?
I can do more testing on windows to exclude the hardware possibility and narrow down the range or system this may affect. However my windows is essentially blank, so I need to know whether the testing with the latest jme release will suffice or I absolutely must test the cvs version.
I have used current jme from CVS folder (without your patch, that was triple-checked) and retested for this bug on Windows using the same machine. AbsoluteMouse worked fine.
So this bug is not hardware related and occurs on some (or all) Linux systems.