from Matty_r@programming.dev to rust@programming.dev on 11 Oct 01:46
https://programming.dev/post/38886251
Hey all, I’ve been contemplating what approach I should take in my app, think along the lines of mapping with lots of UI elements but also a 2D portal/window for showing the map etc.
I want it to be cross platform so thought I’d go with Egui and look at implementing the “game” parts to that. But as I thought more about it, maybe it would be more beneficial to use Bevy and rely on its UI framework.
Thoughts? Maybe Bevy would be easier, but might be too much of a hit on performance because its not a game that I’m making. Egui might be more difficult to add the game stuff, but more performant and not running a full game engine.
I’m really conflicted. It would be good to be able to turn off/disable the game part of it to reduce load if it isn’t needed at the time
threaded - newest
Use Bevy with egui, just disable needless features. You’ll get performance hit until there is an actual complete game inside.
For a graphics-intensive application, this (or something custom with egui).
Bevy also doesn’t need to redraw every N milliseconds or anything. You can create a custom game loop and redraw only when needed, whether that’s 60fps or only on window event.
There’s also no reason a Bevy app couldn’t be embedded within a larger application. You can create the Bevy app when needed, render to a render target rather than the window surface, then manually draw that where you need to in your egui app. This also means you can stop the app, or at least the game loop, when it’s not needed anymore.
On the other hand, bevy is such a neat general manager and framework. You can run crossplatform parallel async within it, stall things with timers, set custom loop rates. I’m experimenting with using it as non-game frontend, and so far it seems much more suited for fast development than those reactive frameworks imitating js frameworks if something more complicated than simple ui is needed. The gaming community cares for each othes, so sweet. The only downside is 30mb wasm file for prototype level of complexity app, but I haven’t even started optimizing yet, and it will not grow much probably once it becomes super sophisticated.
Sounds like Bevy would be the way to go, I found the bevy_egui crate which seems like it might be what I’m looking for to get started.