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 Studio Chat / DrawSprite() only as fast as CreateSprite()?

Author
Message
Onomatopoesie
User Offline
Joined: 6th Aug 2019
Location: Germany
Posted: 4th Sep 2019 18:24
I am currently programming my own particle system. With DrawBox I can easily calculate and display 5000 particles with a frame rate of 60 FPS. A particle system with sprites breaks at frame rates of about 2000 sprites. I thought DrawSprite would be as fast as DrawBox. But even here the frame rate breaks down at about 2000 particles. Can this be somehow accelerated? Why is DrawSprite so slow? I thought the graphics would be copied directly to the backbuffer. It should work as fast as DrawBox?
SFSW
16
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 4th Sep 2019 19:29
I suspect DrawBox is a much simpler entity than a sprite. A sprite consists of additional data/parameters for scaling, rotation, depth, collision, etc. As a result, I would expect the overhead of rendering sprites to be significantly higher than just a 2D draw shape operation. The results you report sound like they'd be within expected norms for such a comparison considering the number and type of operational differences between the two.
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Sep 2019 22:36 Edited at: 4th Sep 2019 22:36
AGK uses a draw call for each DrawSprite() (Especially with Vulkan). Try creating 5000 Sprites.
Onomatopoesie
User Offline
Joined: 6th Aug 2019
Location: Germany
Posted: 5th Sep 2019 09:10 Edited at: 5th Sep 2019 09:17
Thanks for the explanation. Got it.
Onomatopoesie
User Offline
Joined: 6th Aug 2019
Location: Germany
Posted: 5th Sep 2019 09:28 Edited at: 5th Sep 2019 09:48
Hm. If I create sprites without informations (so simply created with CreateSprites -> just white boxes), I can easily represent 15,000 sprites without performance losses. If the sprite contains a different color (with CreateImageColor, SetSpriteImage), then the frame rate drops from 1,800 sprites extremly ... So AppGameKit can only manage 1,800 sprites at all? (But why could it manage the white boxes?) I am at a loss.


If you toggle command line with SetSpriteImage the frame rate drops at 1,800 particles ...

EDIT: I know, that i can use SetSpriteColor - without performance issues. But the goal is, to handle textured sprites.
TomToad
1
Years of Service
User Offline
Joined: 6th Jan 2018
Location:
Posted: 5th Sep 2019 11:14 Edited at: 5th Sep 2019 11:16
I only get a small decrease in speed 25000 with images, 27000 without. The small decrease in speed is not unexpected because you must consider image transparency when drawing the sprite. Why you get such a drastic reduction in FPS, I don't know. Possibly a driver issue?

edit: oops, just noticed I am in the AppGameKit Studio forum. I am using AppGameKit Classic. Don't know if that makes a difference.
Onomatopoesie
User Offline
Joined: 6th Aug 2019
Location: Germany
Posted: 5th Sep 2019 11:49
Okay. So it's an issue of my graphic card.
smallg
Valued Member
13
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 5th Sep 2019 13:15 Edited at: 5th Sep 2019 13:25
doesn't make any difference for me if they're textured or even if the texture has transparency, still got around 60fps with around 25k sprites
if i take out the for loop that repositions them (moved the position to the creation part) i can get up to 35~36k sprites at 60fps though i doubt that's much use for a real time particle system you could reduce how often the loop is called
edit; i can reach 32k with this
life's one big game
spec= i5 4ghz, 16gb ram, Nvidia 1070ti gpu
Onomatopoesie
User Offline
Joined: 6th Aug 2019
Location: Germany
Posted: 5th Sep 2019 14:15
Okay. Thanks. I have to realize, that my onBoard graphics card ist a peace of sh...

Login to post a reply

Server time is: 2019-09-22 18:26:22
Your offset time is: 2019-09-22 18:26:22