views:

560

answers:

4

In short I'm creating a Flash based multiplayer game and I'm now starting to work on the server-side code. Well I'm the sole developer of the project so I'm seeking a high-level socket library that works well with games to speed up my development time.

I was trying to use the Twisted Framework (for Python) but I'm having some personal issues with it so I'm looking for another solution.

I'm open to either Java or a Python based library. The main thing is that the library is stable enough for multiplayer games and the library needs to be "high-level" (abstract) since I'm new to socket programming for games.

I want to also note that I will be using the raw binary socket for my Flash game (Actionscript 3.0) since I assume it will be faster than the traditional Flash XML socket.

A: 

High-level on one side and raw binary sockets on the other won't work. Sorry, but you'll need to go low-level on the server side too.

EDIT: in response to the OP's comment. I am not aware of any "high level" interface of the nature that you are talking about for Java. And frankly I don't think it makes a lot of sense. If you are going to talk bytes over Socket streams you really do need to understand the standard JDK Socket / ServerSocket APIs; e.g. timeouts, keep-alive, etc.

Stephen C
Well I mean high-level in that the naming conventions are laymen. I actually "know" BASIC socket concepts and was hoping to make my own socket server from the ground up but I just don't have that kind of time. I was hoping to find a solution that handled most of the standard socket processes (like timeouts) and than packaged it all into an easy to use api that has good documentation.See it's not even FINDING one it's more or less me asking if anyone KNOWS of a good solution.(I don't want to have to re-program the server in a few months due to my poor choice in a socket library)
CodeJustin.com
What is wrong with reprogramming something later on? It is called "learning from your mistakes". Its all part of the learning process.
Stephen C
Agreed 100% and I guess as long as I don't have to change my api client side then it wont matter much. Just a little worried about building my game around a faulty design (due to my part) and then coupled with my lack of knowledge for socket programming it would be lights out if I attempt to make my own server (from scratch) without the help of a socket library that handles processes such as updating all the clients with new data.I know if the game moves past the end of the year than I will be doing a server rewrite but want to go in prepared.
CodeJustin.com
I have to disagree with the answer ("High-level on one side and raw binary sockets on the other won't work."). See for example Netty in Rod Hyde's answer which provides a high-level, asynchronous interface to Java sockets, in a manner independent from the wire protocol (for which Netty also provides building blocks of various complexity and completeness)
Thomas Dufour
A: 

See "A Quick Guide to ActionScript 3 and Flash Programming". It has a detailed example of an ActionScript client code using sockets to communicate with a Python server (code included). Not what anyone will call high-level, it makes use of the basic Python socket module for communication.

(Note: the Python server example is not pythonic. After getting the general idea of using sockets in Python, write something simpler and NO from socket import * )

gimel
Thanks for this gimel, this is what I mean. I actually started a server a few days ago with the core Python socket module BUT I started to get a little overwhelmed with how much design wise I would have to do before even getting a decent set of methods to work with the game. So much to worry about and so much I do not know... then I seen the Twisted framework which did most of this "little stuff" I was having trouble with but for personal reasons I do not want to use Twisted.
CodeJustin.com
You're welcome. See http://stackoverflow.com/questions/1157245/creating-a-board-game-simulator-python-pygame for a discussion of communication strategy. Keep it simple.
gimel
Thanks again gimel, that was a quick and dirty run down of client-server design for turn based games. Helpful
CodeJustin.com
+1  A: 

An option for Python is the Concurrence framework. I used it fairly recently, in conjunction with Stackless Python, to simulate an environment in which there were potentially thousands of requests per second, each of which had to be processed in less than 2 seconds. The API is very straightforward and is well documented.

I came very close to implementing in Java using Netty, which is a JBoss project.

Rod Hyde
Wow, can not believe I didn't stumble upon Concurrence earlier. It looks to be a good solution for me (even has built in mysql class). The documentation is laid out well too, thanks. Right now I'm still open to more suggestions but I'm going to check out Concurrence to see if I like it.
CodeJustin.com
+1 for Netty, which I'm currently using as a server for a Flash socket client. It's a blast, frankly.
Thomas Dufour
A: 

For java there is Apache mina and Grizzly frameworks both of those really simplify work with sockets

Nikolay Ivanov