[HN Gopher] The first 10k games at bgammon.org, an open source o...
       ___________________________________________________________________
        
       The first 10k games at bgammon.org, an open source online
       backgammon service
        
       Author : tslocum
       Score  : 146 points
       Date   : 2024-07-01 15:08 UTC (2 days ago)
        
 (HTM) web link (bgammon.org)
 (TXT) w3m dump (bgammon.org)
        
       | 29athrowaway wrote:
       | I never understood that game. Maybe I should watch a tutorial or
       | something.
        
       | tslocum wrote:
       | Hey there, author here. Glad to answer any questions.
       | 
       | If you don't know how to play backgammon, check out this guide[0]
       | and/or this video[1]. There is a lot of history[2] behind
       | backgammon. bgammon.org is AGPL-licensed, the client[3] and
       | server[4] source code is publicly available. The graphical client
       | is powered by the excellent Ebitengine[5] game engine.
       | 0. https://bgammon.org/blog/20240201-how-to-play-backgammon/
       | 1. https://www.youtube.com/watch?v=KDvvKWi0ijs       2.
       | https://bgammon.org/blog/20240115-history-of-backgammon/       3.
       | https://code.rocket9labs.com/tslocum/boxcars       4.
       | https://code.rocket9labs.com/tslocum/bgammon       5.
       | https://ebitengine.org
        
         | porphyra wrote:
         | Is there a way to resign a game? I don't want to play against a
         | bot until I get totally demolished.
         | 
         | Also, if I click in the text input, a huge keyboard shows up
         | even on desktop, obscuring much of the game. Why?
        
           | tslocum wrote:
           | Yes, you can type /resign when it is your turn to end the
           | game.
           | 
           | Thanks. The keyboard input should only show up if your
           | browser is indicating there is a soft keyboard available for
           | the device. On Android, the device keyboard doesn't work for
           | some reason. It definitely shouldn't show up on desktop,
           | though. I will look into this.
           | 
           | The desktop version[0] shouldn't have this issue, if you want
           | to give that a try.
           | 
           | 0. https://bgammon.org/download/
        
         | honksillet wrote:
         | It might be worth while looking at lichess and take some
         | direction from their interface, which is quite nice.
        
           | tslocum wrote:
           | Lichess has been a large inspiration for the project. I gave
           | Lichess a shout-out for its influence in this blog post:
           | https://bgammon.org/blog/20240101-hello-world/
        
             | cdelsolar wrote:
             | That's awesome. I also took inspiration from Lichess for
             | https://woogles.io - a way to play a Scrabble-like word
             | game online that is also open source, AGPL, etc. (Also like
             | yours, written in Go!) It's hosted a number of big
             | tournaments and I believe we're about to hit 6M total games
             | (5.984 million so far! within the next day or two).
             | Computer analysis with a WASM program that is going to
             | improve, etc. I hope bgammon achieves a lot of success;
             | I've always wanted to learn backgammon and will give it a
             | try.
        
               | tslocum wrote:
               | Thanks. Lichess really has paved the way for other libre
               | online games. Congrats on the upcoming milestone. :)
        
               | cdelsolar wrote:
               | I'm really tickled by a lot of the stuff on your page.
               | For example your own backgammon interface language (UBEI)
               | - I'm also coming up with a language (UCGI) and slowly
               | translating our clients, bots, analyzers etc to use it :)
               | 
               | I'll plug your site on our Discord, it's neat.
        
         | bonzini wrote:
         | Why does "Play now using your browser" link to the play store?
        
           | tslocum wrote:
           | If the user-agent claims to be Android, the play link is
           | changed to the Play Store. This is because the web client
           | runs single-threaded[0] and has reduced performance when
           | running in a browser on desktop, let alone when running on a
           | mobile platform. When running as a native Android app, all of
           | the device's CPU cores are utilized.
           | 
           | 0. https://github.com/golang/go/issues/28631
        
             | salviati wrote:
             | It would be best to also change the text then, not just the
             | link. The text could read "Install the app and play now"
             | when the link is changed to point to the play store.
        
             | Y_Y wrote:
             | I would much prefer to run single threaded in the browser
             | than be cajoled into installing another fucking app.
        
               | tslocum wrote:
               | I would rather offer the browser-based version to
               | everyone, but it is an objectively worse experience
               | because of the state of the Go compiler. You can still
               | visit the broswer-based version if you want to, it's just
               | a link swap on the page done in JavaScript.
               | 
               | Out of curiosity, what do you think I should do? Keep in
               | mind, not everyone feels the same about being "cajoled"
               | into installing an open source application. But virtually
               | everyone won't appreciate the UI hangs.
        
               | Y_Y wrote:
               | Maybe you could offer both links, with a note that says
               | what you just said?
               | 
               | (I don't think you're forcing free open backgammon down
               | people's throats, but there's an existing fatigue due to
               | less scrupulous publishers detecting mobile browsers and
               | pushing people away from otherwise functional websites.)
        
             | postexitus wrote:
             | Why would a backgammon game need multiple threads?
        
               | TylerE wrote:
               | So the UI can respond while the CPU is calculating.
               | Assuming the AI is using some sort of alpha-beta search
               | the CPU also will scale embarrassingly well across
               | multiple threads.
        
               | CodesInChaos wrote:
               | I agree than the basic functionality should require so
               | little work that multiple threads should be useless. Some
               | features like bots or game analysis could benefit from
               | multiple threads, and should at the very least run
               | outside the main UI thread. However these are only nice-
               | to-have, and I'd be happy with a web-client that either
               | doesn't support these at all, or only uses a single
               | worker thread. And I see no reason to support this on
               | desktop, while redirecting to an app on mobile.
               | 
               | Moving those features a webworker so the UI stays
               | responsive should be easy, however I'm not sure how
               | synchronizing multiple webworkers to take advantage of
               | multiple cores compares to synchronizing multiple threads
               | in a native app.
        
       | closedl00p wrote:
       | Hi, nice snappy interface (even after making the HN front
       | page...) and I like the gentle highlighting of possible moves for
       | a piece.
       | 
       | In two games against the bot I _think_ I had the luck to run into
       | a corner case bug with the rules engine: in the position shown in
       | this screenshot https://ibb.co/dQ3HsM4 I'd rolled a 4-6, but the
       | UI would not let me move my piece on 9 four spaces to hit the
       | opponent on 5 -- the UI only wanted to let me move that piece six
       | spaces.
       | 
       | I can imagine how this bug could happen-- all my pieces except
       | this one are in my inner table, so it looks like my piece on 9 is
       | the only piece that can legally use the rolled six, and you're
       | required to fully use your roll if possible... except in this
       | particular case, once I move that piece four spots, I'd be fully
       | in my inner table and could use the six to bear off a piece.
       | 
       | [sidenote: I realize I don't know the best 2024 way to host a
       | temporary image for posting on a text-only forum like HN... but
       | imgbb looked reasonable...]
        
         | tslocum wrote:
         | Thanks for reporting this and including a screenshot. I
         | appreciate it.
         | 
         | I've just resolved this on the server and in the web client
         | (now v1.3.5p1, displayed at the lower right when the game
         | loads).
        
         | dumbo-octopus wrote:
         | While we're on the topic of ancient link-based sharing
         | websites, here's a pastebin of the Typescript code I wrote
         | years ago that I just dug up to see if it'd handle this case.
         | It does! It uses an actually-pretty-fast backtracking
         | implementation to check for valid moves - validating Backgammon
         | moves is a harder problem than you'd think, especially doing so
         | quickly enough to effectively run monte tree search with. Even
         | with all the thought I've put into it, I still don't have a
         | quick explanation I can give a human trying to learn that game
         | what the valid moves are, especially in the endgame and with
         | blocked moves.
         | 
         | https://pastebin.com/QeSdnQpM
         | 
         | And the test cases I have for it: https://pastebin.com/vmMEjSMz
        
       | _tk_ wrote:
       | Congrats, this looks like an amazing project!
        
       | mieses wrote:
       | bgammon.org register and login pages do not allow copy/pasting of
       | usernames and passwords. i'd love to play but that's kind of
       | annoying.
        
         | swebob wrote:
         | Agree, terrible security not being able to fill the form using
         | a pw manager.
        
       | bonzini wrote:
       | Backgammon had a pretty large community at Yahoo! Games. With the
       | demise of Yahoo! Games the only place to play online was FIBS,
       | for which you had to download a Java client... Glad that finally
       | someone scratched their own itch and built this, I will check it
       | out and suggest it to my father.
        
         | lstolcman wrote:
         | Check https://www.playok.com/ - it has backgammon as well as
         | other games. The site is using html 5 and following "keep it
         | simple" principle; it just works
        
           | 2-3-7-43-1807 wrote:
           | very nice web site! thanks for recommending it here. just had
           | a nice game of gin rummy.
        
         | starmftronajoll wrote:
         | I've played for a long time at BG Galaxy, judging by online
         | backgammon forums (and activity on BGG itself), it's a pretty
         | popular place to play.
         | 
         | https://www.backgammongalaxy.com/
         | 
         | Edit: Hey tslocum, rather than downvoting anyone who mentions
         | other sites where people can play backgammon, I'd love for you
         | to tell us more about why you believe your site is or will
         | become superior to the existing options. There's room for
         | improvement in this space, but you're definitely not there yet.
        
       | ulf-77723 wrote:
       | I love the game, created a german niche website about backgammon
       | with steady traffic since years. Always happy to see new
       | solutions.
       | 
       | How do you cover the server costs, without ads?
        
         | tslocum wrote:
         | I've designed the server and its embedded backgammon engine to
         | use very few resources, so it's all able to run on a dual core
         | VPS that I am already using for my numerous other projects.
         | Everything needed, including Postgres, currently uses less than
         | 256 megabytes of memory and negligible CPU.
         | 
         | As it grows, I intend to follow in Lichess' footsteps by
         | offering a paid supporter badge without locking any
         | functionality behind a paywall. Because the server is
         | lightweight, just a few paid supporters should be able to
         | offset the costs for many free users.
        
       | floed wrote:
       | So clean. So fast. Finally an OS client for all platforms.
        
       | floedel wrote:
       | So clean. So fast. Finally an OS client for all platforms.
        
       | floedel wrote:
       | So clean. So fast. Finally a client fo Android without tons of
       | BS.
        
       | m101 wrote:
       | Can you add support for tavli?
       | 
       | https://www.bkgm.com/variants/Tavli.html
       | 
       | The first game of tavli is portes which is the most common
       | variant of backgammon played. Tavli is played by Greeks at least
       | (and I'm sure many more)
        
         | michaelti wrote:
         | Perhaps of interest: an open-source implementation of Tavli in
         | JavaScript: https://github.com/michaelti/olympus-backgammon
         | (disclaimer: I'm a co-author). Curious if we could share some
         | knowledge here!
         | 
         | Excited to read more about the Universal Backgammon Engine
         | Interface mentioned in the post.
        
         | tslocum wrote:
         | It should be possible to support this variant. (PRs welcome!)
         | 
         | I've opened an issue for tracking this:
         | 
         | https://code.rocket9labs.com/tslocum/bgammon/issues/21
        
       | huimang wrote:
       | Something I've thought a lot while playing backgammon locally is
       | "I wish there was a site like lichess, but for backgammon"... so
       | kudos for going out and starting your own! Are there any plans
       | for post-game analysis?
       | 
       | There seems to be an issue with the login/signup form, as it
       | doesn't pull up the native keyboard for my phone, but some random
       | keyboard.
        
         | fforflo wrote:
         | I got a feeling that this may be a cultural aspect there too:
         | Backgammon is not considered "sophisticated," I think. I'm from
         | Greece (I don't play backgammon myself, though), and backgammon
         | (tavli) is extremely popular but widely considered "a game for
         | the masses." It is played mostly in tavernas and old-style
         | coffee shops, and each game has a social aspect, too. People
         | discussing (sometimes shouting and finger-pointing "no! You
         | should have done this or that! Ah! just get up and let me play,
         | you're a noob!"
         | 
         | I can't but laugh thinking who would be the GMHikaru or
         | GothamChess of tavli :D :D
         | 
         | Edit: This can be misinterpreted. I don't play tavli not
         | because is not considered sophisticated, I just find the rules
         | confusing for certain setups.
        
           | chongli wrote:
           | That sounds great! Here in Canada the bar scene is mostly
           | about watching hockey on big screen TVs. That's a lot less
           | interesting to me than games.
           | 
           | I never learned backgammon though.
        
           | kzrdude wrote:
           | chess should be a game for the masses too, and I think it is.
           | People play that in cafes too
        
             | TylerE wrote:
             | Backgammon is arguably a much better game for casual play.
             | In Chess, unless the skill levels are pretty close, one
             | player (the stronger one) is going to win almost every
             | game, and many of the non-wins will be draws.
             | 
             | Backgammon has just about the perfect amount of RNG
             | injected into it... weaker players can win, especially a
             | single point (backgammon is typically played to a point
             | target.. a game is normally worth 1 point (except for a few
             | edge cases where one player loses very badly), but there is
             | a doubling cube that starts in the middle. At their turn
             | either played can pick up the cube and double, at which
             | point their opponent can either accept, and play for double
             | points, or resign for the _original_ stake. The cube is
             | then handed to the acceptor, and then he can redouble
             | later, etc, etc.
        
           | TylerE wrote:
           | Interesting, I've seen the opposite. In the US it's hardly
           | played at all, nowhere near something like chess or poker,
           | but a large (relative) percentage of the play that happens is
           | for money, often at absolute nosebleed stakes.
        
         | me_me_me wrote:
         | https://www.playok.com/
         | 
         | its english version of polish kurnik.pl (henhouse)
         | 
         | Its as old as polish internet, very rudimentary but always
         | active for all kind of games
        
           | NooneAtAll3 wrote:
           | no long nardi :(
        
         | tslocum wrote:
         | Thanks. Yes, I hope to support analyzing games in the future. I
         | experimented with interfacing with gnubg to accomplish this,
         | and hit a brick wall, as gnubg really isn't designed for
         | computers to use it. From what I can tell, I would need to
         | scrape the terminal output of gnubg to do this
         | programmatically. I haven't found any open source engines that
         | seem easier to interface with, if anyone knows of one, please
         | share.
         | 
         | The internal keyboard is shown rather than the device keyboard
         | because on many devices, using the device keyboard does not
         | work. It either doesn't show at all, or it is shown but key
         | input is not registered. I hope that the game engine powering
         | bgammon.org adds support for using device keyboards soon, and
         | will be glad to revert to using device keyboard as soon as
         | possible.
        
       | oldmariner wrote:
       | Pretty cool, thanks!
       | 
       | I was casting my pieces off, guaranteed a win, but my opponent
       | left, so it didn't count as a win for me to my disappointment.
       | 
       | Perhaps if someone leaves and doesn't return within 60 seconds,
       | the game should be a win for the person remaining if the
       | remaining person's pip count is lower.
        
         | anamexis wrote:
         | I think whoever abandons the game should forfeit, otherwise you
         | get weird incentives (like to quit anytime your pip count is
         | higher)
        
           | oldmariner wrote:
           | That's why I only mentioned a different condition which
           | hopefully doesn't lead to bad sportsmanship.
        
         | oldmariner wrote:
         | Happened a second time :-( although this time my opponent still
         | had a chance.
         | 
         | Both games where my opponent left, now show as wins in my
         | history.
         | 
         | Also, I like the dice addition, but on desktop, the dice images
         | are not matching up with what is rolled and displayed in the
         | log.
         | 
         | How long does an opponent have until they auto forfeit if they
         | don't move?
        
           | tslocum wrote:
           | Thanks. The way inactivity is handled is covered in the FAQ:
           | https://bgammon.org/faq/#what-happens-if-a-player-goes-
           | inact...
           | 
           | You shouldn't need to wait more than 30 seconds to see a win
           | in your history after you also leave the game.
           | 
           | Will you please share a screenshot of the dice issue?
        
             | oldmariner wrote:
             | https://imgur.com/a/bqyWblS
             | 
             | Maybe it was the Firefox addon Canvas Blocker? That addon
             | was crashing the game, so I disabled it and appears to work
             | now. The game still makes my laptop fans kick on though.
        
               | tslocum wrote:
               | Thanks. Yes, that makes sense. The web version of the
               | game is powered by WebAssembly and renders to a canvas.
               | 
               | The game is only able to utilize one CPU core when
               | running in the browser, maxing that core out probably set
               | off your fans.
        
               | NooneAtAll3 wrote:
               | ...isn't webassembly supposed to be _more_ efficient?
        
               | tslocum wrote:
               | The reduced performance is a Go problem rather than a
               | WebAssembly problem. See this issue for more info:
               | 
               | https://github.com/golang/go/issues/28631
        
       | CamelCaseName wrote:
       | I'm on mobile, clicked "Play now" where it said "Play now using
       | your browser" and it brought me to the play store.
       | 
       | Downloaded the app, and tried to sign up, but everything was
       | flashing -- I think it keeps flipping between screen sizes
        
       | NooneAtAll3 wrote:
       | When I press "Play" button in the corner, it shows loading
       | message and then black screen...
       | 
       | Is this website even worth it, if I don't like short backgammon
       | and prefer long nardi?
        
         | tslocum wrote:
         | If you have JavaScript, WebAssembly and/or Canvas elements
         | disabled, the game won't be able to run in your browser. If you
         | take a look at your browser's console, there might be a helpful
         | error message.
         | 
         | Acey-deucey and tabula games are supported in addition to
         | backgammon.
        
       | mandymoorefan wrote:
       | My GF plays a ton of backgammon online. This isn't related to the
       | post. Just sharing a project / software that is related in
       | concept.
       | 
       | heroes.backgammonstudio.com
       | 
       | Whoever runs this project does a fantastic job. It feels like
       | they really care about the game. There's some friction to signing
       | up and rules that force you to finish games that results in a
       | stable player base.
        
       | euph0ria wrote:
       | Great game! Some feedback from a first time ever backgammon
       | player:
       | 
       | - Thank you for getting me to play for my first time!
       | 
       | - Once a move has been utilized, then grey out that dice
       | 
       | - Rename the button "OK" to "Skip turn", I was wasting many turns
       | until I figured out it skips your turn
       | 
       | - Make the color of your player more visible, I didn't know if I
       | was black or white, thought I was white for the longest time
       | 
       | - For desktop users, do not show the popup keyboard, super
       | difficult to chat with other players since it hides the text I'm
       | writing
       | 
       | - Once I've done my two/four moves, autoclick the "ok button" so
       | it speeds up the gameplay
        
       | somat wrote:
       | The opening position of backgammon always worries me, not because
       | it is bad, but because I don't understand it. And backgammon is
       | old enough that getting to the origin and meaning behind the
       | position is not trivial.
       | 
       | My best guess is that the game started out with all the pieces
       | off the board and you had to get them all on and around and off
       | the far side. However this takes too long and some bright
       | Persians who understood the game far more than me who only plays
       | an occasional game with my father started creating and playing
       | strategic openings. Positions with interesting interactions with
       | the dice but now the game was much shorter and exciting. And the
       | game we all play and enjoy today was one of the more popular
       | openings.
       | 
       | A good theory, hard to prove. But why on earth do you start with
       | five tokens already in your home???
        
         | tslocum wrote:
         | I think the opening position evolved out of a desire for more
         | interesting openings and resulting middle and end games. The
         | position does seem strange at first, but it is sort of the
         | foundation for more sensible positions, like turning 6-1 into a
         | fortification of two pieces on the same space. Without the
         | opening position, you would only have at most one checker on a
         | space with this roll. I have absolutely nothing to prove any of
         | this, it's purely speculation, as this is something I've
         | wondered about as well.
        
       ___________________________________________________________________
       (page generated 2024-07-03 23:02 UTC)