Saturday, November 21, 2009

My impression of Assassin Creed: Bloodlines

Assassin's Creed is of the well-respected series and has a humongous fan-base . Ubisoft decided (with good intentions) to give the psp owners a taste of this franchise. The hype for "Assasin's Creed: Bloodlines" started earlier this year with all the "shiny" trailers and screenshots popping up one on the internet. Although I hadn't played any of the other versions but was sure that game with such a standing and ubisoft as its developers this game would surely be good. But somehow when I finally got my hands on it and was one hour into it I didn't quite felt that way anymore.

The graphics of the this game are awesome, in fact one can think that all the amount of detail has been given in making it a graphical masterpiece. Lighting has been rightly used which adds to the eye-candy. However the camera system at some times can become pure nonsense. Like, when your in a corner, it just goes berserk. Specially in the 'kill the witch' stage. The witch, itself is a problem, and if you happen to get cornered, most of the times the camera goes off focus and the screen becomes totally black while the fiend continues her assault with persistence. I'm sure most of you will say, "Why don't you use the free camera?". I'll tell you why don't I use the free camera, because its useless then. No matter whichever way I try to move it I am not able to see what's ahead. The only solution i've found yet is try to get Altair in the middle, which in itself is a grave task during fights as once you've engaged with an enemy only combat friendly controls take over which don't allow you to run.

Another thing that I really hate is its mind boggling controls which vary with the occasion, if I'm on solid ground they're different, when at the edge of a high place they're different and so on. What really ticks me off is when an enemy is near by and also besides it is an item, the triangle button would toggle frantically from "Pickup" to "Target" and back. Even running on rooftops is awkward. In the first stage, on the rooftop of the building besides the safe-house, where you have to cross a log to get over it. When you reach the log, at times, you just get stuck on its end and then for some moments you can't move anywhere.

Apart from these nuisances the game is okay to kill time, the upgrade system is also nice. I still haven't finished the game yet but i've read people saying that the game is just too short. Well, I really can't say anything about it, even if it is true, that's ok.

This game, in my opinion, should have been an iconic classic considering its history, but..., oh well I guess that, "Everything that shines is not gold".

Sunday, November 15, 2009

Twitter oauth with python for desktop applications

As an opportunity to learn about oauth and create a small twitter client (under progress), I googled and found this django snippet, which is very close to what I needed. Although it is perfect if you want to incorporate twitter into a django app using oauth but still requires a little bit of addition if you want to use it in a desktop application.

According to twitter's wiki page on authentication, in the section for desktop clients, it states that after you authorize the application to use your account you'll receive a seven digit pin code. This pin code must be sent as an "oauth_verifier" parameter in the next request to request an access token. In the method "exchange_request_token_for_access_token" I've added an argument "pin" which will take in the pin provided on the authorization step. Apart from that I've also changed the oauth authentication urls a bit, and used httplib's HTTPConnection instead of the HTTPSConnection. I don't know why but the secure connection wasn't working for me. Anyway, you if anyone gets it working with HTTPSConnection, do tell me.

The code requires the following external libraries:

NOTE: THIS CODE IS NOT MEANT TO BE USED IN A PRODUCTION ENVIRONMENT. I SHALL NOT BE RESPONSIBLE FOR ANY DAMAGE CAUSED.


import oauth.oauth as oauth
import simplejson
import httplib


consumer_key="key"
consumer_secret="secret"
request_token_url='http://twitter.com/oauth/request_token'
access_token_url='http://twitter.com/oauth/access_token'
authorize_url='http://twitter.com/oauth/authorize'
twitter_check_auth='http://twitter.com/account/verify_credentials.json'
twitter_statuses_update='http://twitter.com/statuses/update.json'
server="twitter.com"

connection = httplib.HTTPConnection(server)
consumer = oauth.OAuthConsumer(consumer_key, consumer_secret)
signature_method = oauth.OAuthSignatureMethod_HMAC_SHA1()


def fetch_response(oauth_request, connection):
url = oauth_request.to_url()
connection.request(oauth_request.http_method, url)
response = connection.getresponse().read()
return response

def post(oauth_request, connection):
url = oauth_request.to_url()
connection.request('POST', url)
response = connection.getresponse().read()
return response

def get_unauthorised_request_token():
oauth_request = oauth.OAuthRequest.from_consumer_and_token(consumer, http_url=request_token_url)
oauth_request.sign_request(signature_method, consumer, None)
resp = fetch_response(oauth_request, connection)
token = oauth.OAuthToken.from_string(resp)
return token

def get_authorisation_url(token):
oauth_request = oauth.OAuthRequest.from_consumer_and_token(consumer, token=token, http_url=authorize_url)
oauth_request.sign_request(signature_method, consumer, token)
return oauth_request.to_url()

def exchange_request_token_for_access_token(request_token, pin):
oauth_request = oauth.OAuthRequest.from_consumer_and_token(consumer, token=request_token, http_url=access_token_url, parameters={'oauth_verifier':pin})
oauth_request.sign_request(signature_method, consumer, request_token)
resp = fetch_response(oauth_request, connection)
return oauth.OAuthToken.from_string(resp)

def request(url, access_token, parameters=None, http_method="GET"):
oauth_request = oauth.OAuthRequest.from_consumer_and_token(consumer,token=access_token, http_url=url, parameters=parameters, http_method=http_method)
oauth_request.sign_request(signature_method, consumer, access_token)
return oauth_request

def is_authenticated(access_token):
oauth_request = request(twitter_check_auth, access_token)
json=fetch_response(oauth_request, connection)
if 'screen_name' in json:
return json
return False

def update_status(access_token, status):
oauth_request = request(twitter_statuses_update, access_token, parameters = {'status':status}, http_method="POST")
json = fetch_response(oauth_request, connection)
if 'screen_name' in json:
return json
return False