iDevGames Forums
Objective-C Game development - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Objective-C Game development (/thread-1764.html)



Objective-C Game development - TimMcD - Feb 13, 2009 03:52 PM

I know a good deal of Ruby, and some Lisp, but recently have been wanting to get into game development. Ruby is slow. So, I want to work with Objective-C. I've started learning, but I love to learn by doing and experimenting (Why Ruby was so great for me, love the 'IRB'). Does anyone know of a good game development library to be used in junction or in place of Cocoa? Preferably something that already has methods for collision detection... >_>

Also, something like Unity, Torque, etc. but with scripting in Objective-C would be nice! (Btw, want to work on a 2d game, but 3d is fine...)

Thanks in advance,
Timothy.


Objective-C Game development - DoG - Feb 14, 2009 04:50 AM

You can use RubyCocoa or MacRuby to mix ObjC and Ruby with Cocoa.


Objective-C Game development - Blacktiger - Feb 14, 2009 10:22 AM

I don't think what you are looking for exists, although you may want to check out OSC's game shell.


Objective-C Game development - TimMcD - Feb 14, 2009 11:09 AM

Well, I as thinking of using SDL bindings for Objective-C, but I am having trouble compiling it (libtoolize issues?). I have another thread for that, tho. ^_^


Objective-C Game development - Najdorf - Feb 14, 2009 12:57 PM

Quote:Well, I as thinking of using SDL bindings for Objective-C, but I am having trouble compiling it (libtoolize issues?). I have another thread for that, tho. ^_^

You shouldn't need bindings as SDL is C, and objective-C is a C superset. Why not use the pre-built framework?

I don't really have an opinion on objective-c as the language to use for the game itself. It doesn't seem a popular choice.

So far I've seen objective-c as the way to interface with cocoa-write applications, more than a language I would write the game itself.

If speed isn't critical and you like the language go for it, if you are making a processor heavy game (physics etc.) C and C++ are faster, and possibly easier to port (though theoretically gcc compiles objective c also in windows, you don't get the cocoa classes).

Anyone here write all their game classes in objective C?


Objective-C Game development - TimMcD - Feb 14, 2009 01:17 PM

Well, this is more-or-less a project to learn Objective-C. I want to eventually land a job in the Mac industry, but right now programming is just a hobby. If you can suggest a way of using Ruby for the gamelogic and then Obj-C to interface with Cocoa, that would be pretty nice too (Not to keen on MacRuby, I still want to learn basic obj-c synstax, might as well do the cocoa bits in obj-c.). Also, if I do it this way, how would I implement Ruby/SDL or RUDL with it?


Objective-C Game development - TimMcD - Feb 14, 2009 01:25 PM

Y'know what, I would rather just write it all in Objective-C. Anyone know a place to find information on using C/C++ APIs in Obj-C?


Objective-C Game development - SethWillits - Feb 14, 2009 01:31 PM

There is no information to be found. Just use them. If you're using C++ code intermixed with Objective-C, then use the extension .mm, otherwise use .m. That's it.


Objective-C Game development - TimMcD - Feb 14, 2009 01:40 PM

So, I could still follow 'http://sol.gfxile.net/gp/ch02.html' but just replace things like:
void render()
{
...
}
with
- (void)render()
{
...
} // if its an instance method or w/e, or
(void)render() ? Same with method calls?
SDL_UnlockSurface(screen);

What does that turn into in Objective-C?
[SDL_UnlockSurface:screen] ?


Objective-C Game development - Najdorf - Feb 14, 2009 02:32 PM

Objective C is a superset of C means that everything you can write in C you can write in objective C

SDL_UnlockSurface(screen); stays like that.

[SDL_UnlockSurface:screen] won't work.

btw obj-c is syntax [object method: parameter] (or [Class method: parameter] ), so you would need something like

[MySDLClass UnlockSurface:screen]

of course you need to define and implement your own MySDLClass for this to work, might be an exercise.