Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two-player - turn-based game

I have a dilemma here.

Trying to build a simple turn based two player game, and I've been trying out Node.js and Socket.IO, as I've seen recommended in a question:

Multiplayer JavaScript game built with Node.JS - Separating players

This answered most of my big issues, however still few remain. Since I've also build a chat room to test it out and it works nicely.

However, is there really any point of using node.js for that kind of game? Can it be done with HTML5 WebSockets?

like image 630
rexdefuror Avatar asked Sep 10 '13 14:09

rexdefuror


People also ask

Is there a co-op RPG?

Cat Quest II is a two-player co-op action RPG that offers a simple yet effective game design, allowing players to adjust their characters' functionality, strengths, attacks, and magic based on their equipment.

What games are like turn-based?

Many board games are turn based, such as chess, Reversi, checkers, Hare games, and Go, as well as many modern board games.


1 Answers

I'm using knife to butter my bread.
However, is there really any point of using knife for that purpose? Can it be done just with butter?

Node.js - is Application Platform for many different use cases, starting from small command-line tools, ending with big applications like LinkedIn Mobile, MySpace and games as well.
As this platform has a lot of web related libraries and tools - it is very neat to use it in that case, especially coding in JavaScript (what can be better for web?).
Socket.IO - is specific library that utilizes many web transports in attempt to establish reliable real-time bi-directional communication layer between web browser and server (node.js in this case).

HTML5 is set of technologies that are implemented by browser vendors (Chrome, Firefox, IE, etc). This technologies like canvas, webgl, audio/video elements, websockets - are it self dependant on many things. In case with WebSockets - they have to talk to some server. And without any server - they are useless.

If you choose to use node.js as your server platform, then you have few options, most common would be using socket.io or pure websockets.
Most common multiplayer architecture especially in the web is client<>server. So that means there is at least one centralized server that clients talk to. In this case server will do most decision making and all game logic, and send only required data to clients for rendering.
There is another option: p2p (Peer to Peer), and is possible with WebRTC but not yet ready for commercial use due to lack of implementations across most common browsers. In this case all clients should limulate same game state and make decisions them self with cross-approval over all (mostly) peers in game session.
I recommend to start from server<>client as it suits most of cases as well is simplier in many ways (and vice-versa too :) ).

You also can use any other server side platform like, PHP, .Net, Java, Ruby, Python, C/C++ and any other. It is matter of comfort and access to useful libraries that helps you on the way of development.

like image 53
moka Avatar answered Sep 22 '22 04:09

moka