PostToTumblr v3.18 – Fixed Tumblr oauth change

head

 

Just a quick update to say I have now fixed the authentication issue my PostToTumblr that quite a few people contacted me about.

What was going on was that Tumblr appear to have changed the format of the data they return from a token request which was causing a library that PostToTumblr relies on to fail.

Before PostToTumblr can post content on a users behalf it first must get an “access token”. This token is given to PostToTumblr as part of the authentication flow.

When PostToTumblr first starts up it checks to see if it still has a valid token (they can expire over time and other various reasons). If it doesnt it must go through the authentication flow. Firstly it redirects the user to the grant permission dialog:

screenshot_02

When the user clicks allow Tumblr then returns an “oauth token” and an “oauth verifier” to PostToTumblr, which it can then use to get an “access token” which is used to do the posting.

The problem that this update fixed was that the “oauth verifier” that was returned from Tumblr changed:

screenshot_03

You see at the end of the query string there is now a “#_=_” well this was causing havoc with the URL parameter parsing code in the Google oauth library I was using.

My solution is quick and dirty, just strip out the “#_=_” from the url while parsing:

// MIKE HACK!!	  
if(param.indexOf('oauth_verifier=')!=-1) 
{
	param = param.replace('oauth_verifier=','');
	param = param.replace('#_=_','');		  
	decoded['oauth_verifier'] = ChromeExOAuth.fromRfc3986(param);
}
else
{	  	  
	var keyval = param.split("=");
	if (keyval.length == 2) {
		var key = ChromeExOAuth.fromRfc3986(keyval[0]);
		var val = ChromeExOAuth.fromRfc3986(keyval[1]);
		decoded[key] = val;
	}
}

Well I hope this helps anyone else that may encounter this issue too!

Goodbye Playdemic

head

Wow doesn’t time fly.

Over 8 years ago I was a short nerdy student trying desperately to find a way into the games industry for my industrial placement year at university. I was about ready to give up hope when a certain “Starboy” (probably) fed up of my winging offered me a position at his company Rockpool Games.

Cannyshammy – feel free to drop me an email, my company is based in Manchester and there is a strong possibility of us taking on an intern.
alex.rigby@rockpoolgames.com
EDIT: Just seen you’re looking to go abroad, guess Manchester is a little too close then eh?

(source: http://www.gamedev.net/topic/297068-breaking-into-the-games-industry-is-impossible/page-2#entry2882806)

Little did either of us know the long winding path that would unfold from that moment.

Fast forward 5 years. After their success with Rockpool Paul and Alex approached me with a new cunning plan. They were going to start a games company to make these new-fangled social games that Zynga were redefining the games industry with.

Join an exciting new company making cutting edge games with Starboy? How could I refuse

Needless to to say the next 3 years were quite a journey. There were ups, there were downs, there were laughs, there were cry’s there was even the occasional thigh-rub (still not sure how I didn’t get fired for those).

Like all journeys however, they must some day come to an end. I decided that the majority of the world has yet to experience the emotional cocktail of disgust, fear and slight arousal induced by the thigh-rub. So before I reach “that age” I was going to take some time and bring this unique joy to the wider world.

So whats next? Well I have two months of preparation before I embark on an epic 7 month journey through Central and South America, but ill save the details on that for a separate post.

Tinkering With Ash

Last October I was fortunate enough to attend the excellent Try Harder conference for the second time. I have spoken before about how inspirational the event is where every attendant must give a talk on something they are passionate about. One of the talks was by David Wagner’s and was on ‘The Value of Tinkering’ and it inspired me to tinker with TypeScript which led to my Recursive Chrome Extension.

Before I go any further I should mention that there is a Try Harder ‘Level Up’ session taking place in April that is open to new attendees, I thoroughly recommend you check it out!

Following on in the same ‘Tinkering’ vein I have decided to investigate an AS3 library by another Try Harder attendee Richard Lord:

logo

 

What is Ash? Well direct from the Ash Website:

Ash is a high-performance entity system framework for game development.

An entity system is a way to organise the code for a game that is efficient for both code execution and code management. It uses composition rather than inheritance for sharing features between game objects and uses a data-oriented approach to separate the game state from the game logic. This makes it much easier to manage the code and to manage the game state.

Im not going to go into the details too much of why composition over inheritance is a good idea as Richard has already done a much better job than I ever could in these two posts:

If you haven’t got a clue what im talking about when I say Entity or Component I strongly recommend checking out his posts first.

The reason why Ash has piqued my interest is because for the last three years I have been working with Entity-Component systems for games but in a totally different way. The way I have been using and developing started with the Push Button Engine (PBE) method and later expanded out to include Dependency Injection culminating in the Swft Framework.

Ill give one example of why am starting to fall in love with Ash:

In PBE and Swft the components contain data and functions. They can also declare dependencies (via [Inject]) which are automatically fulfilled when a component is added to an Entity. The functions in the component are able to act on their own data, other components and interact with the game as a whole.

One problem with this method is that components are largely tied to their entity and once attached aren’t really free be removed or added. The reason is because other component may have dependencies that depend on that component being part of the Entity. Removing the component will cause the game to crash. This becomes a problem when you want to enable a certain chunk of functionality for a certain time then disable it, what you tend to end up doing is adding the component at Entity creation time then inside of it toggling its behaviour with a boolean.

In Ash components are pure data with the bulk of the functionality being contained within systems. Sure you can have functions in a component but they only act on their own data. There are no hard dependencies between components. What this means is that components are much more free to be added and removed from Entities. So how do component function together then? Well that’s where Systems come in.

Systems are classes that contain the logic that makes up your game. When added to the engine they grab one or many lists of Nodes. A Node simply defines a collection of components that must exist on an Entity. In effect it declares the dependencies that this System needs to operate. What’s neat about this is that this list of nodes is constantly changing as components are added and removed from entities. The Ash Engine manages this all for you so all the system need do is iterate over the linked list of Nodes each frame and execute its logic.

Systems also must not declare dependencies between each other. This rule means you don’t end up with large dependency hierarchies between Systems. This frees up systems to be added and removed from the Engine with no side effects! This is rather remarkable as it lets you do crazy things that you couldn’t normally do when there are many dependencies between systems. For example your game could have a Blitting based rendering system, then halfway through a running the game you could swap that out that System and replace it with a Starling based rendering System!

Thus far I have only spent a limited amount of time tinkering with Ash but I am having a whole lot of fun. I have started work on a little game to experiment around with the framework. At the same time I have been exploring Starling, the hardware accelerated 2D rendering framework built on Stage3D. Thus far I have produced this little map editor:


Click to place a block, shift and click to remove, scroll mouse to change block type and hold control and click to zoom in / out.

Its only a tech demo at the moment and as such hasnt got any game play elements. Im not entirely sure what to turn it into but as a platform for tinkering with Ash its been great.

Its too early to share the code at the moment but if you would like to see how some Ash code looks I strongly recommend you check out Richard’s Asteroids example on GitHub. I was really quite taken aback by how neat and modular the code is. The example is provided in 4 different flavours, one using RobotLegs one with Starling one with SwiftSuspenders and one with no dependencies at all. The fact that the code still works and looks simple in all the examples really demonstrates the versatility of the framework :)