Search Unity

Question 25000 enties in WebGL not running smoothly

Discussion in 'Entity Component System' started by NymoBasepro, Feb 8, 2021.

  1. NymoBasepro

    NymoBasepro

    Joined:
    Apr 28, 2018
    Posts:
    26
    Hi everyone,

    I made a project and published it with WebGL, only it doesn't run smootly.

    #1. Can we please have a brainstorm of what the next steps to take could be?
    (So far):
    - Debugging (but I really want al these entities, there are gonna be even more, I hope).
    - Only calculate the entities that are in screen.

    #2. And also, does WebGL really support DOTS and ECS?

    #3. Are there some build settings I could look at?

    With kind regards,
    Nymo
     
  2. PublicEnumE

    PublicEnumE

    Joined:
    Feb 3, 2019
    Posts:
    729
    I was under the impression that WebGL was not a platform supported by DOTS features.

    I thought there were sandboxing limitations in WebGL which prevented some core DOTS features from working (like using worker threads), and that Unity is proposing Tiny as an alternative for web-based DOTS content.

    If this is wrong, please correct me.
     
    Last edited: Feb 8, 2021
    xVergilx likes this.
  3. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Thing is, WebGL doesn't support multithreading as in real world hardware, so you're probably bound by number of threads. (due to browser restrictions)

    Memory management works differently as well.

    Alternative would be to use Unity Tiny, unless you need whole engine logic. Although I'm not sure whether it will not bump into the same thread count limit.

    Best bet in your case would be to optimize it as a single core.
    So maybe scheduling jobs are a waste of ops. Use profiler to find out.
     
  4. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    I believe this is not entirely true anymore, as web assembly never had the restriction iirc and emscripten now supports pthreads. Unity just does not support it yet.

    The most critical limitation is
    Code (CSharp):
    1. The Emscripten implementation does also not support multiprocessing via fork() and join().