#[Playtesters wanted] LilyLilyHop - rhythm music game about eating flies to the beat
14 messages ยท Page 1 of 1 (latest)
nice!
That is SO GROOVY
Iโve played it and can confirm it is made of JAM! Jammy!
how'd you get it synced so perfectly?
I tried doing some rhythm stuff and syncing music to timers, but seems especially if you change tempo (in kira even with no easing) things get out of sync a bit, which if you change tempo all the time leads to it being out of sync very fast ๐
it's not just one track, it's a selection of clips from different categories that are picked randomly and played simultaneously
also @cinder fable do you want to playtest?
i'd need to know more about what you're doing. what's getting out of sync exactly?
basically imagine something like a progress bar that counts the beats, so for example if it's at 120bpm I'd just run a timer at 0.5s ... that seems to work, but speeding up and slowing down with the following (and changing the timer accordingly) seems to make the timer go out of sync
.set_playback_rate(
PlaybackRate::Factor(speed as f64),
Tween {
start_time: kira::StartTime::Immediate,
duration: Duration::from_secs_f32(0.0),
easing: kira::tween::Easing::Linear,
},
)
I'd imagine this is because this gets pushed into a queue that's not flushed immediately? I noticed that if I push this on each frame I just get errors saying the queue is full, but even if I only push it on change and change the speed like once per second they still kinda desync hmm
I guess imagine the same timer like you have in the video you posted, just have it speed up or slow down based on what's happening in the game
@next loom is the timer on the gameplay side? you're correct that when you call set_playback_rate, the audio thread won't respond immediately, it could take up to 10-ish ms for that to start
yes the timer is in the game, so running independently of kira, ... hmm I guess looking at the API if I used handle.position() (https://docs.rs/kira/latest/kira/sound/static_sound/struct.StaticSoundHandle.html#method.position) it should remain perfectly in sync? as in not even using a timer, just calculating the offset based on the position kira provides
yes, handle.position() could be helpful. keep in mind that it only updates once per buffer, which iirc is about every 10ms, so it may not update as often as your gameplay code. for lilylilyhop, i keep a separate gameplay timer, but i check it against the audio clock's time and gradually adjust it if it gets out of sync
makes sense ๐ I guess even if it's 10ms ahead/behind while it synchronizes it's not that big of a deal, thanks!