The first obstacle I ran into was how to get it installed. I am running on Windows so my options are limited. The very first option on the Ruby on Rails web site is to compile from source code! Are they actually trying to be hostile to beginners?
They had the option to download binaries for Windows, which took me to this page which is a big jumbled up list of Ruby versions and files (do I want 1.8.7 or 1.9.3?), trying to figure out how to get Ruby gems to work, and not having a whole lot of luck, I finally found Rails Installer which did everything for me and was pretty nice overall. It was still much easier to get Node.js installed, and I’m really confused to why the rubyonrails.org web site links to the site with a big list of files instead of Rails Installer.
The main thing I was worried about was speed. I had heard Ruby is something like the slowest language on the planet, so if my game server is going to need one server for 50 people with Node.js, how many is it going to need for Ruby on Rails?
I had the Node.js hello world example loaded, and opened up the Chrome Network tab so I could measure the speed of Node.js as compared to Rails. I loaded the page with the network tab open and checked the time: 2ms. Pretty fast! (I think!)
The next thing to do was to get a hello world working in Ruby on Rails, since unlike the Node.js web site they do not post a Ruby on Rails hello world example code on rubyonrails.org for some reason. I tried to google around for how to get Hello World going, and found this link to the Ruby on Rails wiki that was down (and I’m beginning to think Ruby on Rails is a bad choice) and when I finally got it to work, the whole Wiki was empty and full of spam. Ruby on Rails documentation seems to be pretty bad, which kind of surprises me because it’s so old, you think they would have good documentation by now, and it makes your web framework look pretty bad when your own wiki won’t load and is full of spam.
Eventually I found this blog post that had nice step-by-step instructions, and I finally had my hello world example up and running and even loaded in my browser.
Well, it was time for the moment of truth. How fast is Ruby on Rails compared to Node.js? It took 309ms! In case you can’t do math that’s like 150x slower than Node.js. I figured this was just a fluke and maybe if I refresh it will be faster, and it was, but it was still 20ms, which is 10x slower than Node.js. So Ruby on Rails not only starts up really slow, even after it gets running it’s still very, very slow, and this is just doing Hello World. If my Node.js server can handle 50 users, does that mean a Ruby on Rails server will only be able to handle 5?
The more I googled around the more I saw a pattern between the Ruby on Rails and the Node.js programmers: Ruby on Rails programmers don’t care about speed, and Node.js programmers do! When I would google for speed and Ruby on Rails I saw lots of people dismissing speed and talking about how it’s not important. Node.js is not like that and really seems to value performance. Since I’m writing a game and I want it to be fast Ruby on Rails was probably a bad choice.
I did some further reading on Node.js versus Ruby on Rails and found this blog post which confirmed my suspicions. This post was written by a Ruby on Rails expert who decided to switch to Node.js, so I knew he wasn’t just saying that stuff because he likes Node.js, he has hands on Ruby on Rails experience.
Then I found the real clincher: Ruby on Rails doesn’t support Socket.io! They want me to use AJAX instead, which is old and slow, and there’s no way I’m going to use it to write a game.
And so ends my brief investigation of Ruby on Rails versus Node.js. I am fully confident going forward that Node.js is the right choice for the backend of my game, and best of all I don’t have to learn two languages when I could just use one. I am very excited to try out the Chilly Framework for building HTML5 games as it sounds like exactly what I need.
Long story short, if you are trying to build an HTML5/JS game, don’t even bother looking at Ruby on Rails, because it’s too old and two slow and makes you learnt at least two languages on top of everything else.