#Rhythm Game SpawnTiming Help..?

1 messages · Page 1 of 1 (latest)

craggy roost
#

Hey! I'm trying to find out how to fix one of the most fundamentally wrong things with my game, and the largest one by far is Spawntiming. Notes spawn a few MS before or after their designated time, and game lag can mess this entire thing up and cause fucktons of notes to spawn.

#

when moving lanes with chartmap files, they also are kinda choppy too as they move ms after each other

#

This is the main code for spawntiming:    ```     IEnumerator RunBeatmap()
        {
            #region ModifierMigration++
I'm

#endregion

Debug.Log("Waiting to run...");
            yield return new WaitForSecondsRealtime(2f);
            startedMap = true;
            musicSpeaker.Play();
            musicSpeaker.time = 0;

if (starttime > 0)
                musicSpeaker.time = starttime;

Debug.Log("Running beatmap...");

while (currentLine < (json.Length - DisregardedNotes) - 1)
            {

if (timeStampIndex < timeStamps.Count)
                {
                    if (timeStamps.Count > 0)
                    {
                        if (GetAudioSourceTime() >= timeStamps[timeStampIndex] + noteOffset)
                        {
                            Debug.Log("Trying to load a damn note");
                            jsonLanes[laneStamps[laneStampIndex]].CreateNote();
                            timeStampIndex++;
                            laneStampIndex++;
                            currentLine++;

}
                    }
                }```

#

i feel like the problem is this line:

#

              if (GetAudioSourceTime() >= timeStamps[timeStampIndex] + noteOffset)

#

GetAudioSourceTime() just returns the audioSource.time btw