Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / SetSpriteVisible - Reduce Fillrate?

Author
Message
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 13th Aug 2013 20:04
Does this command prevent the sprite from being drawn? I am trying to reduce my fillrate, and was wondering if setting sprites which cannot be seen (but are on screen) to invisible would help reduce this? Thanks!!
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 13th Aug 2013 23:20
It won't get drawn. However, it still has to be parsed to "see" it's invisible. It may also get parsed for collisions etc. It's probably the best thing to do (although I wondered what putting the sprite way off screen would do, as this would exclude it from rendering but would it exclude it from collision tests?)

Best practice would be also to make sure it's shape is appropriate (for collisions or not) and it's alpha masking.

I always set the depth to keep in control of where it should render (avoid rendering alpha on alpha where possible) and when sprites are at the same level there will be some extra work to decide render order.

Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 14th Aug 2013 00:15
With regards to fillrate, hiding it or placing it completely outside the screen should do the same thing. If I am not mistaken, what nz0 says only affects the CPU. BTW, I have loads of sprites outside the screen in RTA, all with collision and have no problem. On Ouya fillrate is a problem, but only sprites on screen is giving me problems.

nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 14th Aug 2013 00:23
Yes, the parsing, sorting, depth etc. part is all cpu.
Fillrate is more device specific, so crap androids, Ouya ? etc is more problems.

The CPU aspect is always important though, as if you bottleneck there, then the GPU performance is irrelevant.

Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 14th Aug 2013 00:32
The problem with Ouya is that on a TV that can take a 1080p signal, the framebuffer is 1080p. Unless you specify it otherwise. Scaling the framebuffer should be no problem. Like using a 720p framebuffer gives you twice the power. Currently there is no command for altering the framebuffer in AGK.

Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 14th Aug 2013 16:08
Thanks guys... So to put this in perspective, in my app I have a world selection screen. When you select the world, the view pans to the right displaying the correct level buttons for that world. What I do is when you click world 1 (for example) I move all world 2 and world 3 level buttons to the back (hidden behind the background image) and world 1 to the front. This means that although the world 2 and 3 buttons are hidden, they are still being drawn... Hence my question... I could of course move the buttons of screen instead, but if SetSpriteVisible does the trick, I'd rather go with that approach...

Thanks again...
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Aug 2013 16:28
I would use setSpriteVisible and setSpriteActive too (this also stops it from being included in collision tests/ physics etc). In my experience I have gained an increase in speed from this when the sprite is on screen but behind other sprites, probably due to a reduced number of draw calls to the renderer.

"Here I am trying to do some good for the world..." - Fluffy Rabbit
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 14th Aug 2013 16:36
Thanks Bax, I shall do just that...
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 14th Aug 2013 16:50
Yeah, if the sprite is on screen and visible, it doesn't matter how many sprites you put on top. It will still be drawn.

Login to post a reply

Server time is: 2024-04-27 11:06:20
Your offset time is: 2024-04-27 11:06:20