First Programming language?

Discussion in 'Mac Programming' started by 64days, Feb 6, 2011.

  1. 64days macrumors newbie

    Aug 12, 2008
    I want to learn a programming language to create an 2D ecosystem simulation (More of a sandbox game, I searched and searched for one, but I realized there was no real ones, so its now my personal goal to make one) (And I realize I will not be able to do that right away)

    I want it to have a gui to interact with the simulation, and I need it to run on mac (Obviously, But it wouldn't hurt if it worked on windows too) I have no real experience programming except for some experimenting in Xcode with cocoa. I was wondering, should I use C++, Cocoa, or are there any other languages you recommend?

    64Days :D
  2. iDisk macrumors 6502a


    Jan 2, 2010
    Menlo Park, CA
    Start with RUBY then progress with MACRUBY (which is Cocoa based) from there you should know what you need to do. Educate yourself on the languages that the games you like incorporate, as well.;)....P.S. Languages aren't learned overnight, study hard and perfect one and then move to another.
  3. SidBala macrumors 6502a

    Jun 27, 2010
    I would suggest you look into a good game engine that uses a script language like LUA to code.
  4. Les Kern macrumors 68040

    Les Kern

    Apr 26, 2002
    If you want it quick and free, and you have no plans to make it a career try
  5. chrono1081 macrumors 604


    Jan 26, 2008
    Isla Nublar
    Python + PyGame may be what you are looking for. It would be the easiest way to get started.

    That being said expect years of work to develop a game. Games are very very complex and have to worry about things like performance, timers, user input (in a different way then a standard program uses), etc.

    Most games are built using a game engine instead of straight coding or building your own engine just because of the sheer amount of work involved.
  6. GorillaPaws macrumors 6502a


    Oct 26, 2003
    Richmond, VA
    I also think this is one great way to get started. The tools are cross platform, Python is an excellent high-level language that let's you do neat things quickly, and has a very clean/simple/elegant syntax. Also Python is a language that will let you do lots of other interesting things down the road and is built-in to every Mac.
  7. subsonix macrumors 68040

    Feb 2, 2008
    Python is also object oriented, so it allows someone to get their feet wet with OOP concepts.
  8. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    Python + PyGame appears to be an excellent learning environment for an adult beginning programmer. Or maybe one of the Squeak derivatives for a kid.
  9. iDisk macrumors 6502a


    Jan 2, 2010
    Menlo Park, CA
    Ruby is a gem

    Ruby can accomplish this, and it's much more practical from a coding stand point on the Mac, plus he can extend it to Mac Ruby which will involve Cocoa, and he'll need Cocoa to do anything on the Mac Platform. It's also OO and again very flexible.

    Ruby is a gem anyway;)

  10. GorillaPaws, Feb 7, 2011
    Last edited: Feb 7, 2011

    GorillaPaws macrumors 6502a


    Oct 26, 2003
    Richmond, VA
    Ruby is another great language with many similarities to Python. I disagree with several of your assertions however. There is nothing impractical about programming with Python on the Mac. MIT uses Python in their "Introduction to Computer Science and Programming" course available for free online through MIT Open Courseware which is a great way to get started.

    I would also disagree that MacRuby is a good way to learn Cocoa. If Cocoa programming is a direction the OP wants to move in, then he should learn C and Objective-C and then Cocoa first. After learning those he could learn Mac Ruby, but trying to learn Cocoa via a Ruby translation layer would be making an already challenging task that much more complicated/difficult. Finally, you don't NEED Cocoa to do anything on the Mac, particularly writing games (which is what the OP is interested in doing). Writing a game using NSBezierPath is certainly possible, but would be unnecessarily burdensome. Cocoa is a fantastic framework, and absolutely should be used for writing most of the consumer-facing apps out there, but it's not the ONLY way to do it.
  11. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    Another random fact: Last time I checked, there were more job openings listing Python than Ruby as a desired or required skill (although there were a number for either and even both). Has that changed?
  12. ulbador macrumors 68000


    Feb 11, 2010
    Ruby is definitely becoming more popular. I had actually never heard it being used in a production environment until recently. Now, I know of at least 3 or 4 shops in my town that run Rails.
  13. Sander macrumors 6502

    Apr 24, 2008
    It depends on the kind of game. If you really want to write games (which I'm not entirely sure, from the thread starter) I'd recommend you start with simple puzzle games. Nothing beats finishing a project and starting anew with another one, with all the things you learned from the previous one under your belt. Getting started on a project thinking it will keep you occupied for years, will make you go back and look at the choices you made in the beginning, wishing you had known better :)

    But not all games are very very complex. To my surprise, I'm making decent extra money on the App Store wich a game of which the basics took me all of two weeks worth of spare time. So don't be discouraged, and just dive in!
  14. Blakeasd macrumors 6502a

    Dec 29, 2009
    I first learn MS Visual Basic.
    Then I learned REALbasic.
    Then I learned the basics of C.
    Then I learned Objective-C
    That was just my order though.
  15. Hansr macrumors 6502a

    Apr 1, 2007
    Ruby is pretty popular as an alternative to Python for mid-freq algo trading where you have ever evolving algos that you need to modify quickly if there are issues in the model.
  16. SatyMahajan, Feb 11, 2011
    Last edited by a moderator: Feb 11, 2011

    SatyMahajan macrumors regular

    Apr 26, 2009
    Cambridge, MA
    If you don't require high framerates (<30fps):

    1. Learn C / Objective-C
    2. Understand Object Oriented Programming and Design
    3. Understand basics of 2D programming (collisions, etc.)
    4. Learn UIKit in Cocoa (Cocoa is not a language, it's a framework/library).
    5. Build game.
    6. Profits.

    If you require high framerates (60fps):

    1. Learn C / Learn Objective-C
    2. Understand Object Oriented Programming and Design
    3. Understand basics of 2D Game programming (sprites, tiles, collisions, etc.)
    4. Learn cocos2D
    4.5 (optional). Learn Box2D physics engine for more realism.
    5. Build game
    6. Profits

    Most MacOS/iOS games are built using Objective-C and link against various libraries written in Objective-C, C and C++ (OpenGL for instance is C, Cocoa is Objective-C).

    Fundamentally, every game is built on a single loop (called the game loop) that runs continuously and looks somewhat like this:

    1. Check for user input
    2. Perform Artificial Intelligence calculations
    3. Move Characters / Enemies
    4. Resolve collisions
    5. Draw Graphics
    6. Play Sounds
    7. If the user has not exited, repeat starting at 1.
  17. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    It's currently not an academic favorite, but a lot of experienced programmers first learned to program in interpretive Basic. That's all that shipped with the original Apple II+ (later Pascal was available for it as well). And literacy in the basics of computer programming seemed to be approaching an all-time high back then.

    There are several Basic interpreters available for the Mac, many free and/or open source (so you can look "under the hood" and see how they work).
  18. balamw Moderator


    Staff Member

    Aug 16, 2005
    New England
    I'm one of them, and would not recommend it today. It's a great language for beginners because it let's you play fast and loose, but it's a bad language for beginners since if you play fast and loose you can't take that with you to other languages.

    As others have already mentioned in the thread Python, Ruby (and maybe Java) are the interpreted heirs to BASIC today in the same way that for most purposes FORTRAN has been replaced with Matlab/Octave.

    What is interesting to me from the other thread I was just in is that many very useful concepts that are helpful in writing good code don't seem to be explicitly taught in many modern books. e.g. Top-down design, flowcharts, divide and conquer, etc... From that point of view, maybe an older BASIC (or Pascal) book would be useful.

    If I had a choice though, I'd choose Pascal over BASIC as you can take much of what you learn in Pascal over to similar languages like C and Java and write Pascal like C or Java.


Share This Page