Game Maker's Garage Forum

Game Creation => Other Languages & Tools => Topic started by: alias on June 02, 2008, 08:56:05 PM

Title: Objective-C
Post by: alias on June 02, 2008, 08:56:05 PM
Not for the light hearted. If you have Xcode have a look at this site for a basic beginners tutorial. http://masters-of-the-void.com/what-you-need.htm

If anything is confusing, feel free to post or PM me.
Title: Re: Objective-C
Post by: Gan on July 06, 2008, 02:30:11 PM
How much do you know about Open Gl coding in Xcodes?

Also, is there a list of all the NS commands in Xcodes?
Like : NSBeep(); - Makes a Beeping Sound

Also, I now understand why Gm only allows one beep at a time. I tried a for next loop where it beeped multiple times and....

...my computer went nuts. One long BBBBBBBBBBBBEEEEEEEEEE. And it froze everything up.

So, hope you can help me.


Thanks,
-Gandolf
Title: Re: Objective-C
Post by: alias on July 06, 2008, 10:44:47 PM
i dont know all that much about openGL. cept that it opperates within any coacoa app. That means that you can switch between objective C and open GL code at any time. If you know how to code open GL that is.

Yes their is, NScommands are for Objective-C. Like NSstring*["text"] for string variables. They are all documented within Xcode.
Title: Re: Objective-C
Post by: Gan on July 07, 2008, 08:29:10 AM
I have a open Gl tutorial, and in order to make a rpg game, I will need the playing area to be in OpenGl, so I will learn it, and try to make it work.

Thanks, I will look around for the nscommands.


-Gandolf
Title: Re: Objective-C
Post by: alias on July 07, 2008, 09:03:50 PM
Good luck with that. I doubt making a game is a good place to start (i have tried), programming in Cocoa is FAR more advanced than BASIC. Firstly you must understand the concept of object orientated code. Then you need to understand about graphics. In objective-c the way graphics works is far removed from any other language. Since the code is detached from the GUI, you have to understand how to bridge them together. Id be happy to send you some source code explaining the small amount that i DO know, and if you find any resources please share it with me as i am learning the language myself and hoping to one day make a game in it too.
Title: Re: Objective-C
Post by: Gan on July 07, 2008, 10:09:35 PM
Do you know how to bridge a button click to C code?

I just figured out how to bridge all the aspects of the Gui to C code.


-Gandolf
Title: Re: Objective-C
Post by: alias on July 08, 2008, 09:05:45 AM
Yes, using an App Controller, with actions and outputs. Ive made a calculator of sorts.

Good luck bridging Open GL btw, i tried read a tutorial on it and was mildly confused/amused. I sorta got it too work at least.
Title: Re: Objective-C
Post by: Gan on July 08, 2008, 02:29:15 PM
I have ran into a problem.


Lets say I have two buttons on the screen. One button is called "Add Beep", another is called "Beep".

I have the beep in a for command that beeps from 1 to the add beep variable.

When you press the add beep button, it adds onto that variable so it can beep multiple times when you press beep.

But, the problem I find is that I have to initialize that variable each time I click the button, so it can never go any higher.
 How do I make a variable that I won't have to int each time I click the button?


-Gandolf

P.S. If you still have your calculator source, do you think I could take a look at it?
Title: Re: Objective-C
Post by: alias on July 08, 2008, 07:30:31 PM
Sure its at school, it did it as a computer science project, i shall trya dn find it.
I think the problem is it only executes the code from the beginning every time you click each button, where are you writing your code? If its in main.m then thats wrong. If its in the class files then all you need to do is send the variable to be stored in another "object".
Title: Re: Objective-C
Post by: Gan on July 08, 2008, 07:50:53 PM
Ah. I had it in the .m file. I saw a send variable to another object thing in an example, but I couldn't understand it.

Could you explain?


-Gandolf
Title: Re: Objective-C
Post by: alias on July 08, 2008, 10:08:24 PM
Send me your source code and ill see what i can do. This might be beyond my level, but ill try making an app that does what you say tonight to see if what im saying is right, or if its something else.
Title: Re: Objective-C
Post by: Gan on July 17, 2008, 04:03:15 PM
Ah, I didn't see this post. Well, I gave up on the button thing, and decided to move on to a canvas approach. Open GL is way too complicated.

So, now, I need to make a canvas that sprites will move in. The only problem is, How?

Do I use NSImage, Customview, or ImageCell?

Also, what is the command to send a variable to be stored in another object?


Thanks,
-Gandolf

P.S. Did you ever find the Calculator source?
Title: Re: Objective-C
Post by: Gan on July 17, 2008, 06:14:29 PM
I figured out why I am having so many problems with Xcodes.

It's because of my limited knowledge in Objective-C. I don't understand it well enough, only a little bit.

Could you explain If Statements, cases, fors, loops, Sending a variable to another object or class, variables, and any knowledge you can think of?


Thanks,
-Gandolf
Title: Re: Objective-C
Post by: alias on July 17, 2008, 11:55:54 PM
if statements are simple
if ((x = 1) && (y = 1))
{ do whats in these brackets}
else
{do whats in these}

heres a loop
do
{do whats in these brackets}
while ((x=1))

Im not sure how variable sending is done, i believe its somthing like the ways its done in TNT

so you have the procedure
procedure(varible that is send)
{code}
return(variable you want to send back)
im sorry i dont know all that much about that, ill have to ask my teacher whens the holidays are over.


BTW objective C doesnt use "canvases" or sprites. The way to open an open GL window is when in the app interface builder theres an open GL icon, after that it gets endlessly confusing.
Title: Re: Objective-C
Post by: Gan on July 18, 2008, 10:44:05 AM
Good news!

Last night I read a 69 page manual on Objective-C, and now it is way easier to understand. ( http://www.cocoalab.com/BecomeAnXcoder.pdf )

Also, I was playing with the ImageView command, and that is perfect for making a canvas in which sprites can travel across and interact without having to learn Open Gl. It's just a little slower, and it doesn't have rotate sprite command.

And, with all the knowledge I gained, I created a calculator from scratch. Next I will look into the key input and how to move a sprite determined by a key press.

Here is the calc: http://www.mediafire.com/?cicuddgdbt3


Thanks Alias,

-Gandolf
Title: Re: Objective-C
Post by: Tireas Dragon on July 18, 2008, 10:45:15 AM
That must of taken a few hours

Title: Re: Objective-C
Post by: Gan on July 18, 2008, 12:53:32 PM
It's a lot of fun, and I could re-create it in a 5-10 minutes. It is just like Sc and Gm. Though you have to manually connect the buttons and things to the code, and the code syntax is a little different.


-Gandolf
Title: Re: Objective-C
Post by: alias on July 18, 2008, 08:28:07 PM
A little lol??
Its like GM or SC except that it runs 300-100000 times faster
Title: Re: Objective-C
Post by: Tireas Dragon on July 18, 2008, 10:14:58 PM
I figured it would considering its not a game running a game.
Title: Re: Objective-C
Post by: Gan on July 18, 2008, 11:55:46 PM
Sc is made in Realbasic, and Gm is made in Futurebasic.

Realbasic is bloatware, and futurebasic isn't the biggest fish in the sea.

I bet we could create a faster version of both Gm and Sc combined in Xcodes. Possibly use Open Gl instead of a average canvas. Though it would take at least a year to collect all the knowledge we would need in order to try to make it.

I would rather just make a average rpg.

Also, I'm posting on the Mac Rumors forum in the programming section to see if anyone could help me with a few NS commands that will make it possible for me to make the v6 engine in Xcodes.
http://forums.macrumors.com/showthread.php?p=5856373&posted=1#post5856373

I'm hoping to have it created in a week to a month.


-Gandolf
Title: Re: Objective-C
Post by: alias on July 19, 2008, 07:03:08 AM
Should be cool. My teacher at school was going to teach me the ways of making a compiler in C (same code as objective C) for basic, also their are like THIS *holds arms out* many open source basic compiler/interpriders out their. So maybe not quite a year.
And yes, it would run THIS *rips arms off and places them at either end of country* much faster than GM or SC. Where GM does say... 15 fps with 20 sprites, an objective C version would do.. mebe.. 15^2 fps with 20^2 sprites. wait not.. TNT can like do that.. anyways my point is that objective C is a very professional programming language and with open GL it can do sprites at a STUPID rate even with code being interprited on the fly.
Title: Re: Objective-C
Post by: Silverwind on July 19, 2008, 10:01:03 AM
How many game making apps have been created with it?
Title: Re: Objective-C
Post by: Gan on July 19, 2008, 11:11:30 AM
With Xcodes?

I believe many. Futurebasic might of been made with it, Tnt was made with it. They made Oberin in Xcodes.


-Gandolf
Title: Re: Objective-C
Post by: Silverwind on July 19, 2008, 12:27:06 PM
Sorry, I meant C. But Xcodes might be just the example I was looking for anyway. I was going to ask if any of them had the glorious syntax GM has?
Title: Re: Objective-C
Post by: Gan on July 19, 2008, 12:43:50 PM
Tnt has gm syntax, though I believe they coded it mostly in Java in Xcodes.

Hey Al, do you think it would be possible to recode Gm in Xcodes? Imagine, multi-window support, real mmorpg capabilities, a gui editor, many window size choices, super fast sprite movement, smaller file, less bugs, and unlimited sprites. Also, you could code in anything without limits, like a Z grid for a 3D engine, or anything else.


-Gandolf
Title: Re: Objective-C
Post by: Gan on July 19, 2008, 02:38:58 PM
Great News. :D

Someone just posted on the Mac Rumors forum, they gave me all the answers I need to make the v6 engine in Xcodes.

Now, I will research, experiment, and test to see if I can get it to work. Expect a workable version in a few days to a few weeks.


-Gandolf
Title: Re: Objective-C
Post by: HarryCaray on July 19, 2008, 02:43:27 PM
For the record: it's Xcode not Xcodes. :)
Title: Re: Objective-C
Post by: Gan on July 19, 2008, 06:16:59 PM
:P

Change of plans. Quartz doesn't seem as suitable for my needs so I will be taking a look at Open Gl.

Benefits: Faster, more flexiblity, 3D support, and more...

Possible problems: Raised complexity of code.


-Gandolf
Title: Re: Objective-C
Post by: alias on July 19, 2008, 09:09:23 PM
Quote
Sorry, I meant C. But Xcodes might be just the example I was looking for anyway. I was going to ask if any of them had the glorious syntax GM has?

No where near. Heres a sample of hello world.
int x;
do
{
printf("hello word");
x = x + 1;
} while ((x < 5));

xcode isnt a programming language, its a tool for making programs in OTHER programming languages. Its a compiler and does other stuff like lbirary handling.

I dont know how many "game apps" have been made with it. But pretty much every game engine used to be or is made in it. Like the unreal engine for example, and i think halo was made in C. You get the idea.
Title: Re: Objective-C
Post by: Gan on July 20, 2008, 01:11:16 AM
I ran into a problem that is so painstakingly simple that it isn't in any of the Opengl manuals.

I need to know how to stick a 2D image onto the OpenGl canvas from the resources.

Any ideas?


-Gandolf
Title: Re: Objective-C
Post by: Gan on July 21, 2008, 03:32:21 PM
Great progress guys!  :)

I've gone through every manual on Xcode I could find and have acquired as much knowledge as I could understand. So far I have created 3 apps from scratch.

(1) "Calculator", this  is a simple calculator.
(2) "Hello Computer", talk to the computer, it talks back.
(3) "Movement System", I was able to get OpenGL working and stuck a triangle on the screen. You can move it by clicking one of the buttons, so far I am trying to figure out how to make it so you only have to click the arrow keys to move the triangle. Once that is done I will convert the v6 engine to Xcode.

Here are the 3 apps: http://www.mediafire.com/?lvvudw9mijl

The great thing about Xcode is that these 3 apps are only 181 kb when compiled and it runs super fast.


Thanks guys,
-Gandolf
Title: Re: Objective-C
Post by: Gnome on August 08, 2008, 09:32:14 PM
I recently learned that the iphone, use objective-C. So you can make apps for iphone using this. This is one language I DEFIANTLY going to learn.
Title: Re: Objective-C
Post by: Mystor on August 11, 2008, 11:38:43 AM
I have been trying to learn objective C for a while now and have successfully stumped myself 20-30 times.

I am used to object oriented programming languages but I am much too used to applications that use a different structure.

In flash everything is wrapped around the GUI and in OBJC everything is wrapped around the code with the GUI being an extension of it.

If gandolf could send me the source of the thing that he was working on I would greatly apprecieate it.

I am also planning to get into unity, however, but if I can figure out OBJC a bit it could save me the $200 :P

Mist
Title: Re: Objective-C
Post by: Gan on August 11, 2008, 12:17:36 PM
Sure, I will send all 3 apps.

http://www.mediafire.com/?2o5nye1edya

Sorry, I couldn't find my calculator app. Though the way it's made is very similar to the "Hello World" so you can easily recreate it. Also, if you need any help with syntax or understanding, just ask.


-Gandolf
Title: Re: Objective-C
Post by: Mystor on August 11, 2008, 12:19:05 PM
What version of xcode did u use

Mist

EDIT: I just discovered that my version of xCode stopped working when I upgraded to leopard and I don't have an ADC account to get the newer version...
Title: Re: Objective-C
Post by: GMG Tim on August 11, 2008, 05:47:58 PM
Quote
What version of xcode did u use

Mist

EDIT: I just discovered that my version of xCode stopped working when I upgraded to leopard and I don't have an ADC account to get the newer version...

An ADC account should be free, so just sign up for a new one.

Ghost
Title: Re: Objective-C
Post by: Gan on August 11, 2008, 06:25:51 PM
Xcode should also be on the Leopard disk or extra disk.


-Gandolf
Title: Re: Objective-C
Post by: Mystor on August 11, 2008, 06:38:46 PM
Quote

An ADC account should be free, so just sign up for a new one.

Ghost
Not old enough....

Parents rn't home yet either :P

Mist

EDIT: @gandolf, I will look for that soon...
Title: Re: Objective-C
Post by: Gan on August 11, 2008, 06:46:12 PM
You can probably use mine.
Pm'ed you the pass and username. Don't share it with anyone.


-Gandolf

P.S. Xcode is a very large download. I would suggest using iGetter to cut the time in half.
Title: Re: Objective-C
Post by: Mystor on August 11, 2008, 06:51:30 PM
iGetter?


THX
Mist
Title: Re: Objective-C
Post by: Gan on August 11, 2008, 06:52:12 PM
Yeah, let me get the site real quick....

http://www.igetter.net/


-Gandolf

Edit: Boosts speed tremendously.