HTMLViewer - Poor performance

Hi all,

I’m running an HTML5 game inside an HTML Viewer. The performance when run from within my Xojo app is terrible. The game flickers and stutters and is unable to maintain a decent frame-rate. However the same game, even running concurrently with (literally next to) my app in Safari has no issues and runs well.

Is there some trick to optimizing the HTML Viewer? Maybe a property to make it behave more like Safari? I’ve invested hundreds of hours into this app but with the current performance it’s a dealbreaker.

Thanks in advance

Just as a comparison, have you made a test build with phonegap, XDK or Xcode? Those tools have webkit wrappers too, and I don’t think the one that Xojo includes would be less capable.

You should also try do a production build (not debug) and test it standalone, with Xojo IDE shut down, so you can isolate debug factors and overhead.

What version of OS X are you testing on?

El Capitan

I’m still not a registered xojo user so I can’t compile as a final project. Do you think it will make that much of a difference?

A more pressing issue. In testing my application, it seems that the HTMLViewer won’t load the HTML 5 games at all on Mountain Lion (testing in the xojo IDE in a VM) . However Safari on the same VM loads them fine. Within an HTMLViewer they just don’t render and give no error message. All the javascript in the pages to detect browser compliance passes.

Are some features of the browser disabled within the HTMLViewer?

(Works just fine in Mavericks, by the way.)

If I remember correctly Safari uses WebKit 2 with a different JavaScript engine.
So the performance may never be as good as Safari itself.

One way to know some of the features is by analyzing the User Agent String, which is the handshake ID of the browser against a server.
Open any browser and go to http://whatsmyuseragent.com to get your browser info as sent. Take note and now navigate to that website inside HTMLviewer. You will see some of its features, like rendering engine, Etc.

Other approach I would recommend is to profile your game and optimize it’s code. If it does not run fine on HTMLviewer it brings the probability that it will not be performing good in some of your customers machines. You should help the browser by minifying the script and doing all recommended optimizations for HTML5/ Js games.

Which HTML5 game engine are you using ?

If this is Mac only a native WebView app takes like 5 minutes to build and there’s a million tutorials on how to. Make one of those and see how that performance is. Xojo just might not be the right tool for this job.

I agree. I made one with plain Xcode and works nice.

in Xcode with WebView or WKWebView?

With the webkit view in the component palette

Thanks guys, is there a way to build a native webview in xcode and integrate it into Xojo? Because I’ve spent a considerable amount of time building xojo code to support the rest of the application. The HTML5 part is just one part of it, but a critical one.

Thanks for all your wisdom

[quote=221876:@Julio Debroy]
Other approach I would recommend is to profile your game and optimize it’s code.

Which HTML5 game engine are you using ?[/quote]

Unfortunately the HTML5 games are not my code. My client wants a wrapper app for several dozen games he licenses.

Well, the MBS plugin has done that with the WebViewControlMBS control.
Maybe you try setting up the SDK version first?
Because as Xojo apps are linked against 10.7 by default, you may get the 10.7 webview?

Hey, that may be the solution. Will give the demo a go. Thank you!

Just today, I ran into a problem where JavaScript in a HTMLViewer would drop from 100fps to about 1fps.

Turns out Flash Plugin was out of date, and seems to have been blacklisted by apple overnight. Flash content wouldn’t load, and furthermore, after the load failed, the HTMLViewer was down to about 1/10th of normal speed.

Flash plugin 19.0.0.226 is out, if this is a flash-related issue?

[quote=222280:@Michael Diehr]Just today, I ran into a problem where JavaScript in a HTMLViewer would drop from 100fps to about 1fps.

Turns out Flash Plugin was out of date, and seems to have been blacklisted by apple overnight. Flash content wouldn’t load, and furthermore, after the load failed, the HTMLViewer was down to about 1/10th of normal speed.

Flash plugin 19.0.0.226 is out, if this is a flash-related issue?[/quote]

Flash is generally deprecated by Apple, strongly discouraged by Google, and all together frowned upon as unsafe.

It is suggested to replace it by HTML5 video tag. http://www.w3schools.com/html/html5_video.asp

Peter, I can tell you that HTML5 is great for multiplatform distribution of games, including web. But, it is the game code in any engine, language or framework the one that always has to be optimized. Specially because games are the ones that demand the most system resources and performance. HTML5 is not precisely the best at performance, but it is the most compatible.
Every “layer” that you add will impact on performance.

I always test not only in different operating systems but in also in older machines. Perhaps your app is not intended for mobile, but even so desktops vary a lot in performance. Even Macs do. I keep an 2007 iMac for tests and there you can see that performance is affected with older hardware. With older iphones and ipads also you note performance issues.

For the purposes of covering the most market, you should follow the rule of making the software behave well in older machines. If your htmlviewer is doing bad in a newer machine, imagine how it will run in an older computer.