Caboodle 0.2

So I released 0.1 and 0.2. Now Caboodle has a menu bar (whee), an icon and a .desktop file.

To clarify something: you do not need OCaml or the Gtk+ and Cairo OCaml bindings to run Caboodle, just to compile it. I do not provide binaries at the moment, but if there's demand I can put up a pre-compiled Linux/x86 version.

Caboodle

Caboodle is a puzzle game. See:

As you are probably able to tell, it's a clone of Planarity. My excuse for the blatant clone is that I wanted to learn OCaml and the game was a nice, simple project to tackle. And at the same time, I got to learn a bit of Cairo, too. Of course, I was — and mostly still am — totally clueless about graphs and the related math.

Still, the end result, even its current state, isn't too bad. It's definitely faster than the original in most aspects, which shouldn't come as a surprise given the ass-kickingness of the OCaml compiler especially compared to Flash. The most significant slowness is due to the currently very naïve redraw logic: every time something moves, everything is redrawn. As you can probably guess, it starts to slow down with a large graph and fast mouse movement. I'll have to see about fixing that. And I'm not totally satisfied with the level generator, even though that's the part I've spent the most time with (no, the math didn't come back easy after too many years of not using it at all, you can all point at the source code and laugh); it does generate too many vertices with just two edges. But I think that should be pretty easy to fix.

About OCaml: a nice language with an impressive compiler, and quick to learn, at least up to a point. I haven't used any objects in Caboodle, only the stuff that comes with LablGTK2. And I didn't write any functors. Or a bunch of other stuff. And I still don't find code written by others very quick to read and the compiler error messages can be pretty puzzling, at times. Part of the learning curve is probably caused by the fact that I've never before used a language with a modern (you know, from the 70s) type system, just the basic stuff provided by C, Java, C# and friends. Still, I'm not quite sure I like the ML syntax, but I suppose it's not too bad. And I wonder if there are some limits to the language that I would have hit on a larger project. It is mostly very, very strict, and doesn't offer any of the runtime type frobbing that Java does with its happy casting back and forth, reflection and stuff.

Cairo turned out to be surprisingly easy, too, at least for this simple a project. I have to thank Olivier Andrieu's cairo-ocaml examples, though, without them the going would have been a lot rougher. But I can't really compare it to other systems, because I've never done much graphics programming.

Also, turns out I'm not the first one with the same idea: back before I had anything showing up on screen, xiphmont was on #gtk+ posting screenshots of his version. Oh well. Seemed to be a silly reason to stop, given that my objective wasn't to write the game as much as to learn the tools, so I ploughed on.

I haven't yet done a release, but it should be ready for 0.1. I'll post it at gnomefiles once I get around to it. In the mean time, it's available in the darcs repo from the Caboodle home page.

If you wonder what the name is about, it's just a random word I got out of /usr/dict/words. That's my preferred way of naming software.

My First Gtk+ Patch

Whee, my first Gtk+ patch — or at least something not completely unlike it — was accepted.

© Juri Pakaste 2024