开发者

Facebook flash game client-server communication

开发者 https://www.devze.com 2023-03-18 15:47 出处:网络
We\'re currently working on a small scale indie card game for Facebook, which we hope will reach hundreds of thousands of players (eventually).

We're currently working on a small scale indie card game for Facebook, which we hope will reach hundreds of thousands of players (eventually).

We have most of the issues figured out (scalability, server-side architecture, etc) - however one question - communication between client & server.

We have the following requirements:

  • Server side push messages (no client message request)
  • High scalability (should support at first hundreds and later hopefully thousands of CCUs)
  • Secu开发者_StackOverflow中文版re, reliable layer
  • Work well with most computers, routers & browsers
  • Works with Adobe Flash/AS3

First thing that came to mind was socket connections, but I was wondering, is there a better solution that answers our needs?

Thanks!


A socket connection is almost inevitable (see transport layers).

A good idea is to use TCP: it guarantees delivery (high reliability), it's "connection" orientated. There are some downsides, but other alternatives are not available on most computers, routers and browsers.

A more important question is: what are you going to send over TCP? Generally, it's a good idea to use something that can be used in Flash and your server (see Remote Procedure Call for example).

"Push" messages are generally only a problem with HTTP connections, as it was designed to handle synchronous requests. However, in Flash you do not have this limitation.

Security can be added by "wrapping" a TCP connection: use SSL or TLS.

  • XML serialization (XML-RPC): easy to develop and maintain, moderate performance, maybe reliable.
  • RTMP (Real Time Messaging Protocol): native to Flash, great performance, great for realtime games, and can be tunneled over HTTP (to surpass any firewall/router).

See NetConnection class, and the Action Message Format.

The Adobe Integrated Runtime and Adobe Flash Player use AMF to communicate between an application and a remote server. AMF encodes remote procedure calls (RPC) into a compact binary representation that can be transferred over HTTP/HTTPS or the RTMP/RTMPS protocol. Objects and data values are serialized into this binary format, which increases performance, allowing applications to load data up to 10 times faster than with text-based formats such as XML or SOAP.

(from http://www.pyamf.org/)


We use WebORB in our flash games for comunicating serverside and clientside but i don't know it is enough for your requirements.

Sorry if i miss understood.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号