Flash Game Server Suggestions (Node.js, Red5, etc)

2020-06-03 08:04发布

问题:

Quick Summary:

We have a completed flash game similar to Tetris that is ready to be "linked up" for multiplayer. After doing some research and asking here: Flash Sockets, Peer-to-Peer Capabilities , we have come to the conclusion that P2P networking done in the way xbox/ps3 games handle online games is not possible without expensive/dubious adobe software/services (FMS/Cirrus) on the flash platform at this point in time. Basically, a flash client is not allowed to become a "host" listening on sockets without the RTMFP protocol.

The Question that needs Suggestions:

With that summary, the question is... what is the best way to implement the network infrastructure for a game like Tetris, which has quite a bit of small I/O going from user to user (say, a max of 4 players at a time). Given that we can't assign a single player as the host p2p style, our options are:

1.) Fat Server with Game Logic, Light Clients updating display/interpolating based on server updates (Ala Quake)

2.) Light Server handling communication between Fat Clients (Ala Concurrent simulation like RTS games)

The problem is, we are inexperienced when it comes to networking games and therefore would really love some advice on the pros/cons of those solutions (or even other solutions). Our Tetris game isn't as trivial as sending "attacking lines" when a client clears lines to add to the other players currently battling. We need a little more real-time syncing than that. For example, the list of next tetriminos is a single shared source where everyone is "fighting" for desirable pieces.

Finally, depending on the implementation chosen, I'm wondering if anyone has any experience with Node.js on game servers. I'd assume if the server was a lightweight server only handling transfers of data between clients that Node would be a good perfect fit. However, if game logic was placed on the node.js server, I'd assume that the blocking nature of the calculations would make Node.js' single threaded no-blocking I/O approach redundant? Anyway, any advice on the issue is much appreciated.

回答1:

Full Disclosure: I am a cofounder of the union platform.

if you want to get up and running quickly, i would suggest using an existing multiuser server and client framework, such as the ones suggested already or union platform (www.unionplatform.com, free for 1000 simultaneous connections).

people tend to underestimate the amount of infrastructure work required to make a full-featured multiplayer game with reliable lobby systems and match making. if you are building from scratch, you might spend as long on, say, connection failover and reconnection code as you do on core game physics.

in a game like multiplayer tetris, i would implement authoritative game/world logic on the server (in union, you'd use a room module), and mirror the server-side simulation on the client side. the client shows output, interpolates the server-side world, and provides player inputs. here's an example multiplayer pong game that uses that approach:

http://www.unionplatform.com/?page_id=1229

one potentially useful feature of union for your situation is its support for javascript websocket in addition to traditional http communication.

http://www.unionplatform.com/?page_id=1587

the javascript support gives you the option to create full-fledged game clients in html5, or add native web browser clients for displays statistics or spectating games being played in flash. union's protocol is also publicly documented (http://www.unionplatform.com/?page_id=86), so you can build custom client features in any language.

out of curiosity, do you have a public link for your game?

have fun!

colin



回答2:

I've had some success with SmartFoxServer. It's free for under 100 concurrent users, but if you have more you need to buy a license.

Still it's easy to write the server side logic and it's easy to manage and deploy.



回答3:

I have used Flash Media Server to develop a number of multi-user apps (including games). Personally I think it's too pricey for what it does for you.

I've never used Red5 or Node.js, but the socket connections from Node.js sound promising.

I've also built a simple never-ending-socket using PHP which works as well (but not as good, it's a little jumpy) I bet you could find more info on that and perhaps develop something yourselves seeing as how you won't have to transfer too much data between users. On the web there's a number of examples of using PHP sockets with *SWF*s like this chat room example on kirupa.com

Best of luck.