Help with C programming?

Started by
16 comments, last by GaMeStA 23 years, 10 months ago
hey i''m currently learning ''learn C in 24 hours'', i''m up to learning about arrays and pointers. My main question is, how do you actually get a game started?? like changing graphic mode and displaying pictures.... oh i''m also learning pascal at school, so some help with pascal about game programming would be helpful thanks for your time -GaMeStA
When there is a will, there is a way...
Advertisement
Before you even think of doing any game stuff...learn C++ well.

Write lots of console apps doing each of the topics you learn from the book. It may be boring, but there are lots of new things to learn (and hence, get wrong) when you start writing games. If you don''t know the language well, youre going to have lots of problems (I can vouch for that ).

Once you have a good grasp of the language start looking at DirectX (specifically DirectDraw) and you can do all of your graphical stuff.

Good luck!
Just to add to Vallis''s note. When learning C from a book similar to the one you are reading , the odds are that it is going to teach you ANSI Standard C.

Now, ANSI C has no graphic functions, no functionallity to get input from mouse or joystick, etc. These are all platform independant functions.

So, once you have learnt C/C++ you need to decide on which platform you are going to develop a game under. If it is to be windows, then you will need to start to learn Win32 API.

As for graphics you can learn DirectX but better, I feel, would be OpenGL as it is portable and can be used under C and C++.

Basically, just learn one thing at a time, learn C before doing the platform API or C++. Then once you got those, learn your graphics API - OpenGL or DirectX.

Hope this helps.
-----------------------------------------------All messages are of my own personal opinion and not meant to offend. But if they do - tough :)Neuro.
Just continuing from what the others said.

If you would like to learn how to do your own software rasterization (Meaning draw everything up on the screen yourself) then you will need to learn a little about programming for graphics modes. The only book that I know about(I''m sure there are others out there) is the Black Art of 3D Game Programming. It''s old (c.1996) but the rendering techniques that it uses are still in use today. It will teach you how to set up the computer for graphics displays using mode X drivers. You will learn how to transform and light polygons and then chade them on the screen. I left out alot of intermediary steps(line drawing and scan conversion of polys) but I think you get the idea. If you know these routines then OpenGL and DirectX tend to make a bit more sense.
Creativity -- Concept -- CodeYour game is nothing if you don't have all three.http://www.wam.umd.edu/~dlg/terc.htm
If you are currently learning c then you probably like to take a look at http://www.voodooextreme.com/articles/jake/cintro.html . This is a introduction into c from a game programmer called Jake Simpson working for Raven. Perhaps this introduction form a pro in the game programming field can keep you more motivated to learn than your current book. And there are also some links for further infos about learning c.

Have fun!

Bjoern
If you have any specific questions about TurboPascal, just drop me a line (you can write me a mail...)
I have a long experience with that language, and I think I''m good enough to answer your question
But at the moment I''m programming in C++, and that will be the language I''ll keep programming in...
To put it in a nutshell: Don''t start programming games in Pascal, C++ is much more powerful (whatever compiler you use...), because TurboPascal is a bit too conservative with memory allocation and so on...

Personally I wouldn''t recommend learning C (as all the others told you before ), I''d rather learned C++ (there''s not really a big difference...you have the possibility to write an object-oriented code, but I think that''s all...)

Yours,

Indeterminatus

--consuetudo est quasi altera natura hominum...
Indeterminatus--si tacuisses, philosophus mansisses--
You''ve only got up to arrays and pointers. Learn the rest of the book. Learn Win32 API. Learn DirectX (not openGL at first, OpenGL is 3D only, you should do some 2D first)

------------------------------
#pragma twice
Sorry to say this but lets draw an analogy here to get a grip on your perspecive.

'I think I can use a bandaid once I figure out how to get the thing to stick to me. How do I perform open heart surgery?'

You have a long way to go.

Good luck in your efforts, game programming is a fun and emmensly enjoyable adventure (not to mention frustrating, annoying and overwhelming).

I will give you one bit of advice. Start small. Don't start to write Quake 4, you will fail. Write Space Invaders clone first, I did (about 19 years ago), it taught me alot.

Edited by - DeltaVee on June 21, 2000 2:59:07 PM
D.V.Carpe Diem
So do you reckon i shouldn''t learn C?
doesn''t must game programmers for console use C?
because i want to program games for windows first, to get experience then move on to console programming.
thanks for your time
When there is a will, there is a way...
Another thing that you must keep in mind is that the code to your first game will be crap. It will be a learning process, and about half way through you will realize all the things you did wrong.

I also suggest that you learn more about structured programming before taking on a big project. It isn''t the kind of thing you can learn from books. You can only learn it from experience and other peoples code. I don''t do a lot of code with a procedural structure, so I can''t tell you were to find it, but for OOP design try programming in Java. It will force you to learn it. Just don''t get stuck in Java.

Another thing you can try doing is helping on a mud or some other online game, or at least look at the code for one. I really learned OOP programming on an LPC mud. They have a whole class tree which shows you how it can actually be useful.

Once you have a good OOP class tree the code all fits into place. If you don''t you''ll find your self using global variables, and constantly coping and pasting code. You''ll have to make changes to your old code everytime you add in something new.
For a good time hit Alt-F4! Go ahead try it, all the cool people are doing it.

This topic is closed to new replies.

Advertisement