moonlight-stream / moonlight-android

GameStream client for Android
GNU General Public License v3.0
4.29k stars 681 forks source link

[Issue]: Brutal mouse latency #1245

Open Chacal1988 opened 1 year ago

Chacal1988 commented 1 year ago

Describe the bug

Mouse latency its about 100-120ms laggy wich makes any game unplayable, only maybe desktop use is tolerable. I´ve tryed everything but nothing fixes this problem. Maybe using the Android cursor is could be a solution. At least fow desktop usage and real time strategy games. I can make the Android cursor apear by windowing the Moonlight app on my tablet with Android 13. That mitigates the latency but makes the screen so small that is useless.

Steps to reproduce

ALways

Affected games

All

Other Moonlight clients

PC

Moonlight adjusted settings

Yes

Moonlight adjusted settings (please complete the following information)

Non

Moonlight default settings

Yes

Gamepad-related connection issue

Yes

Gamepad-related input issue

Yes

Gamepad-related streaming issue

Yes

Android version

13

Device model

Lenovo Tab 13

Server PC OS version

Win 10

Server PC GeForce Experience version

Last

Server PC Nvidia GPU driver version

Last

Server PC antivirus and firewall software

Windows

Screenshots

No response

Relevant log output

No response

Additional context

No response

cgutman commented 1 year ago

That's terrible latency. Can you enable the performance overlay and see what decoding time is? Is the issue limited to only mouse input or does it also affect gamepad input?

Can you compare with the host display to see if the latency is the mouse input going from the client to the host or the video going from the host to the client?

Chacal1988 commented 1 year ago

@cgutman Excelent questions, ill answer them: Decoding timen is super low (less than 5ms always). Issue is related to mouse only, everything else is ultra fast. Host display is laggy too, and if i move the USB mouse from the host computer i can see the movement instantly happening in the Android 13 tablet client with less than 30ms. (I can perfectly measure the input lag by filming the screen and the physical mouse at the same time with 240fps camera and checking the time distance between the mouse movement and the cursor response on the screens).

Chacal1988 commented 1 year ago

@cgutman i have a phone with Android 12 too, and mouse latency is exactly the same. Network and decoding speeds are super fast! Less than 5ms both

Chacal1988 commented 1 year ago

@cgutman i will try to explain better: Lag is only happening when i move the mouse in the client android device. Everithing else like video transmision, decoding times, network times, and gamepad input is ultra fast!

hoonlight commented 1 year ago

Do you use a wireless mouse? Bluetooth or wifi?

Chacal1988 commented 1 year ago

@archive-r i try all. Wifi, bt, and usb. And multiple brands too. Gaming mouses and standar mouses. Bt mouses have some extra 10ms latency but all mouses are above 100ms.

Chacal1988 commented 1 year ago

Latency is very reduce when using Nvidia software in the server windows PC. Latency is brutal only when using Sunshine. I try touching every option, every config, but no luck. Using Sunshine always add brutal mouse latency no matter what i do, what client, or Android version, or server or software, it just adds a lot of latency.

cgutman commented 1 year ago

What version of Sunshine are you using? The nightly build has some input batching code that's not present in v0.20.

sambuev commented 7 months ago

Please help me too, I run Sunshine on my PC and Moonlight on my Android Tablet with mouse and keyboard, it works perfectly with Parsec, but with Moonlight the delay is huge and very significant, I looking for solution, I remember I tested moonlight back in 2022 and now it's 2024 and the issue is still here. I feel so bad. Test it on your Android and you'll see the issue with mouse.

Chacal1988 commented 7 months ago

Please help me too, I run Sunshine on my PC and Moonlight on my Android Tablet with mouse and keyboard, it works perfectly with Parsec, but with Moonlight the delay is huge and very significant, I looking for solution, I remember I tested moonlight back in 2022 and now it's 2024 and the issue is still here. I feel so bad. Test it on your Android and you'll see the issue with mouse.

There is no fix for that. Sorry :(

sambuev commented 7 months ago

I actually found solution: Ctrl+Alt+Shift+C - makes my mouse visible. and Ctrl+Alt+Shift+N hides the remote-mouse.

Works perfectly for me on Android Client and I read it also works for PC client.

angieEncoded commented 6 months ago

Well, that masks the problem. It does 'work' in that it tricks our brains, but behind the scenes the lag still exists.

It's very strange that it's only present with mouse input - bluetooth gamepad has no noticeable lag. Very responsive. For now I have been using the workaround on my portable setup. Samsung S9 Ultra running Android 14 and OneUI 6.1. The mouse and keyboard combo I am using is the ProtoArc XKM01. The gamepad is an 8bitdo 80DB. The PC running Sunshine is a Windows 10 desktop host and it is running Sunshine version: v0.23.1 which is the latest as of this post.

No lag with keyboard, no lag with gamepad, only a problem with the mouse.

I'm happy to provide any other details, logs, etc. Anything that might help. Thanks.

pranil60 commented 4 months ago

After trying everything. I just changed USB port of my pc mouse. Solved the stutter issue

appleseedexm commented 4 months ago

After trying everything. I just changed USB port of my pc mouse. Solved the stutter issue

I'll try this later, but did this solve general stutter, or did this fix stutter that was only in moonlight? And I assume you changed the mouse port on the client, not the host?

I dont have such huge numbers like OP, but I'd estimate somewhere around 50ms, which is still very noticeable and would not work for some games.

pranil60 commented 4 months ago

After trying everything. I just changed USB port of my pc mouse. Solved the stutter issue

I'll try this later, but did this solve general stutter, or did this fix stutter that was only in moonlight? And I assume you changed the mouse port on the client, not the host?

I dont have such huge numbers like OP, but I'd estimate somewhere around 50ms, which is still very noticeable and would not work for some games.

Well obviously host.. And my problem was not lag. I am using moonlight in android to stream games from pc usung nvidia gamestream. Actual problem was whenever I try to move mouse it was so stuttery, for small movement mouse moved from one point to other after half second and when I tried circular movememts at normal speed, it took 1 second and with stutter like you see in ninja movies. Problem was not only limited upto mouse only but playing with controller, we have to use different buttons alternatively, and while doing that it did the stutters in games and delays but not as frequently as it did in case of mouse. So specificly it was Stutter+Latency issue overall.

pranil60 commented 4 months ago

Also changing and removing different USB devices in client could help.

ClassicOldSong commented 4 months ago

For anyone who is experiencing mouse stuttering issue, you try my fork that may have solved the issue: https://github.com/ClassicOldSong/moonlight-android/releases

Uncheck Enable battery status report for gamepad in the settings.

pranil60 commented 4 months ago

I tried your application, it actually allows some useful modifications but I would like to suggest you to give option to use default keyboard or add features in your keyboard, like sometimes using device with one hand, I'm unable to use multiple keys like Ctrl+Z. Wherein my default keyboard I touch and hold 1 key then release it so that key don't has to be hold with finger and then I press second key of the purpose. For example when I have to press ctrl+z, firstly I touch and hold ctrl then after vibration feedback it remains held even after release then I click Z. Like that.

On Wed, 17 Jul, 2024, 15:42 Yukino Song, @.***> wrote:

For anyone who is experiencing mouse stuttering issue, you try my fork that may have solved the issue: https://github.com/ClassicOldSong/moonlight-android/releases

Uncheck Enable battery status report for gamepad in the settings.

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2232943282, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR556A26IMKOKYA537GDZMY7QDAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZSHE2DGMRYGI . You are receiving this because you commented.Message ID: @.***>

ClassicOldSong commented 4 months ago

The on screen keyboard is not implemented by me. I started this fork for solving issues I have met, including track pad support and the stuttering fix. I might completely rewrite the on screen keyboard if I have enough motivation for that since I use a physical keyboard connected to my tablet to type. I'm looking into the fps limit issue right now, might have a look at the keyboard later.

IIRC you still can toggle the default virtual keyboard in the game back menu.

ClassicOldSong commented 4 months ago

@pranil60 I've just released a new version. The sticky modifier keys are now implemented.

pranil60 commented 4 months ago

@pranil60 I've just released a new version. The sticky modifier keys are now implemented.

Great

ClassicOldSong commented 4 months ago

Oh, you have to use the latest latest version I just released(with hotfix), there was a typo that prevented the option to disable battery status report from functioning...

pranil60 commented 4 months ago

I'm very glad to see mod of moonlight. Thanks for meeting me. I know developing the software is very hard. But I want to request you something and it's not mandatory. A useful is there in your application and that is portrait mod, but what happens in it that when I turn on the portrait mod, instead of cropping put required part of the display, landscaped view of the same is strected out vertically to the aspect ratio of phone screen. So if there is mod to crop the required area of the display from landscape to portrait it will be very useful. I have researched online bit there aren't any software that let you crop and customize viewing display of windows and even if there are some games don't allow it. So it would be helpful if we can customize the useful display for many applications and windows, to zoom, crop and etc.

On Thu, 18 Jul, 2024, 16:57 Yukino Song, @.***> wrote:

@pranil60 https://github.com/pranil60 I've just released a new version. The sticky modifier keys are now implemented.

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2236266727, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR53DFPJNKJDWH6QC3YTZM6RCXAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZWGI3DMNZSG4 . You are receiving this because you were mentioned.Message ID: @.***>

ClassicOldSong commented 4 months ago

You'll need to enter the inverted width and height by using the "manual resolution" option if you want to keep the original aspect ratio for video stream. Portrait mode should be used with screen rotation option on the host or with Widecar.

pranil60 commented 4 months ago

tried but not success

On Thu, 18 Jul, 2024, 18:20 Yukino Song, @.***> wrote:

You'll need to enter the inverted width and height by using the "manual resolution" option if you want to keep the original aspect ratio for video stream. Portrait mode should be used with screen rotation option on the host or with Widecar https://github.com/ClassicOldSong/Widecar.

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2236417205, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR5YRQDU3XSSNCWJEUCLZM6227AVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZWGQYTOMRQGU . You are receiving this because you were mentioned.Message ID: @.***>

pranil60 commented 4 months ago

at this point only developer means you are the hope.

On Thu, 18 Jul, 2024, 18:20 Yukino Song, @.***> wrote:

You'll need to enter the inverted width and height by using the "manual resolution" option if you want to keep the original aspect ratio for video stream. Portrait mode should be used with screen rotation option on the host or with Widecar https://github.com/ClassicOldSong/Widecar.

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2236417205, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR5YRQDU3XSSNCWJEUCLZM6227AVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZWGQYTOMRQGU . You are receiving this because you were mentioned.Message ID: @.***>

ClassicOldSong commented 4 months ago

@pranil60 Would you please try the latest version?

I'm not sure what you want but I find it might suit your need, and it's a useful feature to have, so here it is: https://github.com/ClassicOldSong/moonlight-android/releases/tag/v12.1-noir-240721

pranil60 commented 4 months ago

Definition of display according to me: All the usable area that we see on the physical monitor.

I think we are very close.. I attached the Fit mode SS of portrait mode. What happens here display area does crop out little bit to make it look more zoomed in than it does in Fill mode.. The only thing is, it should've cropped out the landscape upto the whole screen, like there shouldn't be black bars left at top and bottom of the picture and image area should be fitted upto whole verticle screen of the phone.

Like if it had done, the area at the middle, in my case dragon would've cropped upto all screen and it had also cropped most of the horizontal usable area. For comprehension look at the second image.

Also cherry on top would be adjustable feature that will enable to pan remaning area by panning horizontally to get acceas to other part of the display.

On Sun, 21 Jul, 2024, 00:45 Yukino Song, @.***> wrote:

@pranil60 https://github.com/pranil60 Would you please try the latest version?

I'm not sure what you want but I find it might suit your need, and it's a useful feature to have, so here it is: https://github.com/ClassicOldSong/moonlight-android/releases/tag/v12.1-noir-240721

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2241266046, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR5YK3VSX2YHXGHP2PQLZNKZNHAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGI3DMMBUGY . You are receiving this because you were mentioned.Message ID: @.***>

pranil60 commented 4 months ago

fill mode works perfectly on landscape mode in app btw

On Sun, 21 Jul, 2024, 02:22 Brother Nero, @.***> wrote:

Definition of display according to me: All the usable area that we see on the physical monitor.

I think we are very close.. I attached the Fit mode SS of portrait mode. What happens here display area does crop out little bit to make it look more zoomed in than it does in Fill mode.. The only thing is, it should've cropped out the landscape upto the whole screen, like there shouldn't be black bars left at top and bottom of the picture and image area should be fitted upto whole verticle screen of the phone.

Like if it had done, the area at the middle, in my case dragon would've cropped upto all screen and it had also cropped most of the horizontal usable area. For comprehension look at the second image.

Also cherry on top would be adjustable feature that will enable to pan remaning area by panning horizontally to get acceas to other part of the display.

On Sun, 21 Jul, 2024, 00:45 Yukino Song, @.***> wrote:

@pranil60 https://github.com/pranil60 Would you please try the latest version?

I'm not sure what you want but I find it might suit your need, and it's a useful feature to have, so here it is: https://github.com/ClassicOldSong/moonlight-android/releases/tag/v12.1-noir-240721

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2241266046, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR5YK3VSX2YHXGHP2PQLZNKZNHAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGI3DMMBUGY . You are receiving this because you were mentioned.Message ID: @.***>

ClassicOldSong commented 4 months ago

You need to enter your monitor's resolution in reverse like 1080x1920 for 1920x1080 to be used in portrait mode

pranil60 commented 4 months ago

did that

On Sun, 21 Jul, 2024, 02:42 Yukino Song, @.***> wrote:

You need to enter your monitor's resolution in reverse like 1080x1920 for 1920x1080 to be used in portrait mode

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2241295620, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR54IHJH43WDI2GGUCX3ZNLHCLAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGI4TKNRSGA . You are receiving this because you were mentioned.Message ID: @.***>

ClassicOldSong commented 4 months ago

Panning and zooming is available by disabling touchscreen mouse emulation.

ClassicOldSong commented 4 months ago

did that

Then there should be no more black bars unless you're using a phone with a notch.

You have to activate the resolution you entered by exiting the settings and entering again, then select the resolution you entered from the resolution list.

pranil60 commented 4 months ago

I said I tried changing portrait mode and scale mode, also set my device's resolution. But still it appeared same.

On Sun, 21 Jul, 2024, 05:58 Yukino Song, @.***> wrote:

did that

Then there should be no more black bars unless you're using a phone with a notch.

You have to activate the resolution you entered by exiting the settings and entering again, then select the resolution you entered from the resolution list.

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2241350831, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR54S62GAYQ5Y3Y47QULZNL6EDAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGM2TAOBTGE . You are receiving this because you were mentioned.Message ID: @.***>

pranil60 commented 4 months ago

Actually changing the video resolution to Native worked for me. I get what you were trying to say

On Sun, 21 Jul, 2024, 12:47 Brother Nero, @.***> wrote:

I said I tried changing portrait mode and scale mode, also set my device's resolution. But still it appeared same.

On Sun, 21 Jul, 2024, 05:58 Yukino Song, @.***> wrote:

did that

Then there should be no more black bars unless you're using a phone with a notch.

You have to activate the resolution you entered by exiting the settings and entering again, then select the resolution you entered from the resolution list.

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2241350831, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR54S62GAYQ5Y3Y47QULZNL6EDAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGM2TAOBTGE . You are receiving this because you were mentioned.Message ID: @.***>

pranil60 commented 4 months ago

BTW, Panning works only with pan mode, but then, mouse functions doesn't work like right click, left click. I have to go back and change mouse settings alternatively for panning and other functions. It would be convenient if you add controller's floating button like that on gamepad for panning so we can use any of mouse mode with panning function still enabled simultaneously.

On Sun, 21 Jul, 2024, 05:58 Yukino Song, @.***> wrote:

did that

Then there should be no more black bars unless you're using a phone with a notch.

You have to activate the resolution you entered by exiting the settings and entering again, then select the resolution you entered from the resolution list.

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2241350831, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR54S62GAYQ5Y3Y47QULZNL6EDAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGM2TAOBTGE . You are receiving this because you were mentioned.Message ID: @.***>

pranil60 commented 4 months ago

I'm experiencing lag with your version. Slow Connection dialogue while playing

On Sun, 21 Jul, 2024, 12:58 Brother Nero, @.***> wrote:

BTW, Panning works only with pan mode, but then, mouse functions doesn't work like right click, left click. I have to go back and change mouse settings alternatively for panning and other functions. It would be convenient if you add controller's floating button like that on gamepad for panning so we can use any of mouse mode with panning function still enabled simultaneously.

On Sun, 21 Jul, 2024, 05:58 Yukino Song, @.***> wrote:

did that

Then there should be no more black bars unless you're using a phone with a notch.

You have to activate the resolution you entered by exiting the settings and entering again, then select the resolution you entered from the resolution list.

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2241350831, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR54S62GAYQ5Y3Y47QULZNL6EDAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGM2TAOBTGE . You are receiving this because you were mentioned.Message ID: @.***>

pranil60 commented 4 months ago

Whenever I install your app, slow connection and stutter issue start both in stock moonlight and your app. When I uninstall yours stock version works butter smooth. I tried uninstalling stock moonlight when moonlight noir is installed but no. I thinks theres some problem

On Mon, 22 Jul, 2024, 01:11 Brother Nero, @.***> wrote:

I'm experiencing lag with your version. Slow Connection dialogue while playing

On Sun, 21 Jul, 2024, 12:58 Brother Nero, @.***> wrote:

BTW, Panning works only with pan mode, but then, mouse functions doesn't work like right click, left click. I have to go back and change mouse settings alternatively for panning and other functions. It would be convenient if you add controller's floating button like that on gamepad for panning so we can use any of mouse mode with panning function still enabled simultaneously.

On Sun, 21 Jul, 2024, 05:58 Yukino Song, @.***> wrote:

did that

Then there should be no more black bars unless you're using a phone with a notch.

You have to activate the resolution you entered by exiting the settings and entering again, then select the resolution you entered from the resolution list.

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2241350831, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR54S62GAYQ5Y3Y47QULZNL6EDAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGM2TAOBTGE . You are receiving this because you were mentioned.Message ID: @.***>

ClassicOldSong commented 4 months ago

That couldn't be happening.

I think your device might be a little bit old...

pranil60 commented 4 months ago

I'm using galaxy S23. And PC is GTX 1080 and I5 9th gen. I temporarily solved issue by just uninstalling moonlight stock version and restarting the phone.

On Mon, 22 Jul, 2024, 10:13 Yukino Song, @.***> wrote:

That couldn't be happening.

I think your device might be a little bit old...

— Reply to this email directly, view it on GitHub https://github.com/moonlight-stream/moonlight-android/issues/1245#issuecomment-2242076644, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ3LR56OK27C5OLO7QYXWC3ZNSEYNAVCNFSM6AAAAAA4KPDVQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBSGA3TMNRUGQ . You are receiving this because you were mentioned.Message ID: @.***>