Wednesday, August 29, 2018

It's not a Raspberry Pi

I finally had a reason to order a raspberry pi. I'd finally got my first Hi-Fi system and I wanted to make a small HTPC to stream bluetooth, do some audio filtering and various other tasks. I was going to try it with a pi zero-w but decided if I go for the full pi 3 b I might be able to also use it as hardware for the FOGC.

But...

Saturday, February 18, 2017

The Truth about Graphics Drivers

I've been doing most of this project on my work laptop because it has HDMI out and bluetooth and I don't have a machine new or nice enough at home to have these things. It has a NVidia graphics card and I've always been satisfied with the noveau drivers. Until today.

I finally had all 4 controllers working so I gave a 4 player race in Supertux Kart a whirl. It was painfully laggy. I haven't figured out how to print the framerate on screen but it was bad. The controls were all slow and gameplay would have been no fun. Good thing it was just a test.

So I had to go to proprietary drivers. Doesn't that break the whole goal of the FOGC?! Probably, but at least these are supported by the manufacturer, and aren't a break of any license agreement. Its a real shame, but OH! what a difference it made, suddenly everything is smoother frame rate is excellent, and the controls are super responsive.

What this really means is that when it comes to the time to buy hardware for this project, nvidia is a no-go, because it required proprietary software to have acceptable performance. I'll have to do some more research on what I should get, because I've never cared about graphics performance before and noveau has been more than sufficient. But I'll cross that bridge when it comes.

Super Tux Kart

Super Tux Kart is possibly the best game to match the purpose of the FOGC. It's simple to use, has kid-friendly controls, good cartooney graphics, innocent play/story, and has local multiplayer mode for up to 4 people (more with LAN). The menus are all navigable using the controller and it has lots of options for various display sizes and resolutions. It is also in the ubuntu repositories so it's easily installable.

The only downsides are that it does have a single player mode that must be played to unlock certain things in multiplayer mode (though you can bypass it through editing a config file) and that the PS3 controller mapping wasn't very usable until I went and configured them all (which seems more an issue in the PS3 driver). I would like if it had an option for more controllers (TVs are large enough these days you could easily have 9 screens), and you have to have all the controllers connected to the computer before you start up the program, but most of these are pretty consistent with most games.

Now for the kids reactions: they liked this game... but they aren't very good at it. The physics are realistic enough that its fairly challenging even for me (who is a far cry from a gamer but I've played my share) and my wife didn't care for it either. I've learned to change each race we start to only be for 1 lap and often I have to stop it after about 15 minutes of them wandering around if we try one of the more difficult/hard to follow courses.

First we mapped the steering to the accelerometer. This worked fairly well since newbies have a tendency to tilt the controller the way they want to go, but after a few games, I remapped it to the left joystick which took some learning for the boys, but they seemed to get it eventually. This is their first foray into gaming (and they're all 5 and under) so they are really still developing the coordination it takes.

So A+ for SuperTuxKart. https://supertuxkart.net/Main_Page

Monday, October 31, 2016

The first nightmare! (Controllers)

So, I'm not starving, but I'm also hoping to make this cost more like a weekend activity than a Christmas. Looking for controllers online that had decent reviews, I decided to go with some knockoff PS3 wireless controllers from a company called NewBull. They were only $10 each which was about as cheap as any I could find with more than 3 stars on Amazon. I think because the PS3 is an older high volume device there are lots of these knock-off controllers that they are basically trying to get rid of, whereas a dedicated bluetooth controller for PC or android is still valuable and costs a bit more even for poor quality ones.

The controllers came and I charged them up. They seem like pretty decent build quality, not too flimsy or cheap feeling buttons (keep in mind though that I haven't held a real PS-any-number controller for probably 15 years). That evening I excitedly plugged them into my work laptop which will be the test platform for a while until I have another machine to dedicate to the task. This has the side benefit that the kids CAN'T play without me. We can ease into it, only playing every couple weeks or so when I bring the laptop home.

Well I plug them into the laptop running Ubuntu 16.04 and suddenly they start vibrating. And basically I was able to check that it was working and sending button messages using the tool jstest-gtk which identified it as a "Shanwan PS3 Controller" or something. Long story short, I never got it to stop buzzing while plugged in.

Luckily it has bluetooth support so I didn't really plan to use it plugged in anyway. Unluckily, ubuntu's bluez package only supports official PS3 controllers which cost some 4x as much. It sees the devices, tries to connect but each time it tries to set up the connection to the controller it fails and you are left there with blinking leds until the controller times out.

There are tons of threads from 2012 or older that describe how to connect your sixaxis" PS3 controller to ubuntu, but I figured none of them applied. But after much frustration and seeing a few posts suggesting only official controllers are currently supported, I decided to give the alternative method a try. Its called qtsixa.

It was actually developed by a friend of mine who is a very active member of the linux audio community back in 2009 (before I knew him), but he has since become way to busy to support this project. In true open source fashion, there are 34 forks of it on github. Selecting which fork to try took some careful reading but it seemed the one including the most patches since falktx stopped maintaining the original (most importantly the patch to support Shanwan knock-offs) was by free5ty1e which was a fork for a special playstation emulator distribution it looks like.

Once I'd cloned it (just download it if you aren't git savvy) I actually edited the makefile to only install sixad and sixad-tools, since I'm kind of a command line guy anyway. If you want more guidance on how to build from source, I'm sure this won't be the last thing I build from source for this project. Such skills will help if trying to make a similar system, and they're not too hard. Usually you only need to know the commands "cd" "make" sudo make install." Leave a comment asking for help/details if you want them, otherwise, I'll assume your google-fu gets you through.

Anyway, once sixad was installed I just run the command "sixad --start" then push the PS3 middle button on the controller, and it blinks, vibrates happily, and shows which controller number it shows up as (1-4). I also found that with sixad running you can push the PS3 button with the controller plugged in and it stops the vibrating.

So, the first nightmare was trying to avoid any unofficial programs to connect to the controllers. Once I embraced installing qtsixa, it was super easy. Turns out that its still the best way (for fake controllers at least) even in 2016. Oh well. That's over. Or so I thought...

I first bought 2 controllers, and once they were working ordered 2 more. They are labelled the same, feel the same, came from the same seller, but they are not the same. I could not get them to pair the same way as the first two!

First thing I saw was that unlike the first two controllers, these new controllers did not appear in the devices list of the bluetooth wizard. I tried resetting the controllers with the pinhole button on the back, but no combination of button presses seemed to change anything. If you can't access ubuntu's bluetooth tools, you might need to restart your computer if you've already run sixad, since it seems to clobber them, but check to see if the controllers appear.

I tried a whole bunch of things and eventually got them to work. I'll describe the process I took, but possibly some of these steps are unnecessary.

If not first connect the controller with usb to your computer and run the command "sudo sixpair" which is a program with the sixad-tools and does something that makes the controller suddenly visible to your machine's bluetooth. Now when you run the bluetooth-wizard or the "add device" option in the blueman-applet you'll see a new "PLAYSTATION3(R) Controller" but you still can't pair it. But once its visible there, sixad can pair to it and it will work the same as the other controllers. I wish I knew why they were different, but I've got it working now.

Best of luck, hope you can avoid some nightmares.

Friday, September 2, 2016

Announcing: The Family Open Game Console!

Ladies and Gentlemen!

No....

Moms and Dads!

The Family Open Game Console is proud to announce: The Family Open Game Console!

So what is this FOGC? And who am I?

I'm a dad, programmer, and open-source enthusiast. My kids are just starting kindergarten and I think its a good time to start playing some games with them. I've actually been very anti-gaming for a lot of years, basically since my roommate and all my friends flunked out of college due to the release of Halo 2 (and Fable and lack of motivation and priorities). But now I'm remembering some fun times playing games with friends. There was a lot of wasted time, but I think a balance can be achieved.

So this blog is my documented search to create a family friendly game console, but I'm also a linux user and a big believer in the benefits of software freedom, so I'd really like to be able to use open source games. That limits the choices pretty quickly. So its going to be basically a linux HTPC with some controllers and some carefully selected games.

My goals and priorities are:

  • Safe games that don't teach my kids things I don't want them to learn
  • Open source software (which actually excludes most emulators since the ROMs are bootlegs)
  • Local multiplayer games so this is a social device where you actually have to invite someone to come play with you

So everything is arbitrated by me. If I think its too violent or too sketchy of licensing, I'll draw the line and you may disagree or not, but it's my project for my family. If you are interested follow along. If not, it's not the first time I've blogged about stuff nobody cares about. :)