I still have to come up with a good title..

..and a good header too (and yea, it's a template.. bababa..)
  • Subscribe
  • HOME
  • Lucas
  • Showcase
  • Cool Stuff
  • Eco
  • Gaming
  • Ad Campaigns
  • Work in Progress
  • Work
  • Things to do before to die

Oh noes! Itz Kitchen Duty time!

admin | April 22, 2011

Kitten time!

  • Digg this
  • Recommend on Facebook
  • Share via MySpace
  • Tweet this
Comments
No Comments »
Categories
Lucas
Comments rss Comments rss
Trackback Trackback

Thank the Maker

admin | April 18, 2011

‘Nuff said.

  • Digg this
  • Recommend on Facebook
  • Share via MySpace
  • Tweet this
Comments
No Comments »
Categories
Lucas
Tags
kitchen of wonders
Comments rss Comments rss
Trackback Trackback

Halo Reach API, a crash course!

admin | April 16, 2011


Halo Reach API

Every day is potentially a coding day! ..But today there was a South Park marathon on tv, so some sofa coding in da kitchenz was a must.
Perfect occasion to start checking out the Halo Reach API, which allows developers to retrieve information about games and players from the Halo universe.
So yea, just for knowledge sharing sake, here a couple of links that supported me in the creation of that small dynamic banner in the sidebar, which automatically loads my current armor and rank using the Bungie.NET API.

First of all, HaloReachAPI.net has a great crash course, which will get you up and running in no time. It also contains what seemed to me to be the most detailed documentation out there.

In order to access the API you will need a valid API key. This key is unique, and can be easily obtained by any Bungie Pro subscriber registered on the Bungie.net forum. You can then use the key to make calls to the API, and juggling with the available methods you will eventually find out a way to obtain the info you were looking for.
In my case I needed the following two things:

  • Armor picture. Every player in the Halo universe can customize its armor. Ranking up grants access to unlockable equipment, keeping players constantly on the run to Inheritor. I will never reach that rank, but I do love the idea of a customizable armor, and it is very perceivable how this adds incredibly to the identity of an otherwise anonymous model. Your armor becomes your face, and sometimes even recognizing the helmet of that “MLG Pr0 Snip3z” guy entering a room can infuse terror on the lines of bootcamp-fresh noobs. Lol! :D
  • Rank. Everyone loves outranking members of the adversary team ! Prematch lobby psychological warfare i guess.. Some people fights for them, some farm them, and others eventually get them. I’m in the first and third category. So yea, pretty proud of my Brigadier badge.. :D

Allright, here how to obtain that info in PHP! First of all you’l need to make a call to the API:

$apiKey = ‘ultraSecretAPIKey‘;
$playerGamertag = ‘an evil morlok‘;
$url = ‘http://www.bungie.net/api/reach/reachapijson.svc/player/details/nostats/‘ . rawurlencode($apiKey) . ‘/’ . rawurlencode($playerGamertag);

Remember to substitute apiKey with your actual (secret) API key, and playerGamertag with the player whose info you’re trying to retrieve. According to the method that you are trying to call, the url will look slightly different. In this case I’m executing the GetPlayerDetailsWithNoStats method, which requires such a structure.

$output = file_get_contents($url);
$obj = json_decode($output);
if(!is_object($obj)) die(”Error parsing JSON response\n”);
if(!$obj->Player) die(”Player not found…”);

Here we execute the query to the API, convert it into a PHP object and validate it. If everything succeeds obj will contain whatever the method we called returned us.
And there you have it! You can finally very easily interact with the obj object and retrieve all the fields contained in it. In our case:

  • Armor: printf(”<img src=\”http://bungie.net%s\” />”, $obj->PlayerModelUrl);
  • Rank: printf(”<img src=\”http://www.bungie.net/images/reachStats/grades/med/%s.png\” />”,$obj->CurrentRankIndex);

..Enjoy!

  • Digg this
  • Recommend on Facebook
  • Share via MySpace
  • Tweet this
Comments
2 Comments »
Categories
Gaming, Work
Tags
api, halo, php, reach
Comments rss Comments rss
Trackback Trackback

Tag Cloud

3dsm adidas advergame campaign advergame advertising age distribution Alternate Reality Game ARG bababa demographics fail game game engine game platform gaming trends graphics greenpeace guerrilla marketing halo halo reach kitchen of wonders Lucas nestle oilspill overfisher planning portfolio preview problem statement prototype quote reach religion resource seashepherd sea shepherd second sprint steve irwin surveys unity unity3d video viral webdesign westra wtf

WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

Categories

  • Lucas
  • Showcase
  • Cool stuff
  • Eco
  • Gaming
  • Ad Campaigns
  • Work in progress
  • Work
  • Things-to-do-before-to-die

Find

@nti copyright - information for action - copy and distribute!