Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Lack of responsiveness with the build-in mouse look in Ardor3D under Windows  (Read 968 times)
0 Members and 1 Guest are viewing this topic.
Offline gouessej
« Posted 2013-05-12 19:31:12 »

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.

Offline gouessej
« Reply #1 - Posted 2013-05-14 11:24:38 »

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.

Offline Nate

« JGO Bitwise Duke »


Medals: 158
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #2 - Posted 2013-05-14 19:30:07 »

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:
https://github.com/glfw/glfw/tree/master/src
The source is quite nice and easy to read. They also have controller support. For desktop controllers another alternative to JInput is OIS:
http://sourceforge.net/projects/wgois/
libgdx has a wrapper for OIS, it could be extracted and used without libgdx. See the gdx-controllers extension:
https://github.com/libgdx/libgdx/tree/master/extensions/gdx-controllers/gdx-controllers-desktop

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #3 - Posted 2013-05-15 10:25:40 »

No idea why you are seeing mouse lag. It sounds like maybe it is a bug in JOGL?
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.

If you want to fix it there, you can possibly scavenge some input code from GLFW:
https://github.com/glfw/glfw/tree/master/src
The source is quite nice and easy to read. They also have controller support. For desktop controllers another alternative to JInput is OIS:
http://sourceforge.net/projects/wgois/
libgdx has a wrapper for OIS, it could be extracted and used without libgdx. See the gdx-controllers extension:
https://github.com/libgdx/libgdx/tree/master/extensions/gdx-controllers/gdx-controllers-desktop
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.

Offline gouessej
« Reply #4 - Posted 2013-05-15 22:18:39 »

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

Offline gouessej
« Reply #5 - Posted 2013-05-16 12:04:04 »

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.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (49 views)
2014-12-09 22:41:13

BurntPizza (83 views)
2014-12-08 04:46:31

JscottyBieshaar (44 views)
2014-12-05 12:39:02

SHC (58 views)
2014-12-03 16:27:13

CopyableCougar4 (56 views)
2014-11-29 21:32:03

toopeicgaming1999 (122 views)
2014-11-26 15:22:04

toopeicgaming1999 (112 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!