Guitar Hero Game
Author |
Message |
Lithium_Debator
|
Posted: Sat Jun 14, 2008 12:25 pm Post subject: Guitar Hero Game |
|
|
Hello everybody
I am creating a guitar hero game for my final project ISU, and am running into one major problem, which no matter how much i try, i cannot fix. TIMING!
Now, I have a file with all of the timing for the notes, and I know it is right, because I have a simple file that runs a test of the game for me to allow me to see and check them. The problem occurs when there is more happening on screen, as soon as there are more than 8 or 9 notes on screen, the game lags, not allot, just a little, but it's enough to screw up the timing. And before anybody comments that i might need to be running on a better machine, I'm running a dual core extreme processor with 3 gigs of ram, and my graphics card isn't too shabby either. I'll post my current code, and let me know what you think. I appreciate any help in advance.
Please note that my file will not run for you without the music, which i cannot post because of the immense size.
Description: |
|
Download |
Filename: |
readIO test.t |
Filesize: |
8.06 KB |
Downloaded: |
198 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
DemonWasp
|
Posted: Sat Jun 14, 2008 12:51 pm Post subject: RE:Guitar Hero Game |
|
|
You can easily just tell us to rename any old music file to the correct name, in the correct directory. That, along with this YYZ Notes.txt file should let us run your program.
Without being able to run your program, we'll probably have a hard time helping you.
Also worth noting is that Turing will only use a single CPU (not two...possibly if you use processes, but I doubt it), and won't actually use your graphics card. Nice system, though.
|
|
|
|
|
|
Tony
|
Posted: Sat Jun 14, 2008 1:38 pm Post subject: RE:Guitar Hero Game |
|
|
DemonWasp is right, Turing doesn't take advantage of your hardware. Actually most languages don't, unless you tell them to. Though that's besides the point.
I think your problem might be in all those forks. Your program doesn't "lag". But I've noticed there are a bunch of delay statements in every fork for a note. So when you are checking for every note, you are running 5 of those delays, so they accumulate. I'm not sure if that's the actual case, but it might be.
Also keep in mind that the run-speed will be quite different on other, slower, machines. You might want to use Time.DelaySinceLast for frame-rate control.
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Lithium_Debator
|
Posted: Sat Jun 14, 2008 7:36 pm Post subject: Re: Guitar Hero Game |
|
|
thanks for the quick response guys, I'll post the YYZ Notes file as soon as i have it available, as it's still having allot of work done to it. For the mean time, i have the begginings of the file, and i will post those. As for the music files, if you have the song YYZ by rush, you can just run it alone, the two files are just a split version of the song that i have to allow me to turn off the guitar (ie. for a missed note) but I'm not that far yet.
As for the Time.DelaySinceLast, I'm just looking into it now, looks like it could really help, but the biggest issue right now is getting the notes to move at a consistent speed as to stay true to the timing.
Description: |
|
Download |
Filename: |
YYZ Notes.txt |
Filesize: |
7.34 KB |
Downloaded: |
131 Time(s) |
|
|
|
|
|
|
Tony
|
Posted: Sat Jun 14, 2008 7:44 pm Post subject: RE:Guitar Hero Game |
|
|
As I've said, you need frame-rate control. Better yet, since you don't know how fast the program is running, or if there is any other system-related lag, it might be a good idea to sync up to the system clock. Turing will give you current time in seconds (does anyone know if it can do better?).
Since delays are not perfect and there is system noise, you should rely on the clock for a timer, not series of pauses.
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
petree08
|
Posted: Sat Jun 14, 2008 8:31 pm Post subject: Re: Guitar Hero Game |
|
|
here is a timer program i wrote
could be useful
code: |
%% the Timer Program
procedure Display_Timer (LastTime, NewTime, X, Y, Font1, C : int)
var MiliTime : int
var Hours, Minutes, Seconds : int
var StringTime : string (10)
StringTime := ""
MiliTime := Time.Elapsed - LastTime
Seconds := MiliTime div 1000
Minutes := Seconds div 60
Hours := Minutes div 60
if Hours < 10 then
% put 0 ..
StringTime := StringTime + "0"
end if
StringTime := StringTime + intstr (Hours) + ":"
if Minutes < 10 then
% put 0 ..
StringTime := StringTime + "0"
end if
StringTime := StringTime + intstr (Minutes) + ":"
if Seconds < 10 then
% put 0 ..
StringTime := StringTime + "0"
end if
StringTime := StringTime + intstr (Seconds)
Font.Draw (StringTime, 100, 100, Font1, 12)
end Display_Timer
var MiliTime : int
var Hours, Minutes, Seconds : int
var StringTime : string (10)
var Font1 : int
Font1 := Font.New ("Arial:20")
setscreen ("graphics:max,max,nobuttonbar,offscreenonly")
loop
cls
Display_Timer (0, Time.Elapsed, 100, 100, Font1, 12)
View.Update
end loop
|
keep in mind this code was just to see how long the program has been running in seconds/minutes
you may need to mod/and retool it to meet your needs but this should be a start
this was the basic procedure behinde the timer in my music player app
http://compsci.ca/v3/viewtopic.php?t=18380
|
|
|
|
|
|
Lithium_Debator
|
Posted: Sun Jun 15, 2008 9:05 pm Post subject: Re: Guitar Hero Game |
|
|
Thanks again for the help guys
I am working on implementing the methods of frame rate control that you suggested, but at the same time, I am working on changing all of my notes to sprites, to help relive some of the stress on the system, and to allow for some more exciting graphics later. The only problem is, i cant see the sprites. As a matter of fact, I cant seem to see anything that uses sprites, including the example program in the help files. the only thing that i could think of that could cause this is the fact that I'm running a 64 bit version of windows, as it causes allot of problems, but those problems are only hardware related. I'll post my code anyways, so you guys can look at it, but i still cant post the sound files, as i have tried with them in a .rar and a .zip, and neither would upload, so i got rid of the backup so only the main sound (which is in mp3 format and notably smaller) will be there.
Description: |
|
Download |
Filename: |
GH.rar |
Filesize: |
3.95 MB |
Downloaded: |
115 Time(s) |
|
|
|
|
|
|
Tony
|
Posted: Sun Jun 15, 2008 10:12 pm Post subject: RE:Guitar Hero Game |
|
|
I don't think the Sprite module actually works... use regular Pic.Draw instead.
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Sponsor Sponsor
|
|
|
death bringer
|
Posted: Mon Jun 16, 2008 2:03 am Post subject: Re: Guitar Hero Game |
|
|
Here is my guitar hero i have pics and other things use the code for help if you want i also have music
%Guitar Hero 1.6
%music by dragon force
Description: |
|
Download |
Filename: |
GUITAR HERO DEATHBRINGER.zip |
Filesize: |
9.74 MB |
Downloaded: |
118 Time(s) |
|
|
|
|
|
|
nastynika
|
Posted: Mon Jun 16, 2008 8:40 am Post subject: Re: Guitar Hero Game |
|
|
take a look around the site there r plennty of guitar hero related topics
|
|
|
|
|
|
Lithium_Debator
|
Posted: Mon Jun 16, 2008 2:17 pm Post subject: Re: Guitar Hero Game |
|
|
Thanks Tony, your right, the sprite command only works in Turing version 4.1.1, anything older, it doesn't work. So I have updated my version of Turing, and viola, goodbye lag. That was extremely helpful, as i can now move on to the later parts of my program, except, i have come across a new problem, which I have not the slightest notion of how to fix. The computers at my school are not capable of handling my program, so I'm going to have to bring in my computer for the submission of the project. The final project will work from a guitar controller that was made to work through a parallel port, which means i will need to get my parallel port working on my computer. Easier said than done, as I am running a 64 bit version of windows. i have the appropriate support files to open up my parallel port on a win 32 PC, so I guess I'm asking if there is an available 64 bit version of the file used to open the parallel port for Turing to receive input and send output?
And thank you death bringer for your code, it's a very good reference to look to for advice when I'm pulling my hair out as to why something isn't working.
And finally, one last question, I have two different tracks, just as the guitar hero games, and i would like to be able to cause the guitar track to stop when a note is missed, but I'm not sure how to accomplish that. the difficulty isn't stopping the track, it's starting it again at the right time. My original plan was to simply set volume to 0 but Turing seems to be lacking such a command. Any suggestions would be greatly appreciated.
|
|
|
|
|
|
death bringer
|
Posted: Tue Jun 17, 2008 1:29 pm Post subject: Re: Guitar Hero Game |
|
|
kk here is an example from my newest version
Fiddle around with this code in the program you can download below
so as you see if the crowd var is less then 0 the program will delay after showing the end screen
var crowd := 50
if crowd<26
then Pic.Draw (picbad,0,0, picCopy)
end if
if crowd>26
then Pic.Draw (picok,0,0, picCopy)
end if
if crowd>75
then Pic.Draw (picgood,0,0, picCopy)
end if
if crowd<0
then Pic.Draw (picFlat2, 0, 0, picCopy)put "Score: ", score, " Multiplier: ", (combo div 20) + (1), " Max Combo: ", combo,"" Draw.Text ("You were kicked off stage...", maxx div 20 +5, maxy div 2 + 300, Font2, yellow)Draw.Text ("You were kicked off stage...", maxx div 20 +5, maxy div 2 + 295, Font2, red)
end if
if crowd<0
then delay (1000000)% to see your score instead of ending
end if
cls
Input.KeyDown (keys)
for i : 1 .. NODES
node (i).p.z -= SPEED
if node (i).p.z <= SPEED + 1 - 1 then
node (i).p.z += diffspeedgame * NODES
node (i).n := Rand.Int (1, diffgame)
node (i).p.x := (maxx - (maxx div 5)) div 5 * node (i).n
score -= MISS* (combo div 10 + (1))
combo *= zero
crowd -= 1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CROWD
elsif keys (KEYS (node (i).n)) and keys (STRUM) then
if abs (node (i).p.z - (HIT_LOC)) < sqrt (diffspeedgame * 2) then
score += HIT * (combo div 20 + (1))
crowd +=1%%%%%%%%%%%%%%%%%%%%%%%%%%%%CROWD
combo += 1
node (i).p.z += diffspeedgame * NODES
node (i).n := Rand.Int (1, diffgame)
node (i).p.x := (maxx - (maxx div 5)) div 5 * node (i).n
else
Description: |
Fiddle around with it ;p; |
|
Download |
Filename: |
GUITAR HERO DEATHBRINGER.zip |
Filesize: |
9.82 MB |
Downloaded: |
147 Time(s) |
|
|
|
|
|
|
Lithium_Debator
|
Posted: Tue Jun 17, 2008 6:30 pm Post subject: Re: Guitar Hero Game |
|
|
Ok, my program is in a working....non lagging, playable condition, with a few issues.
1. For some reason, it is skipping my test on all of the non hammer-ons that is meant to wait for the strum to be released. In other words, holding down the strum will be quite successful.
2. The fire sprite, which is meant to show on every note played is only showing up on the hammer-ons, which is not right.
Take a look at the code if you get a chance, and let me know what you think.
Description: |
|
Download |
Filename: |
GH.rar |
Filesize: |
4.71 MB |
Downloaded: |
124 Time(s) |
|
|
|
|
|
|
death bringer
|
Posted: Tue Jun 17, 2008 7:33 pm Post subject: RE:Guitar Hero Game |
|
|
Gj but you need to fix the fire in only works on blue node and orange node also the strum isn't working the best if you miss a key it has a short delay probably because of the music sound that you have if you miss the note because i had something like that where if i miss a note it plays a sound but it ended up pauseing the game to play the sound so i touch it off anyways gj i like your positioning i would try that to but i thought of an easier way for me agai Gj
|
|
|
|
|
|
|
|