Arimaa Forum (http://arimaa.com/arimaa/forum/cgi/YaBB.cgi)
Arimaa >> Site Discussion >> server interface protocol.
(Message started by: froody on Nov 23rd, 2009, 2:45am)

Title: server interface protocol.
Post by froody on Nov 23rd, 2009, 2:45am
I'm trying to make a client. (This is a new project, starting from scratch in smalltalk. (My last attempt was never finished properly..))

My first aim is to deal only with postal games.

How often should I check for updates? To do so, do I have to go through each game doing action=reserveseat, action=sit then action=gamestate?

The sensible thing would be for the client to make one permanent connection to the server, then have the server send the client a message each time a move was made?

Any chance this will happen in the near future?




Title: Re: server interface protocol.
Post by Janzert on Nov 23rd, 2009, 9:13am
[Disclaimer: I couldn't find the protocol documentation just now so this is mostly from memory and looking at my bot interface which might vary in the names of a some variables.]


on 11/23/09 at 02:45:52, froody wrote:
How often should I check for updates?


As long as you include the "lastchange" value and set "wait" to 1 the server won't return an update until something changes or your "maxwait" seconds has passed. So in general you either get new information back or you can immediately start another request (either because the timeout was reached or there was a network connection problem). In case something goes wrong though it's probably best to throttle requests to no more than one every few seconds so the server doesn't get hammered.


Quote:
To do so, do I have to go through each game doing action=reserveseat, action=sit then action=gamestate?


Yes, I'm pretty sure that is correct. If you are monitoring multiple games at the same time I think I would open a separate connection for each.


Quote:
The sensible thing would be for the client to make one permanent connection to the server, then have the server send the client a message each time a move was made?

Any chance this will happen in the near future?


While this would have possible advantages in easing the implementation, I have my doubts as to how much difference it would make in end result.

Janzert

Title: Re: server interface protocol.
Post by froody on Nov 23rd, 2009, 11:30pm
http://arimaa.com/arimaa/protocol/

So if I have 10 postal games I should open a separate connection to each and use wait=1 ? Isn't this a bit inefficient? Does it matter?

Title: Re: server interface protocol.
Post by Janzert on Nov 24th, 2009, 8:36am

on 11/23/09 at 23:30:30, froody wrote:
http://arimaa.com/arimaa/protocol/

Thanks


Quote:
So if I have 10 postal games I should open a separate connection to each and use wait=1 ?

Probably.


Quote:
Isn't this a bit inefficient?

Yes.


Quote:
Does it matter?

Most likely not for tens of games. If it were hundreds or thousands it would become an issue.

The other option if you're just waiting for an opponent to make a move is to poll each game sequentially with a relatively short timeout. Your average delay in being notified of a move will be approximately the (number of games-1) / 2 * (maxwait length) and maximum delay is (n-1) * maxwait. So with 10 games and a 30 second maxwait average notification is less than 5 minutes after the opponent moves with the worst case being 9.5 minutes.

Janzert

Title: Re: server interface protocol.
Post by froody on Nov 24th, 2009, 9:45am
Also with action=invitedmegames there is no wait option?

How often should the client poll the server for invites? Once a minute is OK?

It seems a bit crazy to be polling the server so much. And also it adds the problem that the client doesn't get the move or invite immediately.

Title: Re: server interface protocol.
Post by Janzert on Nov 24th, 2009, 11:11am
Invites aren't in the bot protocol for interacting with the server so I don't really know anything about them. But taking a quick look at what the gameroom is doing with firebug it looks like it polls every 30 seconds.

Janzert

* Actually it's using an undocumented, as far as I see, action "state" that returns the state for the overall gameroom including if you have an invite waiting or not.

Title: Re: server interface protocol.
Post by omar on Nov 24th, 2009, 4:25pm

on 11/23/09 at 02:45:52, froody wrote:
I'm trying to make a client. (This is a new project, starting from scratch in smalltalk. (My last attempt was never finished properly..))

My first aim is to deal only with postal games.

How often should I check for updates? To do so, do I have to go through each game doing action=reserveseat, action=sit then action=gamestate?

I would suggest not building such a client. You would be building on a bad foundation. This server was not really built for such clients. What we really need is a better server similar to what FICS or ICC use and then we can build such clients around that.

Also if you are not careful you could cause a denial of service attack on the arimaa.com site if the client polls too fast during development.


Quote:
The sensible thing would be for the client to make one permanent connection to the server, then have the server send the client a message each time a move was made?

Exactly, but this would mean building a new server.


Quote:
Any chance this will happen in the near future?

Anyone interested in building a new server from scratch? I've been thinking this could be done as an open source project and if done in a general way the server could also be used by others for other games.




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