Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nice write up. I wrote my own 2d game engine in C++ a while back. Switching to Ruby was great, but I never made any games. I did make a couple of JavaScript HTML 5 games. But here again speed is a limitation, and so am looking into C (and eventually Objective C) to eventually do some iPhone game making. As great as it would be to make games soley with scripting/interpreted languages, I don't think we're there yet.


Easy porting to iPhone in the future is another big plus I should have mentioned in the original post.


The ObjC object model is very similar to Ruby's object model.

ObjC's way of handling mundane data structures (strings, arrays, hashes) is (once you learn to stop worrying and love long sequences of calls to very long method names) very similar to how Ruby addresses the same problems.

ObjC lets you drop into vanilla C code when you want to.

ObjC doesn't impose GC.

ObjC implements a form of duck typing.

You might be surprised at how good a fit ObjC is for a game engine you prototyped in Ruby, as opposed to C++.


ObjC++ might be an even better fit


I always got a "stay on the golden path and away from ObjC++" vibe from ObjC++, kind of like trying to ask Rails to do database stuff without using ActiveRecord in 2008.

You can easily write C++ code without having to bridge ObjC's object system to C++'s object-and-generics system: provide a simple C API to your C++ libraries.

But the other thing is, one reason to do ObjC at all is to avoid all the heartache that comes bundled with C++.

PS: You got modded down. Baffling. Fixed.


Obj-C++ is working well for me so far and the STL is much better than Obj-C's awkward and slow collection classes for anything that needs to run fast or that requires significant algorithmic complexity.


One of the nice things about going back from Ruby to a C language is, it's hard to think of anything you could do in the C language that would be as non-performant as Ruby. As slow as ObjC's collections are, they're faster than Ruby's.


Yeah, and they're fast enough for a lot of things, but I'm doing DSP at 44.1k/sec and even C++ virtual functions are too slow for that. But I can use an STL vector at no penalty over a native array.


It is just a shame that in some areas Objective-C is still lacking compared with more modern languages:

- a proper module system; - reliance on the primitive #import/#include which slows down compilation - no namespacing, relying instead on conventions to avoid clashes


what about lua/love/corona?


I've thought of using Lua and if I recall correctly, work has been done to develop iPhone games with Lua as well? Ah, where is the time?


yeah corona sdk (which is not free, but seems to be worth the price of entry from my dabbling) compiles for iphone and android from common lua codebase. The api docs are easy to read, tons of examples and plugins (box2d etc.). I threw together an ipad app for my "boiling water" game I've been joking about for years with corona in about an hour having only ever looked at lua from afar. If you grok js/ruby/python than lua will be simple.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: