views:

143

answers:

2

I am currently working on a project that embeds a flash game, that uses Smartfoxserver for the flash communication. That communication is mostly just synchronizing the cursor and object movements between the two players.

Since I am not a flash guy, but a ruby programmer, I got curious: What kind of communication options does flash offer for this kind of time sensitive data exchange? I was thinking of writing a ruby-eventmachine based communication server to minimize the dependencies on external programs. Would that even be feasible?

+1  A: 

Although I don't have a complete answer for you, because I'm not done myself, I have found myself in almost the exact same position as you.

My current approach is for my ruby server to essentially just be a socket server that handles all of the communication between clients, however I personally intend on keeping any of the logic outside of the server ( unless I run across a reason to change that idea).

If you haven't done any socket programming in ruby, I recommend the following as a jumping point. This is an IBM document on Ruby Socket programming and discusses an approach for asynchronous data: Ruby Sockets - IBM

I think what it ultimately comes down to as well will be performance. I currently use a version of my ruby server in my daily work, but the data doesn't have to be updated in a time sensitive manner.

Beanish
+1  A: 

You can create a server in (almost?) any language that supports sockets and manage your clients with that.

From a flash perspective you could use ruby, but I don't know how fitted ruby would be for the task...I mean, you can make a PHP socket server but it would not handle much stress.

An alternative to SmartFoxServer could be open sourced Red5, written in Java.

If you want to know about flash built in capabilities in handling p2p: Flash p2p: Everett Church In Flash Player 10 adobe added Live media (RTMFP) support- Media was always sourced from the publishing peer. In Flash Player 10.1 beta they introduced groups and application-level multicast.

However, you would still need a server (Stratus) to handle introductions and manage active connections. ( Also, I regard it as geared towards flash video, Stratus does not support shared objects or scripting. So with Stratus, your applications will be clients communicating directly with each other.)

Edit: After re-reading your question and the answer provided by Beanish, I think the first time I got your question wrong. So I just re-wrote my answer...

goliatone