Starting to program an actual game

Member
Posts: 185
Joined: 2005.02
Post: #1
i had been slowly making my way through a book on c but then stoped when i started school again in september. i am thinking about starting up again but i am alittle hesitante. the way i have been going at it thus far has been "ok, i get through this boring book, then i'll get through that boring book on c++, then i'll get through that hopefully-alittle-more-interesting book on openGL and then i'll start trying to make some games"
but as the "programing exercises" at the end of each chapter are kind of boring, i was wondering if there was a more exciting approach to the whole thing.
is what i am going through a neccesary boring/menotinous thing that everyone has to push their way through to get to the fun stuff or is there a better way.
i was thinking maybe making a game slowly by surely starting out simple and then adding/ revising it as i leraned new and more complex coding, but wouldn't i need to know a graphics languege for that?
also, i would probably need to know how the heck games work, i know how to do a "for" loop, but i have no idea how that would be used in a game.
does what i am saying make sense?
any help is appreciated. Smile
Quote this message in a reply
Member
Posts: 196
Joined: 2003.10
Post: #2
Yes, what you're saying absolutely makes sense, and is one of the frustrating things about starting programming. There is an end in sight, promise!

The problem with starting with plain C is that you don't get any visible results very quickly unless you learn, as you said, a graphics language (GL, et al). Plain C is wonderful for writing games in (very fast!), but it's a tad tricky to get things showing up on the screen.

That said, my first ever "game" was a command line, plain C version of Tic Tac Toe. Then I used that as a basis for learning some Objective C and Cocoa, and making a GUI version. Then I did pong. And so on.

Why don't you try to write a command line game of some sort, if it's C you've learnt? Tic Tac Toe works nicely.

Probably you want to keep the game in a while(!GAME_FINISHED) loop, where you set GAME_FINISHED to TRUE (or the int 1) when the conditions for the end of the game are true (i.e. when someone wins or loses).

Good luck! We're here to help!
Quote this message in a reply
Moderator
Posts: 529
Joined: 2003.03
Post: #3
Or...if you want a language that gives instant gratification in the sound and graphics area, try any of the BASICs on my home page.

In particular, TNT is now free (see the front page). Not great...but free...

"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Quote this message in a reply
Member
Posts: 39
Joined: 2002.04
Post: #4
ferum Wrote:"ok, i get through this boring book, then i'll get through that boring book on c++, then i'll get through that hopefully-alittle-more-interesting book on openGL and then i'll start trying to make some games"


You don't need C++ to do interesting stuff, C is quite sufficient to build games/applications in. I would recommend looking into C++ (or other languages) when your feeling comfortable with writing C.

Use the C functions; scanf and printf (as mentioned in previous posts) to do simple text based input and output - with this you can implement simple board games and text adventures.

SDL (http://www.libsdl.org/index.php) and possibly Allegro (http://www.talula.demon.co.uk/allegro/ - I haven't used Allegro) can be used with plain C and are fairly simple game libraries, that allow you to do sound, input handling (mouse, keyboard, ...), 2D graphics ... as well as setting up OpenGL when you feel ready to learn 3D.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #5
How much programming experience do you have? Do you at least have the basics down? If so, you can just skip the C book and plow right through the OpenGL book. I ended up learning C just from reading my OpenGL book, when all I knew was Java and a little bit about Objective C. By following the examples, you end up seeing all of what you need to know about general C programming, including pointers, dynamic memory, etc. That way you can read through one somewhat more interesting book, then start making programs for fun after that.
Quote this message in a reply
Member
Posts: 185
Joined: 2005.02
Post: #6
hmm, i could have swore i read somewhere that openGL used c++....
i have just gotten to pointers, do i know enough that i could start learning openGL at the same time as i continue to learn c?
also, i take it that this is the book to get to learn openGL, right?

thanks for all the help!
Quote this message in a reply
Moderator
Posts: 529
Joined: 2003.03
Post: #7
ferum Wrote:hmm, i could have swore i read somewhere that openGL used c++....

No. It can be used from and of the C family languages. Also from Java. Probably others I am too lazy to list.

"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Quote this message in a reply
Member
Posts: 70
Joined: 2004.06
Post: #8
ferum Wrote:i have just gotten to pointers, do i know enough that i could start learning openGL at the same time as i continue to learn c?
Pointers are pretty important, not just for OpenGL but for game programming in general. You could start to learn OpenGL anyway, but I would definitely recommend that you get a good understanding of C before you start trying to write games with it. Makes things just that much easier :-p

ferum Wrote:also, i take it that this is the book to get to learn openGL, right?
That is the book you want to read when you learn OpenGL, but there's no need to buy it - opengl.org provides the 1.1 version of the book as a free PDF on their website:
http://www.opengl.org/documentation/red_book_1.0/
Quote this message in a reply
5thPeriodProductions
Unregistered
 
Post: #9
Heh... My book on C is a wee bit old, and feels a bit so. Learn C on the Macintosh Second Edition by Dave Mark. It's from '95, and I've never actually gone all the way through it. I took 1 1/2 (didn't bother finishing the second) semester of C++ at City College of San Francisco. I'm in the "I'll say I'll do this and never do it" boat with programming. As such, I can follow tutorials, have a pretty good idea of what's going on, maybe do some simple text I/O kind of command line stuff without reference material, and beyond that I'm sunk.

But, yeah... The drudgery is unavoidable and I too need to face that fact, roll up my sleeves, and dig in.
Quote this message in a reply
mjhrali
Unregistered
 
Post: #10
Thanx for a great job.....
I am a good programmer in C and C++....well now starting for gaming have many doubts....
Quote this message in a reply
Apprentice
Posts: 6
Joined: 2007.08
Post: #11
5thPeriodProductions Wrote:Heh... My book on C is a wee bit old, and feels a bit so. Learn C on the Macintosh Second Edition by Dave Mark. It's from '95, and I've never actually gone all the way through it.

Wow, that was my first programming book too. Took me two or three tries to get through the whole thing. Brings back memories...

Why are we resurrecting this two year old thread again? Rasp
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [NSEvent keyCode] to actual keys? teknein 8 9,643 Sep 5, 2007 07:27 AM
Last Post: teknein