rhythmic Spawn

0 favourites
  • 6 posts
  • Guys I'm here again to ask for your help I have tried in every way but I have absolutely not been able to perform what I want to do.I explain as simply as possible what I need.I have to spawn object X and Y at a certain time . Example I have my player that has to hit X and Y sometimes at the same time and sometimes not, it depends on the rhythm I gave to the song If I use the system option every X second Every time I have to jerk X and Y then I will have to write 2 million of lines of code, considering that at each track X&Y will appear at least 100 times. Some of you suggested me to create an array with the times in which I want objects X and Y to be spawned. can you give me a small example?

    Let's say that during the duration of the song, for example one minute, X and Y are spawned sometimes at the same time and sometimes not, in a perimeter of let's say 100 pixels because I want my character to move.

    How can I store the information I have, so the times I want X&Y to be spawned? Is Larray the only solution? If any of you have the time and desire to help me I would appreciate it very gladly especially if related by a written example because I am filling my head with information and today when I look in the mirror I look like Albert Einstein, but a lot and a lot less intelligent than him!

    Tagged:

  • Buckle up buttercup, this one is some real work.

    I have tried in previous projects to detect based on amplitude and frequency of audio, and found the audio object lacking in this ability.

    I will show you how to prerecord it with a string, using your own "beat studio environment":

    Step zero: Create a variable to track how many ticks since you've started your song.

    Step one : record your inputs to a variable, that is updating to an on-screen textbox. Do this in a way we can later separate the values based on the times.

    So if you hit x set textbox to textbox.text + "X," + timerSinceSongStarted.Value + ";"

    And if you hit Y set textbox to textbox.text + "Y," + timerSinceSongStarted.Value + ";"

    So now you've created a string that closely represents when you expect spawns versus the time the song has been running and it looks something like this:

    X,122;Y,125;X,134;Y,134;

    Step 2: Copy this string out of your textbox, back into a local variable and use a repeat tokencount(string,';') times and tokenat(string,loopindex,';') to access each value as time progresses with your song playing again, and make it show a sprite or something on each beat. Use this visual data, to manually modify the strings timer values, to calibrate the values to match the game better than your original reactions allowed when recording your inputs. Tweak a value here and there, when you notice one of your inputs doesn't match the song as well as you'd like. It will be helpful to add an on-screen viewer of the timers value, so you can track down inputs you want to change.

    So now we still have a string of "tokens" that closely represent when we expect spawns to hit, you will need one of these for each song.

    Step 3: In your game, you will want to load up a song string into an array, before its played. so you can access that array at x where x will be the songs timer.

    I wont post the exact way to load it into the array, but I will give you direction: Use array insert to add values to the array, make the position in the array match the timer we stored with the tokens. You can loop through your token string as we did before with repeat tokencount times to insert all the values.

    Then when a player is actually playing, continuously test the current song timer against the array, and spawn the correct object represented by the array value stored there.

    Understanding arrays is the backbone of large data manipulation and an important hurdle for most coders. It's just a spreadsheet of values accessed by position but understanding it truly is fundamental. Key'd arrays are easier to understand, but really, x,y,z are all you actually need.

  • I have tried in previous projects to detect based on amplitude and frequency of audio, and found the audio object lacking in this ability.

    Isn't the Audio Analyzer example providing you with a way to get the magnitude and frequency from your played audio ?

  • Buckle up buttercup, this one is some real work.

    I have tried in previous projects to detect based on amplitude and frequency of audio, and found the audio object lacking in this ability.

    I will show you how to prerecord it with a string, using your own "beat studio environment":

    Step zero: Create a variable to track how many ticks since you've started your song.

    Step one : record your inputs to a variable, that is updating to an on-screen textbox. Do this in a way we can later separate the values based on the times.

    So if you hit x set textbox to textbox.text + "X," + timerSinceSongStarted.Value + ";"

    And if you hit Y set textbox to textbox.text + "Y," + timerSinceSongStarted.Value + ";"

    So now you've created a string that closely represents when you expect spawns versus the time the song has been running and it looks something like this:

    X,122;Y,125;X,134;Y,134;

    Step 2: Copy this string out of your textbox, back into a local variable and use a repeat tokencount(string,';') times and tokenat(string,loopindex,';') to access each value as time progresses with your song playing again, and make it show a sprite or something on each beat. Use this visual data, to manually modify the strings timer values, to calibrate the values to match the game better than your original reactions allowed when recording your inputs. Tweak a value here and there, when you notice one of your inputs doesn't match the song as well as you'd like. It will be helpful to add an on-screen viewer of the timers value, so you can track down inputs you want to change.

    So now we still have a string of "tokens" that closely represent when we expect spawns to hit, you will need one of these for each song.

    Step 3: In your game, you will want to load up a song string into an array, before its played. so you can access that array at x where x will be the songs timer.

    I wont post the exact way to load it into the array, but I will give you direction: Use array insert to add values to the array, make the position in the array match the timer we stored with the tokens. You can loop through your token string as we did before with repeat tokencount times to insert all the values.

    Then when a player is actually playing, continuously test the current song timer against the array, and spawn the correct object represented by the array value stored there.

    Understanding arrays is the backbone of large data manipulation and an important hurdle for most coders. It's just a spreadsheet of values accessed by position but understanding it truly is fundamental. Key'd arrays are easier to understand, but really, x,y,z are all you actually need.

    well, at the very least I'll start studying in detail everything you said to me. many things I am not able to do them but I will try with all my strength. thank you very much for the detailed explanation.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I made a sample two years ago that uses an industry standard format called StepMania Song File (uses the extension .sm)

    there are plenty of songs you can download to look at, and probably programs that will generate the beat files based on your input.

    I don't remember much about the format now, but you can take a look at what I did:

    https://www.rieperts.com/games/forum/dancedance.capx

  • thank you!!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)