Why I switched from Ruby back to C++

Chris Parsons • Sunday 08 January 2012 • products ruby c++ code
UPDATE: This post was pretty popular. I've posted a followup here.

After two months of Sol Trader development in Ruby, I took a difficult decision last Wednesday morning: I’ve decided to rewrite the game code from scratch in C++. Let me explain my reasons.

If you'd like to purchase Sol Trader you can now do so at soltrader.net!

Why I did it

What do I miss about Ruby?

Funnily enough, I don’t miss the automatic memory management: I like having that level of control. Old habits die hard.

So how far have I got?

Thankfully, it’s not a complete rewrite as I’d already done a lot of thinking about the architecture and a lot of the basic classes translate directly over. I worked really hard at the end of last week and got a lot done:

Even with using OpenGL immediate mode (this is a bad thing) and rendering 10000 stars each frame (very inefficient), and a throwing bunch of particles onscreen, I’m still getting 300+ FPS on my 2009 MacbookPro and only using 30MB of memory. That’s satisfying.

UPDATE: By (very) popular demand, here’s a screenshot. Be aware this is three days work only, and obviously not final artwork:

Next I plan to add back in jumping between different planetary orbits, and then work on a very basic ‘person-level view’, so that you can get out of your ship and walk around.

Was it the right decision?

I’ll know at the end of the project :) My feeling is though that it was the correct thing to do. Being really close to the metal will make it much easier to implement some of the really complex AI stuff I’d like to do later on. I already know C++ very well, and estimate it’ll only delay me a week or two if I work hard. If I like, I can always bundle my project as a C++ library and control it from Ruby later on, but it’s harder to go in the other direction.

What do you think? Did I make the right call?

If you'd like to purchase Sol Trader you can now do so at soltrader.net!

Comments

blog comments powered by Disqus