Showing posts with label 3d chess. Show all posts
Showing posts with label 3d chess. Show all posts

October 4, 2012

Clock Option for Vulcan 3D Chess

Maybe it's just me, but I really dislike playing chess against a program where a clock is displayed showing the time I and the program each take to make a move. The clock's presence is a distraction and creates an undesirable sense of tension. On top of that, it subtly suggests the my inferiority by constantly highlighting how much faster the computer 'thinks' than I do. My inclination, thus, is to disable such a clock as quickly as possible.

Vulcan includes such a clock but unfortunately I found it to include no option to disable the clock. I was quite dismayed.

To correct this oversight, my first course of action was to find the point in the program where the clock was displayed and hack it so as to disable the display. This worked great! Problem solved! Then I thought about other people and how they might or might not want the clock displayed depending on their mood, and I started feeling guilty...

So, I went on to add an option to the Options menu to enable turning the clock on and off. This was fine for starters. But the clock defaulted to on, I wanted it to default to off, and others might still want it to default to on. Not wanting to dictate the default to anybody, I added the command line option -t (the program already has a -c command line option; '-t' stands for 'time clock'). When included on the command line when launching the program, this option starts the program with the clock off; otherwise the program starts with the clock on.

The result is all wrapped up in a free patch that's available at http://sourceforge.net/projects/vulcanchessmods/files/feature_patches/clock_option/.

September 11, 2012

King Bug Fix for Vulcan 3D Chess

While testing a prototype game save feature for Vulcan, I ran into a nasty little bug. I would move my king off of it's attack board, the program would start 'thinking', and then it would crash. The crash was at an assertion indicating that the program couldn't find my king anywhere on the board.

After much investigation, which among other things included rerunning the same move a zillion times and adding an ASCII print of the entire board at a couple of points just before the crash, the problem became apparent. I found that the program had 'imagined' that its queen had captured my king as part of it's 'thinking' process. From there, tracing back through a long chain of function calls turned up the bug. There seemed to be nothing to keep the program from considering moves where one of its pieces would capture the king. Adding an additional condition to an existing 'if' statement squashed the bug.

I've gotta say, I got lucky in the timing of finding this bug. It would have taken a lot longer to fix without having already implemented an ability to return to the game state just before the crash.

June 22, 2012

Mouse Bug Fix for Vulcan 3D Chess

Standard chess programs are easy to find, but 3D chess programs รก la Star Trek are comparatively rare. As far as I've been able to find, there's Parmen by Doug Keenan for Windows, and there's Vulcan by Mauro Persano for Linux and probably anywhere else X11 or SDL can be used*.

Parmen would have been the easiest to install and is purportedly the more mature of the two, but I really wanted a 3D chess game to play on one of my Linux machines, so I tried Vulcan first. Compilation and install went fine after installing the necessary packages and adding -Wl,-rpath,/usr/lib/tls to LDFLAGS in the Makefile to pick up one library file the compiler couldn't find.  It seemed to work...when it would recognize mouse events. Unfortunately, the length of time and number of clicks it took to get it to respond made it too awkward to use.

Disappointed, I turned to Parmen. Installation was the usual Windows simplicity: just download and run ParmenSetup exe. All looked good upon running the installed program until about the second or third move, whereat Parmen crashed. Trying again a couple more times and trying it on a different machine yielded the same results. Admittedly, the two XP SP3 machines I tried it on were both fairly low end, so you may have a better experience.

Frustrated, I turned back to Vulcan and the promise of open source software. A lot of experimenting and research helped to isolate the problem primarily to a single line of code. With that line removed... It worked! And it didn't crash!

It's just speculation, but I'm thinking the bug may have arisen due to changes in X11 which occurred since Vulcan's last update, particularly somewhere in X11R7.4 (X server 1.5.1) through X11R7.6 (X server 1.9). Regardless of the cause, I've put up a free patch to fix the bug and improve Vulcan's response to mouse events at http://sourceforge.net/projects/vulcan-mbpatch/. (UPDATE: As of 9/10/2012, this patch may now be found at http://sourceforge.net/projects/vulcanchessmods/files/cricital_patches/mouse_bug/.)

If you know of any other Star Trek style 3D chess program, please post a comment and let us all know about it.

* Mac OS X for Unix Geeks by Jepson & Rothman (O'Reilly, 2003) has a whole chapter on installing and using X11 on a Mac OS X system!