Kanbaru

Members
  • Content Count

    3
  • Joined

  • Last visited

  • Days Won

    2

Kanbaru last won the day on February 8

Kanbaru had the most liked content!

About Kanbaru

  • Rank
    Newbie

Contact Methods

  • Website URL
    https://github.com/lihaochen910
  • Twitter
    https://twitter.com/kanbaru_chen
  1. nice! it works well. thank you for your help.
  2. Thanks for your reply, I tried using SpectorJS to debug rendering performance and found that it took a long time to call the gl.texSubImage2D method. The call stack is as follows: 0: _hackSubImage (TileRenderer.ts) 1: TileRenderer.bindTextures 2: RectTileLayer.renderWebGLCore 3: TileLayer.CompositeRectTileLayer.renderWebGL
  3. I am using "pixijs/pixi-tilemap" library to render maps exported from Tiled, but the rendering frame rate is low. I am newbie and I guess there may be a problem with the rendering loop logic, My thinking is as follows: I have several rendering layers(PIXI.display.Layer) in my game, I call them 'RenderingLayer', there are several cameras in the game (inherited from PIXI.Container), each camera can render multiple 'RenderingLayer' And output to RenderTexture, finally use the PIXI.Sprite group to render the final result according to the depth property of the camera. I use the ECS architecture to implement the game Code of RenderingSystem.update: for ( const camera of this.cameraComponents ) { if ( camera.renderingLayers.length === 0 ) { continue; } // clear stage $app.stage.removeChildren (); // add current rendering camera $app.stage.addChild ( camera.cam ); // collect camera rendering layer for ( const layerName of camera.renderingLayers ) { if ( $app.renderingLayers.has ( layerName ) ) { let layer = $app.renderingLayers.get ( layerName ); if ( layer.visible ) { camera.cam.addChild ( layer ); } } } // rendering camera result Graphics.render ( $app.stage, camera.renderTexture, this.renderTarget ); // clear camera.cam.removeChildren (); } // render final result this.renderSprite.removeChildren (); for ( const camera of this.cameraComponents ) { this.renderSprite.addChild ( camera.renderSprite ); } renderer.render ( this.renderSprite, null, true ); May be frequent use of removeChildren / addChild affects rendering performance?😳 I use the ECS architecture to implement the game, You can find the code for the RenderingSystem class here: js/ecs/systems/rendering_system.js. Another guess might be that I did not use the pixijs / pixi-tilemap library correctly.😲 see here: https://lihaochen910.github.io/RPGMakerProject/ code is here: https://github.com/lihaochen910/RPGMakerProject