Sunday, April 15, 2012

Whoa -- it's been a while...sorry about that! I can offer the typical excuses about life getting in the way and all that, but things really have been a bit busy lately around here lately. Along with the usual work and family stuff, I had a big deadline at work and I did a little work-related travel. Also, I've spent some of my free time in activities related to our upcoming Burlington Mini Maker Faire. Part of that includes time spent towards making an arcade-style joystick intended for use in my Fahrfall display -- I intend to blog a bit more about that later, when it gets finished. Anyway, what really matters is that I am back here now! :-)

Keyboard Control

I had always intended for Fahrfall to have keyboard controls. I had even added them at one point, but I had some problems working-out how to handle having the choice between a joystick or the keyboard. So, I backed that code out of the original Alpha 1 release. No one seems to have minded that, although it did cause a little confusion for someone on the CoCo mailing list while he tried to figure-out how the emulator handled joystick inputs. :-)

I think I mentioned earlier that we have been trying to work towards having a "makerspace" in my local area. As part of that, we have been having regular "maker club" meetings for the Alamance Makers Guild. I have taken Fahrfall as a "show-n-tell" to a couple of those meetings. The first time I did that was great, but the second time I forgot to bring a joystick! Fahrfall just isn't the same when you can't get past the title screen...

The CoCo keyboard is composed of a keyboard matrix circuit formed from the pins on a couple of PIA ports. Keyboard input is scanned by activating one column of switches at a time with one port and looking for certain input patterns on the other port. For Fahrfall, this is simplified by the fact that the CoCo designers cleverly put the spacebar and the arrow keys on the same row. The Dragon designers also did the same thing, albeit on a different row than what the CoCo used. These facts not only allowed me to use a simple routine to check all the required keyboard inputs but also allowed me to select between the CoCo or the Dragon keyboard based on whichever layout was used to start the game.

Selection

The joystick inputs on the CoCo will "float high" if no joystick is connected to them. This means that if there is no joystick plugged into the CoCo, they read as if the joystick is pointed into one of the corner positions. So, what? Well, that means that if we allow both joystick and keyboard input at the same time and someone tries to play without a joystick plugged-in at all, then the joystick input will force Fahrve over to one side of the screen, making the game unplayable. :-(

For now, my solution is to differentiate between whether the game is started using the joystick button or using the keyboard. If the user hits the spacebar to start the game, then that game will only use the keyboard. If the users starts a game with the joystick, then the keyboard will be disabled while that game is being played. This isn't my ideal solution, but I think it is workable. In the future I may find a good algorithm to simply detect when the joystick is missing and then to ignore it.

More To Come!

I've still got a lot in mind for Fahrfall, and time is ticking for my planned events. I had hoped to be further along than I am, but I think this will still work. Besides, it might be better to give Fahrfall some public play testing before moving much further in order to have a better game in the long run? Anyway, I do have in mind a few embellishments to make in the next few weeks...as always, stay tuned!