Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Streaming textures and game assets from online source to make WebGL game more scalable?

Discussion in 'WebGL' started by AmmarByFar, Feb 1, 2022.

  1. AmmarByFar

    AmmarByFar

    Joined:
    Nov 20, 2019
    Posts:
    4
    I wanted to hear about how some teams structure their large browser-based games. We're making a WebGL game and plan to continually add to it but worry that initial download times will start to get large.

    Do people setup a framework to dynamically download textures based on the scene/level the player is playing in? Would it be expensive to stream textures to clients? Are the interruptions to download textures/ assets worth it? Ideally the player shouldn't wait too long for the initial loading however as the game gets bigger would it be better to store the game assets somewhere online and have them download as the user plays?

    What are good design patterns to make a performant but scalable WebGL game?

    Any tips would be greatly appreciated!
     
    OceanX000 likes this.
  2. coldpizzapunk

    coldpizzapunk

    Joined:
    Aug 20, 2014
    Posts:
    30
    https://docs.unity3d.com/Manual/webgl-assetbundles.html

    Keywords to search in the forum and on youtube to get you started: Asset Bundle / Addressable / WebGL. I typically will start with a basic Loader Scene that has only a basic script and simple UI to get the user started right away, while I load the additional asset bundles.

    Another thing I sometimes do when I host my WebGL work is I make a simple HTML loading/landing page with instructions on how to play. I open that as an iFrame that pops up right away when first visiting the site. Then when the initial WebGL scene is loaded I can run javascript on the HTML to close the iFrame.

    I find with WebGL the initial load needs to have some misdirection applied to feel like the user is doing something during the initial load. So adding something to look at or read does go a long way to make the load feel less. Also, unity has improved WebGL in the 2022.1 Beta around loading and mobile use. Being Beta I would not recommend it for production, but just to point it out for future use.
     
    Last edited: Feb 2, 2022