Unity3d WebGL player vs WebPlayer – comparison experiment

Posted by admin on January 7, 2015 in Unity3d, webgl |

Here is a simple comparison between Unity WebPlayer and WebGL player builds generated from the same project.
The project is just a quite complex christmas tree scene which just fits to the current season of the year. I have placed the WebGL player page inside the iframe below. You can replace it with Unity Webplayer on clicking the buttons below the iframe. The main comparison parameter is the loading time.
The players look and work exactly the same, except that I can’t get the fullScreen mode to work when the WebGL player is contained inside the iframe. This test uses the player-browser communication and WWW classes and forms, which work the same in both cases.

The table below is intended to show the non cached loading times collected over time.


The iframe loading time inside the iframe shows the total time between the window.performance.timing.domContentLoadedEventEnd and window.onLoad events.
The player loading time shows the time interval between window.performance.timing.domContentLoadedEventEnd and Start() function inside the player.

Click on the buttons to test all that and get your entry recorded.

The WebGL build settings include:

  • build settings>optimization level>Fastest(vey slow build)
  • other settings>stripping level>strip assemblies
  • publishing settings>enable exceptions>none
  • The WebGL build files weight is around 6 times as much as for the WebPlayer, but the loading time is not that much longer.

    Obviously once the files load from the web for the first time it gets cached. If you enter this page for the first time the files are supposed to get loaded from the server, while in subsequent cases might probably get loaded from cache. In order to force them to load from the server again I used location.reload(true); to reload the iframe.

    Fortunately not all of the webgl build files are necessary. They are grouped in Compressed and Data folder. In this case the total 125 MB distributes into 33 MB inside Compressed folder and 92 MB in Data folder. Four files in the data folder have their gzipped equivalents inside the Compressed folder. The .htaccess file located in the build root folder defines the binds between them. Depending on the server configuration, in most cases, including this one, only the compressed files are used.

    A reward for large build files seems to be a much much shorter WebGL player reloading time once the files get cached on the machine.

    3 Comments

    • EvilEliot says:

      Hi, good to know this i make an empty scene with a cube, i was trying to configure my server on Amazon to serve compressed files, i manage to activate the mod_deflate on my apache server, i use this tool http://www.feedthebot.com/tools/gzip/ to be sure i’m serving gzip files and it says “gzip working compressing 60%”.

      but apparently only works on .js but the files .data an .mem files keep serving with full size even i add the application/octet-stream, i´m doing something wrong but im not very good at servers, maibe you can give me an advice at what i´m missing. i leave the code i add to the httpd.conf to activate gzip.

      thanx


      # mod_deflate configuration

      # Restrict compression to these MIME types
      AddOutputFilterByType DEFLATE text/plain
      AddOutputFilterByType DEFLATE text/html
      AddOutputFilterByType DEFLATE application/xhtml+xml
      AddOutputFilterByType DEFLATE text/xml
      AddOutputFilterByType DEFLATE application/xml
      AddOutputFilterByType DEFLATE application/x-javascript
      AddOutputFilterByType DEFLATE application/octet-stream
      AddOutputFilterByType DEFLATE text/javascript
      AddOutputFilterByType DEFLATE text/css

      # Level of compression (Highest 9 - Lowest 1)
      DeflateCompressionLevel 9

      # Netscape 4.x has some problems.
      BrowserMatch ^Mozilla/4 gzip-only-text/html

      # Netscape 4.06-4.08 have some more problems
      BrowserMatch ^Mozilla/4\.0[678] no-gzip

      # MSIE masquerades as Netscape, but it is fine
      BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

      # Make sure proxies don't deliver the wrong content
      Header append Vary User-Agent env=!dont-vary

    • siva says:

      hi,

      i have exported the webgl its running in my browsers(chrome and firefox) but its loading the content from the release folder, but i want to load the content from the compressed file.

      Can you please tell me the instruction how to do that?
      Warm Regards,
      Siva.
      Skype: sivmaurugan.soundarapandian

    • Cetin says:

      Hi,
      Thanks for your information, very useful. You tell that your server uses the compressed version, but don’t tell us how to configure that. So my question is the same as above (Siva), how do you do that?

      Thanks!
      Cetin

    Leave a Reply

    Your email address will not be published. Required fields are marked *


    *

    Copyright © 2011-2017 virtualPlayground All rights reserved.
    VP based on Desk Mess Mirrored v1.8.3 theme from BuyNowShop.com.