In making a prototype for a game idea I had, I ran into a few problems.
First off, to give a general idea of what the game is supposed to be, there will be zombies randomly spawning around this map, and you are to kill them, as you would in any zombie game. However, your shots must be timed with the beat of the music, as well as the rest of your actions (minus movement), which includes picking up items, reloading, destroying walls, switching weapons, and so on.
The main technical problem is music sync. I specified an offset so that the taps will be on-beat, yet for some reason, the offset is always different and unpredictable. Sometimes it's 0, and sometimes, it's some negative arbitrary number close to -0.12. In the game, I've made it so you can tap to the beat using the WASD keys (and move with the arrow keys but that's irrelevant) and a gunshot noise will play when you do so, along with the timing of your hits in the console, and how far off beat they are. Positive numbers are late, negative numbers are early. I have a feeling that it's something I'm doing wrong with the audio library, that maybe I should load the music first before playing it? I have the load mode for the music set to 'stream' so that might be the issue.
My other problem is more 'gameistic', that when the user taps to the music, the gunshot noises will always seem off sync, and I don't really know how to solve that issue outside of removing the sound altogether, which will give the player less satisfaction when killing the zombies on beat. I have the option of using a less realistic sound as well, but I'm not sure what would be the best option here.
You can find the repository for the game here and I've attached a love of what I have so far for convenience. Any help / thoughts on the idea itself would be appreciated.
Rhythm-based gameplay troubles
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Rhythm-based gameplay troubles
- Attachments
-
- rhythm-zombies.love
- (7.13 MiB) Downloaded 99 times
Re: Rhythm-based gameplay troubles
What a cool idea!
I haven't played it, but Crypt of the Necrodancer immediately came to mind. Maybe you can find some ideas / inspiration there.
I haven't played it, but Crypt of the Necrodancer immediately came to mind. Maybe you can find some ideas / inspiration there.
You could tweak the volume and sound of the gunshots until they become less noticeable and instead award the player with a nice "splatter" sound when he successfully times an attack and hits a zombie (Project Zomboid does something similar for critical hits). That splatter sound could then be synced to the next beat.Kingdaro wrote:My other problem is more 'gameistic', that when the user taps to the music, the gunshot noises will always seem off sync, and I don't really know how to solve that issue outside of removing the sound altogether, which will give the player less satisfaction when killing the zombies on beat. I have the option of using a less realistic sound as well, but I'm not sure what would be the best option here.
Re: Rhythm-based gameplay troubles
I'd say your timing window is to small.
At 60fps you only have two frames to get a fantastic precision, that's why it's more up to luck if you actually hit the beat fantastically.
Good luck with your rhythm game!
At 60fps you only have two frames to get a fantastic precision, that's why it's more up to luck if you actually hit the beat fantastically.
Good luck with your rhythm game!
Re: Rhythm-based gameplay troubles
This is where a part of my inspiration came from, actually. I haven't played it either, but I saw some gameplay of it and thought the concept of a top-down rhythm-based game was pretty cool.rmcode wrote:What a cool idea!
I haven't played it, but Crypt of the Necrodancer immediately came to mind. Maybe you can find some ideas / inspiration there.
I'll see if I can try this out. The audio does need a bit better mixing anyway.rmcode wrote: You could tweak the volume and sound of the gunshots until they become less noticeable and instead award the player with a nice "splatter" sound when he successfully times an attack and hits a zombie (Project Zomboid does something similar for critical hits). That splatter sound could then be synced to the next beat.
The timing window is made this thin on purpose, to mirror that of "traditional" rhythm games like DDR. The fantastic judgement is basically the 'above and beyond' type deal, where if you're consistently getting fantastics, you have amazing timing. Excellent is basically saying "you timed this as well as most normal people can", and great is "try playing when you're not as drunk".undef wrote:I'd say your timing window is to small.
At 60fps you only have two frames to get a fantastic precision, that's why it's more up to luck if you actually hit the beat fantastically.
Good luck with your rhythm game!
Should still probably increase the window at least a little bit, though. A window of five or so frames on fantastic should be reasonable, no?
Re: Rhythm-based gameplay troubles
this doesnt have anything to do with your problem, but i gotta say
you got a good taste in music my friend
monstercat ftw
the music is razihel - children of the night if anyones wondering
you got a good taste in music my friend
monstercat ftw
the music is razihel - children of the night if anyones wondering
Re: Rhythm-based gameplay troubles
Hmm it seems to work pretty well, I had to change the 0.12 timing to 0 offbeat tho.
It seems it goes a bit offbeat, well at least I started hitting more greats when it restarted the song for some odd reason, although I managed to hit all excellent / fantastic for 1 round.
I have played rhythm games in the past ( alot).
I added some more statistic for it to measure the hit of a button interval, aka how much the beat would be between the press of a button so that I can see how accurate my pressings are/when love reads keyboard. I have noticed from the past that keyboards themselves play quite a big role on how well they work, some keyboards at least feel a lot less inconsistent than others.
I tested it also with and without vsync, and in both cases I maanged to hit all excellent / fantastic, so I guess vsync at least doesn't make difference.
I changed the gameplay enter-function so that it loads the song after it has intitialized everything, then calls play. I figured, this would reduce tha chance of randomness happening.
Personally though, I always managed to get same timing, although I didn't boot the computer. I did install asio4all though, and set asio buffersize to rather low 96 samples. And tries before that were less succesful, but on the other hand it takes time to get used to pressing at certain beats + this was time before i also changed the enter-function.
A link to asio4all: http://www.asio4all.com/ From my understanding it does reduce latency and use low latency asio drivers. Although what I understand is that since windows 7 sound systems do have less sound latency than directsound system.
I don't think this helps much though. Nice song though, but after playing it for 30-60 mins for testing purpose, it starts to slightly "repeat" itself.
Edit: I did a bit more testing, but I wasn't able to get the timer out of 0 offbeat. 32 and 64 bit love2d had no change. I disable HPET from bios, no change. I even checked if I have what kind of battery mode, and it was on balanced (desktop). I am using asus xonar dx/xd sound card with unofficial low latency drivers. With low latency drivers, I cannot put on some things from sound playback device settings, like ear etc, so I cannot test if using those would have an impact or not. Also I did boot up, so I might have been running it without asio4all. That program is so weird that I never know if its on or not after you install it. It seems to also affect a lot of weird stuff, like sometimes it cuts off my talk in ventrilo/teamspeak, but I assume it wasn't on when I tried the game.
It seems it goes a bit offbeat, well at least I started hitting more greats when it restarted the song for some odd reason, although I managed to hit all excellent / fantastic for 1 round.
I have played rhythm games in the past ( alot).
I added some more statistic for it to measure the hit of a button interval, aka how much the beat would be between the press of a button so that I can see how accurate my pressings are/when love reads keyboard. I have noticed from the past that keyboards themselves play quite a big role on how well they work, some keyboards at least feel a lot less inconsistent than others.
I tested it also with and without vsync, and in both cases I maanged to hit all excellent / fantastic, so I guess vsync at least doesn't make difference.
I changed the gameplay enter-function so that it loads the song after it has intitialized everything, then calls play. I figured, this would reduce tha chance of randomness happening.
Personally though, I always managed to get same timing, although I didn't boot the computer. I did install asio4all though, and set asio buffersize to rather low 96 samples. And tries before that were less succesful, but on the other hand it takes time to get used to pressing at certain beats + this was time before i also changed the enter-function.
A link to asio4all: http://www.asio4all.com/ From my understanding it does reduce latency and use low latency asio drivers. Although what I understand is that since windows 7 sound systems do have less sound latency than directsound system.
I don't think this helps much though. Nice song though, but after playing it for 30-60 mins for testing purpose, it starts to slightly "repeat" itself.
Edit: I did a bit more testing, but I wasn't able to get the timer out of 0 offbeat. 32 and 64 bit love2d had no change. I disable HPET from bios, no change. I even checked if I have what kind of battery mode, and it was on balanced (desktop). I am using asus xonar dx/xd sound card with unofficial low latency drivers. With low latency drivers, I cannot put on some things from sound playback device settings, like ear etc, so I cannot test if using those would have an impact or not. Also I did boot up, so I might have been running it without asio4all. That program is so weird that I never know if its on or not after you install it. It seems to also affect a lot of weird stuff, like sometimes it cuts off my talk in ventrilo/teamspeak, but I assume it wasn't on when I tried the game.
Last edited by Muris on Fri Feb 06, 2015 10:06 pm, edited 1 time in total.
Re: Rhythm-based gameplay troubles
You can sync the gunshots to the beat by delaying the play request and only fulfilling it on the beat. I'd recommend putting a limit so the delay only happens if you get Excellent or Fantastic, and for Great/Decent/Miss it plays normally
I don't have time to check how it would feel though.
Code: Select all
if math.abs(time-nearestbeat) < 0.045 then
-- wait for time-nearestbeat seconds...then play gunshot
else
Sounds.gunshot:play()
end
Re: Rhythm-based gameplay troubles
Thanks a ton for all the input!Muris wrote:Hmm it seems to work pretty well, I had to change the 0.12 timing to 0 offbeat tho.
It seems it goes a bit offbeat, well at least I started hitting more greats when it restarted the song for some odd reason, although I managed to hit all excellent / fantastic for 1 round.
I have played rhythm games in the past ( alot).
I added some more statistic for it to measure the hit of a button interval, aka how much the beat would be between the press of a button so that I can see how accurate my pressings are/when love reads keyboard. I have noticed from the past that keyboards themselves play quite a big role on how well they work, some keyboards at least feel a lot less inconsistent than others.
I tested it also with and without vsync, and in both cases I maanged to hit all excellent / fantastic, so I guess vsync at least doesn't make difference.
I changed the gameplay enter-function so that it loads the song after it has intitialized everything, then calls play. I figured, this would reduce tha chance of randomness happening.
Personally though, I always managed to get same timing, although I didn't boot the computer. I did install asio4all though, and set asio buffersize to rather low 96 samples. And tries before that were less succesful, but on the other hand it takes time to get used to pressing at certain beats + this was time before i also changed the enter-function.
A link to asio4all: http://www.asio4all.com/ From my understanding it does reduce latency and use low latency asio drivers. Although what I understand is that since windows 7 sound systems do have less sound latency than directsound system.
I don't think this helps much though. Nice song though, but after playing it for 30-60 mins for testing purpose, it starts to slightly "repeat" itself.
I have found that the sync issue seeems to be resolved when the song is loaded statically as though it were a sound effect, and it makes sense, so that seems alright. It shouldn't at all be going offbeat, though, because the game uses the position of the song's source itself to figure timings.
And yeah, the music is made to loop and does get hella repetitive, but the actual level won't be that long. I'm thinking I might make more levels with different (non-copyright) tracks if this actually does take off.
I considered this, but this only works if your hit is timed early. If it's late, there's no good way the game can tell whether you hit it in the future, unfortunately.Duster wrote:You can sync the gunshots to the beat by delaying the play request and only fulfilling it on the beat. I'd recommend putting a limit so the delay only happens if you get Excellent or Fantastic, and for Great/Decent/Miss it plays normallyI don't have time to check how it would feel though.Code: Select all
if math.abs(time-nearestbeat) < 0.045 then -- wait for time-nearestbeat seconds...then play gunshot else Sounds.gunshot:play() end
Re: Rhythm-based gameplay troubles
[quote=Kingdaro ]The timing window is made this thin on purpose, to mirror that of "traditional" rhythm games like DDR. The fantastic judgement is basically the 'above and beyond' type deal, where if you're consistently getting fantastics, you have amazing timing. Excellent is basically saying "you timed this as well as most normal people can", and great is "try playing when you're not as drunk".[/quote]
I understand, but even a time window of 0.025 instead of 0.02 makes a huge difference from my experience.
I've just recently started a thread on reddit to get an overview of indie rhythm games, it might interest you as well!
I understand, but even a time window of 0.025 instead of 0.02 makes a huge difference from my experience.
I've just recently started a thread on reddit to get an overview of indie rhythm games, it might interest you as well!
Re: Rhythm-based gameplay troubles
That's fair. Now I mostly just stole the timing windows that Stepmania uses which is similar, so that should be fine for the time being.undef wrote: I understand, but even a time window of 0.025 instead of 0.02 makes a huge difference from my experience.
Sweet, I'll check it out.undef wrote: I've just recently started a thread on reddit to get an overview of indie rhythm games, it might interest you as well!
Who is online
Users browsing this forum: Ahrefs [Bot] and 204 guests