Guitar Hero Engine - How?

Miscellaneous Forums/General Discussion/Guitar Hero Engine - How?

Hey guys,

I was just wondering if anyone had any ideas on how to go about coding something similar in gameplay to RedOctane/Harmonix game Guitar Hero.

I have the the guitar working with a GUI on screen, so the buttons light up when pressed, strum works, the whammy bar etc, however....

What is the best way to store the fingering information, and then keep it in synch with the music, and play it back at the right speed / tempo, and be in time.

Thanks for any light anyone could shed.

edit: Posted in this forum as it really isn`t specific to 2D/3D/Max, I`m looking for the ideas on how to do it rather than exact code.

The required keypresses are predetermined by the developer and shown in sync with the music. So long as you can ensure that you kick off the playback of the music and the playback of your "on screen indicators", it's just a case of coming up with a pattern that works.

The scoring is then simply "did you hit the right button in line with what's on screen". It's pretty simple - just like the dance games really.

Does BMax support streaming yet?

One thing that's always worried me if I were to code my own GH spin-off (which will likely never happen since I play GH3 to death everyday...can't, fricken, beat, Dragonforce..) was the fact you'd have to deal with multiple audio streams (one for lead, one for bass/rhythm, and one for vocal/drum), and making the engine capable of keeping the graphics up with the audio regardless of interuptions and slowdowns.
(which is never the case with a console since they don't have antivirus, firewalls, windows running in the BG...)


On a random note rIk, if you can, make all the buttons configurable, so people can run the thing on any random controller they may have.
(such as my Wii GH controller which I use on my Mac)

I was just wondering if anyone had any ideas on how to go about coding something similar in gameplay to RedOctane/Harmonix game Guitar Hero.


The open source project mentioned on Coding Horror should be helpful.

Cheers guys.

Mark:
I know that is what happened, I`m more lacking an understanding of "how" it happened.
ie. How are they ensuring the scrolling down the screen is in synch, at the right time....are they using timers with info from text files or simply making a 3d level of the layout and running a camera through it (I know that would never happen but you get what I mean).

I know a couple of the free GH-clone games use xml files with the info of what button, start time of when pressed, and length it is held for - which makes complete sense......
but how are they then translating this into the game to scroll at the correct time. Is this even possible with Blitz audio commands?

Maybe I`m making this more complex than it really is - I just cant get my head around it.

Genexi:
GH3 - I just did Tenacious D - The Metal on Expert, took me a couple of hours!
I`m on level 7 now and have just done Stricken...wish me luck :)

To start with I just knocked up a front end to see if the guitar would work (360 wired GH2 guitar) and now it has, well I hadn`t even thought about the next bit - hence this post to get some ideas.

To start with I`ll use some mp3s, but getting 3 tracks for bass/rythm/vocal etc wont be a problem as a lot of my friends are in bands and record regularly.

I would make all the noted configurable also, but I`m concentrating on the guitar atm just for fun :)

Sledge:
I have played this and this is what got me curious as to if I could get he guitar working myself - which I did.
Unfortunately it is coded in Python, which I don`t get - and as I said I`m more looking to understand "how" it works rather than getting a bit of code.

I agree with that review tho - I stopped playing because it looked pants...theres a jave one too called Freetar which has a cool editor.

You load in the mp3, hit play and it records whatever you press as the song plays, you then save and load that into the game and it is playable.
How is this possible - what is the theory behind it...what are they doing to take the info and store it and then play it back as a level, in time and in synch?
As I said above its to do with timing, how are they making the times recorded in the txt file (for example) scroll down and be at the right time/place on screen as the song is playing?

Any other ideas / suggestions / theories welcome :)

Can I just be a total bad guy here and state that guitar hero is utterly retarded? Its like simon of this century. But without the memory part. Plus coming from someone who plays many instruments its just a disgrace. Anyone who has the ability to keep time and a rhythm sucks horribly at this game. If you mute the music I can get a near perfect score on the hardest settings.. but you throw the music on there, the hits are all off time and not real notes its just.. ahhh I want to pull my hair out.

Ok sorry about that.. just one fellas opinion.. Now, I suggest that you look into "Frets on fire" its a freeware pc game that uses the actual data files/music from the guitar hero games. Tearing those apart manually will give you a pretty good idea on how that did it... I would just mimic that because it seems to "WORK"... using the term loosely. If I were you id do something original with the same concept.. maybe something that isnt a disgrace to musicians haha.

Peace,
Scott

I'm gonna do two individual posts for two people here:

Vertigo - sounds like you need to calibrate the lag - especially if you are on an HD tv.

My son is a pretty excellent musician (he is only 15 though) and he rocks at Guitar Hero - all versions. He can play it in sync with his back turned to the tv on some songs, once he has started.

Now that's keeping in rhythm not learning the frets btw. Perhaps its just sensory overload for you Vert? ;)

Anyways although being a doubting Thomas to begin with I now think its a very clever game and very enjoyable, even for us mid-aged chaps.

IPete2.

.rikman,

Im right at the finishing line on a game I have been working on solidly since Feb this year. One of the big issues I had was how to mimic the Diddy Kong Racing style of music transforms - where the same tune is played throughout each section of the game but as you approach different areas the instruments change based on being near a beach or a snowy mountain etc. I believe they did it using Midi sounds knowing that every N64 had the same installation of midi instruments. But my game is a PC based game and although I have control over the kiosks it'll be played in I wanted proper composed music in the form of OGG playback files.

In my game I needed to have at least five different pieces of music in every level - all keeping in sync with each other. One evening I was playing Guitar Hero II with my son and a friend and we were wondering how it was done... as I sat there it dawned on me one way it could be achievd was to paly multiple tracks in sync and simply alter the volume level if the user makes a mistake - this gave me the clue as to how to achieve my musical mixing live in my game. It's nothing clever really in fact at first I thought, "Nah,m no way is that a good idea!" - I was sure that would cause issues on an already over straining cpu, but I was wrong.

Simply put I run 5 tracks of music all at the same time and crudely put I fiddle with the volumes of each as I get to differennt sections of the game - works a treat, and its how they did the music respons to player input in Guitar Hero I reckon.

IPete2.

Vertigo
I agree with iPete - calibrate the guitar and whammy.
With GH2 and GH3 I have never noticed anythin "out of time" and each song is perfectly in synch.

However, I have also played about 4 of the Custom GH2 disks - in which pretty much EVERY song is out of synch or badly created so it is way out of time with the music.
Maybe you were playing a "Custom GH2"....?

iPete2:
That is the general idea I had for the music playback....if note hit then volume as per normal, if note missed then play a clunk sound and lower/higher the volume of playback progressively as the player hits/misses notes.

However - as I said, my head is really struggling with the concept of getting the stored info back displayed on the screen in time t the music.
ie. Example of stored info

Channel=1
NoteHit=1.565
NoteHeld=5.235

Channel=3
NoteHit=1.565
NoteHeld=5.235

etc etc etc...those times are in seconds.

So I know that I must hit Green and Yellow at 1.565secs into the song, and must hold them down for 5.235secs after I strum.

So...how do I make some sort of graphic (is it a plane?) scroll down the screen and when the music starts playing, 1.565secs into it my Red/Yellow gfx must scrll down the screen, in time with the music.

This is the biggest thing i dont get - what is being done to scroll at the correct time, what system, what exactly is happening?

Hope someone can help - my head hurts! :)

Could always look at the source to my Fight Tune, thats on my website (I think)...

Cheers for that, I`ve no idea what it is but I`m checking it out right now :)

edit: Just looked and that is interesting, but damn its hard :)
It doesn`t seem like the notes you have to hit interact or are in time with the bg music in any way though - or maybe I`m wrong?

Its probably around 5 seconds out - give or take. I could probably have sorted it, but I cant be bothered now.

It does use the music information though, to decide which arrows to create.

A. For some reason I like my Wii GH3 over my PS2 GH3... The controller is better, the lack of the 2 hour pause for saving is nice, and it just works smoother.

B. I have been playing guitar since I was 8 (22 years ago) and it was hard for me to pick up guitar hero... Still hard for me to play GH. One thing that gets to me is the lack of playing an open string. Most of the songs off all 3 guitar heroes I can play (exception being the 80's GH which many of the songs are unknown to me) and many of them require an open string here and there which I am so used to playing that it screws me up when playing GH. Stupid I know but when I finally get the pattern down and then mess around on one of my guitars a week later I find myself having difficulty with the song itself because I am used to hitting something on an open string note :-(

Perhaps there are some guitar players that can empathize with me on this one..

@Dark Half: I'm a musical producer and professional guitar player and I've tried to play GH2 and 3, but it was just impossible for me!!!! I tend to replicate what I hear but I miss strings and everything, It just drives me crazy!

Yeah, sad part is your fingers have played a song a certain way, or when you hear a note you know where the fingers should be placed without even thinking about it.

Like you hear a chord (lets just say a simple C chord or G, or maybe a Dsus7) and your fingers just know where to go. When I am playing Ziggy Stardust on GH1 my fingers are used to a G chord, then a D alternating Dsus4 to D back and forth... The fingers know where to go but GH and the controller and even the way they arrange your fingers on the GH controller fretboard on expert is no where close so my instincts of Ziggy Stardust on the 'real' guitar argues with what my brain is trying to tell it to do...

I saw that south park episode of Guitar Queer-O the other day and it made me laugh so hard when Stan's father is trying to get the boys to play the real guitar and they say "Real guitar is for old people".... So many have GH competitions at bars here locally and so many pride themselves on how good they are at GH but I really like that the real guitar requires more skill, by far, than GH gives credit for. Gives us 'real world' guys a 1 up :-)

http://xkcd.com/70/

Apparently the PC version of GH 3 lags a it - more than the XBox version...

I can imagine it does lag more as it has Windows running behind it chugging along, plus all the other processes etc associated with Windows.

Back to my original post...

I have done a fair bit of reading and it seems the best way to go is to use a MIDI track to record the keypresses etc and then as that plays along with the actual music (mp3/ogg whatever) code something in Blitz that can read the MIDI information (when pressed / how long for) etc and then check this against the bit I have already done (input from the guitar)...

DOes anyone know if Blitz is able to do this sort of thing with MIDI`s - the sound commands seem fairly limited.

Thanks in advance for any help / further ideas & suggestions.

Been doin a bit of work (hence 4.30am!), and have again got stuck - ho hum.

I can load a song, get the BPM, and my program will light up the buttons according to a file it loads that stores the button presses, times, length held etc.

However, I`m hoping some mathy person can help.

How on earth do I go about scrolling things at the right time on the screen when all I have is a BPM.
I also know at what times buttons have to be pressed/held down for)
I could actually play a song with the guitar if i knew the buttons to press - there is just no graphics so u dont know what/where to press.

Is there some formula to be used to convert a bpm into a value to scroll things on the screens... in 2d/3d?
Maybe some way to use the fact I know which buttons need to be prerssed at what time to make them scroll according to a timer using millisecs() ?
But even then, how do you know when to start scrolling so the gfx reach a certain point on the screen at an exact millisecs() time?

The graphics would need to scroll down, and then "hit" the bottom section at the exact time you are meant to play it on the guitar (press the button).

The checks aren`t made against these graphics (they are done against the data in the txt file), but they need to be accurate so the user is seeing/pressing them on the screen and they match with the txt file data.

Thanks for any help you can give!

But even then, how do you know when to start scrolling so the gfx reach a certain point on the screen at an exact millisecs() time?

The notes would be displayed ahead of time (start moving the notes from the back 3-5 seconds before the song), as for the timing, only thing I can think of is converting the BPM into millisecs (BPM/60000?) and work from there for moving the graphics.

Thats how I`m doing it at the moment Genexi:

bpm / 60000 = millisecs per beat.

I can set a BPM and my program will do it spot on every time, also as I said above I have it "strumming" based on info in a level file, so it is playing the notes and strumming at the correct time based off times and info that I have preset.

Its the graphics you mention that is the problem, they need to tell the player when to strum so it has to be pretty accurate and in time with the preset times in the level file (ie. at 7.45s, green button, hold for 1.5s)
I`m crap at maths, and I have no idea how to translate knowing the bpm and times u need certain graphics to scroll past a certain bit of screen, into any kind of formula to move pixels / sprites / models in 2d/3d space (all suggestions welcome! :))

Guru`s, please help!

.rIKmAN,

Use what you know...

You know when the bpm - you can get a level file working with this yes? Sounds like you have already done the hard work.

Now you'll have to mess about a little but I reckon if you can set up however many sprites on screen in a line at the bottom of the screen for now - which don't move for now, I think you should just prove you can have control when you want it to begin with.

You should be able to show the beat or strum you want by reading the Level file information but with an offset of some kind - so you are reading it ahead of the sound playback code, lets say the equivalent of 4 seconds.

So the sprites at the bottom of the screen are 4 seconds away from being played and the nearer the top they get, the nearer to being strummed they are. You need to adjust the sprite position on screen vertically to show the file information between the time you are 'pre-reading' the file information (bottom of the screen) and the time you actually have to strum the note (the top of the screen).

Does this make sense?

If you can get it moving up the screen and being in the top position when it is being strummed then you have the code, you just need the length of strum/hold whatever (which is easier than you think) and the graphics re-positioning so you see them coming up the guitar neck.

For the length held down look up timers in blitz, these should be able to offer what you need, but do everything indirectly through variables and not directly by just looking at key presses. Put the key presses into variablea and only call timing functions once they are pressed - and when they are no longer pressed for the length.

IPete2.

If you're going to clone a guitar game, at the very least clone the far superior (and now 10 years old) Guitar Freaks.

http://en.wikipedia.org/wiki/Guitar_Freaks

I'm surprised Konami haven't sued Red Octane.

IPete
I had a play around with the code last night, and rewrote it from the small test it was to a properly laid out one - using types etc etc.

Anyway, I basically played about with your idea.
So for example,if I scroll at 3 pixels a second, it takes me 3.125 secs for the button graphic to get from the top the screen, to the bottom (where it needs to be pressed).

So using this I stored the "note time" (when it is meant to be played ie. 7.35secs), and also another value which is (time - scrDelay ie. 7.35 - 3.125) which is the value I check against a timer to see if the graphic should be displayed yet.

It`s kinda working, and kinda not..... I`m still thinking I need to work out some kind of formula so the scroll speed will be adjusted accordingly depending on the the BPM of the song being played.

Any ideas still welcome!

Possibly a red herring, but doesn't FMOD offer some kind of marker-system that lets you sync game logic to music? A feeble foggy memory says it might...

If it had, I would have liked to use it :)

OK - how about this. When I was fiddling with FMOD and music visualisation, you could definitely reduce a stream to a real-time array of values via the hmmm ?DSP engine?

Why not overlay in a music editor an extra (silent) music track that contains the notes you are meant to press (or their simple equivalent) and then run that track through the DSP and your note events will then be spat out into the array on playback?

- David

PS - this could be utterly hair-brained. It was one of those ideas you get in the middle of the night and then type in bleary eyed 'cause you won't get back to sleep until you have!

David:
When you say an extra track - on what type of music file are you talking about - MIDI?

I have not used FMOD before, I did take a look at the big thread on it but it seemed overly complicated for what I wanted to do (which I thought was simple!)

I`ll post some code if I get chance later, maybe somebody can see where I`m goin wrong, or what I need to add to make it right.

Which bit of FMOD should I be looking at specifically?

I used the Spectrograph system in FMOD - but that wont help with timing...

Done a bit more homework and from what I understand at the moment, its looking like BASS is going to be suitable for what I want.

I need to re-read tomorrow to clarify my understanding of some of the stuff it does, but for now it looks good.

EDIT:
Can`t seem to read the fact that a note is being played in a loaded midi file.
I can get other info from it and change volume etc, but using:
ch=BASS_MIDI_StreamGetEvent(midi,0,MIDI_EVENT_NOTE) constantly returns -1 (error) and then error code 37 (BASS_ERROR_NOTAVAIL)

The midi file I made has 1 track, with 1 channel and 1 repeated note (sound 1 - piano)

Am I using the wrong command - should I be looking for something other than a note?

Personally I would just store key positions as offsets in samples of audio, and calculate where to draw them on screen relative to the current playback position of the audio.

most audio API's allow you to get the current position in samples. (samples meaning 4 bytes (really two shorts) for 16bit stereo ect)

So if the audio is playing at 44100 hertz, you know that when the playback cursor is at 44100 samples it has played for one second.

To relieve this topic....

Guitar Hero uses a package system for each song. The package contains these kinda files...

-"Guitar.OGG": The main guitar track
-"Rythem.OGG": The rythem guitar track if needed.
-"Song.OGG": The rest of the songs track (drums, vocals, synth)
-"Song.INI": The info for the song. Default characters, stages, titles, loading screen, etc.
-"Notes.MID": This is the main treat! This holds all the note info. There is only one of these and it holds all difficulties. Easy starts at C5, Medium is C6, Hard is C7, and Expert is C8. This also keeps the Tempo.


I am making a GH clone that will hold the ORIGINAL songs (if you own the PS2 versions).

Who would have thought that a game which needs an external device you have to buy on top would be so successful. I wouldn't...

As for the how i also would have gone for different files storing music/instruments and playnotes unless you can't access a tracker format or enable for an easy version syncs like in Flash for instance. But also there it would take some additional information to mark what's of interest ubnless you don't reserve some special channels for this.