A very odd thing about Mouse Movement

This forum is currently in read-only mode.
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Well basicly i almost finished programming the gameplay and now i started working with some UI. So i wanted to replace the original mouse cursor with some nice custom one. So yeah, ive hidden the cursor and made a sprite object and an event

    +Always = Set SpirteX to MouseX and SpriteY to MouseY

    Now heres what happends.

    If the mouse is being moved rapidly and fast the Sprite is falling behind! And not only that! whenever the mouse is being moved in such a rapid manner - the CPU usage grows preety noticeable.

    At first i though its because i have about 1200 events running, so it creates the delay. But no.

    So ive gone and made a new, perfect clean project.

    Added 16^2 sprite

    Same event. Always>set PosX/Y to MouseX/Y

    If the mouse is still, then the CPU wainting on circles around 95% (+/- 0.30%.

    But when ill start moving the mouse like a crazy monkey then blam: down to 88%(!!!!). Thats a Whoping 7% CPU usage just for mouse movement O_O The heck?

    And obviously, even at such empty, newborn project - the sprite falls behind the mouse cursor.

    And its not a Debugger error - ive checked the CPU usage also via windows Task Manager. It shows the same. At worst the usage is 41% without the mouse movement. With the mouse going crazy - up to 51%. And thats with Dual AMD Phenom CPU.

    1. Why position updating leave the sprite behind?

    2. What the heck is wrong with the CPU usage?

    3. How to fix the CUP usage and/or Sprite Pos updating?

  • Okey after some testing, the delayed Pos updating turns out to actualy be a V-sync issue. The pos are actualy updated correctly. Its the visiuals that arent.

    When it switched the V-Sync into unlimited or Fixed (about 100FPS) the updating is perfect. But thethe CPU suffers greatly.

  • It is a known problem, even in todays modern games. The best solution to have a quick mouse with V-sync is using system mouse cursor, replacing image with a small python script. It works perfectly:

    http://www.scirra.com/forum/mouse-lag_topic41235.html

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • okey but what about the CPU increased usage?

  • a friend of my confirmed that its not only on my end. The mouse movement in general eats about 5-7% CPU.

    This is a serious issue.

  • Have you tried measuring the cpu usage when moving the mouse without previewing? 5-7% is likely just caused by Windows posting notifications of mouse movements.

  • Have you tried measuring the cpu usage when moving the mouse without previewing? 5-7% is likely just caused by Windows posting notifications of mouse movements.

    this sounds ridiculous but

    my gawd Rojo lol you are right!

    But this is madness O_O

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)