Lack of responsiveness with the build-in mouse look in Ardor3D under Windows

Hi

I have rarely tested my game under Windows since my switch from JMonkeyEngine 2 to Ardor3D and as it was very slow until I added a performance test, I thought the lack of responsiveness came from the low frame rate. However, it still stutters now on a laptop Packard Bell MH36 under Windows 7 64 bits with Java 1.7. I use the latest aggregated build of JOGL 2.0.2 and NEWT. I notice some lag only under Windows when I use the mouse look even though the frame rate is correct (around 60 FPS). Using a mouse instead of the build-in touchpad doesn’t improve the situation. This bug is not reproducible on the same machine under Mageia Linux 2. I thought it came from NEWT, then I modified Jake 2 (Quake 2 Java port) in order to use the same version of JOGL and it worked correctly. When I run my game on an high end desktop computer under Windows 7, it works very well. I assume the problem comes neither from my hardware nor from NEWT but rather from Ardor3D. NEWT uses SetCursorPos under Windows and XWarpPointer under Linux. After some investigations, I have discovered that the method JoglNewtMouseWrapper.mouseMoved(MouseEvent) has a different behaviour under Linux and Windows:
https://github.com/gouessej/Ardor3D/blob/master/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java#L147

Under Windows (on my laptop), no event is properly ignored, it never goes to the line 170 whereas it does under Linux.

I know that there are more accurate options to handle relative mouse moves under Windows, for example Raw Input API and DirectInput, but it would require a lot of work, I would have to write a separate mouse wrapper based on JInput. Moreover, if it works with Jake 2 without JInput, there is probably something wrong in my code. I plan to use JInput or a similar API later only for controllers. I have tried to fix this bug for about 2 weeks without success, your help would be more than welcome. I know some of you already implemented similar features in other engines (cylab?), I would be glad to see your suggestions. You can test my game here. You can force the mouse pointer to stay visible by modifying this setting in the options. At first, can you tell me whether you reproduce this bug under Windows please? Best regards.

Hi

I confirm it works very well on the workstation HP Z220 under Windows 7 64 bits, Intel® Xeon® E3-1225v2, 4 GB RAM, Nvidia Quadro 600. I’m still investigating.

No idea why you are seeing mouse lag. It sounds like maybe it is a bug in JOGL? If you want to fix it there, you can possibly scavenge some input code from GLFW:


The source is quite nice and easy to read. They also have controller support. For desktop controllers another alternative to JInput is OIS:

libgdx has a wrapper for OIS, it could be extracted and used without libgdx. See the gdx-controllers extension:

That was one of my first suppositions but Jake 2 works very well on “my” laptop despite its use of JOGL 2.0.2, even with the very latest build.

Mario spoke about OIS to me some months ago, really nice job, it was a great source of inspiration for NEWT Controller API (I only wrote a draft for the moment). Thank you very much for your suggestions. I know that I will have to support HID devices as using absolute screen coordinates instead of relative raw data is a bit counter-intuitive for a typical first person mouse look.

I get this on my crappy laptop under Windows:
http://pastebin.java-gaming.org/be57d4a8659

I get this under Linux:
http://pastebin.java-gaming.org/e57da56895f

Hi

When I add tons of logs, the mouse look becomes less responsive under Linux too, I’ll try again with a lower resolution.

My younger brother gave me a laptop whose Windows install is half broken, some files are corrupted according to “sfc scannow” and they can’t be repaired (according to the CBS logs), one sector of the partition is “bad”, the file explorer can’t be opened from the shortcut of the task bar despite the correct path in the environment variable “windir”. I think that this Windows install is too crappy to draw any conclusion, SetCursorPos is extremely slow on it even in Jake 2, I notice that the mouse inputs sometimes block the keyboard inputs both in TUER and in Jake 2 only on this crappy machine. I’m not sure that the use of Raw Input API would solve the problem. I tried to reproduce this bug on some Windows machines without success. I can’t spend several weeks (months?) in adding support of this API into NEWT if I don’t know the root cause of this bug but HIDAPI, GLFW, JInput, OIS and LibGDX are great sources of inspirations and I will have to implement this feature later.

JMonkeyEngine 3 and Jake 2 are not concerned by this bug because their implementations of the mouse look use a fixed position when recentering the mouse cursor. This is a safer but more rigid approach. Ardor3D starts grabbing the mouse pointer from anywhere in the screen (you don’t have to set this position and you’re not forced to choose the middle of the screen) which is sometimes helpful in scientific visualization.

As a conclusion, I have to give up until I’m able to reproduce this bug in a “better” environment and I don’t really want to give some money to Microsoft. Maybe I’ll use ReactOS.