Archived

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

Newbie question! Where will C++ take me before...

This topic is 5623 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

Probably discussed a lot here, but here goes. How far will C++ take me before it''s overhead will require me to have some parts in C? I''ve read an article here that mentions that most shooters use C, is this a concern for other types of games (RTS, chess games etc) Are there shooters only using C++ these days? And is C fast enough for shooters or should I also look at assembly? Mind you, I''m only looking far ahead and only need a general idea. Thx! p.s.: no, I''m not another guy wanting to create Quake VIII... I''m just wondering...

Share this post


Link to post
Share on other sites
Umm yes this is a newbie question... C++ is just C with objects. If you didn''t understand that last sentance buy a book. C++ has virtualy the least overhead you can get, most FPS are written in C++, which as I stated is just extended C. I would suggest the Sams Teach Yourself C++ in 21''s book to understand C++. After that if you are intersted in gamming I would suggest a book that teachers you Direct X or Open GL. They are both graphics API''s that are used in almost every game. Good luck and remember not to give up!

Share this post


Link to post
Share on other sites
Hey,
C++ is just as fast as C if you do it right. Even with the extra overhead of classes, C++ is only a fraction slower than C, it does not make all too much difference. You can write an entire game in C++, and then the same game in straight C, and I''m willing to bet you couldn''t tell the difference.

Walt

Share this post


Link to post
Share on other sites
Thanks! That's what I thought... I've already got two books coming in soon (Sams Teach Yourself C++ in 24 Hours and Thinking in C++, Volume 1: Introduction to Standard C++). Should get me from my usual web programming to C++/game programming in no time, I hope...

[edited by - merlin9876 on July 23, 2002 11:23:05 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
"C++ is just C with objects" that''s a newbie answer. C++ is so, so much more.

Share this post


Link to post
Share on other sites
quote:
Original post by trub
"I''ve read an article here that mentions that most shooters use C"

Dooom III = c++

nuff said?


Except the main graphics engine, which is still *gasp* C .

Share this post


Link to post
Share on other sites
I have yet to see *ANY* C/C++ code that is not some bastard hybrid of the two languages. Folks tend to use the features of each language that they like.

Pure C or pure C++ is very close to being a fantasy.



God was my co-pilot but we crashed in the mountains and I had to eat him...
Landsknecht

Share this post


Link to post
Share on other sites
Yes ''AP'' I know that C++ is more than ''C with objects''. But I didn''t really think that I was going to need to expalin every moresl of sh*t that C++ does. Also thanks for helping merlin9876 with his problem.

Share this post


Link to post
Share on other sites
Landsknecht is right.

C++ is an own language, just as C. But C++ can also be considered
a superset of C as it includes most of C''s functionality to
ensure backwards compatibility. That is, C++ often supports
a C++ way for doing things and a C way, too. Good examples
are typecasting and I/O routines. Of course, C++ has some
unique features like OOP support, templates and exception
handling.

Both languages are perfectly suitable for "shooters" and for
other 2D or 3D games as well. Assembler language is not needed
as almost all recent C++ compilers are able to optimize code
to the same degree as an intermediate assembler programmer is
capable of doing. Sure, there are hardcore assembler freaks who
can do better, and this is still done in large-scale projects
to optimize bottlenecks away. But you won''t ever need it...

Of course, that doesn''t mean you should never have a look at
assembler language. It''s nice to know about it. I just wanted
to point out that the actual use of assembler language is today
not longer necessary.

Share this post


Link to post
Share on other sites
In my opinion C++,at a basic level ,is the ideal language for game programming.
Consider many characters sharing same functions : move(),
animate(), draw() etc and same variables, x,y,z (position) etc
You can group all functions and variables in a class.
You can write also a class Time, World etc
At this level C++ is simply an extension of C.
I have some doubt that the most advanced C++ features can be of help to a game programmer , at least for an amateur, I do not mean for a pro working in a team.
There is an advanced feature that I am using a lot ,operator overloading, for example in switch() statement if you must fill a structure or an array etc

Share this post


Link to post
Share on other sites
quote:
Original post by fallenang3l
[quote]Original post by trub
"I''ve read an article here that mentions that most shooters use C"

Dooom III = c++

nuff said?


Except the main graphics engine, which is still *gasp* C .


iD switched to C++ so it would be easier for people to make mods. The fact that the main graphics engine is in C (I didn''t know that until now) is probably because Carmack has made all his other engines in C, so he is more comfortable with it. BTW, if you make a file *.c instead of *.cpp, does if force you to use pure C? If so, then Quake III is pure C.



Proceeding on a brutal rampage is the obvious choice.

Share this post


Link to post
Share on other sites
All of id''s games are C, with the exception of Doom 3.

Half-Life''s engine is C, (but I guess thats because its based off of the Quake engine).

UT is like the only shooter, not written in C.

Share this post


Link to post
Share on other sites