Arimaa Forum (http://arimaa.com/arimaa/forum/cgi/YaBB.cgi)
Arimaa >> Bot Development >> Gameroom API?
(Message started by: corsix on Nov 7th, 2007, 4:57pm)

Title: Gameroom API?
Post by corsix on Nov 7th, 2007, 4:57pm
Is there a documented game room API, or documentation of all these game room cgi URLs? The bot scripts can be examined to determine the API that bots use, but this would likely not determine an API that could be used to write a replacement game room client (or the game room might think the human client was a bot).

Title: Re: Gameroom API?
Post by omar on Nov 8th, 2007, 11:49pm
Sorry never got around to documenting it. It's all in my head :-)

The closest thing to what you seek might be this:

http://arimaa.com/arimaa/protocol/

It has enough to allow writing a program that can be
used to play games in the Arimaa gameroom, but does
not have the APIs to show whos in the gameroom,
list of games in session, etc.

I was getting ready to add more APIs to it soon so that
the gameroom can start using AJAX and avoid
refreshing the page.

Are you interested in writing a gameroom client?


Title: Re: Gameroom API?
Post by corsix on Nov 9th, 2007, 10:31am
First some output from my experimentation:
Code:
> dofile "Lua/Gameroom.lua"
> room = gameroom:new()
> = room:login("corsix", "******")
Debug Response:
sid=3995072326
grid=3
--END--

true
> games = room:invited_games()
Debug Response:
1=opponent=corsix_%13timecontrol=0/0/0/0/0%13createdts=1194623865%13postal=1%13role=w%13rated=0%13
num=1
--END--

> print(#games)
1
> print(games[1]:time_control())
0/0/0/0/0
> print(games[1]:opponent())
corsix_
> print(games[1]:postal())
true
> print(games[1]:rated())
false
> print(games[1]:game_id())
nil


The action=invitedmegames doesn't seem to behave quite like the protocol page says it should:
Quote:
POST

   action=invitedmegames
   sid=[gameroom session id]

RESPONSE

   Same as for 'Find My Games'.
With the 'Find my Games' including:
Quote:
Each game information record is a set of key=value pairs seperated by '\n' and with all value strings modified so that '%' chars are replaced with "%25" and all '\n' chars are replaced with "%13". Each record contains the following fields:

   gid=[game id]
   role=[role=[w or b; which side the user will be playing]
   timecontrol=[time control string]
   rated=[0 for unrated; 1 for rated]
   postal=[1 if game is postal; 0 if game is not postal]
   createdts=[unix timestamp of when the game was created]
   opponent=[username of opponent]
As you can see from the debug output in the code (" 1=opponent=corsix_%13timecontrol=0/0/0/0/0%13createdts=1194623865%13postal=1%13role=w%13rated=0%13"), there is no gid field, which makes it rather hard to join the game.

Documentation for full gameroom functionality would be great to have, as I am planning to write my own client with the code placed under the GPL. You can download the current version from http://www.corsix.org/arimaa/ , although at the moment it only supports two players on the same computer, hence why I would like to plug it into the gameroom.

Title: Re: Gameroom API?
Post by omar on Jan 13th, 2008, 12:22am
Sorry corsix I didn't notice your post. I checked the code and you are right the gid was missing. I've fixed it now.



Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.