Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Ruby on Rails be a game server?

I want to make a multiplayer game. So, I should make a server socket and loop forever to accept incoming client's request. Since I don't want a browser to browse a PHP website to do that, I just want to the server auto execute the server socket once. Can I use Ruby on Rails to do that?

like image 758
Samuel Avatar asked Apr 12 '11 02:04

Samuel


2 Answers

Rails could be made to do it. but it probably is not the best tool for that particular job.

HTTP is a Request/Response protocol and sending out-of-band data is tricky, you need to use cometd or the new websockets, and have all the clients listening or polling for data.

I think using Erlang is a better tool, or if you are more comfortable with Ruby use a Ruby server (not Rails) using something like EventMachine.

like image 112
Jim Morris Avatar answered Oct 04 '22 05:10

Jim Morris


Depends on what you want the server to be. If it's for a turn based game or non-realtime game (not RTS/FPS etc) then Rails should do fine. You'll want to use it as a framework for a web service rather than a website itself.

It could also be useful as an experimental server while you are developing the game itself since Rails code tends to be easier to modify in quick iterations.

like image 34
Daemin Avatar answered Oct 04 '22 05:10

Daemin