Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a framework for multiplayer board game in JavaScript?

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.

like image 702
Papipo Avatar asked Jul 23 '10 15:07

Papipo


2 Answers

Sounds like Ape fits your requirements rather closely. It supports javascript modules so you can run the same code on the server as you use for clients and sending messages between different users is well supported (check out the mmorpg and chat demos).

like image 91
phyrex1an Avatar answered Sep 28 '22 16:09

phyrex1an


I've been using RingoJs http://ringojs.org for exactly this - client&server code sharing - for a while.

For writing networked browser games easier i'm developing a thin layer on top of that: http://gamejs.org

like image 32
oberhamsi Avatar answered Sep 28 '22 16:09

oberhamsi