erazemnot Posted June 7, 2015 Share Posted June 7, 2015 Hi everyone,I'm noticing refresh freezes when showing items (loaded, but with visible set to false). With freeze I mean that although normally the game works with 60fps, when showing new item (loaded but not visible) it takes 300ms to call another render.My loop is simple and looks like the following:function render() { update(); renderer.render( container ); // render stage requestAnimationFrame( render );}I logged the render function to output time from the previous render and it returns 300ms when the problematic event occurs. I tested every single line and it came down to a single line:sprite.visible = true;This sprite is made visible through keyboard event (when space is pressed) and it is the single line of code being called.The texture for the sprite is loaded at the beginning by using PIXI.loader with event complete that instantiates the sprite object, closes the loading screen and shows the stage (container object, I'm using pixi 3.0.6). As follows:PIXI.loader.add("mysprite","sprite.jpg").once('complete',function(){ sprite = new PIXI.Sprite( loader.resources.mysprite.texture ); sprite.position.set( 100, 100 ); container.addChild( sprite );}).load();So why does it take so much time to render the object, it is loaded just not visible. Is there a workaround, like preloading (am I not doing that already?), I mean, this 300ms freeze is just too noticable. One more thing. It happens only on the first time the sprite is shown, later everything runs smoothly. I am testing with Chrome 43 (I tested the example with Chrome 43, IE11 doesn't seem to have a delay), same thing happens on Android after compiling with CocoonJS.Thanks. Quote Link to comment Share on other sites More sharing options...
xerver Posted June 7, 2015 Share Posted June 7, 2015 Hmm, that doesn't sound like it should be happening at all! Do you have a running example I can look at? Would like to look through some profiles and see what is going on. Quote Link to comment Share on other sites More sharing options...
erazemnot Posted June 8, 2015 Author Share Posted June 8, 2015 One more thing, it happens only on the first time the sprite is shown, later everything runs smoothly. Quote Link to comment Share on other sites More sharing options...
JamesId Posted June 15, 2015 Share Posted June 15, 2015 I'm running into a similar issue with no solution. I am loading a few dozen new objects at once, so it is more pronounced taking a full 2-5 seconds to display the frame. When the same action is done again, after all objects on the stage container is destroyed, its instantaneous. I am using spritesheets, if that makes any difference. Quote Link to comment Share on other sites More sharing options...
xerver Posted June 15, 2015 Share Posted June 15, 2015 All I can do is repeat myself at this point: Hmm, that doesn't sound like it should be happening at all! Do you have a running example I can look at? Would like to look through some profiles and see what is going on. Quote Link to comment Share on other sites More sharing options...
JamesId Posted June 15, 2015 Share Posted June 15, 2015 xerver, I apologize for not providing an example earlier. The project I'm working on cannot be revealed public just yet, so I had to make a separate example to highlight this issue. https://dl.dropboxusercontent.com/u/90649252/pixiexample/index.html This may not be erazemnot's issue, but my problem seems to have a similar symptom. In the example script, I create a new sprite and add it to the stage container on click, and it uses a spritesheet as a texture. Admittedly, the spritesheet in the example is pretty large as that mimics the characteristics of my project. Though the spritesheet has been loaded by the assetLoader, there is a noticeable delay between click and object creation. I assume that since I use several spritesheets in my project, the delay accumulates with each spritesheet to create a 2-5 second delay. Quote Link to comment Share on other sites More sharing options...
xerver Posted June 15, 2015 Share Posted June 15, 2015 The project I'm working on cannot be revealed public just yet, so I had to make a separate example to highlight this issue. Totally understand that. I will look into this, thanks! **EDIT**: Added a GitHub issue for this: https://github.com/GoodBoyDigital/pixi.js/issues/1899 JamesId 1 Quote Link to comment Share on other sites More sharing options...
JamesId Posted June 17, 2015 Share Posted June 17, 2015 Totally understand that. I will look into this, thanks! **EDIT**: Added a GitHub issue for this: https://github.com/GoodBoyDigital/pixi.js/issues/1899 Thank you for creating a GitHub issue for this. For the time being I'm going to attempt to see if having single files for most of my sprites will avoid this issue for me. I've just started teasing out all the images from my spritesheet, and so far I have 1046 sprites Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.