Live broadcast of engine pv

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Live broadcast of engine pv

Post by Ferdy »

How do you show to a web page the engine pv's during broadcast?

Example site with missing engine pv.

http://www.chess.x10host.com/pgn4web/live1.html
User avatar
Rebel
Posts: 6991
Joined: Thu Aug 18, 2011 12:04 pm

Re: Live broadcast of engine pv

Post by Rebel »

In theory you can pick it from the Arena debug file, I have considered it for a next version.

BTW, you have made something nice of it, well done.
User avatar
Graham Banks
Posts: 41415
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Live broadcast of engine pv

Post by Graham Banks »

Looks good. :)
gbanksnz at gmail.com
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Live broadcast of engine pv

Post by Ferdy »

Rebel wrote:In theory you can pick it from the Arena debug file, I have considered it for a next version.

BTW, you have made something nice of it, well done.
I am experimenting with ChessGUI, it is capable of outputing %clk in move comment on the pgn (aside from LiveTmp.pgn and LivePgn.pgn, the latter is for completed game and the previous is for the curent game) this is for time remaining monitoring. It is also capable of outputing PvWhite.txt and PvBlack.txt, can be used to display live engine pv's, but I observed it is not consistent, sometimes only PvWhite is updated or PvBlack is updated, then later the certain file is updated again. But this can all be solved by parsing the
file TLCV_File.txt (output from ChessGUI too containing engine and gui communication logs, from observation this file is consistent) ourselves and extract meaningful info.

I did try sending PvWhite.txt to sever then read it via javascript and display it on a page, but it looks slow (delays have to be configured perhaps both in pgn4web reloads and sending of files, it also depends internet speed, broadcasting games played on slower time control could be ideal), added to that the problem of PvWhite.txt not updating consistently. Also there are times that the server fails to load the PvWhite.txt even if the updated file has already arrived.

Later I will try to extract relevant pv from TLCV_File.txt

I am also looking now on python/cgi, to show on a page the Pvwhite.txt instead of using javascript.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Live broadcast of engine pv

Post by Ferdy »

Graham Banks wrote:Looks good. :)
One more remaining feature, show me the live pv :), I don't like TLCV I cannot connect, cannot see it on my phone and tablet too :( .
tttony
Posts: 268
Joined: Sun Apr 24, 2011 12:33 am

Re: Live broadcast of engine pv

Post by tttony »

I'm learning node.js right now so, to work with real-time update you can try node.js that has websocket, but most of the free shared hosting does not offer node.js, so you can register on https://www.heroku.com that offer node.js for free with (I think) 300MB disk space, the only problem is that you have to configure everything yourself and can be tedious, after creating the account read this guide to setup your app with node.js https://devcenter.heroku.com/articles/g ... troduction

The rest is to create a real time app to show the pv, with https://socket.io/ you can do it (I have not tested it)

Let me know if you want some help :D
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Live broadcast of engine pv

Post by Ferdy »

tttony wrote:I'm learning node.js right now so, to work with real-time update you can try node.js that has websocket, but most of the free shared hosting does not offer node.js, so you can register on https://www.heroku.com that offer node.js for free with (I think) 300MB disk space, the only problem is that you have to configure everything yourself and can be tedious, after creating the account read this guide to setup your app with node.js https://devcenter.heroku.com/articles/g ... troduction

The rest is to create a real time app to show the pv, with https://socket.io/ you can do it (I have not tested it)

Let me know if you want some help :D
Thanks for the tips, I will try to explore it too.
mjlef
Posts: 1494
Joined: Thu Mar 30, 2006 2:08 pm

Re: Live broadcast of engine pv

Post by mjlef »

Rebel wrote:In theory you can pick it from the Arena debug file, I have considered it for a next version.

BTW, you have made something nice of it, well done.
This has been an issue for too long. Few GUIs support embedding PVs, Evals, nps, etc in pgn files while playing a game. Arena does, but some of the major GUIs have just not done this, perhaps not knowing the importance of streaming this information live during a game. there is a nice javascript PGN viewer that will display this stuff if embedded properly in the PGN.

So, one solution is to write something like inbetween, but in this case, it simply passes UCI command back and forth between the GUI and engines. And in the process, extracts the information needed and writes out a PGN file with each move. This file then can be sent via scp, ftp, dropbox.... to a server showing the live game. It would be a little tricky, since it would have to convert the "position" command to a series of reduced algebraic notation moves. Putting in the eval, nps, depth, PV.... in as a comment.

I think if someone wrote this to match the existing javascript displays, it would be very popular. And I am even willing to spend some time to work on it, and make a public domain source code base people could add to and modify.

If there is something that does some or most of this, let me know.
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Live broadcast of engine pv

Post by hgm »

When I broadcast an event, I usually want to show an update of the PV several times per move. (Unless perhaps when it are bullet games.) So embedding it in the PGN is not the way to do it.

I developed a broadcasting server as a server-side CGI script, which allows a broadcasting server to deposit game or PV data on the server through http GET requests. A program on the server examines the GUI <-> engine traffic to select the moves and PVs, to upload these by this method.

The viewer web page can then download the game and PV data through other GET requests to the same server (e.g. by long polling), to provide live reporting of any change.
User avatar
Rebel
Posts: 6991
Joined: Thu Aug 18, 2011 12:04 pm

Re: Live broadcast of engine pv

Post by Rebel »

mjlef wrote:
Rebel wrote:In theory you can pick it from the Arena debug file, I have considered it for a next version.

BTW, you have made something nice of it, well done.
This has been an issue for too long. Few GUIs support embedding PVs, Evals, nps, etc in pgn files while playing a game. Arena does, but some of the major GUIs have just not done this, .....
Chances are small this is going to change soon. The alternative is that engine programmers do it themselves by an universal protocol. Basically what is needed are 2 text files.

main.txt - with the (current) main variation.
current.txt - with current depth|move under consideration.

And the life of web developers suddenly is a lot more pleasant.