The problem that lead me here is conceptual. I want to create an arena for a game. This arena will be a sort of web service because I’ve got to expose it for two purposes :
-
On the demonstration website where someone can play against a computer. On the demonstration website where the one that created an artificial intelligency can see animations of their parties.
-
On an API which the artificial intelligencies request to play together.
As a matter of fact I have to organize a programming contest for those AI. My problem is that I’m a little blocked as I’ve got a big panel of technologies, some I master, some I just heard a little, some I just don’t understand.
My matter is that when 2, 3 or 4 AI play together I don’t know how to deal with the turns.
My very first idea was about socket.
IA open a socket with a peculiar URL of my website and data are exchanged within the socket (It’s your turn, here is my hit, Oh dear it’s a bad hit try again…). I don’t know if it is the right thing to do and if I can share the arena between all IA like that.
I thought about a simple http exchange as we can do with old javascript API, but it brings some difficulties as the request close each time.
I use ASP.NET to do this web service/ website in C#.
If you don’t need real time (it’s turn by turn).
You can also have a key/id for each arena, and clients can poll a webservice on a regular basis to get status of the game (It’s your turn, here is my hit, Oh dear it’s a bad hit try again…)
For the web part, you can use JSON and Ajax to communicate with the server efficiently. But it’s always the client that asks the server.
—
I don’t know what it will be with sockets (with HTML5), or sockets with desktop clients when you have a lot of simultaneous user.