Fog Creek Software
Discussion Board




Multi-player Flash Games

I've mostly disliked Flash in web pages since I first started seeing it, and the recent slew of overlay Flash animations also annoys me, but a friend of mine recently introduced me to the games built into Messenger 6 and I got somewhat curious :)

You can play solitaire, or bejeweled (among others) against a friend also running Messenger and the game shows up in an add-on window running Flash. Provided everything is working, you play against each other in real-time, and the scores are stored somewhere on Microsoft's server. However, if for some reason the score servers are down, it will stay allow you to play peer-to-peer. This kind of makes me wonder how the networking is implemented, and if it's built into Flash or something you need to code yourself.

That got me curious, so I went to zone.msn.com and noticed the CA$H games they have where you can now play (also through flash) the same games and win cash prizes (e.g. you pay $1 to play and win $1.80 if you beat someone else, so MS makes $0.20).

Has flash become a valid medium (sandbox) for doing multi-player gaming on the web? Does anyone have any experience developing systems like this, or is MS the first? I notice on the zone site, they're running asp (heh) so I guess the flash clients could just report back to the server every time the player does something in the game ...

Note: I have done practically nothing in Flash, so if this is a blatantly obvious question then please excuse me :) I did poke around on Macromedia's site a bit this morning, but didn't seem to see any similar examples.

jedidjab79
Thursday, September 18, 2003

Generally Flash browser plug-ins needs to respect a sandbox rule similar to java applets. Not only does it protect users from hackers.. it actually probably protects hackers from servers in some respect.. I think you are only allowed to open a connection back to the server. And they are XML messages sent using HTTP post/gets. The server is the point of contact for all Flash-based game clients and need to apply the rules in a constant way so that everyone get the proper "state of now" in the xml updates. You can design HTTP servers that can serve lots of concurrent XML-web service-like requests with session tracking and what not and use main memory databases to update rules (and RDBMS to update final scoring and ranking or message passing).. one of the examples you might want to consider is the Haboob tarball for the SEDA project created by Matt Welsh (author of Running Linux I think)

Li-fan Chen
Thursday, September 18, 2003

I dunno if this is suppose to be helpful, but I have found some key documents detailing how the security model works. Observing the rules in these models should allow you to see what sort of networking arrangement is possible for your games. To the best of my knowledge XMLHTTP and the more raw form queries is the only way Flash knows how to grab anything from the server side.

Flash 7's security model:

http://sdc.shockwave.com/devnet/mx/flash/articles/fplayer_security.html

Flash 6's security model:

http://www.macromedia.com/support/flash/ts/documents/security_sandbox.htm

Flash MX's security model:

http://www.macromedia.com/devnet/mx/flash/whitepapers/security.pdf

Li-fan Chen
Thursday, September 18, 2003

Actually, Flash supports client socket connects as well as the standard HTTP requests.  In either case, the Flash client must connect to a server from the same domain as the client was downloaded from.  Therefore, I don't believe there is a way the clients could talk directly to one another.  Flash does provide a relatively simple means to connect clients together though via a server.

seeker
Thursday, September 18, 2003

off topic, but does anyone have a link to that flash putt putt golf game?  that thing was great.

Christopher Hester
Thursday, September 18, 2003

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=flash+putt+putt+golf

Kevin
Thursday, September 18, 2003

18th Hole is a bummer.

Ram Dass
Thursday, September 18, 2003

*  Recent Topics

*  Fog Creek Home