QR Codes

We integrated a web server with web sockets and a web browser into Torque. The goal is to allow hidden information to be displayed on a phone and to create games where all the player play on a web page whether that is on a phone, computer or at the touch table. For the phones, it would be nice if they could quickly log into the game without the overhead of typing in a web address that looks like http://192.168.1.2/<game name>/<table position>

Most smartphones have a QR code reader that can interpret a URL and open the web browser with that address. So it would be nice to display a QR code at each table position. If the player doesn’t have a smartphone, they could sit at the table and use blinds. If they did, they could scan the QR code and be taken to the locally served web page that displayed their information.

I found a C++ library for generating QR Codes called libqrencode. With some minor tweaks I got this compiling in visual studio and linked into Torque. Integrating with torque was a bit more effort. The library outputs a character array of actual text ones and zeros. To display this on the screen, I build an OpenGL texture and draw it at the position and rotation of the sprite.

Here is what our test application looks like:

Here you can see a web page being displayed by the built in Awesomium browser. The page is being served up by the same program’s built in web server. The virtual keyboard can be used to fill in the text entry field on the web page. When you press the connect button, the page makes a web socket connection to the address entered. The web socket server is also running within the application and just sends the text “Greetings!” when it gets a connection. The QR code displayed on the right can be scanned by a phone and contains the URL to connect to the local web server. When the phone browses to that page, they see the same page as displayed within the application.

Now that all the technologies are integrated. We are ready to put it to use. We have two plans for this system. One is to replace the hidden information areas in the games “Temple Raiding” and “Hearts”. The other is to create a new game called Clever Blitz where the players compete in a series of extremely short mini-games. Each mini-game would be displayed in the web browser.

Web sockets and Mongoose

A couple of weeks ago, I experimented with using bluetooth to communicate hidden information from a game to a phone held by the players. While the prototype worked, there were issues with client side logic and lack of support for iOS.

Another way to achive the goal of displaying hidden information on the phone would be to create a web page that the phone could access. In the past, we have done this by having the game state in a MySQL database and php scripts to access the data. The game server and clients would poll the data watching for updates and sending their moves. This system was cumbersome, laggy and prone to error.

However, the web page is a nice way to provide the data to the clients. It is easy to layout a good looking interface, you can use javascript to allow the player to interact with the game and all phones have a web browser. The problem lies in the communication back to the C++ game.

One solution to this problem would be to use web sockets to send data back and forth between the clients and the game. Ideally, the C++ game would serve out the web pages that the clients display too so that people buying the game wouldn’t have to know how to setup a web server.

Mongoose is a simple web server with web socket support that can be compiled into a C++ application. With a couple of minor tweaks I got the mongoose code integrated into Torque.

Adding web sockets was a bit more problematic. The support for raw web socket connections comes with Mongoose, but I needed to write the code to send and receive the messages in the format expected by the chrome WebSocket class.

Continue reading “Web sockets and Mongoose”

Experimenting with Bluetooth

One of the challenges writing games for the touch-table is handling hidden information. So far we have used two solutions: Physical blinds that rest above the sensor and block the view of the other players, and a touch-to-reveal system where the player blocks the view with their hand and touches the screen to reveal their cards.

Many of our users have smartphones, and I thought that it would make sense to let them use their smartphone for the display of the hidden information. In the past, have experimented with a web based system where the game is hosted on a webpage and played on browsers. This works, but when the game is written in C++ for the touch-table, the game has to send data to the web-server so that the clients can display it. This creates extra overhead and lag.

Instead, I thought it would work better to send the hidden information directly to the phones over bluetooth. So I set out to write a C++ server that would use bluetooth to broadcast data to Android clients. This ended up being more difficult than I expected, but I did get it to work and wanted to post what I have done.

Continue reading “Experimenting with Bluetooth”

Dead iMac

We got an iMac in January 2009 to compile Hackers of 2073 for iOS. After finishing the game, we used the Boot Camp feature to set up the machine as a Windows box and set it up in the kitchen for recipes and web browsing. The machine worked well for this use and we really liked that it was nearly silent.

A month or so ago, the hard drive died. Unfortunately it is not included in the list of defective iMac’s which were sold after October 2009, so I wanted to replace the bad drive. This is something that I have done many times on my PCs. I knew that it would be harder on the iMac since it is an all-in-one machine. I imagined that it would be like fixing a laptop. Continue reading “Dead iMac”

Integrating Awesomium into Torque

Battle Home, one of the games that MCG is developing for Mesa Mundi, has a lot of options which dramatically change the rules to the game. For previous games, we have created instructions by making one or more graphics in Powerpoint or Photoshop and displaying that  graphic on the screen. For this game, each combination of options was going to require another set of images. It would be much easier if we could create the instructions dynamically based on the options selected.

Enter Awesomium, a C++ library that lets you put the Chrome/webkit web renderer into your application. While it was not trivial to integrate Awesomium into torque it does allow us to display any HTML or public webpage within our games.

Continue reading “Integrating Awesomium into Torque”

New word game for the touch table

I have almost finished a new game for the touch table. The game is based on the board game “Keesdrow” and is similar enough that I am not going to be selling this game. “Keesdrow” is a word finding game somewhat similar to Boggle, but the board is much bigger and each letter can only be used three times. The first time a letter is used it scores its base value, the second time it scores double and the third time it scores triple. This makes it very important to find words that have repeated letters and use letters that have already been used once or twice.

The most interesting part of this project was the AI. I expected it to play significantly better than it does.

Continue reading “New word game for the touch table”

Geocaching in City Park

We went Geocaching with Lucas, Jessie and their kids on Saturday. We did an elaborate multipart geo cache in City Park in downtown Denver. The geocache had a fantasy, chose your own adventure story behind it. We printed out the story and spellbook and set out on our adventure. You can see all the pictures here.

Continue reading “Geocaching in City Park”

Electric game for touch-table

We have mostly finished a new board game for the touch table. The game is inspired by Power Grid, but is intended only for use on our own table and will not be for sale.

I am pretty happy with the result. The game plays very fast since you don’t have to worry about setting up, distributing paper money and manipulating the cards. In the original board game, we often needed ‘thinking money’ that we could arrange in piles representing planned expenses. To meet this need in the electronic version, we included a calculator in each player’s area. Hopefully this will be adequate.

Continue reading “Electric game for touch-table”

Trip to Belgium and The Netherlands

We took a two week trip to Belgium and The Netherlands with my brother, his wife and my parents.

Since returning from the trip, I have spent a bunch of time going through pictures. I took  ~2200 pictures and trimmed it down to ~1750. I caption, geo-tag, people-tag and do some basic tuning for each picture. The pictures are finally available on this website here.

We stayed in four cities: Amsterdam, Delft, Bruges and Brussels. From there we did day trips to see: Hoge Veluwe, Haarlem, Enkhuizen, The Hague, Rotterdam, and Antwerp.

We primarily spent our time touring: going to museums, cathedrals, seeing the sites, etc.

Continue reading “Trip to Belgium and The Netherlands”

Violin Recital

Last night I had my first violin recital. I started taking lessons in September of 2009 and have been playing for a bit more than three years. I have kept track of my practice time and have now played for 1940 hours.

The recital was pretty informal. Half of the students were beginners and four of the six were adults. We started by playing music from Suzuki book 1 as a group. Then each student played one piece. Most of the students acted like they played worse than they expected, or at least worse than they do normally. I felt the same way; I was nervous and made more mistakes than usual. I had a particularly hard time with the timing. It could have gone much worse though. The accompanist was extremely good and I never had to stop and re-start.

Overall it was a positive experience. It forced me to put a lot of time into a single piece. I wasn’t patient enough to do that without the pressure of a performance. And it was fun to meet the other students.

Continue reading “Violin Recital”