Can I use API to create and play custom games

Hi I am wondering if it’s possible to use only the API to create an offline game and play between two players.

If you’re using the API, you can’t really do an offline game… am I missing something?

But yes, you can use the API to create and play a game - see any of the third party apps. Probably simplest is going to be this CLI client written in Go(lang). More mature examples will be the two mobile apps: Android, iOS

If you’re just looking to play offline, your best bet is to create a demo board before you disconnect from the network.

Oh my bad I meant to say the type of game where both players are in front of the same computer playing. I guess internet is needed like you said. As long I can use ogs to play or display game in real life with only programmatic calls I’m happy. Not sure if I can do that though. I didn’t see create game in api documentation.

1 Like

Yeah API documentation isn’t great AFAIK (although I thought maybe some work was being done so maybe it’s changed).

How about players/%%/challenge? See how the website does it:

1 Like

Oh the website looks like a great place to get the info. And I think what I really need is to be open a demo board and interact with it. Do you by any chance know what API that uses?

To create the demo board, use /demos:

I’m not sure how game play works - but one way to find out would be to open up your browser’s network tab and see what’s getting transmitted over websocket.

1 Like

I am really curious about the purpose though. :smiley: Why use an API of an online go server to create offline games? If all you want is to play offline I am willing to bet we would find a more convenient way. Any sgf editor would do, or you can even have bots to play with…

1 Like

Oh any third party sgf editor offer library and a display as well?

I want to build a go board that allow people to play with physical stones and also displayed digitally somewhere. I thought about ogs because it’s something people use already and if I can incorporate it then people don’t need to use an additional software to interact with the board. I will start with other libraries though because that sounds more straightforward. Can you recommend me some libraries that can display and build the sgf in real time as people play?

2 Likes

If you mean “I will enter the moves from both sides as the players play on a physical board, and this will be displayed to people watching online” I can see how that’s a useful thing, and OGS would seem like it has all the right features you’ll need to otherwise create somehow.

Is that what you mean?

People already do this sort of thing “relaying” pro games on OGS. I’m not quite sure how :smiley: Someone must know though!

1 Like

I didn’t know the network tab gives me the API call name. I’ll give that a try. Thanks!!

2 Likes

I initially just want to build a DIY project with my girlfriend because we both like to play go but we can’t recall accurately where we place our stones. But now that you mentioned it, it would be a useful and fun feature to have for sure.

I assume this would serve two players who are in the same room but want their game to be broadcasted while playing on a physical board.

Right - I think you can already do this … maybe someone will pop in here to say how, or you could create a thread with that question.

If there isn’t exactly what you want, I think that starting from the OGS web client code would be far easier that bringing up a game from scratch using the API and standalone code.

edit: actually, that might be an exaggeration. It wouldn’t be far easier, because there’s a learning curve for “how does this whole web client work”, but it might be easier in the long run, because many challenges using the API alone are already solved in the web client :blush:

Yeah make sense. I’ll utilize ogs API and post more questions in the forum in the future as they come. I’m quite surprised by how responsive this community is. I’ll definitely need more helps later on xd hopefully this project will become something fruitful.

1 Like

Actually what do you mean by web client code? I probably didn’t exactly know how that differs from API. :joy:

I meant the code for the OGS website that you use to play normally :slight_smile:

Instead of building a separate application from ‘nothing’, which calls the API, how about making the OGS web site do what you want (if it doesn’t already, which I suspect it might do already!)

I guess if you want a command-line app where you type in the coordinates of who played, and it shows up in OGS, then that’s relatively simple and makes sense to do standalone, calling the API.

But soon you are going to wish you could just click on a board on the screen to copy what they are playing, and when that is true, then adding to the current OGS web site to make it do what you want will be easier.

I think what you want is to be able to play both black and white moves from the same login, right?

1 Like

Hmm the idea is for people to play on a 19 by 19 “keypad matrix” and use Arduino to send any new move through the serial port. On the PC side some kind of application would run and take the new move coordinate as input and call the necessary function to register a move in ogs.

2 Likes

In that case, yep, it sounds like the API is what you want :+1:

1 Like

Wait a sec, this sounds like electronic go board, which I am always excited to see. Please keep us updated! I’d love to see the hardware in action!

2 Likes