derianna thomas
blog

Playing Cards with AR

15/05/2020

Since starting my PhD I've been playing with AR to see what different things can do and how I can use them. Here's a quick run through of this basic card game I made back in October!

AR Card Photo

I've been looking at wearable AR for my PhD and figured getting used to developing for it would be a solid place to start. I came up with this quick AR card game idea, mimicking those memory matching card games we played as kids. There's far more advanced AR games out there but this was a fun project to begin with!

I began by making the printable cards in Paint (classic), drawing random shapes until the card was filled up. The cards are recognised by Vuforia (the AR software I used) by looking for "features" in the image. You can see a side by side pic of what one of the cards looks like and how Vuforia sees and recognises it below ↓

AR Card AR Card Features

Vuforia gives your images star ratings based on how easy they are to recognise and track, so once I had 10 5-star cards I moved on to getting some AR characters for the cards. I found some cute (and free) animals on the Unity Asset Store (5 animated Voxel animals), downloaded them, and whacked them into the project. They were super easy to use and I added a teeny bit of code to make them follow the camera so they'd always be facing you.

After that I added in some messages for when the player matches a pair, doesn't match a pair, when too many cards are turned, and when they win. I also made sure that it stopped tracking cards once they were matched in case players left matched cards in view of the camera, since Vuforia can only track a maximum of 5 images at a time.

For this kind of game, Vuforia seems to work best with non-white backgrounds and an indirect light source. Playing on a white desk merges with the card backgrounds weirdly and direct light reflects off the cards into the camera, distorting the card pattern so it can't be recognised. I used this game for some user testing at uni and direct light was quite an issue!

This is a super quick game but it was a nice little intro project to AR. You can see a full runthrough of the game below!