Web server in a game [closed] - web

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am implementing a 2-player tetris game on the web. One of my colleagues told me that I can implement it or use a web server.
Since this is a game, I think I must implement a server part. What is the point of using a web server in a game development?

The server keeps track of the game while the clients (the 2 people player Tetris) just deal with the UI and User inputs.
Server
The server should be in charge of making sure that moves are legal, calculating points, and anything else related to the rules and running of the game. This is where the logic of the game is or where the game is played.
Client
This is ONLY used for interacting with the server. There should exists a protocol between the Server and the Client. The client will only send requests to the server, wait for a response and update the UI appropriately. No game logic should be implemented here.

The purpose of the server is to talk to each of the clients and bounce data between them. If you need a server for your Tetris game you probably want to have a look into NODE.JS, PHP and WEB sockets.

Related

create application WebRTC [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
how create a WebRTC (video, audio & message) chat via socket.io
on this application you can:
talked to specify user.
talked with several users at the same time (notion of room).
the user can accept or reject the call.
There are many frameworks geared towards that specifically. Check out https://simplewebrtc.com/ and http://easyrtc.com/ as solid alternatives.
Note that for multiparty calls you may need to add a server component to handle the media itself.
Take a look to WebRTC in the real world and to Building a webRTC Video Chat Service On Nodejs and Krakenjs. Also, you can see Advanced chat using node.js and socket.io – Episode 2.

Is it best to use Node.js or SignalR [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
At the risk of this question being closed I will ask anyway.
I have been looking at the different JavaScript Frameworks as most jobs roles seem to want:
angular.js
Knockout.js
Node.js
Whilst i can see Angualr.js and Knockout.js provides a MVC construct to the markup pages (though still not sure which one is best to use) I cannot see what is the case for node.js?
Whilst I appreciate node.js is good for real-time comms but so is Signalr as they both use long-polling.
At present I use signalr to update images on my clients.
is there any purpose to swapping this out for node.js?
Like I said this question could be voted to be closed as it may seem to be asking an opinion - and that would be an answer to me in itself as it would be down to developer choice but is there a DEFINITIVE reason to use node.js over signalr?
thanks
One reason to use node.js is code redundancy. Both the server and client run the same language, thus they may share a certain part of the codebase, meaning potentially less to write. With libraries like Browserify this process can be made a lot more transparent and writing the client-side can be almost indistinguishable from server-side development. Another opportunity this opens up is both client and server side rendering + MVC setups with, for example, rendr.js. So you can have both the fast load speeds of server-side and responsiveness of client-side rendering. If any of this will be useful naturally depends on what you are developing.

Socket.IO Rooms on different servers [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
My goal
I want to create a game with different playing rooms. Playing rooms are not connected in any kind. Only the one thing: I need to be able to move a player to other room.
My thought
There will be many users playing, so it will be a good thing to use many servers and many node-instances at each server.
I use
NodeJS with SocketIO. Playing rooms are SocketIO rooms. Each player is connected to only one room.
Question
But what I should do, if I need to move a user from one room at server #1 to another room at server #2?
Methods I know
I have found methods to have connection between servers by NoSQL as Redis. I can send events like this to other rooms.
But it seems to be better thing, I will send command to my client: "disconnect from server #1, connect to server #2, to room ..." (and store all possible rooms in redis client). So, it will be direct connection, not the "server #1 -> redis -> server #2". I want it to be fast.
Main question
Is there a way to transfer client connection from one server to another, fast and simple? Or may be use Redis pub-sub is not so bad by speed and it's ok to use it? What is the best solution?
Thank you.
Redis is ok.
It's pretty fast and easy to use.

What is the philosophy to determine client/server rendering (Nodejs) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
When playing with NodeJS, I came up with this question, since one can now put some code either on client side or server side using even the same language.
E.g. For a small game app, I can put the computation on client side when interacting (via some onclick function); also I can initiate a server request and do the computation there.
With more investigation, the terminology for my question is client vs server side rendering. Now there's a lot of materials I can find.
It's basically a tradeoff, depends on the user case, server capacity, etc.
The best philosophy for deciding what is left to the client and what is left server is often to leave as much as possible up to the client. While this often does not apply to very complex applications, most applications can apply this with no negative effects.
The logic here is that 1 dedicated computer (the client) can handle its' individual needs (such as images, video, gameplay) much easier than 1 or a few servers can handle 1000's of client needs.
However, some things require an external application (the server). Good examples of these are sessions, leaderboards, user authentication, and social media integration.
The only downside is that it may increase your applications initial load time. For small applications this may only be milliseconds. For larger applications, that take more than 2-3 second to load, I would say add a loading bar.
Cheers
-Nick

Why people use node.js to provide http service? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I just began to study web developing and heard that node.js can be easily used to deal with incoming HTTP requests. But I'm wondering why they don't simply use Apache or IIS? Under what circumstance would people prefer handling HTTP requests with their own code written in node.js? Thanks.
Go and have a look into the Raspberry PI community. I know that there this is discussed every once in a while to have a very lightweight server to do stuff. So I believe this is one occasion.
In reality it's though very common to have nginx or apache as a proxy before the node server. The proxy then handles all the heavy lifting like handling static files, while node handles the dynamic stuff.
Node.js compared to PHP is a completely different concept. While a PHP application is stateless, a Node application is stateful, meaning you start the application and it's just running, even when there's no requests, which would not be the case with PHP.

Resources