Building off the blog post from earlier this month about creating an in-office Uncorked derby experience from scratch, this post dives into the hardware aspects of making the game work.
Once we had a working game in Unity, it was time to create a way for two people to run each horse.
One person would need to ride the horse-like object and the other would need to give the horse life by clapping coconuts together (insert Monty Python reference here). These actions would mimic the same input as the keyboard—they would be alternating values. I developed a plan to make this work, using a basic keyboard from Goodwill and a little bit of imagination.
Creating the New Input
To start the process, I took a Goodwill keyboard and stripped it down to just the board. From there I would need to figure out what combination of crossing wires was needed to hit the keys. A standard keyboard uses a matrix of buttons that are activated by pressing pathways and making a signal. This works like a switch: you press the key and the switch turns on momentarily. The key springs away and the switch is turned off.
On this particular controller, there were two bays of pins. One had 20 pins and the other 10. It looked like all the keys were a combination of touching one pin from one bay to the other. This part took a while. I plugged the controller circuit into a computer and opened a notepad, then ran a wire between each of the pins, jumpering them to see which would cause a signal for a letter or number or special character—basically anything but a function key.
After I detected a combination for those keys. I would immediately solder down that combination to a set of headers, ready to accept input from the game devices. After going through all 16 possible key combinations, I ended up with a header block that if you jumpered any of the rows it would give you a key pressed. Now that I knew which keys would be in play, I was able to update the Unity game and tell each horse the combination of keys that it would be monitoring. Being careful to keep the combination of the left and right key linked to the pairs used in the game.
For our input devices, I needed to have something that would be able to detect the movement of a horse. Our plan was to have the person riding the horse—similar to a child’s broomstick horse.
We had seen these fantastic pool noodle horses at Ace Hardware and decided they would be perfect for our needs. These horses would need a spring loaded switch: a little device with a spring inside that would be set into the nose of the horse. The shaking movement would trigger the switch and register that the horse was moving. It was time to run to the hardware store.
Building the Horse Switches
I spotted these great chunks of pvc cut into two-inch segments, which would serve as the casing for the sensor device. The device consisted of a small piece of perf board soldered to a spring with a piece of copper wire running up through the middle. Then on top of each spring I added ball bearing for weight.
So when the sensor shakes from the weight of the bearing, it throws the spring back and forth. Then, when the spring touches the copper wire it creates the closed switch, which in turn was hooked up to the keyboard controller, and therefore closed the circuit on one of the keys on the keyboard. Effectively this setup causes the shaking of the sensor to press a key on the keyboard.
Phew! One input done. Now for the other part of the game, we needed the coconuts. First I had to crack and clean nine coconuts, which was the easy part.
In the beginning, I thought that the coconuts might work with the spring sensors, but ultimately decided it would probably work better with a slide switch. The gravity on the bearing inside the switch would pull to either side, creating an open circuit when we pulled the coconuts apart, and a closed circuit when they are clapped together.
To make the slide switch, I took a little metal tube and a metal ball bearing. The ball would roll inside the tube and touch a little, floating piece of metal inside, which would complete a circuit with the outside of tube. Again, this would have the same effect as a key being pressed on the keyboard.
However, it turned out that this plan was easier said than done. Apparently a ball bearing could not complete the circuit very well.
I am guessing that the shape of the ball could not make quality contact with the small posts on the inside. To address this, I soldered the two posts together and bent them to make a larger surface for the bearing to touch. Sadly, this still didn’t really work.
Next, I replaced the ball bearing with some heavier gauge solder that was twisted up. This little chunk of solder was able to slide back and forth and this time the connection was made! These little slide switches were pretty small and fit perfectly inside the coconuts. A little bit of hot gluing later and they were all installed.
I now had all of the sensors built and wired to the keyboard controller via some ethernet cabling. The basic ethernet cable provided a great set of quality wires at length for running each sensor to the horses and coconuts. With everything complete, we were ready to have the show…
And it was glorious. A great time was had by all and some hilarious videos of the event were captured.
In the end, there is something to be said for having the opportunity to express creativity for a crowd and have a fun time doing it. It’s great to work for a place that encourages us to get out of our normal day-to-day work. Whether it’s developing a gaming experience just for fun, or encouraging the staff to race and bet on fake horses, wear silly hats and drink mint juleps.