• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 Random stuttering when moving objects

D

DestroyTheRunner

Guest
Hey everyone,
(sorry in advance for the long post, I´m trying to give every info and experience possible)
I own the html5 module for quite some time now and one of the issues that has been around for a while(and it was what have made me stop using it for a while) is a random stutter/freeze that happens when playing in the browser.(In case you change for windows module for testing it happens too but if you turn on v-sync it behaves perfectly and html5 module don´t have v-sync option).

I just got back after more than a year on a project aiming desktop browsers in hope that this stutter had been fixed with the updates and apparently it don´t.

Things I already tried:

  • Drawing stuff using the round() function for it´s coordinates, I´ve read somewhere that this stutter could be the browser not being able to draw things 'between' pixels. Didn´t work but behaved differently but still stuttering.
  • Different browsers on different computers. Same behavior.
  • Searched for another game made if GM:S html5 and had a similar stutter my games/projects have. (It´s been a while can´t remember which game was)
  • Hosted the game on a real server and tried to play it. Same behavior.
  • Lowered the FPS for 30. Same behavior.
My last attempt was a test project I just did yesterday:
  • One small room (60 room speed)
  • One sprite (32x32px with no transparency)
  • One object that moves around the screen randomly
  • Result: The object moving over the screen stutters randomly :(
The real question(s):
Does this happens for everyone?
Will it ever have a fix? (more than a year since last time I used and same problem)
Does anyone have a workaround for this?

Thank all of you in advance for reading this long post.
 
P

PlayLight

Guest
Are you able to post a link to the test project so members can help you out ?
 
A

Aura

Guest
Use floor() or ceil() instead to evenly round the coordinates. Apart from that, we have no real information about what you are doing, so we can't give a 100% accurate solution. Are you using views? Do you use rounded coordinates for views as well? How does your object move? Post some relevant code and we might be able to help. ^^"
 
D

DestroyTheRunner

Guest
I´ll be putting up a very simple fresh new project to my domain and will post the link here tonight.
 
D

DestroyTheRunner

Guest
Here´s the link: http://www.oldstovestudio.com/test/
  • One room with 60 room_speed
  • 800x600
  • One sprite 96x96
  • One Object
Code:
///Step event:
move_wrap(true,true,2);
direction = 0;
speed = 6;
Code:
///Draw event:
draw_sprite(sprite0,0,floor(x),floor(y));
Notice how the object stutters randomly while moving to the right.
 
D

DestroyTheRunner

Guest
Yes, just tested with speed of 4 and it stutters.
 
N

NokFrt

Guest
Set the room speed to a higher number than 60 (for example 999). You'll still get 60 FPS in HTML5 but without stuttering.
 
D

DestroyTheRunner

Guest
@icuurd12b42 - I did try with fps 30 and still stutters but never with 45 tough.
@True Valhalla - So it´s not a bug/issue with the GM:S HTML5 module then? Is it a HTML5 'native' issue??
@NokFrt - I did try once with something like 70/80 but the results were the same, I´m affraid that setting room speed to 999 would mess things up since I would need to tweak do whole game and have to work with really low/small numbers. I´ll give it a try anyway.
@Andrey - I saw that before and it´s resolution is "Unable to reproduce", I opened another request at http://help.yoyogames.com/ on Friday but didn´t get a response yet. Today I updated the request with a link I posted earlier with the issue.

Things I´m going to try later today and post here the results:
  • Set room_speed to 45
  • Set room_speed to something like 999
  • Use only drag'n'drop functions and see if there is anything related to it.
 
J

jackhigh24

Guest
here is a few other things to try
1) put your move code in the draw event as the draw event can skip steps so the image might not follow perfect with step event as that wont miss a step.
or
2) keep your move code in the step event and dont draw the sprite your self let the object draw it.
 

Andrey

Member
I think the problem can not be solved . That looked to the square of the test on the tablet with the two browsers . The chrome small stuttering , but in an opera - very strong . I guess that's not the GMS.
 
D

DestroyTheRunner

Guest
  • Setting room_speed to 45 = Stutter
  • room_speed to 999 = Stutters but less noticeable, looks a bit more smoother but I don´t know if this is the right solution :(
  • Drag'n'drop actions only = Stutter
  • @jackhigh24 (1 option) = Stutters with a behavior like putting room_speed to 999 but bit more choppy
  • @jackhigh24 (2 option) = Stutter
@Andrey I can´t agree yet because I never played a 'raw' HTML5+Javascript game so I don´t know how they behave on <canvas>
 

Roa

Member
That's really funny, because I had the opposite issue where firefox runs like crap, but chrome is smoother than a babie's bottom. I narrowed it down to 2 biggest issues though.

1: Draw calls kill html5. Make as few texture swaps as possible, priority one above all other optimizations. I've not seen any platform take nearly the hits with those 2 things as much as html5. This suggestion always seemed petty on other platforms, but for html5, its night and day.

2: Too many plugins and services running in browsers work space. Having too many tabs open or too much junk running in the background loaded up can cause a lot of micro stuttering. I've noticed degridations with even as few as 4 tabs sitting on google's home page. Download and keep separate clean versions of the browsers to test in. Disable everything that isn't stock, including flash, silver light, java, any add blockers or fancy themes. The game having lower priority over other loaded pages in the background causes hitching.
 
D

DestroyTheRunner

Guest
@icuurd12b42 That could be a solution but it´s funny to have to implement delta time even for a single room with a single object moving. I haven´t tested it yet though.
@Roa I´ve tried it in IE and Chrome and in different computers (mine, friends, work) and they all behave the same, even with no tabs, no plugins. I don´t even tried Firefox cause I know their javascript engine is slow.

Another problem is I won´t ever know how the player´s browser will be, I can´t tell the player "close all tabs, clean your cache, disable your plugins to play my single room with one red square moving to right without stutter". It´s too bad it´s already mid-2016 and we still can´t deliver a solid product in HTML5. I still don´t know if it´s the export module or the nature of HTML5.
 
N

NokFrt

Guest
I was complaining about stuttering in HTML5 about a year ago. This problem is related only to GM:S games, pure javascript/phaser/construct 2D games are usually without stuttering. The only solution I've found is to set the room speed to a higher number than 60 and use delta timing - then the stuttering is much less noticeable and it helps even on native Android/iOS/Windows exports. I use delta timing in all of my games - you can't count with 60 FPS in browsers on older phones. You can deliver a solid product in HTML5 with GM:S, but it's better to make a game where the view is not constantly moving.
 
D

DestroyTheRunner

Guest
@NokFrt Well, I still have a open request on yoyo support about this issue, I hope they could re-work this export module.
Do you mind share your code of delta time?
 

Andrey

Member
I tried. Nothing succeeded! How were stuttering at Android, and have remained. The room and 60 and 90 and 120 and 9999 did. The result of one - stuttering persist even with delta.
 
D

DestroyTheRunner

Guest
I´ve been a bit busy in those last days but I will update that example (the one with a red square moving to the right) this week with delta time and see what happens.
 
D

DestroyTheRunner

Guest
Just to update this post about the HTML5 issue, unfortunately I´ve been busy and cound´t test with delta time stuff, but I´ve been in touch with yoyogames staff and they said that this issue MIGHT be fixed in the Early Access release 1.99.493. So I´ll test this out as soon as possible and report back here.
 
S

seanm

Guest
Vsync is responsible for preventing screen tearing and stuttering. In HTML5 there is no vsync, and no way to prevent stuttering.

The fix is vsync on windows, there is no fix on HTML5
 
U

Undead Hero

Guest
Just to update this post about the HTML5 issue, unfortunately I´ve been busy and cound´t test with delta time stuff, but I´ve been in touch with yoyogames staff and they said that this issue MIGHT be fixed in the Early Access release 1.99.493. So I´ll test this out as soon as possible and report back here.
Did you ever figure this out? I'm having this issue on iOS and it's driving me nuts. I haven't tried delta time or 1.99.493, however.
 
Top