By Gwyneth Saldanha | Sep 8, 2013
By now many people have heard of Angry Moose, the geeky game that draws crowds of engineers and fans wherever it goes. It’s a real-life version of a popular iOS game, but with a Canadian twist. The Beavers have stolen the Moose’s beer, and the Moose want it back. Players use an iPad to control the pitch, yaw, and stretch of a giant slingshot The slingshot launches plush moose at the beavers, who are hiding behind a beer-can dam. Here’s a behind-the-scenes look at the iPad app development process from Nuvation Lead Design Engineer Gwyneth Saldanha.
I became involved in the Angry Moose project last July, when we needed to develop an app to run on a tablet and interface with an FPGA controlling the Angry Moose sling shot. After a month of brainstorming, the design was finalized. At the heart of the system was an Altera Cyclone III FPGA running a Nios II soft core embedded CPU. (Note: we’ve since migrated to Altera’s new Cyclone V development kit). A web service running on the embedded CPU parses incoming commands into Avalon bus cycles to control four independent Pulse Width Modulation generators. These, in turn, control four Texas Instruments Jaguar motor controllers responsible for adjusting the slingshot and firing the stuffed moose at the target. An isolated and secure network created by a router allows the iPad to communicate with the embedded CPU.
Using the web server abstracts away the domain logic from both the Nios and the iOS app. It allows for loose coupling and modularization of the components. This simplifies development on the iPad – the app doesn’t need to be aware of the implementation details on the Nios. It also allows for easy translation to an Android tablet or Blackberry Playbook in the future, if that’s something we want to do.
Another benefit of using this design was easy integration testing for our international development team. The hardware and Nios development were done at Nuvation’s Silicon Valley Headquarters, and the iPad app was developed at Nuvation’s Waterloo Design Center in Canada. The web server abstraction allowed each office to develop and test independently until final integration. To simulate the Nios system, I could quickly create an Ubuntu virtual machine with VMWare and throw in a PHP script to accept commands like the Nios would. Virtual Machines are a great tool for development – but that’s another article.
The iOS app is designed to work with the 10″ iPad running iOS6. Development for the app was done with XCode 4.x on Mac OS X. Since the app is a limited release in a controlled eco-system, the development cycle was short and relatively smooth sailing.
The app contains a View Controller for the main screen and another View Controller for the pop-over help instructions. The main page has buttons to control the pitch, yaw and stretch – or anger, as we like to call it – of the slingshot. Tapping the fire button causes the iPad to bellow like a moose as the slingshot releases the moose into the air.
To make the game more challenging, tapping a movement button causes not one but a random number of web requests for that movement to be sent to the server. The motors move the slingshot in tiny increments so that the slingshot isn’t wildly swinging around when a button is pressed. This randomness encourages users to visually confirm the alignment of the slingshot and prevents them from trying to “game” the game. The finishing touch was dropping in images for the view controller’s backgrounds and button images to give the app its polished and cool game look that draws in users.
Although the iPad app is only the tip of the iceberg of the overall Angry Moose design, it was a fun project!