Computer Science Canada

need a little bit of help [DDR]

Author:  nightcrawler938 [ Mon Apr 05, 2004 2:56 pm ]
Post subject:  need a little bit of help [DDR]

I have an ISP to do, I am re-creating the game Dance Dance revolution, i have a problem though, i get the user to enter watn song they want, but when the game starts, i cannot get any user input (when the arrow matches up and the user hits the key) and my GUI menus will freeze. I could use alittle help now Very Happy

Author:  Dan [ Mon Apr 05, 2004 4:00 pm ]
Post subject: 

well i have not used the music fuctions in turing but i bivle they are blocking. What this means is that it will stop the progam intill it is done playing the song.

so u will have to uses a process to play the music. An example of this can be found in the turing manual witch i copyed in to this post below:

code:

       process DoMusic
            loop
                Music.PlayFile ("branden3.wav")
            end loop
        end DoMusic
       
        fork DoMusic
        var x, y, clr : int
        loop
            x := Rand.Int (0, maxx)
            y := Rand.Int (0, maxy)
            clr := Rand.Int (0, maxcolor)
            Draw.FillOval (x, y, 30, 30, clr)
        end loop

Author:  Tony [ Mon Apr 05, 2004 7:36 pm ]
Post subject: 

may I introduce you to the wonders of turing v4.0.5 - althought numerically it is just a slight modification (3rd order increase), it really changed quite a bit (well... introduced quite a bit of new functions)
code:

Music.PlayFileReturn ( fileName : string )

and
code:

Music.PlayFileLoop ( fileName : string )

Both procedures return as soon as file starts playing, so your program can go on. It eliminates the need of setting up your own processes (I have my suspecions on its internal workings, but what do I know Rolling Eyes )

You could stop your music at any time using
code:

Music.PlayFileStop

Author:  nightcrawler938 [ Mon Apr 05, 2004 9:10 pm ]
Post subject: 

thank you, its about time holt software didsomething useful

Author:  nightcrawler938 [ Tue Apr 06, 2004 7:28 am ]
Post subject: 

thanks guys the music coomand really worked well, however, it still proves that it is impossible to run music and recieve input at the same time, anyway around that Question i can get all arrows to appear, but user input freezes it up

Author:  nightcrawler938 [ Tue Apr 06, 2004 8:56 am ]
Post subject: 

also, i don't know what i should do for arrows, use grid ?

Author:  Dan [ Tue Apr 06, 2004 3:39 pm ]
Post subject: 

nightcrawler938 wrote:
thanks guys the music coomand really worked well, however, it still proves that it is impossible to run music and recieve input at the same time, anyway around that Question i can get all arrows to appear, but user input freezes it up


Hacker Dan wrote:
well i have not used the music fuctions in turing but i bivle they are blocking. What this means is that it will stop the progam intill it is done playing the song.

so u will have to uses a process to play the music. An example of this can be found in the turing manual witch i copyed in to this post below:

code:

       process DoMusic
            loop
                Music.PlayFile ("branden3.wav")
            end loop
        end DoMusic
       
        fork DoMusic
        var x, y, clr : int
        loop
            x := Rand.Int (0, maxx)
            y := Rand.Int (0, maxy)
            clr := Rand.Int (0, maxcolor)
            Draw.FillOval (x, y, 30, 30, clr)
        end loop



it works, realy, i dont just make this stuff up. i have had input and muscik at the same time.

look:

code:

process DoMusic
    loop
        Music.PlayFile ("streamsound1.mp3")
    end loop
end DoMusic

fork DoMusic

var temp:string

loop
    get temp
    put temp
end loop


works and so dose this in turing 4.0.5

code:

var temp:string
Music.PlayFileReturn ("streamsound1.mp3")
loop
    get temp
    put temp
end loop




but now you may say that it has to do with turing GUI but it dose not

code:


import GUI

procedure DrawRandomCircle
    Music.PlayFileReturn ("streamsound1.mp3")
    var r : int := Rand.Int (20, 50)
    var x : int := Rand.Int (r, maxx - r)
    var y : int := Rand.Int (r, maxy - r)
    var c : int := Rand.Int (0, maxcolor)
    Draw.FillOval (x, y, r, r, c)
    % In case we drew over the buttons, redraw them.
    GUI.Refresh
end DrawRandomCircle

View.Set ("graphics:300;200,nobuttonbar ")
var draw : int := GUI.CreateButtonFull (50, 10, 0, "Draw Circle",
    DrawRandomCircle, 0, '^D', true)
var quitBtn : int := GUI.CreateButton (200, 10, 0, "Quit", GUI.Quit)
loop
    exit when GUI.ProcessEvent
end loop


works fine. sory if i seem pissed but so far you have made over 5 topics realting to this and i dont think you even tryed our solction.

you are knew to the site so i gusse i can undersant it, but plz dont post the same question many many many times. one time in turing help with a good suject name is fine.

Author:  limited_skillz [ Tue Apr 06, 2004 4:10 pm ]
Post subject: 

i tried creating this game as well, i sorta failed though

check out my code though, its not efficient at all, i was such a n00b 3 months ago

just create a text file with numbers 1-4 for the arrows

ex.

1
2
1
3
4
2
1

save as trial.step


when i get the time this weekend, ill redo it because now i know objects

Author:  nightcrawler938 [ Tue Apr 06, 2004 7:43 pm ]
Post subject: 

i have tried it, and i works great but the problem is not just that i must press spacebar to pause music and then the arrows go up and still cannot recieve input, the arrows go up and then the game freezes

Author:  Tony [ Tue Apr 06, 2004 8:03 pm ]
Post subject: 

nightcrawler - you should be ashamed of yourself Rolling Eyes Perhaps you should start paying attention in class - Shannon is a great teacher Wink
code:

procedure DoMusic
    %put usong
    if usong = "Sandstorm" then
        Music.PlayFileLoop ("Darude - Sandstorm.MP3")
        loop
            exit when hasch
        end loop
        Music.PlayFileStop
    elsif usong = "Speedway" then
        Music.PlayFileLoop ("speedway.wav")
        loop
            exit when hasch
        end loop
        Music.PlayFileStop
    end if
end DoMusic

now plz tell me - why do you have those loops in there?!
also why do you set your screen and declear all your menu variables insdie the input procedure?!

I'm sorry - I don't mean offence - but the code looks like shit Confused Maybe you should consider making another game for your project Thinking

Author:  nightcrawler938 [ Tue Apr 06, 2004 9:18 pm ]
Post subject: 

i do pay attention, i manage to have 94 % in that calss Very Happy , i don't really have time to change, you should have seen the code before, it is all bs, i re did my format to make it neater, especially with the GUI Menus,
i have the loops there because hacker dan told me, err, i didn't realize, now i do, but when this happens and the game starts, the GUI MEnus disapper (cls) or the arrows cause streaking effect, so i tried to recreate them, i could use GUI.Dispose, since i'm familiar with that, i also thought of using rand,int to determine where the arrows go (with specific perameters), ?SO MANY PROBELMS,

however turing 4.0.5, helped alot and i thank you for your help

Author:  Tony [ Tue Apr 06, 2004 10:43 pm ]
Post subject: 

well mark in class doesn't mean much Confused

anyways - I'm suspecting that your main problem is the fact that you desided to use turing's GUI Thinking you might consider dropping it and writing your own UI

Author:  nightcrawler938 [ Wed Apr 07, 2004 7:16 am ]
Post subject: 

well i know how to make a GUI button, but have no clue on making my own GUI Menu, would that possibly solve all my problems, shannon thinks i'm going into a whole new world, even i though i agree with Turing's GUI screwing up my entrie program Mad , is there no way around it

Author:  Tony [ Wed Apr 07, 2004 8:04 am ]
Post subject: 

nope Laughing You see that
code:

loop
     exit when GUI.ProcessEvent
end loop

?
That what's driving your GUI and that is preaty much your entire program. Unless you use GUI for user input you just can't tell what user is doing.

You are going into a whole new world and it ain't preaty.

Author:  nightcrawler938 [ Wed Apr 07, 2004 8:15 am ]
Post subject: 

no kidding Mad , but anywho, that loop is crucial, because without it, the menus don't drop down, shannon has informed me that,i've already technically created my own, GUI items, she thinks that creating my own GUI, will screw me over!!!

Author:  omni [ Wed Apr 07, 2004 4:15 pm ]
Post subject: 

I think what tony means is to get rid of TURING GUIS. Make your own from scratch. Draw your own boxes, then do a loop with mousewhere in it.

proc drawOWNmenu
drawboxes..
..
end drawOWNmenu

loop
mousewhere
(if user clicked on the box area, then do whatever that button was supposed to)
end loop

A good rule is don't use someones routine if you can't understand it yourself.
In other words, dont use TURING GUIS.

Author:  Dan [ Wed Apr 07, 2004 6:40 pm ]
Post subject: 

i dont know how good a rule that is...

i mean if u falow that stricly, i dont think most poleop could uses put or get. u know that it puts stuff on the screen but no one knows exctaly how b/c we can not see the code for it.

Author:  Tony [ Wed Apr 07, 2004 6:56 pm ]
Post subject: 

nightcrawler - reason that Turing GUI will screw you over is because it is badly writen and it hoggs the processing power (that never ending ProcessEvent loop).

Does shannon use MSN? Thinking or just tell her to actually read compsci once in a while - it might help her with teaching Wink

Author:  nightcrawler938 [ Wed Apr 07, 2004 7:54 pm ]
Post subject: 

yeah, shannon doesn't know all the answers, but still is a great teacher, well today i discovered that removing GUI speeds up my arrow movement, Turing pusts this natural delay of (3), err, well now i need to determine wether or not to use hasch or input key down Thinking
heres my new improved code!

Author:  Tony [ Wed Apr 07, 2004 8:03 pm ]
Post subject: 

defenatly Input.KeyDown if you want to have two players and/or have two arrows pressed down at same time

Author:  nightcrawler938 [ Thu Apr 08, 2004 7:24 am ]
Post subject: 

acutally, i started using GUI.SetEventKeyHandler,it works well, but a few bugs

Author:  equs [ Thu Apr 08, 2004 8:41 pm ]
Post subject: 

Shannon is a great teacher. I am in michelas class and his code is great and his program is good, just its to compliated.Well to complicated for me. IM having trouble making a grid in snake and collision detection. I wonder if Tony could help me? lol. Tony were you in Shannons class?

Author:  Tony [ Thu Apr 08, 2004 11:58 pm ]
Post subject: 

equs wrote:
Tony were you in Shannons class?

yes Laughing grades 10 and 11 CS

snake eh? ask Shannon about turing v3.1 snake days Wink Fun times. The code was horrible though, I used to be such a bad programming Rolling Eyes

Author:  nightcrawler938 [ Fri Apr 09, 2004 3:00 pm ]
Post subject: 

tony, input.keydown doesn't work so well, should i put it in my game procedure or call it separatly Question

Author:  Tony [ Fri Apr 09, 2004 3:04 pm ]
Post subject: 

huh Confused what do you mean?

Idealy you would call it right before you check user's input.

Author:  nightcrawler938 [ Sat Apr 10, 2004 1:29 pm ]
Post subject: 

i mean that, the computer can only recieve input before the music plays and the arrows move, so i've tried decrlaing it as a procedure, then calling it the game procedure, i've kinda tried to put the input in the game procedure but it doesn't work

Author:  white_dragon [ Sat Apr 10, 2004 1:31 pm ]
Post subject: 

try foolin round with forkin the process and procedures. tat might help a little.

Author:  Tony [ Sat Apr 10, 2004 3:36 pm ]
Post subject: 

no, no processes Evil or Very Mad damn it people, if there's one thing you don't fork - that's input!

Now then... the reason input doesn't work is because you never call the procedure Confused That largely has to do with the fact that you have GUI. So you have to put your game loop inside of the GUI loop
code:

Music.PlayLoopReturn %or something
loop
draw background
draw arrow
Input.KeyDown
process input
exit when GUI.ProcessEvents
end loop

Author:  nightcrawler938 [ Sat Apr 10, 2004 4:48 pm ]
Post subject: 

makes sense, however i assume that process input is the input recieved from the user

Author:  nightcrawler938 [ Fri Apr 16, 2004 8:23 am ]
Post subject: 

tony, i think i solved, my porblem, just wanted verification, since my arrows are picture files, could that be the reason why, i recieve input before arrows showup Question Question Question , because i have started to draw my own arrows

Author:  Tony [ Fri Apr 16, 2004 9:55 am ]
Post subject: 

Input.KeyDown is input. By process I ment analyze

anyways.. I'm not sure what you mean by having input before pictures show up Confused

Author:  nightcrawler938 [ Mon Apr 26, 2004 1:24 pm ]
Post subject: 

since i am using picture files for the animated arrows, i am not able to recieve input while the picture files are moving, so a friend recommended i create my own arrows, using drawline etc, what do you think?

Author:  Tony [ Mon Apr 26, 2004 4:28 pm ]
Post subject: 

i think it's not going to make any difference since instead of drawing the picture you'll just be calling a procedure to draw the arrow using turing gfx Confused

what you need to do is to check for input in between the arrow movement, as in

Move/Draw
Check Input
Move/Draw
Check Input
... etc

btw - what's shannon's email? she doesn't seem to be replying Thinking

Author:  nightcrawler938 [ Wed Apr 28, 2004 8:09 am ]
Post subject: 

no , she recieved your message

Author:  nightcrawler938 [ Wed May 19, 2004 7:55 am ]
Post subject:  EDITED: DDR

hey its been a while but i have acomplished alot Razz , take a look, i still have to verify if user keys mat ches att he exact time the idsplayed image does.

Author:  Ultimus [ Wed May 19, 2004 10:57 am ]
Post subject: 

Hmmm I can't seem to get it working...

Anyways, if you're trying to make a DDR simulator, it will be best if you just use the DWI file format, so people can use their own stepcharts without converting them. Tell me if you're interested, I might be able to help you there. I was once on the dev team of Stepmania.

Author:  nightcrawler938 [ Thu May 20, 2004 8:19 am ]
Post subject: 

hmm, that would be appreciated, i have played stepmania before, plus my program wasn't working cause you were missing some music files and picture files, send me a message, because DWI patterns would help alot Very Happy

Author:  nightcrawler938 [ Thu May 20, 2004 8:30 am ]
Post subject: 

oh yeah, to whoever downloads my program, you'll need some picture and music files, ask me for them

Author:  Tony [ Thu May 20, 2004 12:37 pm ]
Post subject: 

maybe you should just zip everything into one nice working zip file and upload it Smile

Author:  nightcrawler938 [ Fri May 21, 2004 8:12 am ]
Post subject: 

my zip would be too large, i've tried before, this is because of the sound and picture files, meh, i'll try again sometime

Author:  Josh_VK [ Sun May 23, 2004 12:28 am ]
Post subject: 

Dude just post it.. so everyonw knows what your talking about..
it will fit if zipped im sure

Author:  Paul [ Sun May 23, 2004 10:18 am ]
Post subject: 

lol, we only get what, 2 mb of space? a large zipped mp3 or 2 would excede that limit.

Author:  Josh_VK [ Sun May 23, 2004 11:22 am ]
Post subject: 

yeah mabey your right.. i dunno.. host it someplace? lol

Author:  nightcrawler938 [ Sun May 23, 2004 2:42 pm ]
Post subject: 

i can post it on my website, but that also doesn't have enough space... Rolling Eyes , and i 'm lazy, if you need it badly i 'll send it to whoever needs it

Author:  Dan [ Tue May 25, 2004 2:12 pm ]
Post subject: 

while if u tell us exactly how much it will take up we can adjusted your size limits for uploads on this site. PM if u still whont to upload it here and i will add some MBs on.

Author:  nightcrawler938 [ Fri May 28, 2004 7:22 pm ]
Post subject: 

ok, i need help in recieving input at the exact moment the keys hit the stationary keys

i've used Input.Keydown, however when the eact moment come and the user hits the correct key i need it to display either excellent, or miss any suggestions, i think locatexy would work

Author:  nightcrawler938 [ Tue Jun 01, 2004 7:25 am ]
Post subject: 

i finished DDR, ask to see, it exactly like DDR to each intricate detail


: