So I was experimenting with some Simplex noise map generation. I've created simple test map 128x128 tiles. For each point in the noise array I create a SpriteBundle just to render simple sprite.
if noise_data[x][y] >= 5.5 {
commands.spawn((SpriteBundle {
texture: asset_server.load("plus_button.png"),
transform: Transform {
translation: Vec3::new((x * TILE_SZE) as f32, (y * TILE_SZE) as f32, GROUND_LAYER),
..default()
},
..default()
},
Tile,
));
} else {
commands.spawn((SpriteBundle {
texture: asset_server.load("steak.png"),
transform: Transform {
translation: Vec3::new((x * TILE_SZE) as f32, (y * TILE_SZE) as f32, GROUND_LAYER),
..default()
},
..default()
},
Tile,
));
}
Map size of 128x128 tiles is 16384 sprites, which shouldn't be any issue at all for a multithreaded ecs engine like bevy but I'm getting like 35fps.
So I tested the same map generation in LibGdx which is singlethreaded java game framework. And I've created 256x256 map which is 65536 sprites and I get stable 144fps(monitor refresh rate) without issues.
What am I doing wrong in Bevy ? This doesn't seem right.