Need I say more?
Tuesday, April 10, 2012
Wednesday, April 4, 2012
EVE’s in-game browser – tying your code into the game
Yesterday I wrote a little about EVE Online’s database dump and API Functions, and mentioned some funky tools people had developed with them. These tools are generally Windows desktop apps, which allows for great functional interfaces, but sees you alt-tabbing out of the game if you want to fiddle around with a training plan in EVEMon, or brainstorm some ship fitting ideas in EFT.
But of course, as well as desktop apps, a popular way to present an application is via a web interface into a browser. And, as luck would have it, EVE has a browser built into the game client, the “in-game browser.”
I do a lot of different things in my day job, but the biggest part of what I do is ASP.NET web development. So this is right up my alley – I can write some code, put an ASP.NET front-end on it, run it on my local PC, and then hit http://localhost/ from the in-game browser. Neat!
It gets a lot neater, though. The in-game browser isn’t just a Webkit-based browser, it has some extra customizations that allow interaction between the game client and a trusted website. So if you add a little bit of Javascript to your page, it will pop up a message in EVE asking if you want to trust the website. Say yes, and communication can now occur in two ways.
First of all, any page requests from the in-game browser to the trusted site will have some extra HTTP headers. These are all documented on the EVE wiki’s “IGB Headers” page, but basically, it passes across useful information like your character’s name and ID, where in space you are currently located (down to the star system, or the station if your are docked), what type of ship you’re flying, etc. Obviously any type of market-related app can be greatly enhanced if it can make its recommendations based on where you are currently located.
Secondly, there are a bunch of other Javascript calls that can be made on the page to cause the EVE client to do various thing. These are all documented on the EVE wiki’s “IGN Javascript Methods” page. Useful things that can be done include setting your autopilot destination (e.g. to take you to a system that a bargain has been located at), opening the info window on an item (no need to display all the details on an item within your web app if you can just pop up a proper info window in-game), opening the market details window for an item, even sending in-game mail or a fleet invite. You can see why you need to explicitly trust a website for this functionality to be enabled!
Anyway, I did a little more hacking last night, whipping up some code to parse a market export file. While looking at an item on the market, you can hit a button to dump the buy and sell orders to a CSV file in your EVE folder. Now I have code to parse that file and store the orders into a database.
Next step – find profitable trades, and use the pathfinding code I wrote earlier to determine how far the seller is from me, and how far the buyer is from him!
Tuesday, April 3, 2012
Also I redesigned my blog
I know everybody reads blogs via RSS readers, and never actually sees the layout of the site, but anyway, for the first time since creating this blog two and a half years ago, I changed the layout away from the first default Blogger theme that caught my eye.
Now it uses the second default Blogger theme that caught my eye, with a background image that caught my eye, and a few tweaks to colours and fonts.
EVE Online, the MMO for programmers?
So EVE Online has been in the news again lately. Scandal, cyber-bullying, banhammer wielding, resignation from the CSM, all manner of general angst.
But even before that, it has been more prominently on my radar for a couple of months now due to increased activity amongst the bloggers I read. SynCaine had been writing a fair bit about his corporation’s activities, and Wilhelm Arcturus, the Ancient Gaming Noob, has entertained with lively accounts of nullsec warfare going down.
I’ve played EVE. I played the free trial roughly four years ago, created an account and played for a month. Reactivated about a year later and played another month. But that’s it – the actual gameplay never grabbed me enough to keep me subscribed and playing.
Also there seems to be a bit of a vicious circle: to really appreciate EVE, I’m told, you need to be in an active corporation doing interesting things. To be in an active corporation requires quite a level of commitment. And I’m not prepared to make that level of commitment to a game that I’m not yet really appreciating.
But anyway, with the game being on my mind, I thought it might be worth another look. I didn’t reactivate my account, I thought I’d just quickly create a new trial account, jump on that, and refresh my memory about how the game played.
And that led me to check out an aspect of EVE that I had a vague awareness of previously, but no more: the scope for tool development using the EVE API.
Now this is really quite neat, the sort of thing to really catch the attention of a programmer who might be up for some hobbyist coding. You can download an EVE data dump in the form of an SQL Server database backup from here. There’s all the information you could want on the game’s star systems, items, all sorts of stuff. And then there’s the API documented here which allows you to retrieve specific info on your characters, etc.
There are many wonderful tools which make use of this data and API, such as EVEMon and the EVE Fitting Tool.
What I’ve done is write some code which takes the tables of star systems and jumpgates from the EVE data dump and figures out routes from one system to another, limited to high-sec systems. What I’d like to do next is combine that with some market data, which I can either save to a file from the game, or pick up a feed from EVE-Central’s API, which is itself fed by volunteers saving data from the game. Then, I’m hoping I can generate some trading opportunities.
Another possible step is spotting reprocessing opportunities. The EVE data dump, combined with my character’s skills (obtained from the EVE API), can be used to calculate what minerals I can reprocess a given item into. So I should be able to spot bargain items that I can buy, reprocess, and sell the minerals.
I have to say, cutting this code strikes me as being potentially more fun than orbiting a rat and plinking it with a railgun!