|
|
| Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate. |
|
|||||||
| TouchArcade.com - iPhone Game Reviews and News |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
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.
|
|
|
|
|
|
#2 |
|
macrumors Demi-God
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. |
|
|
|
|
|
#3 |
|
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. |
|
|
|
|
|
#4 |
|
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!
|
|
|
|
|
|
#5 |
|
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.
|
|
|
|
|
|
#6 |
|
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? |
|
|
|
|
|
#7 |
|
Demi-God (Moderator)
Join Date: Oct 2002
Location: The Bamboo Forest
|
__________________
"grade image" - say it out loud, it'll make you laugh. |
|
|
|
|
|
#8 | |
|
macrumors Demi-God
Join Date: Jul 2002
Location: London
|
Quote:
__________________
My App Store Apps: DLR Times |
|
|
|
|
|
|
#9 |
|
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 |
| View Public Profile |
| Find More Posts by SpiffyChee |
|
|
#10 |
|
macrumors 68040
|
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" |
|
|
|
|
|
#11 |
|
macrumors 6502a
|
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 |
|
|
|
|
|
#12 | |
|
macrumors 68000
Join Date: Jan 2004
Location: Raleigh, NC
|
Quote:
|
|
|
|
|
|
|
#13 | |
|
macrumors 68000
|
Quote:
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
|
|
|
|
|
|
|
#14 | |
|
macrumors regular
Join Date: May 2005
Location: Boston, MA (I miss Willoughby, Ohio)
|
Quote:
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. |
|
|
|
|
|
|
#15 | |
|
macrumors 6502
Join Date: Jan 2002
Location: Santiago, Chile
|
Quote:
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. |
|
|
|
|
|
|
#16 | |
|
macrumors 68020
Join Date: Apr 2004
Location: Huntsville, AL
|
Quote:
__________________
"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 |
| View Public Profile |
| Find More Posts by ChrisBrightwell |
|
|
#17 |
|
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 |
|
|
|
|
|
#18 |
|
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). |
|
|
|
|
|
#19 |
|
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. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|