Playing Magic in the Terminal

Over the weekend I started digging into online play for TCG Lightning. By Sunday I was playing my first round of Magic in the terminal.

My first game of Magic in the terminal.

Down the Rabbit Hole

I first wanted to recreate the interface and style of Cockatrice for online play, but at some point I thought about XMage and started looking into it. Turns out XMage is actually fully open source — especially the server, which does all the rules validation. But everything is written in Java, and the protocol for client-server communication is basically serialized with Java JBoss or something like that. So I can't just attach a TypeScript client, which is what I'm using in TCG Lightning.

The Proxy Approach

I needed a way to talk to the server, so I started creating a proxy in Java that acts as a middleman. The proxy handles the JBoss serialization stuff towards the XMage server, and talks WebSocket to the client. That's the tcg-lightning-xmage-bridge project.

What's the Plan

I plan to open-source the parts. If the XMage people at some point agree, I'd love to merge the proxy back into their project. The client library in TypeScript will be the first open-source part of TCG Lightning.

Get In Touch

Join my Discord — I'd love to hear from you ❤