Saturday, April 19, 2008

Python and XML, my two loves in life.

I'm a big fan of Python. I'm also a big fan of XML. I also happen to like card games and am utterly frustrated by the complete lack of a card-game player/server that meets my needs. In short, I need something that I can throw cards of any shape, size, or content at and it not fall over.
Apprentice is okay, but it's closed source abandonware.
OCTGN is alright, but their newest version isnt _fully_ open source to keep the shuffling part a secret. And its written in .NET...not optimal.
Firemox is getting close, but its documentation is lacking, and the fact that I cant use Ubuntu's default JRE to run it is a pain. Also, its errors are less than helpful when writing up the XML files for the rules of your game.
There was a little program written in Python (and using Twisted too) that was made to play WoW:TCG. It's on the right track but it's really alpha quality. (I'll come back to this in a minute)

So, in a fit of rage against Firemox and their error "A card is broken, Fix it.", I decided to write a Jabber bot to play referee for card games. That idea didnt last long, but it did lead to an XML-RPC based server. As with all projects, the architecture has evolved as my old, crappy ideas get pushed out of the way in lieu of new, better ideas.

Anyway, the idea is to define a set of functions for the server to handle. Then a client can depend on a server having those functions. Always. Then client-writers only have to worry about what the "spec" says rather than what the server actually does. (This is where that WoW:TCG client comes in. It can be re-written to use those xmlrpc calls and use its shiny interface for good instead of evil :P)
It's abstraction, and it's good. After about a day of hacking on it, I have a reasonable skeleton for the functions, as well as logging in and out. Presence will come in the days to follow, as well as getting down to the actual "card game" bits.

Yes, yes, I know I very well could have used Jabber for that presence junk. And yes, I will probably have a "message_user()" function in there too. However, that will be rather simple compared to Jabber, as it has to support transporting messages over multiple servers, etc. Mine only has to worry about who's on the server it knows about. The independent servers cant, dont and wont talk to each other. Maybe the third time I rewrite it, who knows ;)

Sylva is on the back burner, but on the forefront of my mind. I probably wont get to touch it till this summer, but by then I'll have all sorts of ideas. The one that's highest on my list at the moment is "Loading objects and scene settings from a file." I neglected to mention that one in my previous post. But it's quite important. I would _love_ for that stuff to be randomly generated, but without settings, it's going to be a rather static random world :P

And yes, I'll be moving Sylva to Launchpad when I start working on it or maybe sooner. HG is great and all, but it really requires you to have your own public server :/

No comments: