ID:2683666
 
Resolved
High-precision timers could cause major issues for input handling, which were even worse on clients connected to remote servers, if the client lagged behind due to an overloaded map.
BYOND Version:514.1552
Operating System:I'm running BYOND using a computer I made in Minecraft
Web Browser:Clay Tablet
Applies to:Dream Seeker
Status: Resolved (514.1558)

This issue has been resolved.
Descriptive Problem Summary:
When a client has low FPS and there are lots of mouse events going on like tracking and clicking, these can stack up and can cause a delay. If there are a lot of actions stacked up at once it can take several seconds to execute them all, but they take place in the order they were sent (nothing is lost). In a game with time-sensitive or reaction-based components to it, this can be bad: By the time you react to something (say an arrow flying at you), it's a couple seconds too late.

Numbered Steps to Reproduce Problem:
  1. Run the test project
  2. Move your mouse around to make sure it faces your cursor
  3. Click turfs to make sure they change colour
  4. Spawn particle sets using the verb until your FPS drops noticably
  5. Repeat steps 2 - 4 until the issue occurs

Code Snippet (if applicable) to Reproduce Problem:
// Test Project


Expected Results:
The mouse to stay caught up with real-time, even if a few commands end up getting lost on the way.

Actual Results:
Mouse commands get backlogged and all execute in order they were sent.

Does the problem occur:
Every time? Or how often? The problem is only apparent when the client has low FPS (ie when they have many particles on screen)
In other games? When do I ever test this?
In other user accounts? You Betcha
On other computers? Indeed

When does the problem NOT occur?
When the player has a computer that's not shitty like mine, or when their FPS is good, such as when they have a computer that's not shitty like mine.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Didn't test that stuff bb.

Workarounds:
Lie down, fold your hands on your chest and prepare for an existential crisis

Ye Olde Teste Case
https://cdn.discordapp.com/attachments/725458744711839873/ 843947404730564658/click_lag_src.zip
Also, FYI, in my local tests, the bug persists when the Hazordhu files are excluded, it's just easier to see (because of the turn to face cursor stuff)
Okay, I've been testing this a lot and I'm honestly not sure yet that there's an actual bug here. From other conversations I've had with Repo82 who has a similar issue, this seems to have cropped up in 514.1547. However, I can't manage to get any different behavior when I try in an old version like 514.1544.

I updated the verb in the project to spawn 100 particle sets instead of 1, which pretty reliably murders performance, but what I'm seeing all makes sense. Can you confirm your issue still happens or doesn't on older builds, and if it doesn't then which build it started on?

Edit: Actually one thing I hadn't tested was hosting in DD and connecting in DS. When I do that I see a definite issue. It isn't merely "lag" like you describe though, so I'm not sure it's the same thing you're reporting. It seems more like the commands stop going through altogether past a certain point. Can you clarify whether you tested in just DS, or in DD+DS?
Lummox JR resolved issue with message:
High-precision timers could cause major issues for input handling, which were even worse on clients connected to remote servers, if the client lagged behind due to an overloaded map.