immanuelx2

Members
  • Content Count

    4
  • Joined

  • Last visited

About immanuelx2

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks for the reply @ivan.popelyshev I'm not understanding. Can u elaborate? Shouldn't delta update when ticker.update() is called every ~1000ms?
  2. Hello, @ivan.popelyshev and @Herbert sorry for the necro but this looks to be exactly the issue I'm trying to tackle here in 2019. I'm working on a multiplayer game so it is important that my game state (physics calculations) stay in sync with the server. When the tab loses focus, it is my understanding that: RAF (which is what the Ticker uses) pauses. setInterval() is limited to 1000ms intervals. So my approach is to use a setInterval() instead of ticker.add() when window is blur and adjust as necessary (using deltaMS from the ticker): let manualUpdateInterval; window.onblur = () => { ticker.stop(); // stop the ticker so we can manually update ticker.minFPS = 1; // correspond to the setInterval limit (1000ms) manualUpdateInterval = setInterval(() => { ticker.update(); }, 1000); // capped at this value anyway } window.onfocus = () => { clearInterval(manualUpdateInterval); // stop the interval ticker.minFPS = 10; // reset to default minFPS ticker.start(); // start the ticker back up } if (ticker.started) { ticker.add(() => { update(ticker.deltaMS); // send deltaMS so physics calculations stay in sync draw(); }); } When the tab is focus, everything looks right. However when the tab loses focus, my physics calc seems off (I can monitor this by seeing the server update player location in it's logs)... When I switch back to the tab, player is behind. Is there something I'm missing here? Any help is appreciated.
  3. Thanks Ivan. It looks like the way to create a RenderTexture is by creating a sprite for each layer (including the initial "base" layer that the others will be added to): const dynamicTexture = PIXI.RenderTexture.create(130, 65), baseSprite = new PIXI.Sprite(resources.base.texture), layerSprite1 = new PIXI.Sprite(resources.layer1.texture), layerSprite2 = new PIXI.Sprite(resources.layer2.texture); app.renderer.render(baseSprite, dynamicTexture, true); app.renderer.render(layerSprite1, dynamicTexture, false); app.renderer.render(layerSprite2, dynamicTexture, false); Any way to bypass sprite creation and just use the texture directly, or is this the most efficient way to do this?
  4. I have several textures created from PNG's (with transparency), and I would like to layer them onto a sprite so that they would effectively create one "combined texture". The problem is the Sprite object only takes a single texture. The reason I do not want to combine my textures into a single PNG file is because I want to dynamically layer different textures (using random generator functions in JS). So I think my two options, if possible, are: Create a new combined texture from the layered textures at runtime Assign multiple textures to a single sprite Is there an effective way to accomplish this?