PDA

View Full Version : ThinBasic Guitar Hero?



ISAWHIM
27-06-2009, 13:11
I was researching "Guitar Hero Hacks", and came across several interesting things.

One of those things was a program called "Frets on fire". The game runs horrible on my laptop, but I am sure that is due to my limited integrated video card. However, the issues were enough to make the game unplayable. The game only came with three songs, and they were hardly quality songs. The guitar strums were even worse. (Timing was off, and many strums were unnaturally difficult.)

Another one of the things I stumbled across, was a MIDI program which used mapped joystick buttons to trigger MIDI events. Things like keys, effects, volume, etc...

This led me to download the Microsoft drivers, which makes a USB x-box "Guitar hero" guitar and drums, function on a PC. (I have not tried the wireless controllers yet. The wireless drums have a direct MIDI input, separate of the joystick drivers.)

Any-who, playing around with the JOYSTICK DEMO, some other interesting things were discovered. Apparently, there is a second axis inside the X-PLORER guitar. This gives the ability for full 3D rotation detection, in addition to the buttons and whammy-bar.

I have collected this information, so far... (Don't use the dead-zone in the demo. I change it from 50 to 0)

Whammy-bar is (JoyRX) -1024 to +1024 (-1024 at rest)
Horizontal-roll is (JoyZ) +512 to -512 (+320 at vertical, -512 is upside-down.)
Horizontal-tilt {Star power} is (JoyRY) -1024 to +1024 (0 at horizontal, -1024 up, +1024 down.)
Strum-Neutral is (JoyPOV(1)) -1
Strum-Up is (JoyPOV(1)) 0
Strum-Down is (JoyPOV(1)) 18000
Directional is (JoyPOV(1)) 0 to ??? {I forgot} N, NE, E, SE, S, SW, W, NW
Button order is ODD... (1,2,4,3,5)
1 = Green
2 = Red
4 = Yellow
3 = Blue
5 = Orange
7 = Back button
8 = Start button

Power button has no input value. There is no button 6, 9 or 10 on the X-PLORER GUITAR.

I will post a sample modified code, for those interested in attempting to play with this control. I was thinking that the TBASS module might be used, since my demo program only uses horrible beeps to indicate buttons. I had no intentions of using this program as it is, for anything other than seeing values. The sound was added for fun.

Perhaps a simple 3D representation of the guitar, and simulated motion, would be of use, but numbers work fine for me.

If not another knock-off of guitar hero, than some other form of game, using the guitar as input. Dodge-ball, Arknoid, Tank, Worms, Frogger, Bomber-man, Jet-ski, etc... Using the guitar like a Wii control, with the added whammy-bar, and five buttons for targeting or positioning, and the strum for actions?

ISAWHIM
27-06-2009, 13:21
CODE SAMPLE:


'
' TBDI Demoscript : Read Joystick Version 1.2 & X-PLOD
'
' Original code by, Michael Hartlef 2007
' Reduced code by, Jason DAngelo 2009
' (Reduced code is specific to X-BOX, X-PLOD Guitar, USB, as a Joystick.)
'
DECLARE FUNCTION WinBeep LIB "KERNEL32.DLL" ALIAS "Beep" (BYVAL dwFreq AS DWORD, BYVAL dwDuration AS DWORD) AS LONG

Uses "TBGL"
Uses "UI"
Uses "TBDI"

dim hWnd as dword

hWnd = TBGL_CreateWindow("Read Joystick - press ESC to quit") ' Creates OpenGL window, it returns handle
TBGL_ShowWindow ' Shows the window

TBGL_LoadBMPFont "TBGL_Font.bmp",40 ' Loads texture for font

GetAsyncKeyState(%VK_ESCAPE) ' Resets ESC key status before checking
TBDI_Init(hWnd)

TBDI_joysetdeadzonexyz(0, 0)

while IsWindow(hWnd)

TBGL_ClearFrame ' Prepares clear frame

TBGL_Camera 0,0,5,0,0,0 ' Setups camera to look from 0,0,5 to 0,0,0
TBGL_ResetMatrix ' Important before printing on screen !

' POV is also the N-NE-E-SE-S-SW-W direction pad. {STRUM Up,Down}
TBGL_Color 255,255,255
TBGL_printBMP "WHAMMY= "+str$(TBDI_joyrX(0)),1,2

TBGL_Color 128,128,128
TBGL_printBMP "STRUM= "+str$(TBDI_joypov(0,1)),1,4

TBGL_Color 128,128,0
TBGL_printBMP "STAR POWER= "+str$(TBDI_joyrY(0)),1,6

TBGL_Color 0,128,128
TBGL_printBMP "HORIZONTAL= "+str$(TBDI_joyz(0)),1,8

' Two actions complete the full range of sound, or either one can make half the range.
' The two time delays 1 or 30 were to hear which was which.
if TBDI_joypov(0,1) = 18000 then
WinBeep ((TBDI_joyrX(0)*0.5)+(TBDI_joyrY(0)*0.5)+1064,1)
elseif TBDI_joypov(0,1) = 0 then
WinBeep ((TBDI_joyrX(0)*0.5)+(TBDI_joyrY(0)*0.5)+1064,30)
end if


' I just added some notes, in addition to the colors.
' They play in order, due to the BEEP limitation.
' Take note of the order (1,2,4,3,5)
' START (8) and BACK (7) were left-out of code.
TBGL_Color 0,255,0
if TBDI_joybutton(0,1) then
TBGL_printBMP "XXX",1,10
WinBeep (3135,5)
end if
TBGL_Color 255,0,0
if TBDI_joybutton(0,2) then
TBGL_printBMP "XXX",1,11
WinBeep (2793,5)
end if
TBGL_Color 255,255,0
if TBDI_joybutton(0,4) then
TBGL_printBMP "XXX",1,12
WinBeep (2637,5)
end if
TBGL_Color 0,0,255
if TBDI_joybutton(0,3) then
TBGL_printBMP "XXX",1,13
WinBeep (2349,5)
end if
TBGL_Color 255,128,0
if TBDI_joybutton(0,5) then
TBGL_printBMP "XXX",1,14
WinBeep (2093,5)
end if

TBGL_DrawFrame ' Swaps the buffers - displays rendered image
if GetAsyncKeyState(%VK_ESCAPE) then exit while
wend

TBGL_DestroyWindow ' Closes OpenGL window

Petr Schreiber
27-06-2009, 13:29
Hi Jason,

that is interesting information it behaves like joystick.

I don't want to disappoint you, but I do not know anyone who owns Guitar Hero from quite big radius around my house. I see one problem with developing game for this device - player which has this control already owns Guitar Hero. That means making the game more attractive than this. And that sounds like a tough task. Maybe a game which could take as input any CD/MP3 file and let you play (maybe GH already allows this), that sounds the best, as player can choose music set totally under his control.

Your idea of using guitar as control for other games sounds interesting and pretty courageous, but I think it still restricts the target gamers to "I bought Guitar Hero" club.

Do you know anyone who bought just the controller?


Petr

EDIT: Didn't see your second post, will try it with Joystick :)

Petr Schreiber
27-06-2009, 13:32
Interesting script,

maybe with some sampled sounds instead of PC speaker it could become interesting music game.

Michael Hartlef
27-06-2009, 15:07
Hi jason,

Didn't see you posting for a long time. This a great project, as it uses tbdi and also i am a big fan of GH and GH World Tour. Have both at home. Once i recover from this damn flew that took me out finally. I don't have a usb guitar but will use the joystick.

Thanks for posting.

Michael

ISAWHIM
27-06-2009, 20:26
I have made a few random posts. I have had a difficult time getting back into actual programming, since I have been consumed by other projects. They have all been program related, but directly deal more with timing and data processing, with a focus on flow, and little to do with actual programming at the moment. I am simply a flow-pawn. Others are doing the actual programming. My job is to know the limitations and ability, and create workarounds within limits.

I was trying to see if joysticks had a callback. Unfortunately, it looks like they have to be continually polled. Wow, the only thing that windows still lacks is active controls. I was instructed to use a timer inside a %wm_initialize, which triggers a callback for the scanning of the joystick states. Sure it will work, but it seems like overkill to process. That is why I liked the fact that the joystick demo was inside the TBGL screen/area. So those better screen/game timers can be used directly as needed. (As opposed to being at the mercy of only windows external laggy API timers and reactions.)

Ok, the "Les Paul, wireless", works if you have the wireless adaptor.
(Made for PC version of the game.)

The wired guiar is called the "X-Plorer, USB", not "X-Ploder".
(Confused name with another item.)

There are tons of accessories that allow any PS2-PS3 or X-Box controller to work on a pc. However, this is the only "Free" way that I know of. You can find the USB wired x-plorer guitars online for $10.00 to $20.00, since they are the least desired of the three guitars for x-box.

I was leaning more towards using the device as an interactive creation tool. However, I didn't want to limit the device to the single-use that it already has.

Other styles of games, I was thinking of...
Burger-time (You have to catch falling burger toppings, falling in five rows, and ultimately serve a complete burger.)
Skate-challenge (Using the five buttons as "Special" positions to avoid or interact with scenery.)
Tetris-clone, Arkanoid (Using five buttons as directional actions, other buttons as movement.)

If used while playing songs, I was thinking it could be used to control on-screen interactions. Forget the game element, thinking more like the stuff on the windows media-player screen. Possibly 3D objects spinning around, screen flashes, explosions, tone-shifting, scratching forward or backwards, echo, reverb, 3D sound shifting, etc...

There are millions of these games and controllers floating around. Unlike the PC-Force-feedback controllers, and unlike the limited number of side-winders out there. Don't forget this is the number one selling game in the world. Sorry Peter, you must be the only one without one. Just kidding.

Seriously, I purchased X-Box 360 just to play Fallout-3, and rebirthed my x-box 360 just to play Guitar-Hero. Now my collection of games includes, "Guitar hero II", Guitar Hero III, Legends of rock", "Guitar hero IV, World tour", "Guitar Hero, Aerosmith", "Guitar hero, Metallica", and soon I will have "Guitar hero V".

It took me a while to get good at the Medium-Levels, but I can play any medium levels without thinking now. I don't even have to know the song I play. However, the heavy-metal solo parts usually remind me how bad I can be. Hard-Levels are now a challenge, and Expert-Levels are still a complete fantasy to me. (My fingers are cramped and still healing. I have not been in this much pain since "Kid Icarus" came-out on Nintendo.)

ISAWHIM
29-06-2009, 10:05
(I will be adding KEYBOARD and CONTROLLER support, for those without the guitar. It may be harder, but there is nothing I can do about that. Well, I suppose I could reduce it to four columns for the controller.)

Well, I got a better sound setup, using tone-to-note conversion.

However, there is no good way to make this sound good. Even with sound-samples.

In the tradition of guitar hero, it would be better to have "Key notes" for a song, and hitting those key-notes plays the note. Any other note hit would simply play a sour note. EG, doesn't matter if the button is red, yellow or green, but hitting the desired color plays the critical note of the moment, which could be A, B, C, etc...

Once I program all the notes, I will also make a quick "Song". There are many out there, using WinBeep API. Those will be data for the notes, and a separate (Record/Edit) will be used to set the key-input desired to play that note, or to skip that note from needing to be played. EG, some notes will/can play without hitting a button, so you can still follow the song, or to keep it fun to play.

I have started to outline a quick "GEM JUICE" game. Gems fall from above, down a path to the "Catcher". The catcher is a suction grabber, which uses air to capture the gem in mid-air. The captured gem gets boxed-up and shipped away. Missed gems fall below, which raises the capture bar higher on the screen. You don't want to miss them, because the capture bar being higher will make it more difficult to see what is falling next. The capture bar uses a little air to capture the gems safely, but uses more air if you miss. Air takes longer to replenish the more you miss. (If you miss too many over time, you run out of air and loose.)

Missed gems stack-up below, on the "Grinder", which has a stress-level and takes some time to grind-up the juice-gems. The juice collects in a "Waste" container. If the container fills-up, you also loose. If the grinder motor is too stressed for too long, the machine breaks, and you loose. This happens if you miss too many, too fast, and the grinder has to grind too many for a long time. Missing a few will stress the motor, but it will recover as you don't miss other gems. Missing one gem at a time is zero stress.

The goal is to earn points by shipping the most complete set of orders. Missed gems are shipped out later, and counted as a loss. There is also a waste disposal fee, which is removed from your points. However, you are not charged for failed attempts at capturing nothing. (Hitting a capture before a gem was ready to be captured, but later capturing it on the second try, only wastes air for future captures.)

This was my equivalent of a burger-time style game, mixed with a guitar-hero style.

Five columns drop notes, the catcher simply moves up and down, and has suction holes the shape of the gem. Essentially behind the gem, so missed gems fall past it, into the grinder below. The grinder being a cheese-grater wheel style grinder, chewing up the juice gems into juice, for disposal.

Why do the juice gems drop, and need to be captured... Um... Because they harden in the air as they fall, and would get deformed if they rested on a conveyor. LOL.

The falling sequence has no specific order, but certain predetermined patterns based by difficulty of finger-movement, will be used. This is actually a form of compression. Each individual drop-location will not be recorded. Only the pattern style. The pattern will be in an array of values.

01 = (AB_AB_AC_AC_)
02 = (A_A_A_A_)
03 = (A=B=C=D=)
04 = (A_AB_B_BC_)

Underscore would be "Nothing".
Equals would be "Sustain that button".
A would be button 1
B would be button 2... etc...

Using 1/2 slots as the smallest slot, but rate of decent would change. Falling slower or faster, bu still in 1/2 position slots. Following the standard of using BPM, (Beats Per Minute).

I might use the tones as generic "Go-along" beat music, to help with timing. Going faster near the end, and starting nice and slow in the beginning. Perhaps being kind enough to slow-down as the catcher rises, while it grinds the missed gems below. That would reduce your ending point, but it would attempt to speed-up a little faster, when you are grind-free, to compensate for lost time. If you don't meet the delivery time, those are counted as a loss, but not waste loss. Those will have to be packed and delivered by another delivery person.

At the moment, I am using falling letters as the gems. Pure ghetto, but it works. Sample code to follow, with the note-values also.

Note values come from this website...
http://www.phy.mtu.edu/~suits/notefreqs.html

Michael Hartlef
29-06-2009, 20:51
Interesting info. Thanks for the info.