15

I will probably use javascript to develop an online board/card game. My approach will be to have a client that will be able to work in standalone mode, so it must enforce rules. That means for example, if a player can't play a card, he or she shouldn't even be able to play it. This is to enhance the user experience.

The idea here is to add hooks to send and receive events to and from the server, and share the code that implements the game rules between the server and the client. I don't see the point of writing them twice.

So, if I play in "server" mode, the client will update the server with my actions (verifying them as well), and the server will send me updates about the rest of the players.

Is there any framework to leverage this work?

For the server side, my options seem to be Node.js (unstable, but everything would be JS and that's neat), Erlang + erlang_js, and maybe some of those weird frameworks that "compile into javascript", that I'm no really fond of.

4

2 に答える 2

3

Apeはあなたの要件にぴったり合っているように思えます。JavaScript モジュールをサポートしているため、クライアントに使用するのと同じコードをサーバー上で実行でき、異なるユーザー間でのメッセージの送信も十分にサポートされています (mmorpg とチャットのデモを確認してください)。

于 2010-07-25T11:42:50.913 に答える
1

私はしばらくの間、まさにこれ(クライアントとサーバーのコード共有)のためにRingoJshttp://ringojs.orgを使用してきました

ネットワークブラウザゲームを簡単に作成するために、その上に薄いレイヤーを開発しています:http: //gamejs.org

于 2010-10-12T17:37:29.663 に答える