Flash has come a long way in the last decade, and it's a well-kept secret getting a Flash game to connect to a multi-client server for chat and/or basic avatar movement in real time.

Why has the industry as a whole not made this a common-knowledge type of thing yet? We keep pushing to the web but I am finding it incredibly difficult gathering learning material on this subject.

Sure, I can find multi-client server socket tutorials in various languages (using select statements and/or threads to handle multiple socket connections), but in regards to Flash applications inside of a browser? NOPE!

Can everyone please share what they know? :] It's a subject I'd really love to get into but I'm afraid I just honestly don't know enough about how to do it.

  • \$\begingroup\$ I was looking into this very thing many years ago before Adobe was in the picture, and I telephoned Macromedia directly after not finding anything online. They told me that only XML communications were supported, and that direct socket I/O simply wasn't possible and wasn't in the plans. For an MMO, reading/writing specific bytes of data is important from a performance optimization standpoint, and XML carries ridiculous amounts of overhead for this sort of thing (it's wasteful to package/parse 50+ bytes to send/receive a few bytes of data repeatedly -- that CPU power should go to gameplay). \$\endgroup\$ Jun 10 '11 at 1:45

The reason you cannot find any info about running a socket server from Flash within the browser is because it is not possible. You can only connect to a socket server from a Flash movie running in the browser.

To run a socket server with Flash you need to create an AIR 2.x application that runs on the desktop. This article on Adobe AIR Developer Center should get you started.

  • \$\begingroup\$ I meant exactly what you said - connecting to a socket server from flash, not running Flash AS a socket sever (I never even said that to begin with..) \$\endgroup\$ Feb 9 '11 at 20:29
  • \$\begingroup\$ You mentioned "multi-client server socket tutorials ... handl[ing] multiple socket connections". I read that as wanting to run a socket server inside of Flash Player. Anyway, the article I linked also explains how to connect to a socket server in Flash. \$\endgroup\$ Feb 10 '11 at 5:08

I'd imagine the reason you're not hearing much about Flash connecting to a multi-client server is possibly because you're researching only the Flash-side of things and not the server-side element.

It's less of a front-end / client-side issue, and more of a server-side management of state, connections (i.e. players), data (-base) updates, and what-not.

I've seen a nice abstraction used with SmartFoxPro. They offer the plug-and-play chat client, room client, in-game API that you can hook into as a flash / actionscript developer.

Honestly, you should take a look at multiplayer game development from the server-side perspective (java - redwarf, ruby, python (piston as a framework), even php using a framework like codeigniter for a lightweight application).

Take a look at researching from that angle and hopefully that helps!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.