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?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With