Making Rhythm game (snapping notes)

Joh

Member
Hi, I've done a bunch of research on the subject and while it seems like GM is not exactly the best friend of Rhythm game (limited Audio system & functions) it seem doable.

borrowing from multiple sources, I went with a deltatime to seconds system to bypass the fps/lag potential issues. And while I'm very early in (haven't even checked how it synchronizes with sound),

I'm facing an odd issue: I can't seem to place notes at a consistant pace/rhythm with "snapping".

Gist of sytem:
create
Code:
seconds=0
fullwindow=60 //1 minute, just the testing time scale (loop)
subdiv=4 //number of subdivision between beats
bpm=120
beatpersec=60/bpm
increment seconds every step
Code:
seconds += (delta_time*0.000001);
on click, create note at second.

Note is created like this
Code:
vbeat=round((seconds%fullwindow)/(beatpersec/subdiv))*(beatpersec/subdiv); //snap
//can ignore the fullwindow, its just to loop position.
sc_create_note(vbeat)
I'm wondering if there's a flagrant flaw in there.
If i click as fast as I can, I can usually have notes in 3 "subbeats" in a row before one skips (even if i didn't slow down) sometimes only 2. If i allow holding (keyboard_check()) all subbeats DO fill. So I'm wondering, do fps somehow cause some "unlucky" beats to be skipped? is there a mechanical limit, say one click takes "0.3sec" thus if a beat was 0.2sec, you eventually miss one? I feel my code should work and it does when I don't use snapping, so I am confused on what is going on.


The idea overall is to be able to place note by ear. but to have them "snap" to beats or subbeats for consistency.
(wasn't too sure, in design or help section, but some previous threads were here, + i am quite open to other designs)

Thanks
 
Top