• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Sub-Project When Hardware Interrupts Get You Down

SinsOfApathy

Smash Journeyman
Joined
Feb 24, 2015
Messages
474
NNID
Psion312
So, originally my idea and existing code for my Melee bot was based around using my Shuriken USB (Gecko SE clone) to send inputs to the SI registers. However, I quickly found that I was causing the game to crash or simply do nothing, likely as a result of not setting the various registers up properly. (Plus I wanted to support all 4 slots, which would be a pain in my ass.) So, instead I looked around and thought, "Well, I have an old Gamecube controller and I know the pinout, as well as how to emulate the protocol. Could I just do it that way? Plus the Gamecube puts out 5V for the rumble, which is exactly what I need to power a Raspberry Pi."

And viola, the picture below is an old Gamecube controller cable that I stripped with a pair of scissors, plugged into my Wii, and powered my Raspberry Pi with. The LED isn't on since it would intermittently blink (and I think the power was off during this shot), but I was capable of SSHing and using VNC to access my Raspberry Pi.



The next step is to get some form of housing so that the wires can easily connect to my Raspberry Pi. In the picture, I literally just bent the wire and pressed them against the GPIO pins.

After that, I've got some code around that'll let me emulate the protocol and timings (including bit banging), so that I can communicate with a console. From there, my plan is to write a TCP server for my Raspberry Pi, so that I can communicate inputs to it, since I can't guarantee that my B+ model doesn't have the processing power to pull off any sort of calculations, which I know my heuristics will need. Plus, I'd like to have visualization and logging available on my desktop, which shouldn't be too hard given my past experience.
 
Last edited:

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,178
Location
Sacramento, CA
I've always thought emulating controller hardware would be fun to play with.


How are you going to get input to your bot then? Or are you still able to read the game's RAM just fine? (Though I still don't really understand your method with that anyway. :p)
 
Last edited:

SinsOfApathy

Smash Journeyman
Joined
Feb 24, 2015
Messages
474
NNID
Psion312
How are you going to get input to your bot then? Or are you still able to read the game's RAM just fine? (Though I still don't really understand your method with that anyway. :p)
Input will be done through the RPi, since I have the male end plugged into the GC/Wii for power and input. I'm just going to be emulating the controller by replicating the data it sends, which is a less time-consuming method of what I was doing before. Plus, the upside is that once I have this interface done, this peripheral will work through the Wii U adapter too.

As for memory reads, that'll still be done through my Shuriken / Dolphin's TCPGecko. It'll still be the same method, where I just read specific addresses that store the game state I need. Since Gecko code was designed to run per-frame, I don't need a frame advance feature (like a typical Lua bot on BizHawk would do), but I do need to make sure that my end code results in less than ~16ms altogether.
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,178
Location
Sacramento, CA
Input will be done through the RPi, since I have the male end plugged into the GC/Wii for power and input. I'm just going to be emulating the controller by replicating the data it sends, which is a less time-consuming method of what I was doing before. Plus, the upside is that once I have this interface done, this peripheral will work through the Wii U adapter too.
Yeah, I know. What I meant was, how will your AI receive information from the game? Which I see you're answering below.

As for memory reads, that'll still be done through my Shuriken / Dolphin's TCPGecko. It'll still be the same method, where I just read specific addresses that store the game state I need. Since Gecko code was designed to run per-frame, I don't need a frame advance feature (like a typical Lua bot on BizHawk would do), but I do need to make sure that my end code results in less than ~16ms altogether.
This is the part I'm unsure of. How does the Shiriken work exactly? It physically interfaces with a GameCube, right? How so? It sounds pretty interesting. I'm also not sure what exactly you're doing software side either for your method.
 

SinsOfApathy

Smash Journeyman
Joined
Feb 24, 2015
Messages
474
NNID
Psion312
This is the part I'm unsure of. How does the Shiriken work exactly? It physically interfaces with a GameCube, right? How so? It sounds pretty interesting. I'm also not sure what exactly you're doing software side either for your method.
Plug it into the memory card port. Gecko codes are written to write out of the port or read from the buffer (which is written to by the computer).
 
Top Bottom