Register FAQ/Rules Forum Spy Search Today's Posts Mark Forums Read

Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate.

 
Go Back   Mac Forums > Apple Software > Mac Programming
TouchArcade.com - iPhone Game Reviews and News

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 7, 2005, 03:06 PM   #1
Thidranki
macrumors member
 
Join Date: Apr 2005
Location: Virginia
Game Programming - - - - Help

I know very little about programming. When reading some of these posts, it is a different language to me. I've been doing a little research about programming though. I've decided that I want to program 3D games.

I read a little about Game programming, and the language suggested was C/C++. It also included some things about algorithms, AI, graphics etc...

Anyways. I won't have access to the internet for two months and I want to know first of all if C/C++ is the best language, and where I can get a compiler and what I should physically write the language in for Mac.

Thx a lot.
Thidranki is offline   Reply With Quote
Old Apr 7, 2005, 03:25 PM   #2
robbieduncan
macrumors Demi-God
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
You simply cannot just dive straight into 3D games programming. You need to learn the basics first. Unless you know how to set up data structures, control program flow and debug your code at a minimum you are just going to get annoyed and upset.

Having said that most professionally developed games are written in C++ using either Direct-X or Open-GL to provide the graphics. As only Open-GL is available on the Mac that's what you'll be using. Open-GL is fairly simple to get started in, but difficult to get the most out of.

In terms of what to program with install the developer tools that come with every Mac (and copy of OSX). Fire up XCode and open some the Open-GL samples. Now buy a book on learning C++ and read it and do EVERY example. XCode is an IDE so it has a reasonably nice programming text editor compiler and everything else built in. The developer tools also include the standard command line compilers so you can use any other text editor you choose if XCode is not for you.

If you get this far try writing some 3D example programs to get a feel for how it works. An Open-GL book would be good here.
__________________
My App Store Apps: DLR Times

Last edited by robbieduncan : Apr 7, 2005 at 03:30 PM.
robbieduncan is online now   Reply With Quote
Old Apr 7, 2005, 03:29 PM   #3
bousozoku
Retired (Moderator emeritus)
 
Join Date: Jun 2002
Location: Gone but not forgotten.
C++ is a reasonably good language for it, but you have to be diligent in making sure that everything is balanced. You allocate something, use it, and dispose of it when you're done. A lot of the problems with C++ programming come from someone not being methodical in this. They try to use something not yet, or no longer, allocated.

C++ and OpenGL is certainly a good combination to use for both Mac and Windows programming but there will always be certain platform-specific details that you should hide by using of compiler directives to make your cross-platform life easier.
bousozoku is offline   Reply With Quote
Old Apr 7, 2005, 03:42 PM   #4
Pismo
macrumors 6502
 
Join Date: Apr 2002
Location: NH
C++ is the language of choice because it's object oriented. C++ is a great language to learn but I think it's going to be a while before you can dive into 3D games. I took an OpenGL class in college and learned about sprites and collisions. It wasn't easy. It was an advanced upper level class but it was an intro to game programming. There are programming books out there written specifically for gaming but I think they expect the reader to have a good understanding of programming. Good luck!
Pismo is offline   Reply With Quote
Old Apr 7, 2005, 03:51 PM   #5
Pismo
macrumors 6502
 
Join Date: Apr 2002
Location: NH
I forgot to mention that you need to have a good understanding of memory allocation and memory usage. A guy in my OpenGL class made a very simple game but he didn't do a very good job with memory usage. He had a gig of RAM in his computer and the game seized up his computer because the game was using the rest of the RAM and bogged his system down. Good thing the professor showed him how to fix the problem. Same thing applies with memory on video cards (in my experience). My professor made the game engine and tuned it to run better on NVidia cards. Good thing my PC had an NVidia carrd. There are countless thing to take into consideration when making a game, no matter how simple it is.
Pismo is offline   Reply With Quote
Old Apr 7, 2005, 06:26 PM   #6
Thidranki
Thread Starter
macrumors member
 
Join Date: Apr 2005
Location: Virginia
I know that I can't just dive into 3D games, i was planning to learn C/C++ with some books on my own this summer, and go from there. I was wondering if i should learn C first or just go striaght to C++. I have no coding experience (just some minimal experience with html )

I doubt I will get to memory usage and Open-GL anytime soon, although that would be cool.

BTW, what college did u go to Pismo?
Thidranki is offline   Reply With Quote
Old Apr 7, 2005, 07:18 PM   #7
SilentPanda
Demi-God (Moderator)
 
SilentPanda's Avatar
 
Join Date: Oct 2002
Location: The Bamboo Forest
http://www.createmacgames.org

Although I'd start with the basics as recommended above.
__________________
"grade image" - say it out loud, it'll make you laugh.
SilentPanda is offline   Reply With Quote
Old Apr 8, 2005, 05:16 AM   #8
robbieduncan
macrumors Demi-God
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by Thidranki
I know that I can't just dive into 3D games, i was planning to learn C/C++ with some books on my own this summer, and go from there. I was wondering if i should learn C first or just go striaght to C++. I have no coding experience (just some minimal experience with html )

I doubt I will get to memory usage and Open-GL anytime soon, although that would be cool.

BTW, what college did u go to Pismo?
If I had my way everyone who wants to program would learn C. It teaches you an often used syntax but more than that it enables you to learn how the machine works. As a base to learning C++ it's probably a very good idea to learn C, but it's not required and you will learn a load of stuff that you will stop using when you use C++ properly.
__________________
My App Store Apps: DLR Times
robbieduncan is online now   Reply With Quote
Old Jul 22, 2005, 10:39 AM   #9
SpiffyChee
macrumors newbie
 
Join Date: Jul 2005
I am in the exact same boat as him, I have a huge book on C++, but it is a pc book, will it still work for me?
SpiffyChee is offline   Reply With Quote
Old Jul 22, 2005, 11:52 AM   #10
whooleytoo
macrumors 68040
 
whooleytoo's Avatar
 
Join Date: Aug 2002
Location: Cork, Ireland.
Send a message via AIM to whooleytoo
I'd agree very much with what robbieduncan said above, you have to start off with something simple and work your way up (patiently! )

When you're starting off, it's far more worthwhile to pick an easy project and finishing it than trying something more ambitious and getting bogged down in the nitty gritty. The morale boost from finishing your first game - regardless of how simple it might be - is very rewarding!

Obviously, you need to learn the basics of programming, but then I'd recommend a simple, 2D sprite based game. Most games like this have a simple overall structure:

while (game isn't complete)
get user input
calculate new player position
calculate new other-sprite positions
detect collisions
draw player & sprites

Getting user input is easy, there are various documented ways of reading which keys, modifier keys (Command, Option etc..) are pressed, as well as mouse movement.

Calculating the player position simply involves changing the co-ordinates you have stored for the player, if the right arrow is pressed, increase the x co-ordinate by a fixed amount, etc.

You'll have to figure how other moving sprites in the game determine their next move - do the little green men rush straight towards your character, and how fast, or do they move randomly about?

Then you need to detect collisions. Is your character trying to run through a wall? Does one of the little green men's bullets co-ordinates coincide with your player's co-ordinates?

Then, based on the previous steps, you draw all the sprites in their current positions. If they're all static sprites (like, say, spaceships), it's quite easy. If they're animated (such as a character walking), you'll need to have several pictures("frames") of the character, and keeping drawing the next one while he's moving.

There are other factors to consider then, such as how fast will the game play - you'll (eventually) need to add some kind of timer functionality so that it plays at a regular rate on both fast and slow computers. You may want sounds, and background music.

One piece of advice, try - as much as possible - to read in settings like 'player speed' from a text settings file, that way you can just change it by hand and run the program again, instead of having to make code changes.

Best of luck!

(Incidentally, I'm told one of the best ways to get into 3D programming these days is to start by making game mods for games like Unreal Tournament, or Quake 3. Once you have a handle on programming, it might be worth a look).
__________________
Greenpeace Apple
Mac <- Macintosh <- McIntosh apples <- John McIntosh <- McIntosh surname <- "Mac an toshach" <- "Son of the Chief"
whooleytoo is offline   Reply With Quote
Old Jul 22, 2005, 01:33 PM   #11
ExoticFish
macrumors 6502a
 
ExoticFish's Avatar
 
Join Date: Dec 2002
Location: The inner depths of madness, aka Kent, OH
Send a message via AIM to ExoticFish Send a message via Skype™ to ExoticFish
i'm in the same boat as you Thidranki,

i've been learning C++ and i highly recommend the book Beginning C++ Game Programming which is good cause it's platform independant so everything will work on whatever platform you choose.

i've only got 1 chapter left of that book so i picked up Beginning OpenGL Programming, but i think i'm going to try some SDL first cause it's a lot easier than OpenGL 3D stuff.
__________________
20" Intel iMac 2.16GHz C2D, OS X.5
ASUS M51Sn laptop running Ubuntu/Vista
play Dofus on your Mac? try Dofex
ExoticFish is offline   Reply With Quote
Old Jul 22, 2005, 02:16 PM   #12
DavidLeblond
macrumors 68000
 
DavidLeblond's Avatar
 
Join Date: Jan 2004
Location: Raleigh, NC
Quote:
Originally Posted by ExoticFish
i've only got 1 chapter left of that book so i picked up Beginning OpenGL Programming, but i think i'm going to try some SDL first cause it's a lot easier than OpenGL 3D stuff.
You can also stick with SDL when you venture into OpenGL. That way you have a cross-platform game. SDL is good stuff.
__________________
www.davidleblond.com
Try my new iPhone game, Claustrophobia!
DavidLeblond is offline   Reply With Quote
Old Jul 22, 2005, 07:03 PM   #13
savar
macrumors 68000
 
savar's Avatar
 
Join Date: Jun 2003
Location: District of Columbia
Send a message via AIM to savar
Quote:
Originally Posted by Thidranki
I know that I can't just dive into 3D games, i was planning to learn C/C++ with some books on my own this summer, and go from there. I was wondering if i should learn C first or just go striaght to C++. I have no coding experience (just some minimal experience with html )

I doubt I will get to memory usage and Open-GL anytime soon, although that would be cool.

BTW, what college did u go to Pismo?
Nobody has mentioned it yet, but developing games also requires good math skills.

For 3d games, you specifically need to be strong in vector algebra, and I suspect vector calculus as well. It also wouldn't hurt to have taken a course in algorithms and data structures, because games make heavy use of the kinds of algorithms and data structures that are typically taught in a good intro comp sci course.
__________________
Mehce
savar is offline   Reply With Quote
Old Jul 27, 2005, 10:26 AM   #14
aquanutz
macrumors regular
 
Join Date: May 2005
Location: Boston, MA (I miss Willoughby, Ohio)
Quote:
Originally Posted by savar
Nobody has mentioned it yet, but developing games also requires good math skills.

For 3d games, you specifically need to be strong in vector algebra, and I suspect vector calculus as well. It also wouldn't hurt to have taken a course in algorithms and data structures, because games make heavy use of the kinds of algorithms and data structures that are typically taught in a good intro comp sci course.

Yeah, that's why I steer clear of 3d game programing. My mathematics is so weak it's not right. It's something I have to work on if I ever want to get serious about 3d.
aquanutz is offline   Reply With Quote
Old Jul 27, 2005, 10:45 AM   #15
colocolo
macrumors 6502
 
Join Date: Jan 2002
Location: Santiago, Chile
Quote:
Originally Posted by savar
Nobody has mentioned it yet, but developing games also requires good math skills.

For 3d games, you specifically need to be strong in vector algebra, and I suspect vector calculus as well. It also wouldn't hurt to have taken a course in algorithms and data structures, because games make heavy use of the kinds of algorithms and data structures that are typically taught in a good intro comp sci course.
I totally agree, and I would even go as far as to say that if you really want to do a serious program, it is a must to have a developed mathematical and logical way of thinking.

It helps so much to design the adequate data structures and to design intelligent and efficient solutions, that I could not imagine doing so if you can't really embrace the "abstract".


If you are serious into programming, I would recommend getting into related topics at the same time you try to pick up your C++ skills, like maybe computer architecture (it's always nice to know what the computer really does), automata theory (you know, Turing and all that), data structures (too important), and maybe some programming concepts such as calculating O(n) for your functions, so you can just look at the code and know what solution would be the most efficient.
colocolo is offline   Reply With Quote
Old Jul 27, 2005, 11:12 AM   #16
ChrisBrightwell
macrumors 68020
 
ChrisBrightwell's Avatar
 
Join Date: Apr 2004
Location: Huntsville, AL
Quote:
Originally Posted by Pismo
C++ is the language of choice because it's object oriented.
Calling C++ OO is just funny to me. OO is an afterthought for them.
__________________
"Simplicity is the ultimate sophistication."
15" MacBook Pro (2.4GHz, 4GB RAM, 320GB HDD)
Canon 50D (10-22, 24-70, 50/1.4, 70-200/2.8)
ChrisBrightwell is offline   Reply With Quote
Old Jul 28, 2005, 07:38 PM   #17
makeme
macrumors member
 
Join Date: Jul 2005
Professional C / C++ Programmer's Bookshelf

I don't do any game programming, but I would assume that you should learn the language first anyway. So, for what it's worth here are some of the books I've read and refer to frequently as a professional C / C++ programmer. Throw in some excellent game, graphics, artificial intelligence and OpenGL books and you should have everything you need.


The C Programming Language by Brian Kernighan and Dennis Ritchie
The Standard C Library by P. J. Plauger

Algorithms in C by Robert Sedgewick (This is a set of books)
The UNIX Programming Environment by Brian Kernighan and Rob Pike

The Practice of Programming by Brian Kernighan and Rob Pike
Expert C Programming by Peter Linden

The C++ Programming Language by Bjarne Stroustrup
The C++ Standard Library by Nicolai Josuttis

Effective C++ by Scott Meyers
More Effective C++ by Scott Meyers
Effective STL by Scott Meyers

Exceptional C++ by Herb Sutter
Exceptional C++ Style by Herb Sutter

C++ Gotchas by Stephen Dewhurst
C++ Coding Standards by Herb Sutter and Andrei Alexandrescu
makeme is offline   Reply With Quote
Old Jul 29, 2005, 02:05 PM   #18
rinseout
macrumors regular
 
Join Date: Jan 2004
While we're at it, I'll throw in Bruce Eckel's Thinking in C++, which is available for free at mindview.net . I still think this is one of the best-written computer books around.

When you get into serious programming, you will occasionally encounter issues with the language which, fortunately, have usually been encountered before. I find myself reading parts of the C++ FAQ about once every three or four months. I first encountered it when I found myself wondering how to get something like a "virtual friend" member function, which is not provided for in the language. (But it turns out you can get the behaviour you're looking for easily).
rinseout is offline   Reply With Quote
Old Jul 29, 2005, 02:49 PM   #19
makeme
macrumors member
 
Join Date: Jul 2005
The FAQs really are excellent free resources, I can't believe I forgot to mention them. I was just too busy focusing on books, I guess. Here are the websites that I would be lost without.

http://www.eskimo.com/~scs
The C FAQ as well as lesson plans, lecture notes, assignments and their solutions from Steve Summit who taught Computer Science at the University of Washington.

http://www.research.att.com/~bs
Bjarne Stroustrup's website with a C++ FAQ, papers and articles as well as errata and code examples from his book.

http://www.dinkumware.com
Complete, free and up to date C and C++ standard library references.
makeme is offline   Reply With Quote

Reply

Mac Forums > Apple Software > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 04:46 PM.

Mac News | Mac Rumors | iPhone Game Reviews | iPhone Apps

Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 2002-2009, MacRumors.com, LLC