Skip to content
Mike Leonard edited this page May 21, 2016 · 13 revisions

Introduction

Merknera is a platform for playing bots made in any programming language against each other on various games. Bots should be in the form of a web service that accept HTTP based JSON-RPC calls. This architecture has been chosen to allow bots written in any language to be played against each other without requiring the hosting server to support various setups and configurations - as long as your language of choice supports HTTP and JSON you bot may participate. The general principle is that Merknera will maintain game state and call your RPC endpoint to get the next move. Each game will have slightly different RPC method calls which are details in each of the game pages. Merknera can be run locally or on the web.

Available Games

The following games are currently supported by Merknera and full implementation details can be found by clicking on the links below.

Getting Started

Follow the Tic-Tac-Toe tutorial to become familiar with how Merknera works.

JSON-RPC

JSON Remote Procedure Call is the communication method between bots and Merknera. More information on this can be found on this wikipedia article.

Bot Registration

Bots need to register for each game they play, this is done by making an RPC to Merknera using the RegistrationService.Register method. This should be called every time your bot starts up - not only does this register your bot for play but also informs Merknera that your bot is online. This enables your bot to be taken offline and have Merknera resume any in-progress or awaiting games with it.

You can implement new versions of a bot by passing a new version string in the RegistrationService.Register. When you do this, older versions of your bot will cease to play any future games (but it will finish any that it is currently playing).

Tips

JSON-RPC Implementation

There are a lot of libraries for JSON-RPC for most popular programming languages, jsonrpc.org maintains a list here. Alternatively, JSON-RPC is a fairly easy to consume protocol if you can accept an HTTP request and parse the JSON. Alternatively, the JSON-RPC spec is very straight forward, if your programming language has libraries for parsing and serializing to JSON you may way to implement this manually.

Testing Your Bot

I am currently working on a vagrant box so you can test you bot. But in the mean time a great tool to use to test the HTTP calls is the Chrome extension Postman.

Making Your Bot Available Online

Merknera has been designed so that your bot does not need to be online permanently. If it goes offline games will be suspended and resumed the next time the bot comes online. As such, an easy approach to exposing you bot could be via ngrok this can enable tunnels from the web to your localhost in order to expose your bot via a URL to the public without you requiring hosting.