|
Using the native interface
Shredder for Linux comes with a pretty nice, though Java
based interface. It works very well indeed, but it might need
a recent version for the Java Runtime
Environment (jre). No problems where found using the
original jre 1.5.0 from Sun.
In case that problems occur it might be worthwile to get the real
stuff driectly from Sun. (For example the Java-edition
1.4.2 delivered with OpenSuSE 10.1 seems to
have some problems. GNUs
Java Implementation version 4.1.0 seems also not
sufficient.)
Note:Of course the real chess engine is a native Linux
binary not using Java. Java is only used for the GUI
components. So you do not need any java if you use another
GUI with Shredder.
To blend Shredder a bit better with the ususal GNOME environment one might
want to pass a parameter to the java call:
-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
It is suggested though to use this only from Java version 1.6
onwards. Earlier versions of Java offer a GTK Look&Feel,
but the implementaion is pretty incomlete.
For Shredder passing this parameter is easiest to be added to
the startup file. Just insert it right after the java
call.
|
Interfacing Shredder
Shredder is split into two parts. First and foremost the
engine, ie. the real chess program, the real strength of the
package. The second part is the GUI which is currently
implemented in Java.
Though it has a pretty nice looking GUI one might want to have
the Shredder engine available in other programs as well. As a
pure UCI-Chess Engine so it doesn't natively work with most
Linux-Chess-programs though. So here is how to set things up...
PolyGlot
is the key to the usage of UCI-Engines like Shredder in nearly
all Unix/Linux programs. A usable shredder.eng is all needed for the
usage of Shredder. Note that this shredder.eng sets all parameters
known by the Shredder engine explicitly to their defaults, so
you can see every parameter there you can use. See also the
comments in the file. Additionally note that you need to adopt
the paths!
Unfortunately, Shredder currently does not support the "OwnBook"
UCI-command so it is necessary to build your own opening book
from a suitable PGN-file. Such PGN-Files are available in
numerous places. From there just export your selection to a
PGN-file and call polyglot:
./polyglot make-book -pgn book.pgn -bin book.pbk
where book.pbk is the new opening book created.
NOTE: polyglot uses huge ammounts of memory for opening book
creation and it works heavily in memory, so for it to finish in
a decent period of time you want to have this memory available
as real RAM, not as swap-space! From my tests a 600.000 games
pgn-file requires some 800MB of RAM (using polyglots default
settings), resulting in some 12MB for the opening book file.
NOTE 2: The same opening book can also be used for
Fruit 2.1 as it's OwnBook. (Or you serve it to Fruit via the
UCI-protocol of PolyGlot.)
Although the standard
version of scid is still available not much progress was
made in that project for several years. Therefore, it is
suggeested to use this extended version of scid which natively
supports the use of UCI engines (among the numerous other
enhancements that this version features). This eases up things
considerably and also offers the ability to use multiline
evaluation available in Shredder. In scid Shredder is
just added as an engine and the UCI checkbox is set:
Via the Configure UCI engine button all internal engine
parameters can be set from within the GUI without fiddling
arround in any config files.
Using Shredder with the standard version of
scid is easy as well. Once polyglot is set up correctly
just use
polyglot shredder.eng
as chess engine. Enter the path where shredder.eng lives into
the appropriate field of scid and you're done.
To use Shredder to automatically annotate games is unfortunately
not as straight forward as it might look like at first. The
UCI standard requires that the evaluation of the chess engine
has to be seen from the side to move. That is in a position
where White has an advantage of one pawn unit the engine would
return +1 if white is to move where as it would return
-1 when it is black's turn. On the other hand no such
rule is defined in the xboard protocoll so every author did it
to his likeing (or just emulated the behaviour of crafty). Scid
now requires that the engine emulates the behaviour of crafty
that is the evaluation has to be positive if the position is to
whites favour whereas it has to be negativ if it is to blacks,
regardless who has the move.
As of Version 1.3 of polyglot there is no way to switch the way
polyglot returns the evaluation codes. But, fortunately,
polyglot is OpenSource so it was a very easy to come up with a
polyglot-131.patch. Applying
this patch against the polyglot 1.3 source enables the new
configuration file option
ScoreWhite = true
Setting this option in the eng-files will result in the patched
version of polyglot to write the evaluation value correctly. Not
setting it or setting it to false will give the old
behaviour.
Note: The "Score Problem" affects all UCI-engines, so
one has to set the ScoreWhite option for all engines to
be used in scid. Several engine
configuration files are available as example. There are
also files which run actual Windows engines like ProDeo or SOS
if someone wants to use such an engine.
Note 2: If one is using Shredders own GUI the current evaluation
is always returned from Whites perspective. It is just the bare
engine that changes sides while evaluating. Actually the author
of Shredder stated that he prefered this switching evaluation
for long time and only now comes to the conclusion that
especially for analysis it is easier to have always the view
from the same side.
Unfortunately the above feature enhancement did not make its way
to 1.4 of polyglot which on the other hand offers quite some
improvements. So here is polyglot-141.patch, adding
the same feature as the above one to version 1.4. Hopefully
Fabien will like it and include it in the upcoming releases.
Though somewhat beyond the scope of this document: How to
apply the above patch?
You have to admit: this is easy. Welcome to the
wonderfull world of OpenSource!
If you were unable to do the above yourself, try
to learn it. But for the time beeing you can use polyglot131.gz or polyglot141.gz on a i386
compatible linux PC. This version was built on Debian 3.1 stable (sarge).
No, no Mac or Windows version available. Sorry.
This is also really easy:
xboard -fd /path/to/polyglotfiles -fcp "polyglot shredder.eng"
(The same goes with Fruit 2.1, just use fruit.eng instead of schredder.eng.)
Jose knows how to deal with UCI-Engines by default, so you can
just set up Shredder as a normal engine. Jose will give you all
options adoptable in a nice GUI. But, this method has the
disadvantage, that Jose currently (V1.3.6) does not know how to
serve an Opening Book via UCI, so for really playing using
polyglot here as well is probably a better setup.
|
Engine Parameters and Playing Style
Note 1: The following chapter describes some of the parameters
one might set in PolyGlot's eng-Files. The syntax is for that
reason the one used for PolyGlot.
Note 2: The extension for the polyglot files used here is
"eng" and not "ini" as Fabien suggests. There are just to many
ini's arround so another extension might be more convenient.
Polyglot doesn't care about it anyway, and as long as file types
are guessed by such silly things like extensions...
Shredder comes with various "engines" by default, which you can
select from the Shredder GUI. Actually these multiple engines
are implemented by setting various engine parameters for the
standard Shredder engine. These parameters can be read from the
.eng-files in clear text and dranslated to polyglot-settings
immediately. For convenience the four additional personalities
are available for download.
|
Using the Bare Engine
Admitting that this is my prefered usage for crafty
I tried to find out how to do this with Shredder as well. The
main drawback of UCI is though, that it is definitely not
designed for that usage. So, the easiest way to have a pure
commandline interface is again by just using polyglot inbetween.
Fire up polyglot on the shell passing it the shredder.eng (or
whatever setup you want) from above and you can happily use it
in a terminal window. Unfortunately I did not find a way yet to
change the options of the engine form there, so one has to write
them into the eng-file passed.
|
Theming Shredder
Admitting that I got that used to the design of xboard that
actually all my Chess GUI's look like it I tried to figure out
how to achieve this in Shredders GUI as well, and it turned out
to be quite simple in fact.
Shredder uses 5 "slots" for board images in png format to
display the actual board. Actually one can put whatever png of
suitable format one likes into these slots. For that reason I
created a xboard image and just
copied it into slot 3 which (though not really a bad design) is
the most unlikely I would have Shredder to look like.
Having created the board image all that needs to be done is tell
Shredder it is actually there. This is done via the message
files within the messages subdirectory. The necessary
lines to adopt are (shown here for English.utf8):
CM_3DBOARD1, "Mahogany"
CM_3DBOARD2, "Blue Marble"
CM_3DBOARD3, "xboard"
CM_3DBOARD4, "Light Wood"
CM_3DBOARD5, "Dark Wood"
|
Theming Shredder Advanced Edition
Playing arround a bit with theming Shredder there arrose the
need to have it done more automagically. Several things need to
be done:
- Find suitable, nice looking textures of wood or marble or
whatever. Those can be found on the Internet for example.
- Creating a full board of the texture: A realistic looking
board does not use the same square all over the board but
uses different textures for each square, but made of the same
material. For that reason one needs a "full block" of the
material in question.
- Cutting the squares out of the full material.
- Gluing the board together using the just created
pieces.
- Setting the board frame
- Placing the board on a suitable desk i.e. a
background.
All this can be done by hand, and the best tool to do it that
way is of course The GIMP. But
it actually involves quite some work and to play arround with
several designs is almost impossible that way. So an automagic
procedure is required. Here ImageMagick comes into
play. ImageMagick can accomplish all functions required but it
does this non-interactively, that is: just instruct it, get a
nice cup of tea and let the computer do the work.
After some fiddling arround this resulted in ShredderBoard, a simple shell
script that does all the work required except of course
collecting the textures. This script is written for the
bash-shell or compatibles. This means that you should have such
a shell at hand. Almost every decent system has. If yours does
not: this script is really simple straight forward just
collecting calls to ImageMagick. Feel free to adopt.
First of all four textures are required:
- Dark squares
- Lite squares
- Board frame
- Background (i.e. the desk)
The call to the tool is straight forward:
ShredderBoard DarkSquare.png LiteSquare.png Background.png Frame.png
Additionally lines can be appended if thin black
lines should be drawn arround the squares.
Some examples are given here for download
Notes:
The ShredderBoard Script tries to create an optimal
looking board by creating first of all a full piece of the
material at hand. This is then cut into the pieces, and this is
meant literaly: it creates a small bitmap for each square in the
process. This means that some 70 files are created on the fly
(and removed afterwards) and it means also that this can take
quite some time. For this reason the script tells you what it
does at the moment.
Some filemanagers (almost all the better ones) create image
thumbnails while showing a folder. If you display the folder in
which the script is working with such a filemanager this slows
down the process considerably as your filemanager will update
its thumbnails all the time. So closing such a view is
advisable.
As in real life the result is mostly determined by the
ingredients. Use high quality textures, and the larger the
better as small textures of course tend to repetition whereas
larger textures do not. Also look at the image quality. GIF
(still widely used) is not optimal as it uses only 256 colours
which is to few for realistic looking images in most cases.
Using png or jpg is better.
Having said that png or jpg is better implies that you can
use any format for the textures ImageMagick is capable of
handling. This are almost all formats, so there is plenty of
room to choose from.
Play arround with adding the black square separators. Sometimes
they improve the look considerably while they just look plain
ugly in other cases.
|
New Piece Sets
Though Shredder comes with very nice piece sets already
one might want to create ones own sets. This is actually
as simple as for the chess boards. All one has to do is to
place the pieces as png-bitmaps on a transparent
background. One can do this most easily using The Gimp interactively.
The necessary file has to be 696x116 pixels with
transparent background (in case of existing sets one wants
to add an alpha channel if it does not exist yet) one for
the white pieces and one for the black counterparts. Each
piece has therefore a size of 116x116 pixels. The pieces
are now placed on this transparent background in the order
pawn, knight bishop, rook, queen, king. One file for the
black and one for the white pieces each.
Hint: If one wants to use a dark wood for the board, the
visibility of the pieces is greatly enhanced by using a
thin white border arround each.
Hint: For shadows use proper transparencie values, do not
just add a "coloured shadow" this will not give a nice
look.
Once the pieces are created they have to be copied over
one of Shredders internal sets. That is one has to replace
the one set of the files
alpha_black.png | alpha_white.png
|
berlin_black.png | berlin_white.png
|
media_black.png | media_white.png
|
ortho_black.png | ortho_white.png
|
by the new one.
A new Merida White
and Merida Black
set may serve as example. These pieces were generated from
screenshots of the Jose chess
GUI using a free font as input. The are just simple Merida
Chess pieces but with a light cloured thin frame for usage
with dark boards like e.g. Maple
Walnut. Additionally they use ivory instead of
bright white for the light parts.
The same Merida White
and Merida Black as
above but without the thin white halo.
|
Sound
Shredder uses Java's internal sound interface which sits
directly upon the ALSA subsystem which is very nice as it
interfaces seemlessly with the rest. Setup of the Linux
Sound System is far beyond the scope of this document, but
just some notes on what may go wrong as the question arrose
recently.
For historic reasons there are unfortunately quite a lot
sound subsystems for Linux on the market. OSS, which is the
oldest, is still in quite some use an may give some headache
as OSS-Applications write directly to /dev/dsp, which ALSA
also creates for sake of compatibilty. The trouble comes
about if the sound card, like the majority of the cards on
the market today, does not have a hardware mixer built in but
rely on software mixers.
Problems one might experience are:
- No sound from Shredder
This is cause some OSS application is blocking the sound
device exclusively.
- No sound from other applications once Shredder played
a sound
this results from your sound card to not support hardware
mixing.
The solution to these problmes are immediate:
wrap the OSS-application into the aoss tool that comes
with ALSA so that it works through the ALSA-Mixer. The
invocation of
soundtool would then look like
aoss soundtool
Additionally Java itself might need to be warped in the
aoss tool in these circumstances. This seems a problem
of Java. Also note that this works only if you set up your
software mixer properly! (See /etc/asound.conf)
Note: All these changes are an investment into the future as
nowadays ALSA is Linux' default sound subsystem. So it's
worth the efford to get it working if one uses still an older
setup.
Note: Proper ALSA-Setup has nothing to do with Shredder and
will not be covered here. In Linux on an IBM ThinkPad
T41p is a coverage for the common Intel Soundchip with
some hints on how to get it working though. For almost every
soundcard a document describing how to set it up can be found
at the
ALSA-Project.
|
Bugs & Fixes & Known Limitations
All tags marked in green are
fixed in the first patch dating 05/11/05 for Shredder 9/Linux.
Thanks to Stefan Meyer-Kahlen for his quick support and open
mind towards suggestions.
See also November
News for details how to obtain the patch.
|
|