GBear Posted March 3, 2016 Share Posted March 3, 2016 hi. how can i reduce drawcall.. first. i packed images. effect 2 image ui 1 image map object 1image bg 49 image( doing culling) char main - 1packed monster - one by one but my game draw call is not low normally 30-100 and hardly 100-1000(200 same monster use two skill(2 effect by spine)) and. i'm using pixi-particle and this is using high drawcall T-T is drawcall up if container layer is complicated like following example? for example iconObject(Container) has like following - icon image - sprite - count - bitmaptext - name - bitmaptext - special button - sprite - bg - sprite how can i reduce drawcall? please give me tips.. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 3, 2016 Share Posted March 3, 2016 Find whichever object has the most instances, and separate it into another container. I also use a trick like shadow.position = char.position , so position of two objects will be ALWAYS synchronized even if they are in different containers and dont have parent-child relation If you have 100 objects of the same type, same texture in one container, it will be optimized. And ParticleContainer/SkiinedMeshPatch can optimize it even further. Quote Link to comment Share on other sites More sharing options...
GBear Posted March 4, 2016 Author Share Posted March 4, 2016 @ivan.popelyshev hi ivan.. is there a reason sprite can't use 'batch' when sprite has mask ? and i don't know correct reason. but when i use two emitter or more on same container and same time(emitter is pixi-particle and emitter has different texture and same basetexture)) drawcall is up very fast.. emitter has different texture and same basetexture and same container like following container - emitter1_container - - emiiter2_container if added 100 of emitter1 only or emiiter2 is same. . it's good... batch, it was optimized.. but if it used same time T-T.... Quote Link to comment Share on other sites More sharing options...
GBear Posted March 4, 2016 Author Share Posted March 4, 2016 it looks because blendSwap Quote if (currentBaseTexture !== nextTexture || blendSwap || shaderSwap) emitters has different blendMode in this case T-T.. how can i control in this case... differnt blendmode different Shader, different Position and different drawOrder by position T-T... do you have ideas? Quote Link to comment Share on other sites More sharing options...
GBear Posted March 4, 2016 Author Share Posted March 4, 2016 Quote I also use a trick like shadow.position = char.position , so position of two objects will be ALWAYS synchronized even if they are in different containers and dont have parent-child relation what's the meaning? Quote Link to comment Share on other sites More sharing options...
fire7side Posted March 4, 2016 Share Posted March 4, 2016 I think he's saying that if you move char, shadow will automatically update and move with it, so you can bind two things that way that don't have to be in the same container. I was looking at that too. I wouldn't have thought it would do that. I would have thought it only would do it for the one call and when character changed it would need to be redone, or maybe it does. I think I read javascript does a lot of reference copies, so maybe that's why. Quote Link to comment Share on other sites More sharing options...
GBear Posted March 4, 2016 Author Share Posted March 4, 2016 @fire7side hi.. Quote I think he's saying that if you move char, shadow will automatically update and move with it, so you can bind two things that way that don't have to be in the same container. can draworder control in this case? my game need drawing order between characters and objects and etc... how can i control draworder if container is different Quote Link to comment Share on other sites More sharing options...
fire7side Posted March 4, 2016 Share Posted March 4, 2016 I've just started using Pixi also. Although I did try it a time ago for a little while. I don't think there is anyway you could control drawing order unless they are in the same container. You're kind of stuck there. You might could have two containers and shift from one container to the other. Like foreground and background. Haven't tried anything like that, though. Quote Link to comment Share on other sites More sharing options...
GBear Posted March 5, 2016 Author Share Posted March 5, 2016 draworder is changing in real time on my game. every frame calculated .. T-T So container can't be separated . ui and game are separated and game is separated between object and bg and object container is always sorting every frame object container is big problem.. Quote Link to comment Share on other sites More sharing options...
fire7side Posted March 5, 2016 Share Posted March 5, 2016 You're the only one that can figure it out. Sometimes there are certain things that can be separated, like for instance particles can all be in one container. Maybe there are more game elements like that which can be grouped, or you can figure out a way that they can be grouped without changing the game. Other things can also slow down a game like destroying objects, it's better to keep an object pool for game speed, things like bullets, or enemies that die often can be re-used instead of destroyed. If the objects don't need to be rotated, then you can use CacheAsBitmap, there's an example for it in the pixi examples. I haven't done any of them yet, though, because I just haven't worked with Pixi long enough. I talked to one guy and he said CacheAsBitmap made a huge difference for him in game speed. Make sure you clean up debug lines, also, like if you use console.log like I do, that will slow it down a lot. Then there's just code, like maybe not checking something every frame if you don't need it. Another thing I've done is redesigned the game because it didn't work that way. I used things that didn't need to move as much in the game. Quote Link to comment Share on other sites More sharing options...
GBear Posted March 6, 2016 Author Share Posted March 6, 2016 @fire7side thx.. ^^/ i will check every parts... and CacheAsBitmap.. hmm.. which part can i use it? Quote Link to comment Share on other sites More sharing options...
fire7side Posted March 6, 2016 Share Posted March 6, 2016 It works on the container. container.cacheAsBitmap = true; or you can do it with each sprite. I haven't tried it. That's from the examples. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 7, 2016 Share Posted March 7, 2016 cacheAsBitmap will help only if you have a number of objects in container that doesnt change at all. Quote Link to comment Share on other sites More sharing options...
fire7side Posted March 7, 2016 Share Posted March 7, 2016 What if you do a screen scroll, is that static, or does it actually have to not move? Quote Link to comment Share on other sites More sharing options...
GBear Posted March 17, 2016 Author Share Posted March 17, 2016 If children's sprite is changed and cacheAsBitmap is true, child sprite isn't redraw sprite? if i wanna redraw.. what can i do? cacheAsBitmap to false? Quote Link to comment Share on other sites More sharing options...
GBear Posted March 17, 2016 Author Share Posted March 17, 2016 16 minutes ago, GBear said: If children's sprite is changed and cacheAsBitmap is true, child sprite isn't redraw sprite? if i wanna redraw.. what can i do? cacheAsBitmap to false? yes.. 1.cacheAsBitmap set true; 2.create new sprite when process 'render' 3.draw created sprite.. ^^; Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 17, 2016 Share Posted March 17, 2016 @GBear better not to use cacheAsBitmap. At all. Pixiv4 will have multiple ways of improving performance, and they're much more effective. Can you please profile your app and give me the timeline of one render operation ? Quote Link to comment Share on other sites More sharing options...
GBear Posted March 24, 2016 Author Share Posted March 24, 2016 how can i give you timeline? chrome timeline on debugger? and do i reset children's flags like renderable or visible if set cacheAsBitmap to true? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 25, 2016 Share Posted March 25, 2016 yep.go to timeline tab, and "save timeline data" after you record it. Quote Link to comment Share on other sites More sharing options...
GBear Posted March 25, 2016 Author Share Posted March 25, 2016 hi @ivan.popelyshev ^^/ this is my game's timeline... TimelineRawData-20160326T010457.zip Quote Link to comment Share on other sites More sharing options...
wosagoy936 Posted February 25, 2022 Share Posted February 25, 2022 On 3/17/2016 at 2:54 PM, ivan.popelyshev said: @GBear better not to use cacheAsBitmap. At all. Pixiv4 will have multiple ways of improving performance, and they're much more effective. Can you please profile your app and give me the timeline of one render operation ? What did you mean by that ? 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.