After seeing the recent post showcasing “Glitch Run,” I really wanted to play the game. Unfortunately, I don’t own an iDevice, but I do have access to most of the same tools as the developer that made it. So, I started with the C# SDK from the dev site and got to work. By the next morning I had successfully recreated the core features of the app. Over the next three posts I’ll chronicle the creation of the XNA version of Glitch Run.
Part 1 – The XNA Wrapper
To start, I need a way to contact the Glitch API and receive data for the game. I can accomplish this by using .NET’s WebClient class in the System.NET namespace. This provides a very handy class to help speak with the API.
There’s an old saying in Ur, that “clothes maketh the Glitch”, and it’s true that a quick visit to the wardrobe can turn your average run-of-the-mill Glitch into a sharply-dressed, snazzy-looking little fellow. Donning a smart new outfit certainly makes folk around you sit up and take notice – perhaps there is more to you than first met the eye.
This doesn’t just work for Glitches; the more general principle can be applied pretty much anywhere, even in the world of software. Have you ever coded something that you quite liked the idea of – a nifty tool, a useful app, or even a neat little game – but when you came to look at the finished thing, couldn’t help but think that it looked just a little dull? How can you get people to truly appreciate your creations? Well, just like Glitches, they need to get all dressed up and show the world how smart they are.
Unfortunately (or fortunately?), we aren’t all iPhone, Android, or PHP developers. Some of us enjoy tinkering with other OSes and tools – including Windows, .NET, Windows Phone 7, and Unity.
To that end, we thought that some of you might find this interesting.
Now available: the official Glitch C# SDK!
Let us know if you have any feedback or feature requests via the developer forum.
One of the most important things to understand about the Glitch authentication system is that there are different levels of permission, each of which allows you to do a different set of things. These levels of permission are called scopes. At the most basic level, there are a whole bunch of API methods you can call that don’t require any authentication at all. Typically, these let you find things out about the world in general, such as the names of the streets in a region (locations.getStreets) or a list of all the auctions that are currently open (auctions.list).
The next level of permission is the identity scope. If your app is granted the identity scope, it is allowed to get various bits of information about the player who has authenticated — by using players.info, for example, you can get basic information such as their player name and that most important piece of information, their player TSID. (The TSID is the thing Glitch uses to uniquely identify objects — it’s not only players who have TSIDs, but pretty much everything in the game does: items, streets, skills, even the individual slots in your bags have their own TSID).
This is a basic introduction to the Glitch iOS SDK, as well as an in-depth tutorial over OAuth in iOS.
The iOS SDK can be found here: https://github.com/tinyspeck/glitch-ios-sdk
Create an API Key
In order to use the SDK, you need an API key. Open up GlitchConfig.h in the Glitch iOS SDK folder. In there, you’ll see two #defines:
#define GCRedirectURI @"" #define GCAPIKey @""
It’s important that you create a new API key for each application you build. If you’re the impatient sort, for this sample app, there are some example values given in the comments in GlitchConfig.h. For this sample application, you could just uncomment the example values given and use those, but where’s the fun in that? Let’s go get a proper key of our own. Obtain a key here: http://developer.glitch.com/keys/new/
The App Name and Description can be anything you like, but do try to be reasonably descriptive when you fill those in. The Auth Redirect URI is the important part.
Welcome to the Glitch Developers site. Whether you develop for the web, iOS, or Android, the resources here will allow you to create awesome new applications that enrich the Glitch world.
While you’re here, explore the Glitch API and fire up the method tester. If mobile is your bag, check out the iOS and Android SDKs.
This site will be updated regularly with new content. Stay up on our newly released developer tools, stories from Glitch developers, and apps featuring the Glitch API, by subscribing to our blog here.