Chess UCI protocol tracer utility
I have this bad habit of starting coding on some application, bringing it to an alpha-ready stage, dropping it and moving on to the next one. Fortunately I don’t do this in my day job, else I’d have got the boot long time back.
Couple of months back, I was working on a chess application. I will not be able to discuss it further here, as I still think that app idea is a good one and is highly marketable. My chess GUI had to support UCI engines. UCI (Universal Chess Interface) is a protocol used by Chess GUI to talk to chess engines (see Figure 1). There are other GUI <-> Engine protocols, like Winboard, but UCI is an effort to create a standard. Since my software had to support all the existing UCI engines, I decided to understand the UCI protocol fully. I looked around for some way to capture the UCI transactions that go in between the GUI and the engine, but couldn’t find any tool to do that. So I wrote my own.

[Figure - 1]
In the attached file, you will find uciplug.exe, the main UCI tracer application. Tracer is a simple pump, which works as shown in Figure 2:

[Figure - 2]
It acts like a network repeater, by passing on everything it gets (either from the engine, or from the GUI) to the corresponding recipient, the only difference being it also logs that message to a file. Multiple instances can be used for running more than one engine simultaneously.
Download
Downloaded a total of 170 times
How to use UCIPlug?
Download UCIPlug from here. There is nothing much to it. Just treat uciplug.exe as any other chess engine. The step-by-step process is given below:
- Create a directory under your Chess GUI’s engines folder for each engine you want to capture UCI messages. Put a copy of uciplug.exe and the engine executable in that directory.
- Open uciplug.exe.config XML file in a text editor. Put your engine executable name (with out the path) in "EngineName" field.
- Open your Chess GUI and install the uciplug.exe from the newly created directory to load your engine.
uciplug.exe, by default, dumps all the UCI messages to "pluglog.txt" in the current folder. If the file already exists, the new contents are appended to the existing file.
For example, lets say you use Chessbase GUI as your main chess GUI and want to capture the trace between this GUI and Toga (a freeware UCI chess engine), the changes you need to do are shown below.
Step1: Create subdirectory
Create a directory TOGA under %CHESSBASE_ROOT%\Engines folder, where %CHESSBASE_ROOT% is the installation directory of Chessbase. Copy uciplug.exe, uciplug.exe.config & toga.exe to this directory.
Step2: uciplug.exe.config modification:
:
:
<setting name="EngineName" serializeAs="String">
<value>toga.exe</value>
</setting>
:
:
Step3: Installing the engine in Chessbase:
Goto Engine > Create UCI Engine

[Figure-3]
Select the uciplug.exe from %CHESSBASE_ROOT%\Engines\Toga using the "Browse…" button. Press OK. Thats all, now you can go ahead and setup an engine to engine fight.
Sample log: [CMD represents the GUI command, RSP represents the engine’s response]
uciPlug.exe Information: 0 : PUMP: Engine toga1.exe started @ 2:33:54 PM
uciPlug.exe Information: 0 : PUMP: SETUP complete
————————————————–
RSP: Toga II 1.3.4 UCI based on Fruit 2.1 by Thomas Gaksch and Fabien Letouzey. Settings by Dieter Eberle
RSP: EgbbProbe not Loaded!
——-|CMD: uci
RSP: id name Toga II 1.3.4
RSP: id author Thomas Gaksch and Fabien Letouzey
RSP: option name Hash type spin default 16 min 4 max 1024
RSP: option name Search Time type spin default 0 min 0 max 3600
RSP: option name Search Depth type spin default 0 min 0 max 20
RSP: option name Ponder type check default false
RSP: option name OwnBook type check default true
RSP: option name BookFile type string default performance.bin
RSP: option name Bitbases Path type string default c:/egbb/
RSP: option name Bitbases Cache Size type spin default 16 min 16 max 1024
RSP: option name MultiPV type spin default 1 min 1 max 10
RSP: option name NullMove Pruning type combo default Always var Always var Fail High var Never
RSP: option name NullMove Reduction type spin default 3 min 1 max 4
RSP: option name Verification Search type combo default Always var Always var Endgame var Never
RSP: option name Verification Reduction type spin default 5 min 1 max 6
RSP: option name History Pruning type check default true
RSP: option name History Threshold type spin default 70 min 0 max 100
RSP: option name Futility Pruning type check default true
RSP: option name Futility Margin type spin default 100 min 0 max 500
RSP: option name Extended Futility Margin type spin default 200 min 0 max 900
RSP: option name Delta Pruning type check default true
RSP: option name Delta Margin type spin default 50 min 0 max 500
RSP: option name Quiescence Check Plies type spin default 1 min 0 max 2
RSP: option name Material type spin default 100 min 0 max 400
RSP: option name Piece Activity type spin default 100 min 0 max 400
RSP: option name Piece Square Activity type spin default 100 min 0 max 400
RSP: option name King Safety type spin default 100 min 0 max 400
RSP: option name Pawn Structure type spin default 100 min 0 max 400
RSP: option name Passed Pawns type spin default 100 min 0 max 400
RSP: option name Toga Lazy Eval type check default true
RSP: option name Toga Lazy Eval Margin type spin default 200 min 0 max 900
RSP: option name Toga King Safety type check default true
RSP: option name Toga Extended History Pruning type check default false
RSP: uciok
——-|CMD: quit
PUMP: Hit a quit in the stream. Quitting!
Future plans:
- It’d be cool if we have some kind of GUI to visualize the log.
- Have the same instance support multiple engines, instead of separate uciplug instances.
Disclaimer: Note that this is not production ready code and meant to be used only for learning purpose. This utility is not even in Alpha stage, so am not responsible for any kind of damage that may occur by using this tool. I’d appreciate if you let me know of any problems, though.

i’m trying to use this program but chessbase and fritz don’t seem to load it and when i try manually opening the program i get an alert that mfc71d.dll was not found (unable to locate component). do you have a solution?
nevermind. I got it to work. it was an issue with toga.exe. Thank You for the great program!
Glad it is of some use to you
I will try this when I get home tonite….thanks for this tool…. Any plans to release the source code?
Mr.L, let me know your email ID. I can send out the src code.
BTW, I remember putting this in GoogleCode, will send you that link if I find it. Thanks.