#How to draw 1000s of Sprites

16 messages · Page 1 of 1 (latest)

spring nexus
#

I am new to Bevy and Rust and tried to write a program where I just draw 1000s of Sprites. I was doing this to compare to Ebiten. I know it's a stupid way of comparing. But my concern is that with few 1000s of Sprite I start to get variable amount of FPS. Around 10,000 sprites FPS jumps continuoisly between 20 and 60 fps. Then around 20,000 Sprites, the FPS completely tanks to 15-20 fps on my M1 Pro.

I am just curious, am I doing something wrong in my implementation.

dapper locust
spring nexus
#

Thanks @dapper locust I added logic where I am spawning sprites when a user presses space key, so I can gradually increase sprite count. This logic is inside update function. can this be a problem?

hallow blade
#

Remember to run with --release

spring nexus
#

I tried my code on Windows and it's working fine. Previously I was testing on MacBook. On Macbook I am getting very unstable and fluctuating fps. But on Windows it's stable and everything is working fine.
Yes, I have been testing with --release

dapper locust
karmic elm
#

@boreal mango you might want to look at this and see if your SpriteMesh would help here

tough hill
#

Why not use instancing if they the same parts/models?

karmic elm
#

The numbers shared honestly don't make sense unless it's running in debug, it's a very very old computer or there's a bug

spring nexus
#

I am using Macbook M1 pro. So it's sligtly old but not very old. I am using release mode. I tried my code on Windows with RTX 4060ti and I can see easily see 50k sprites at 60 fps and the fps are stable. But on mac same code gives very unstable variable fps even with 10k sprites like 58, 75, 96, 113 fps. Once in a while dropping to 30fps. Another thing I noted, on Mac even when I don't render anything just a text node with fps counter, the FPS are still variable and jumps between 100 to 260fps. So I am guessing something is weird between mac os 26, bevy or my monitor.
This is my updated code that is slightly better performing than my first shared code.

spring nexus
#

I ran the official many sprites program, and still get variable FPS. These were the FPS between 31st to 40th seconds: 104, 85, 75, 72, 58, 84, 155, 196, 179, 87, 73, 69, 77

git clone --branch v0.17.3  https://github.com/bevyengine/bevy.git
cd bevy
cargo run --release --example many_sprites
boreal mango