We could do the same experiments as before with the textured cube, but let’s try to make a more real-world comparison. Flappy Bird clones have been made in both Unreal and PlayCanvas. Let’s take the Epic-authored Tappy Chicken and see how it fairs against the PlayCanvas-powered Flappy Bird. Here’s the (playable) PlayCanvas game:
Unfortunately, I can’t embed Tappy Chicken because Epic have restricted it to desktop browsers. So here’s a link to it, along with an animated GIF:
So before we begin, there’s an important point to make. T hey are not the same game and they do exhibit certain differences . Tappy Chicken uses different textures, has parallax, uses particles and so on. But in essence, they are remarkably similar and worthy of a comparison, despite not being pixel perfect clones of each other. It up to you, dear reader, to decide if the differences in the games account for the
As before, we will look at three key metrics: download size, load time and runtime performance.
To check the download size of each app, we disabled the cache in Chrome Dev Tools and recorded the total transfer:
|Tappy Chicken (Unreal)||Flappy Bird (PlayCanvas)|
Unfortunately, Epic prevents Tappy Chicken from running on mobile so we’ll just test load times on desktop. For the test, we’ll use a Core i7-powered Win10 machine on a 50Gb connection to the net. The browser cache has been disabled.
|Browser||Tappy Chicken (Unreal)||Flappy Bird (PlayCanvas)|
The PlayCanvas game was also run on a number of mobile devices and always runs at 60Hz and loaded in under 2 seconds.
Things to notice:
- Chrome loads the PlayCanvas game 17.6 times faster than the Unreal game. Other browsers show impressive multiples too.
- Firefox load the asm.js-based Unreal runtime the fastest. Since Emscripten is a Mozilla technology and Firefox is heavily optimized for asm.js code, this is not a great surprise.
To analyse runtime performance, let’s compare captures of the two games using the Timeline panel in Chrome Dev Tools. Here’s a capture for the PlayCanvas-powered Flappy Bird showing a frame executed in 0.57ms:
And here’s a capture for the Unreal-powered Tappy Chicken with a frame executed in 5.0ms:
In each capture, a typical frame has been selected. Not the fastest, not the slowest. Just an ‘average’ frame. Note that both captures are showing a frame at the same timeline scale.
Things to notice:
- CPU load in the Unreal game is typically around 6x greater than for the PlayCanvas game. So although both games generally lock to 60Hz on the test hardware, the PlayCanvas game can process a frame well within a millisecond whereas the Unreal game is clearly stressing the CPU. On lower end hardware, the Unreal game would become CPU bound.
- CPU load is much more variable in the Unreal game and spikes regularly. Without understanding the internals of the Unreal engine, it is hard to explain this. But the result is sporadic frame drops.
- Epic’s game is over 47 times larger than the PlayCanvas game.
- Chrome loads the PlayCanvas game 17.6 times faster than the Unreal game.
- CPU load in the Unreal game is typically around 6x greater than for the PlayCanvas game.
To be fair, Epic say the following in their documentation:
The HTML5 pipeline is currently experimental. Some projects may not run properly when built for the HTML5 platform. Expect some rough edges.
But we clearly see here that Unreal suffers similar problems to Unity’s WebGL exporter. Export sizes are huge, load times are long and runtime performance is poor when compared to a ‘WebGL-first’ engine like PlayCanvas.
To learn how PlayCanvas built an engine so optimized for the browser, head over to GitHub to explore the open sourced runtime. And if you want to start building with PlayCanvas today, sign up for free onplaycanvas.com. To check out the Flappy Bird project,click here.