[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] Web version of GNU Backgammon

From: Theodore Hwa
Subject: Re: [Bug-gnubg] Web version of GNU Backgammon
Date: Sun, 22 Sep 2019 09:03:49 -0700 (PDT)
User-agent: Alpine 2.21 (LRH 202 2017-01-01)

Thanks for the pointer to Broadway, I'll have to look into it. For the initial project, I didn't look into running GTK in the browser, since I figured that would be the easiest part to do in Javascript directly.

It is currently done in pure JS without any special libraries. An HTML5 canvas is used to draw the board, checkers, dice, etc. directly (fortunately backgammon needs only simple geometric shapes that can be drawn easily, unlike (say) chess). I set gnubg to output the FIBS rawboard, which the JS intercepts and then updates the board. You can see the source code in the github project link in the original message. The board drawing logic is in the graphics.js file.


On Sun, 22 Sep 2019, Øystein Schønning-Johansen wrote:

Cool project. You have used emscripten to port the C code to webassembly? Isn't 
there a port og GTK done with emscripten?
Another way to port to web would be to display the application itself with a 
different GTK backend. I've tried that with the
Broadway backend that can display GTK applications directly in the browser. 
I've tried it with GNU Backgammon, however I
think it fails for GNU Backgammon due to the OpenGL stuff. 
How did you make the user interface? Is it pure js or do you use any fancy like 
React or Angular or Vue?
(I guess JavaScript is the next thin on my *must learn* list)


On Sun, Sep 22, 2019 at 9:47 AM Joseph Heled <address@hidden> wrote:
      A wonderful initiative. Perhaps one day we will have a reasonable Android 
version and all will be well.

On Sun, 22 Sep 2019 at 19:00, Theodore Hwa <address@hidden> wrote:
      Hi gnubg users,

      I have ported GNU Backgammon to the web, replacing the GTK UI with a
      Javascript UI. You can see it hosted here:

      As of now, you have to enter moves manually, like "8/5 6/5". You can enter
      arbitrary gnubg command line commands, so nearly all the features of the
      original are available.

      The project repository is here:

      Some technical details: This was done by compiling gnubg's C source code
      into Javascript/Webassembly with Emscripten.  A browser supporting
      Webassembly is required (the latest versions of most modern browsers do).

      Any comments, suggestions, contributions are appreciated!

      Ted Hwa

      Bug-gnubg mailing list

Bug-gnubg mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]