Thursday, 11 August 2011

Magic Online trade account proposal

This is proposed as an addition to the current trade system in Magic: The Gathering Online, which works quite well for casual trades between two players. But for trade bots, which are the way most players tend to acquire singles, there are a number of points on which this system could be improved:

* One bot account can service only one customer at a time. This means that the bot owner must run an army of bots, which in turn adds to server load; in addition, players need to figure out which ones aren't currently trading, and many bots solve this by rewriting their advertisements - again, unnecessary server load.

* Each bot account must have its own classifieds ad, which everyone must weed through to find the ones they want.

* Each bot has its own separate inventory. When you're looking for an obscure item, you might need to open trade multiple times with bots from the same controller.

* Bot credit is utterly unmanaged; there is no recourse from MTGO if a bot loses your credit, and there's no protection against misrepresentation by competing bots (imagine a bot that advertises that you can sell your cards to it for credit that can be used with a famous bot like Marlon). Also, it's very easy to "lose" credit by not knowing which bots you have traded with.

* Bots count as regular playing accounts, as demonstrated in the recent tournament in which myriad bots competed just to get a free booster pack.

* Most bots (I won't say all, but the bots I've seen for sale have said this) require a computer dedicated to running one bot account. I dread to think how many computers are tied up doing what a single computer ought to be able to do.

My proposal solves all of these issues, by creating a new type of account: a non-playing trade-only account. This does not in any way affect trades between two regular accounts, which can be done the same way they currently are. A trade account would replace one vendor's entire army of bots. This account would be managed by a script running on the vendor's computer, using a simple API to communicate with the MTGO server.

The requirements from Wizards' end would be:

* A new trade server connection, which would be a published connection-point in the same way that the current logins are done. This could simply be a different port on the same computer, or it could be a completely separate host.

* Ideally, a credit matrix. This is optional; the proposal will stand without it, but this facility would solve another of the problems (that of "lost credit").

The requirements on a vendor would be:

* Write an application that uses a simple network protocol to handle multiplexed simultaneous trades.

That's all. Quite simple on both ends.

I recommend a straight-forward TCP socket connection, using SSL/TLS for encryption, as it is available without much effort in many programming languages. The vendor's app (the "client") connects to MTGO's API server (the "server"), negotiates SSL, and logs in using a username and password (or a hash thereof), just as a player does using the regular MTGO application. The server can then notify the client of a new customer, and the client can query the customer's on-trade items, select items, communicate via chat, and be alerted of the customer's chat messages and item selections.

The protocol need not be complex. Each notification or command is terminated by end-of-line, as with IMAP and similar. For example:

(connect to server)
<--- OK Welcome to Magic Online Trading
---> LOGIN test_bot my_password
<--- OK Logged in
---> ADVERT Test bot: all cards, boosters, etc at great prices, blah blah
<--- OK Advert saved
(user named Rosuav opens trade)
<--- NEWTRADE Rosuav 0.00
---> ACCEPT Rosuav
<--- OK Accepted
---> CHAT Rosuav Welcome to Test Bot, Rosuav. Your credit is: 0.00
(user Rosuav selects an item - the server identifies it by its ID)
<--- ITEM Rosuav 123456
---> CHAT Rosuav You have selected: {Island} (foil) 3.40
(user Rosuav types "done" into chat)
<--- CHAT Rosuav done
---> ITEM Rosuav ticket
---> ITEM Rosuav ticket
---> ITEM Rosuav ticket
---> ITEM Rosuav ticket
---> CREDIT Rosuav 0.60
---> CHAT Rosuav I'll save 0.60 credit on your account. Please confirm!
---> CONFIRM1 Rosuav
(user clicks Confirm)
<--- CONFIRM1 Rosuav
---> CONFIRM2 Rosuav
(user clicks the second Confirm)
<--- CONFIRM2 Rosuav
<--- RECV ticket ticket ticket ticket
<--- ENDTRADE Rosuav

If MTGO doesn't save credit, then the NEWTRADE alert would not have a credit amount, and the CREDIT command would not exist.

Note that this protocol allows simultaneous trades with different players. The user name is given in every command and response, and separate trades need not interfere with each other in any way.

I would be prepared to write the code necessary to make this work. It could be coded extremely efficiently, and the protocol is simple enough that any basic computer could operate the vendor's account, without affecting other things running it.

This would require some set-up work, but this could be offset by charging for trade accounts. The added convenience of operating a bot in this way rather than the old way would be a great boon for vendors, and players would find things immensely easier under this system.

No comments: