Playing with a gamepad?

Is that possible to use a gamepad (PS4 controller in my case) with the go board of OGS (for both playing and review)?

That would be really great!

HTML5 has a gamepad API in case that’s useful: Using the Gamepad API - Web APIs | MDN


The first thing I played on my PS4 was a game on OGS. Just in the PS4 browser with the browser cursor - not optimal, but doable haha.

Seems like a pretty niche request though… is it something you’d be willing to write a PR for? If so I’d be happy to show you around the code (all the client code is on GitHub!) Otherwise, I feel like there’s pretty slim chances of this feature becoming reality.

1 Like

Clearly niche but that would be quite nice to be able to play that way (with two controllers, you can basically play 1vs1 on the same screen).

I’ll try to give it a try whenever I have some time. Which repo that should go to?

Awesome! I do agree it would be very fun way to play. So I think a feature like this would be split between two codebases:

  • goban - A vanilla JS library for the HTML canvas Go board
    • GobanCanvas, the code for displaying the board on the canvas.
    • GobanCore - the superclass for GobanCanvas
  • - A React JS app that is pretty much the whole site.
    • Probably all changes would fall under Game.tsx and the components it relies on. That is the view for games, review and demos.

Fair warning, the code gets pretty messy because it’s been around for a while and handles a lot of different scenarios. Altogether it’s about 10k lines of code for the files I specifically called out. If your main goal is to be able to play with your friends locally, and don’t need all the OGS stuff (saved games, ability to play over a network), it may simpler to just make a basic website from scratch (client-only). Anyway, this is not to be discouraging, just wanted to share my thoughts having spent a lot of time in the Goban/Game code :sweat_smile:

This is a different thing and relatively often requested but not formally really possible right?

I guess we are in the realm of playing on a demo board or something with all the pitfalls of that.

1 Like

Using two controllers for black and white separately means that your software is able to manage two players at a time, each one with his own controller.
OGS doesn’t do that, nor does it any SGF client or PC Go software that I know.
There are many apps that allow you to reproduce a game, hence to play a new one, but controls are for one person (keyboard and mouse).
So I think you actually need a different kind of app, which behaves like a multiplayer game instead of a simple Go client.

I actually installed a Go app on my Xbox. It’s a KGS client and I used just once. Probably you could find something similar for your PS4.

1 Like

Yes. There is no need for the concept of two players of any kind in the code base. Simply being able to play from a gamepad. Then instead of allowing one gamepad to input a move simply allow two or more.

Actually it would work exactly the same with two mice.

Ok thanks. It’s a bit discouraging TBH since JS is far from being my confort zone. But I appreciate the transparence here! Stay tuned.

1 Like

But isn’t the point that in a normal game, say black places a stone using the game pad then it’s white’s turn but white is using another device somewhere. If white is in the same room using the same device then black must log out and white logs in to play their move.

Or with a demo board you have to be sure that white will not have the hilarious idea of interfering with black’s moves if both controllers control at once.

Yes I was thinking something fairly simple. One single account + 2 gamepads without conceptual differences in between those two input devices. Then indeed you must trust your friend just next to you in the same room to not interfere when this is your turn. But that is quite fair I would say.

Sorry for the confusion here, I wasn’t really talking about a fully implemented “2 players shared screen” feature here but simply a low ganging fruit as a consequence of being able to use two gamepads.

1 Like

Sure, but “normally” one single account only controls one colour. Hence workarounds like using a demo board which brings other issues since it wasn’t designed for playing games on.