4 Mar

My Caylus: Magna Carta videogame conversion

Filed under: Boardgames,PC Games 4 Responses

I’ve put in more work into the AI of my videogame version of Caylus: Magna Carta. Its play is still far from optimal and any human who takes the time to properly think through all the moves will beat it easily, but at least it can now occasionally beat my wife and me. It also plays rather predictably so someone who’s used to how it thinks can find exploits. The AI uses a bunch of weighted heuristics to make its decisions, so nothing fancy like a general min-max problem-solving strategy or the neural net approach in Keldon’s Race for the Galaxy implementation. That stuff is way beyond my limited programming skills.

There’s not much left that I can improve without drastically overhaul the whole thing. It sorely needs to be aware of the risks of placing workers near the end of the path and the defensive use of passing early. And I could make it a bit smarter about dealing with other players. It should prioritize using the buildings of weaker players instead of stronger ones for example. But these are small incremental improvements that I’ll dip into when I feel like it. For the most part, the project is basically done and I’m pretty happy I’ve gotten this far.

I’ve also been looking into distributing it, though of course I’ll have to switch out the scanned images for placeholders. Unfortunately, it seems that compiling it for Windows-based systems is non-trivial. There are tools for packaging Python programs into Windows executables, like py2exe and pyinstaller. But for Python 3.2, which is what I’m currently using, only cx_freeze supposedly works and try as I might, I couldn’t get it to work right for me. I don’t think cx_freeze works for Pygame at all. This unanswered Stack Overflow question addresses my problem exactly. So unless I expect other people to manually install the correct versions of Python and the Pygame library, distributing it would be pointless.

Written on March 4 2012 and is filed under Boardgames, PC Games. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 Responses to “My Caylus: Magna Carta videogame conversion”

Brian Sturk

I have pygame and python and would *love* to try this. I own the physical game (as well as the expansion from the Ystari Box). Maybe you could make the src available in lieu of an installer? I agree though, distributing python is quite painful… I’ve given up on binaries.

I write computer versions of board games too, am curious to know what you use for an AI.

wankongyew

I’ve been on vacation and haven’t seen your comment until just now. I haven’t messed it in since I more or less finished it. But if you’re still interested in the src files, I’ll be happy to send you a copy.

It doesn’t really have an AI by the way, just a relatively simple set of scripts that reflects what I personally would do in a given situation.

Brian Sturk

Cool! I wouldn’t mind tinkering a bit, I’ve made a bunch of computer implementations of board games and this is one I had considered. I’ve also done some pygame projects. My email is bsturk—a-t—-comcast——dot—net.

Looking forward to trying it out!

Brian Sturk

Leave a Reply

Designed by Gabfire