The HEX API and You

Hello Hexers, this is Fred here to talk to you about my number one favorite feature in HEX: the API. Unlike some other games, HEX doesn’t shy away from sharing a lot (and I mean A LOT!) of game data with the community. Having access to all that data allows the community to build tools for the benefit of all.

When I first heard about Chris Woods releasing a server API to share that data, the number cruncher in me went crazy thinking about all the cool things that could be built on top of it. My objective here is to share a high level view of what is available from the HEX API in the hopes that you will also discover wonderful things that could be built with it and to add your own contribution to the growing list of community tools. Before we get into those tools, let’s first have a look at what data is available and how to access it.

What’s in an API?

What is dubbed the HEX API is not an API in the classical interpretation of the word. Rather than being a library that third-party programs can connect to, the HEX API acts like a message broker where either the client or the server broadcasts a message, and it is up to the third-party tools to listen to those messages and process them however they see fit. One cannot “pull” information from the API, but rather you have to listen and wait for the API to “push” that information.

While less efficient, there are two very important reasons for why the HEX API is set up to communicate this way. The first is security. Despite all the efforts that the engineering team could put into making sure their API server is completely locked down and secure, allowing third-parties to connect to your servers is an invitation to wreck havoc. There are no ways to know how such a connection could be abused before it is too late. The second reason is stability and performance. By pushing the messages rather than allowing connections, the HEX API server can manage its own load in a predictable manner, whereas having a large number of third-party tools connecting and trying to pull data at the same time could bring down the server if left unchecked. The message broadcasting solution allows HEX to be as transparent as it wishes while protecting itself against Nefarious Corruptors.

Server API

The server API provides data on 2 main topics: competitive PvP play and the auction house. The competitive play messages include results and decklists for any PvP match that occurs in a competitive setting, be it the ranked ladder, gauntlets or a scheduled tournament. In order to prevent abuse and giving some people a competitive advantage, the information provided is always only available after the match or tournament has concluded, where knowledge of that data can no longer affect the outcome. The auction house messages aggregate everything that happens in the auction house.

Client API

The client API provides a much broader variety of messages, and it does so in a real-time manner. By configuring your HEX client through the use of a simple text file, you can get it to tell you about the content of your entire collection, the content of a deck that you save, when a game starts or ends, when you login or logout, and basically whenever something happens on screen during a game.

The community tools

By listening to those messages and processing the data they contain, members of the community (and that includes you) can build a vast array of tools. Below is a non exhaustive list of tools that have been built around this API by community members.

Websites



URL: https://hex.tcgbrowser.com

Author: Romichete, support@tcgbrowser.com

TCG Browser is one of the first sites that came from the HEX community. While first and foremost a cards browser that lets you look and search for every card ever released in HEX, it also comes with a long list of features.

Collection manager, including auto-generation of wishlist and tradelist based on what you already own (as provided by the client API)

Trade post using the above data to display which user you can trade with, and initiate contact.

Deckbuilder for theorycrafting, with deck analysis, draw test, private sharing, export, etc.

Deck repository. Over 10,000 decks shared by other members of the community. The client API also lets you filter the decks for which you already own all the cards.

Live auction house data, updated from the server API every minute, for when you want to browse the auction house without launching the Hex client.

Match tracker that keeps a history of all your Ladder and Immortal matches with statistics for the decks played.

Draft simulator which will throw packs at you so you can practice building a competitive draft deck.

Card tooltips for content creators to use when talking about specific cards.



URL: https://hexpvptools.net

Author: Fred, fred@hexpvptools.net

I first developed Hex PvP Tools with the primary objective of making all the data coming from the server API available and visible to everybody in order to level the playing field. Over time, I got more and more ideas of new ways to analyze the data and display it in a way that is relevant. I still have plenty of ideas on my to-do list, but here’s a non exhaustive list of what you can currently find at Hex PvP Tools.

Ladder meta analyzer, aggregating results from all the ladder matches, finding which decks are mere variation of the same meta deck and listing which decks define the ladder meta.

Constructed match history, updated in real time, to see all the decks that are being played at any given moment, as well as full decklists for scheduled tournaments.

Limited card and archetype statistics let you see which cards, champions and shard pairings have the most success in each limited formats.

Limited history displays the decks and matchups of all gauntlets that have been completed.

Draft pod replay lets you look at the packs as they are passed around the virtual table, highlighting the choices made by players.

The draft assistant will show you each card limited stats in real time as you draft so you can decide which is the best card to pick.

Limited history tracker will keep track of all your gauntlet runs so you can review your matchups and keep track of your lifetime record in each limited format.

Server activity tracker that shows how active are each queues and the auction house on a hourly, daily or weekly basis.

Hex Meta

URL: http://hexmeta.com

Author: Veetor

Hex Meta is a large repository of decks that have been played in tournaments and on the ladder. Updated in near real-time thanks to the server API, it also displays the total platinum cost of each deck based on the auction house value of the cards it contains. Another nifty feature of Hex Meta is that you can search through the decks by card. With this, you can select a couple of cards you want to build a deck around and see the existing builds that included those cards.

Hex Price

URL: http://hexprice.com

Author: Kroan

Hex Price tracks the auction house to provide you with not only the current value of all cards, but also with historical data of the price at which every card sold in the past. The graphs it presents lets you see whether a card is on the rise or on the decline. Just like a stock market report, Hex Price displays the winners and the losers of the day, or rather the cards that have seen the biggest increase or decrease in value over the last day of trading. Hex Price is an invaluable tool for the market junkie who obsesses about buying low and selling high.

Share your Draft

URL: http://shareyourdraft.com

Author: dBug

Share your Draft lets you play a Draft in HEX with your friends or viewers. You can start a Draft in HEX and other people can see your cards in real time and vote for the next pick. You just need to provide them with the keyword you used for your draft or use the url. This site is designed to be as easy as possible. No registration is required. Additionally, your drafts gets recorded and you can watch them again later.

Hex Sales

URL: https://hexsales.net

Author: nolo

Hex Sales aggregates data from the auction house to present data on the overall economy of HEX.

Other tools

URL: https://www.twitch.tv/workerbot

Author: Skaro, @skaro87 on Twitter

Workerbot is a chat tool for Twitch that makes viewing HEX streams easier. It uses data provided by Celendine and Dinotropia. Workerbot has commands for getting card text, in-game names and similar things that can help a streamer or viewer enjoy watching HEX. The bot is currently in about 220 twitch channels, including the official channel.

Hex API Streaming Tool

URL: https://github.com/JeffHoogland/HexAPIStreamingTools

Author: JeffHoogland

Jeff Hoogland is a frequent streamer, and he used the client API to build a tool to help communicate with his viewers the contents of the decks he plays.

Jeff’s tool generates a decklist png image using StackIt whenever a user saves a decklist, which you can then display on stream while you are playing or share on the forums after the match.

The tool also listens to the message from the client API that informs it when a new game starts and then send you a notification so you can walk away from the computer between tournament rounds and never miss a game.

Your tool here

All the community members above had an itch to scratch and formatted the raw data provided by HEX in a way that is usable for the community. You might be thinking of tools that don’t yet exist yet, but would be very useful to yourself and to the community. If that’s the case, contact us and join the group of tool developers.

See you on the battlefield!

Fred-

Got any questions? Want to chat with other players? Then discuss this article in our Forums! You can also follow us on Twitter and Facebook, or enjoy regular streams on our official Twitch channel.