1

I'd like to understand if it possible implements an application in a pure multi client/server way... don't mind about the specific thing but I'd like implementes a server that invite in a sort of "room" (page) just 3 -or more- user registred on the platform (for the start is enough that only those can login on this specific page) and then those users sends "something" to the server, the server waiting for all players reply's and then close the room/page.

So:

  • the server sets a temporary room for some given users from the db;
  • the users(clients) invited can only access to this page;
  • clients send something back to the server;

  • server waiting for "N" client reply, then send them back a message, and the room is no more active/aviable;

Data structure will be something like a table for user, usertype, tempRoom, roomPlayers, games; etc.

the first 2 step are not so complicated in my mind but i cannot imagine how to do the last 2 step, any tips are so wellcome.

thanks

JahStation
  • 893
  • 3
  • 15
  • 35
  • if the game is realtime, do not bother with PHP. Then you can better have a look at websockets in a language that supports them. – online Thomas Jan 04 '18 at 12:44
  • i dont need strict "real time" just waiting for all user that sends something, then showing the results... – JahStation Jan 04 '18 at 12:48
  • In that case I would develop a REST API that accepts your inputs on different endpoints. In case it is needed, you can let the clients poll for a response every x seconds. – online Thomas Jan 04 '18 at 12:50
  • ok, make sense to me, the question is how to "you can let the clients poll for a response every x seconds" I dont need specific infos but just in general how to accive a task like this with laravel, thanks – JahStation Jan 04 '18 at 12:52
  • How: it depends in which language the clients are written. in javascript you can have a look at jquery's ajax for example. (https://stackoverflow.com/questions/6835835/jquery-simple-polling-example) – online Thomas Jan 04 '18 at 13:36
  • ops I suppose to use laravel as framework... – JahStation Jan 04 '18 at 13:45
  • I understand, but laravel is a server side framework. To update the browser window you should use some javascript. Or you could ask the user to keep pressing F5 ;) – online Thomas Jan 04 '18 at 14:15

1 Answers1

1

Same as you , i was trying to make an online game and find a server-side technology that handles real time requests .

So after digging and some research i found that node.js is the right choice for making Online gaming or network gaming apps because nodejs uses an event-driven, non-blocking I/O model that makes it lightweight and efficient so that allows you to build app that functions within a time frame that the user senses as immediate or current.

  • thanks a lot... so no way to write it as laravel app :( – JahStation Jan 04 '18 at 14:15
  • u can write it with laravel ,but what i meant is in this case nodejs is more efficient –  Jan 04 '18 at 14:34
  • efficent is even what you know... if I have to spent months to learn nodejs it will so not efficent to me that im good in laravel basis... but thanks a lot for pointing me in some direction! – JahStation Jan 04 '18 at 15:43