Frame rate problem 120 fps

Hello,

I’ve played a bit with the html 5 exporter and I realised that my exported game is 2x faster on my 120 Hz screen when played in a browser as if the key in config.lua fps = 60 was ignored during the build. What should I change to keep the function onEnterFrame processing 60 times per second even on a 120 fps screen?

thanks

iosman

Unfortunately each browser has own HTML5 settings: different real FPS, default fonts, etc.

For example HTML5 on Chrome works faster than Firefox.

You can use JS callbacks to determine browser or real FPS and use this value for enterFrame settings.

Simple code (main.lua):

local function callbackFunction( message ) print(message); -- you get browser name end local platform = system.getInfo("platform") if platform == 'html5' then info.callback = callbackFunction info.execute() end

and JS file (info.js):

info = {     execute: function() {  if (sUsrAg.indexOf("Firefox") \> -1) {      sBrowser = "Mozilla Firefox";      //"Mozilla/5.0 (X11; Ubuntu; Linux x86\_64; rv:61.0) Gecko/20100101 Firefox/61.0" } else if (sUsrAg.indexOf("Opera") \> -1) {      sBrowser = "Opera"; } else if (sUsrAg.indexOf("Trident") \> -1) {      sBrowser = "Microsoft Internet Explorer";      //"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; Zoom 3.6.0; wbx 1.0.0; rv:11.0) like Gecko" } else if (sUsrAg.indexOf("Edge") \> -1) {      sBrowser = "Microsoft Edge";      //"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299" } else if (sUsrAg.indexOf("Chrome") \> -1) {     sBrowser = "Google Chrome or Chromium";     //"Mozilla/5.0 (X11; Linux x86\_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/66.0.3359.181 Chrome/66.0.3359.181 Safari/537.36" } else if (sUsrAg.indexOf("Safari") \> -1) {     sBrowser = "Apple Safari";     //"Mozilla/5.0 (iPhone; CPU iPhone OS 11\_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1 980x1306" } else {     sBrowser = "unknown"; } this.callback( sBrowser );     } }

We should add this into the base HTML template…

Unfortunately each browser has own HTML5 settings: different real FPS, default fonts, etc.

For example HTML5 on Chrome works faster than Firefox.

You can use JS callbacks to determine browser or real FPS and use this value for enterFrame settings.

Simple code (main.lua):

local function callbackFunction( message ) print(message); -- you get browser name end local platform = system.getInfo("platform") if platform == 'html5' then info.callback = callbackFunction info.execute() end

and JS file (info.js):

info = {     execute: function() {  if (sUsrAg.indexOf("Firefox") \> -1) {      sBrowser = "Mozilla Firefox";      //"Mozilla/5.0 (X11; Ubuntu; Linux x86\_64; rv:61.0) Gecko/20100101 Firefox/61.0" } else if (sUsrAg.indexOf("Opera") \> -1) {      sBrowser = "Opera"; } else if (sUsrAg.indexOf("Trident") \> -1) {      sBrowser = "Microsoft Internet Explorer";      //"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; Zoom 3.6.0; wbx 1.0.0; rv:11.0) like Gecko" } else if (sUsrAg.indexOf("Edge") \> -1) {      sBrowser = "Microsoft Edge";      //"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299" } else if (sUsrAg.indexOf("Chrome") \> -1) {     sBrowser = "Google Chrome or Chromium";     //"Mozilla/5.0 (X11; Linux x86\_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/66.0.3359.181 Chrome/66.0.3359.181 Safari/537.36" } else if (sUsrAg.indexOf("Safari") \> -1) {     sBrowser = "Apple Safari";     //"Mozilla/5.0 (iPhone; CPU iPhone OS 11\_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1 980x1306" } else {     sBrowser = "unknown"; } this.callback( sBrowser );     } }

We should add this into the base HTML template…