Opened 7 years ago

Closed 7 years ago

#9876 closed defect (fixed)

TITANIC: Slowness of mouse cursor

Reported by: dreammaster Owned by: dreammaster
Priority: normal Component: Engine: Titanic
Version: Keywords:
Cc: Game: Starship Titanic

Description

The mouse cursor in game seems to lag by 300-500ms...meaning if you want to travel somewhere you have to briefly wait for the in-game cursor to catch up and change accordingly, otherwise the game registers a "mis-click". This delay is doubled or even trebled when dragging items around...ESPECIALLY the parrot - it took me almost 10 seconds to drag him down to the inventory.

Change History (13)

comment:1 by dafioram, 7 years ago

I did not experience any mouse lag on my playthrough.

ScummVM: 1.10.0git-3571-gd5ebd9a 64bit
Game: Starship Titanic, GOG (1.00.42c), Windows/English
Tester OS: Win7-64

comment:2 by hamakei, 7 years ago

I've recorded an example of what I mean...in the parrot room because it's particularly bad there. This may suggest it's something to do with the animation of the mouse cursor, as when you pick the parrot up the cursor becomes very large and complicated compared to the regular one.

https://ln.sync.com/dl/1c01f05f0/ig2wknmy-v6r9inwz-y4gwuyim-dvdeqktf

All I do is move the mouse over the parrot, hold the button down, drag him to the top left of the window, then straight back to the centre. This should take less than 5 seconds under normal circumstances, but here it takes almost 30 seconds. As you can see, it takes almost 7 seconds before the cursor even changes.

For consistency, I used the same build that dafioram did:

ScummVM: 1.10.0git-3571-gd5ebd9a 64bit
Game: Starship Titanic, Windows/English
Tester OS: Ubuntu Linux

comment:3 by dafioram, 7 years ago

hamakei,

That slowness was noticable on your video. Can check if this is present on the latest build? What you're experiencing may be a linux specific thing. They have done some optimization on the code so that the mouse slowness may have been fixed.

comment:4 by dreammaster, 7 years ago

I too just double checked, and I'm not noticing any significant slowdown either. As dafioram suggested, if you could double-check with the latest build. If it still persists, maybe someone in the #scummvm Freenode IRC channel may be able to suggest a profiling tool to find out where the slowness is happening, and I could look further into whether any optimizations are feasible.

comment:5 by dreammaster, 7 years ago

Owner: set to dreammaster
Resolution: worksforme
Status: newpending

comment:6 by dafioram, 7 years ago

I am able to reproduce this on my Ubuntu 16.04 laptop. It is a low-end laptop. This is especially noticeable when grabbing the parrot at which time my cpu is at 100%. I am seeing large latencies, but not low frame rates. So the animations look fine, but there is a lag between my clicks.

The actual mouse cursor moves as you would expect it, but when you move it to the right to turn right it will still be pointing forward from which you just drag the cursor.

I even compiled 6278aa250a1c65ab035e453d67340ac5a699d6df with optimizations on and it was about the same. My laptop cpi is a dual core 1.3MHz, and the gpu is integrated.

comment:7 by bgK, 7 years ago

This is likely due to how events are handled in the engine. The main loop handles one event, then waits for 10ms and handles the next one, ect. If the operating system sends more than one event per 10 ms there will be latency.

comment:8 by hamakei, 7 years ago

Confirm it's still there in the latest (July 17th) build.

When waving the mouse around "empty" there is a very, very slight delay...almost unnoticeable. If you throw the mouse around very quickly, then as dafioram mentioned, you can end up in a situation where the pointer image doesn't match what it should be based on it's location on-screen.

If you pick up and drag an object, then the delay is obvious....like some weird version of mouse acceleration where everything is a second or two behind.

But the parrot....that adds 15-20 seconds to my movements. Which is what makes me wonder if it has something to do with the animation complexity...

Btw...I'm running on a quad-core 3.9.Ghz system with a dedicated nVidia GPU unlike dafioram...I ran "top" alongside the game and noticed something similar. When playing normally, the scummvm process was using between 5 and 12% of my CPU. If I picked up the Liftbot's head and started waving it around the screen, it immediately jumped to 30-35%.

I *did* notice that during the elevator animation the CPU usage jumped to 50%, which does suggest there is something weird going on with the animation playback in the game...this could all be related...but it shouldn't take so much CPU power just to play a non-interactive video...

When I picked up the parrot it jumped to a ridiculous 75% CPU usage...

comment:9 by wjp, 7 years ago

I can confirm that fixing the event loop structure removes noticable mouse lag in the parrot scene.

comment:10 by dreammaster, 7 years ago

I've committed in a fix for the event loop processing. See if this makes any difference in the next daily build.

comment:11 by dreammaster, 7 years ago

Resolution: worksforme
Status: pendingnew

comment:12 by hamakei, 7 years ago

Today's build (July 18th - 1.10.0git3986-gc3f8f1a) fixes the problem - I no longer experience severe lag when the mouse pointer is "customised"

It's also speeded up the transition animations, though they are still VERY CPU intensive.

comment:13 by dreammaster, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.