Advertisement

newbie programmer

Started by August 02, 2000 08:50 PM
6 comments, last by nin syn goth 24 years, 4 months ago
Hello.I just started learning how to program with c/c++,and i was wondering where i should start in game programming.Web sites say i should build a tetris clone as a start.So my question is,can anyone tell where i could find page or online book on how to make a tetris game??
hahaha...

sorry, don''t mean to be rude by laughing... this sounds kinda familiar to a recent post looking for a "how to write a game" tutorial... they don''t exist. The closest you''ll ever find is what you get in Andre LaMothe''s "Teach Yourself Game Programming in 21 Days" by Sams Publishing. And that''s not really close enough.

Here''s a hint, though: learn C/C++ (I suggest just learning C first, get an idea of procedural programming, understand how C works, then move onto objects and encapsulation and all the neat little things they''ve put into C++ (well the neat things that your compiler supports...))

Once you''ve learned C/C++, and you''ve got an idea of how to take abstract concepts and chop them up into groups of pieces, and take those pieces and chop them up into short procedures that you can implement in code... THEN you can start thinking about games. USE YOUR IMAGINATION!

There is no one formula for making games... especially making new games. If you want to know how to specifically make a certain game, the way a certain person did it, just look at that person''s code. This will require that you''ve learned C/C++ well enough, but i''ve assumed you''ve already finished step one by now. There''s simply too many ways that you can do the same thing when you''re dealing with high level languages. You can still learn by studying how someone else did it; however, i''m one of those people who thinks that you learn SOOO much more by coming to a solution yourself. (And that way, your resulting style is yours and yours alone, not heavily influenced by how someone else does things (that can cause you to not see other possibilities))

If you really want a push in the right direction, though... the core loop process of MOST games goes something like this:

Begin Loop->Get Input->Erase Screen->Move characters/scenery(based on input/velocities)->Draw Screen->Back to Begin Loop

Input can be anything from a keyboard press to an AI''s next decision to information over the network.

Now take these pieces and break them up into useful modules, which you can break up into procedural pieces of code!

And most importantly: PROGRAM, PROGRAM, PROGRAM!!! You don''t learn C/C++ by just reading... and even though I know that those sample programs in any learning C++ book are really dumb and don''t have any special purpose, do them anyway! (I didn''t realize this when i started 7 years ago, and it really slowed me down) The only way you can learn is by making a LOT of mistakes... and trust me, even with the smallest, most useless piece of code, you can still end up with mistakes.

Monday is an awful way to spend one seventh of your life.
Greenspun's Tenth Rule of Programming: "Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp."
Advertisement
I agree. Better yet though, get the book entitled "Windows Game Programming For Dummies". With basic C skills (and I mean VERY basic), this book will get you going.

I managed to make a simple Tetris-like game using the examples in the book (I could make more, but the first 5 chapters of the book are enough for Tetris). You don''t need to know C++ either, as the book is targeted towards novice C programmers. Not only that, but you''ll learn DirectX too!

Julian Green
Toronto, Canada
Another thing:
When i saw that someone earlier had posted to a forum asking where a tutorial for a game was, i actually considered for a second about making a game programming tutorial... especially now that there seems to be a demand for it...

But I can''t stress this enough -- there''s not a formula for making games, no more than there''s a formula for creating a word processor or an OS. If someone were to lay out a method of making games, it would have to be incomplete.

You can put up tutorials about how to use a specific API, or how to program effectively for a specific OS... but when it comes to the part about how you''re going to implement your data structures, and how you''re going to go through the algorithm for your game states... that''s all on you, that''s the creative process... noone can lay that kind of thing out for you without hindering your advancement in understanding the mechanics behind games. Go find a tetris clone and read the source code, if you really want, but i don''t think it''ll be a step forward for you in the game programming industry -- it''ll be a step back because you won''t have done the reasoning for yourself, and you won''t have failed at anything, and been forced to go back and try a different approach. That''s what programming is all about, when you get down to it... coming up with a solution to something, exalting if it works, and trying a different approach if it doesn''t.

I''m a programmer because deep down, I''m an engineer... there''s no greater satisfaction for me than solving a problem and finding a solution or a path that noone has before -- or, at least, that i have never seen/heard before.

I''m a game programmer because deep down, I want to be creative -- I don''t have fabulous art skills, i don''t want to make movies, and writing doesn''t bring the joy that a tough programming problem does. But i can create whole worlds through my computer, and i feel like these worlds are an expression of myself, in a way.

If you get frustrated trying to figure out how to solve a certain problem, put it down for a while, go do something else, clear your head of the problem... then come back and take a different approach. If you''re still stuck after 3 or 4 different approaches, come to a forum like this and ask a specific question. I''ve seen a LOT of programming and design questions answered on this site, and others, but this site has a wealth of information that should be especially helpful (though it''s not all-encompassing).

If you still feel like you don''t know where to start in game programming, buy (or borrow) some books on the subject... there are plenty out there.

If you feel like simply learning an API or two isn''t helping you get anywhere, then maybe you''re not an engineer... if you''ve got some ideas and creative impulses, and you feel like the only way to express these is through a game, maybe think about becoming a game designer (but i wouldn''t bank on this concept - it''s not the easiest job in the world to get).

Maybe I''ve gone on a little long on this subject - but i''m not aiming this specifically at you, nin syn goth... i''m ranting to everyone who''s wondering about why there aren''t any game programming tutorials anywhere.

Since you''re still reading this, thanks for hearing out my rant -- don''t give up trying, because if you finally finish even the smallest program/problem, you''ll have put so much of your heart and soul into working it out that you''ll (almost definitely) feel that great feeling well up within you.

This satisfaction is the thing that keeps you going through the next problem, and the next, and the next... Seeing your first pixel come up on the screen brings such elation... then when you''ve got whole bitmaps coming up, that''s even more joy... soon you''ve got bitmaps crashing into each other, and when you see that your collision detection algorithm works, and they''ve stopped just passing through each other, you get so excited... and there are so many other little joys involved during the process... i guess it was more so back when i was doing DOS games.. but that doesn''t mean you can''t be happy with just setting DirectX up properly (or OGL for those of the other cult)

Good luck in wherever you go with your games!

Greenspun's Tenth Rule of Programming: "Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp."
quote:
Original post by *void

I suggest just learning C first, get an idea of procedural programming, understand how C works, then move onto objects and encapsulation and all the neat little things they''ve put into C++


Well it is not necessary to begin with C.There are a few good books that will teach you C++ without any knowledge on C.
And i believe it is better to start with C++ cause some things you''re gonna learn in C do not apply in C++.

I suggest you to read "Teach yourself C++ in 21 days" by Sams publishing which is a very good book.

Voodoo4
Here these words vilifiers and pretenders, please let me die in solitude...
I recently finished a simple ''rising blocks'' puzzle game in OpenGL. It''s not the most amazing thing ever, but it has some interesting features like loading levels from file and multiplayer mode. Most importantly, it''s written in very clean, well-designed code - no hacks, and it demonstrates the kind of framework and techniques that go into programming a game. Anyway I''m considering breaking it up into chunks and making it into a full-on "How To Make A Game" tutorial.
Considering the fact that I''m planning to enter it in GameDev.net''s puzzle game contest, it definitely won''t be finished until the contest ends .

-RWarden (roberte@maui.net)
Advertisement
The way I got started was learning to get bitmaps on the screen, after that I learned how to move them by themselves, them learned how to move them with the keyboard, then learned how to move them with the keyboard AND by themselves at the same time, then... well you get the idea. Short of finding a book that details how to make a game from the ground up I think thats the best thing to do. I learned a little more each day, ran into problems, overcame them, and went on.

------------
- outRider -
As I always say, the hardest thing I ever did was put my first pixel on screen. After that ... I am still learning.

youpla :-P
-----------------------------Sancte Isidore ora pro nobis !

This topic is closed to new replies.

Advertisement