• Advertisement

Archived

This topic is now archived and is closed to further replies.

Help with C programming?

This topic is 6453 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Ooh, that book sucks! That is the book that I started with. As for not learning C, I think that is a bad idea. C++ is just another method of writing C code. It will be much easier to grasp C++ if you know C well. Once you have C and then C++ down, move on to Win32. Win32 sucks and you probably wont use it much, but you will have a much easier time with DirectX if you are atleast familiar with how Win32 is put together. Ive been writing Win32 for 6 months and am about to move on to DX. I have been writing a tileing engine in Win32 GDI for awhile now, and I plan on converting to DirectX when I have that down. Ive been coding for 2 years total so dont get frustrated. Learning to make games takes a lot of study, and is still a very difficult thing to do. With a little (lot) of perserverance, you can be a good game programmer.

Share this post


Link to post
Share on other sites
Well, you should learn C++ aswell. That''s what DirectX is all about. As for console programming, ick, it apears that Microsoft may be starting a monopoly on that market aswell. So, I guess it would be best to know DirectX (Microsotf), which uses C++. Don''t get ahead of yourself. You won''t get very far with a knowledege of arrays and pointers.

JoeMont001@aol.com

Share this post


Link to post
Share on other sites
About the C vs. C++ thing:

To learn C++, you''ll have to learn C anyway, so it isn''t really a matter of "Should I learn C or C++?", but more of a "Should I learn C and continue on to learn C++?". As for that second question, I say go for it. C++ can to a lot of nifty time/effort saving things if you know how to use it well (I don''t claim to, but I have found a few very cool uses for it).

As for general tips: Read, read, read, and experiment, experiment, experiment. Like the others said, once you learn a new topic, play around with it for a while until you really understand how it works, even its you think it''s something trivial. Also, read everything you possibly can on programming, code design, etc. If there is a topic that interests you, there is probably a paper relating to it somewhere on the net, and most likely on this here gamedev.net site.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
not console as in DreamCast and the like GaMeStA.. they mean console as in text mode

Share this post


Link to post
Share on other sites
Ok, Lets get the facts straight, The first thing you need to do is learn C( if you start with C++, you will get confused and write bad code without even knowing the basics of what your errors are. ). Then, once you know C and you''ve made a couple of little apps, you learn C++ ( with the knowledge you get by learning C, you will understand more clearly what Objects do and how to write good code ) then move on to Win32 API ( you have to go through that if you want to understand the basis of windows programming and also the basis on what DX was made ) and finally DX... Anyhow, that is how I learned it and it worked for me. Though I wouldn''t recommend as all the others before me already said, to write a game with the little knowledge you have at the moment. I would keep on going until I''ve finished the book as you will surely use Structs and Pointers in your game as most programmer do...



Cyberdrek
Headhunter Soft
DLC Multimedia
Two Guys Soft

Share this post


Link to post
Share on other sites
Try "C The Complete Reference" by Herbert Schildt. It is one of the best books about C. It does not have a teaching format but the author is VERY good.

Edited by - The_C_Guy on June 22, 2000 2:21:10 PM

Share this post


Link to post
Share on other sites
Im learning C from teach yourself C by Herbert Schildt, and im finding that its an excellent book (almost finished now)

Share this post


Link to post
Share on other sites
quote:
Original post by CoiN

Im learning C from teach yourself C by Herbert Schildt, and im finding that its an excellent book (almost finished now)



I''m using that book, as well as The Waite Group''s C PRIMER PLUS.
3rd Edition. Both are great books.




BeOS, "It's da bomb, baby"

Share this post


Link to post
Share on other sites

  • Advertisement