Closed claudijo closed 7 months ago
Bevy ggrs already manages its own Time, so you can just use Res<Time>
within the rollback schedule.
Bevy ggrs already manages its own Time, so you can just use
Res<Time>
within the rollback schedule.
Thanks Johan. Currently following your excellent tutorial on https://johanhelsing.studio/posts/extreme-bevy.
A follow up question...
Do you know if there is a (convenient) way to make the GgrsSchedule Time available in shader code as well? I have a shader that renders the ocean waves and typically accesses the same elapsed time as game logic code, via bevy_pbr::mesh_view_bindings::globals::time
. The idea is to sync the rocking of ships (handled by normal game logic) and the rendering of ocean waves (handled by shader code).
Cheers!
It's a good topic for another blog post, and likely something I want for my game as well.
I don't remember the details, but what you want to do is probably set another uniform to Time<GgrsTime>
and write a custom shader.
Thanks Johan. Yeah, that's what I ended up doing.
I'm writing a multiplayer game with ships that are positioned on an ocean with rolling waves. The shape of the waves in turn is dependent on
time.elapsed_seconds()
.So in order to have a consistent game state, I need to sync the elapsed time since startup among peers. Is that possible using bevy_ggrs (and matchbox), and if so how would you go about doing that? Thanks!