Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Gosu/Ruby performance limits
- - By armornick Date 2011-11-23 13:24
Hey everyone

I'd like to know what the upper limits of Gosu/Ruby performance are. I don't really like the hassle of programming in C++ (primarily memory management) so I'm interested in being able to program in Ruby. I know that high level languages are usually slow, however large parts of the library are written in C++ so I'm interested how much overhead ruby itself has.

In short, what are the things you'd do with Gosu/Ruby and what are the things you'd only write in pure C++.

It's possible that this question has been asked a lot in the past, so I apologize in advance.

Yours truly

Armor Nick
Parent - By jlnr (dev) Date 2011-11-23 14:14
Where you want to go with your game? FOSS that ends up on school PCs should be efficient, stuff that you'll play with your friends in a year can be more wasteful. If you ever want to port it to iOS, you have to rewrite it in C++ anyway. (Or any platform that is not a PC, but for iOS you can keep using Gosu at least.)

Most games end up between 10% and 90% completion (personal guess). If you don't feel enthusiastic about writing a game in C++, then focus on finishing it in Ruby and if necessary port parts or everything to C++ later on.

Sorry for the vague answer, it really depends a lot on the genre of the game, and on how much you'd be willing to adjust some details to make Ruby happy. I'd suggest joining a timed gamedev competition (Ludum Dare is in one month) to get a feeling for how far you can get with Ruby. (I'm a C++ programmer mostly, but Ruby works great for compos.)
Parent - By Spooner Date 2011-11-23 15:28
Your best bet is to look at all the games that have been written in Ruby/Gosu and see what they achieve. As jlnr points out, most are unfinished, and it might be hard for you to see which ones really push the envelop of Ruby/Gosu development. You might like to try running my Wrath game, for example. Pressing F in-game will show the FPS and potential FPS in the overlay (that is, the FPS the game would achieve if the frame rate wasn't capped at 60).

One thing I'd recommend is for you to do a simple rendering test of your game idea and see what the frame-rate is like. That is as far as I've got with Smash and Grab, which achieves a nice 400 FPS, though of course you need to allow for the fact that the game is extremely light on game-logic at this point.
Parent - By Maverick Date 2011-11-23 16:28
As these fine blokes above me have mentioned, I would like to add that no matter what you decide to use, it's all about putting time into said project and knowing your limits. Lately, I've been making little mini games because my ambitious projects grow exponentially and before I know it, I have to refactor lots of code if I want to keep moving forward (something I know I don't have all the time in the world for...)

Both are great for making games.
Ruby is faster and making games.
C++, at this point with Gosu, just says "this game could go somewhere big if I really, really cared and had time"

Even as a C++ and Gosu user, I still stay go for Ruby.
- - By armornick Date 2011-11-23 16:42
Thanks for all the answers so far, everyone.

I'm not going to be making very intensive projects. Probably a SNES-style RPG or a visual novel. I'm mostly worried about how performant AI would be.

On an off-topic note, I tried the C++ version but I had some problems with compiling the tutorial. The variable _WIN32 didn't seem to be declared so it tried to import either some Mac or Linux headers. Maybe it's because I'm on an x64 system... Should I open a bug report?

Yours truly
armornick
Parent - - By jlnr (dev) Date 2011-11-23 16:49
Sure. To be honest, I have no experience with Win64 at all, but I would've guessed that _WIN32 would still be defined there. Can you try around a bit and see if WIN32 or _WIN64 or something like that would be better?

Which compiler are you using? Gosu has just recently gained support for MinGW (a contribution that I'm not sure is being actively maintained).
Parent - - By armornick Date 2011-11-23 17:04
I'm using Visual C++ 2010 Express edition. I'd take a look at the source of Boost to see how they catch the platform.
I'd try to use MinGW but there seems to be some error with g++ too.
Parent - - By jlnr (dev) Date 2011-11-23 17:18
Can't you just choose to create a new 32-bit Windows application instead? And think about the 64-bit stuff later. (I really need to reinstall my Windows to try it too...)
Parent - By armornick Date 2011-11-23 18:37 Edited 2011-11-23 19:16
Well, as far as I know, I'm making a Win32 application. Maybe the problem is at my end. I'll try installing Gosu again this weekend and I'll post again if I'm still having problems.

EDIT

Alright, so here's to reading the manual; everything works perfectly except that I had to manually define WIN32. I didn't read the getting started guide the first time and it turns out that it contains a lot of interesting stuff even if you already know how VC works :D
Parent - By Spooner Date 2011-11-23 17:57
You are right: AI and game-logic are the killers performance-wise, since you can make a perfectly decent 2D game render in Gosu without significantly impacting your frame-rate. To some extent you actually need to be more skilful to use Ruby/Gosu effectively, since you do need to optimise your code more (whereas I suspect that an equivalent C++ game can be incredibly sloppy and still hit 60FPS). Still, that doesn't mean you have to be an expert just to get a game working at all; I don't see any real reason why an RPG wouldn't be possible in Ruby/Gosu.
Up Topic Gosu / Gosu Exchange / Gosu/Ruby performance limits

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill