Quake 3 1.32b - C or C++?

MechaSheeba

Banned
Dec 10, 2005
768
0
0
I think I read somewhere that Q3 was written in C, but I have no idea if it was ever rewritten in C++ or not...

Anyone who's downloaded the source know? I can post snippets if needed.

Also, is it a bad idea to start with C and move on to C++, advantages/disadvantages of doing so?
 

TheoPetro

Banned
Nov 30, 2004
3,499
1
0
I used to think that starting with C would be a huge help in learning C++ but honestly programing is so easy once you get the gist of it down. Just the syntaxes are different. If you want to learn C++ pick up "C++ programming in easy steps" its what I started with and it worked really well for me.
 

MechaSheeba

Banned
Dec 10, 2005
768
0
0
Originally posted by: GundamSonicZeroX
Can you give us a linky to your mod when your done? :D

lol sure, it'll probably be a long time coming though, I'm just now getting into it with zero experience/knowledge.
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
Quake 3 was always C and is still C as far as I know. Having them convert it from C->C++ would be a bigger endeavor than one little patch.
 

MechaSheeba

Banned
Dec 10, 2005
768
0
0
Originally posted by: xtknight
Quake 3 was always C and is still C as far as I know. Having them convert it from C->C++ would be a bigger endeavor than one little patch.

Yeah looks like it is C afterall, that kinda sucks, I was hoping it'd be C++ since I really wanna be able to use the Q3 engine/source as a reference while I learn the ropes. Maybe I can just stick with C though, is OOP really supposed to make life easier?
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
Originally posted by: MechaSheeba
Originally posted by: xtknight
Quake 3 was always C and is still C as far as I know. Having them convert it from C->C++ would be a bigger endeavor than one little patch.

Yeah looks like it is C afterall, that kinda sucks, I was hoping it'd be C++ since I really wanna be able to use the Q3 engine/source as a reference while I learn the ropes.

The Quake 3 engine is an awesome way to learn C if you can figure out what's going on. It's all very optimized.

Maybe I can just stick with C though, is OOP really supposed to make life easier?

It depends who you are. Obviously id Software didn't think so when they made Q3. Epic has been using C++ for Unreal since UT99. I think Doom 3 is C++.

I know my way around C fairly well but C++ is a nightmare for me. It's the architecture of it all that's difficult. I wouldn't be able to tell you what multiple inheritance or polymorphism is but I understand objects, constructors, garbage collection, etc. I doubt I will ever use the former technologies until I realize their potential in my field (batch data/string processing). But I'm not going to deny the value of it simply because my grasp on it is not great. There's some things procedural code is great for and others OOP.

The only way I can get things done is to first make a proof of concept with messy variable declarations all over the place and then rewrite the program the way I want, in an organized fashion. Whether that entails converting it to OOP-style depends on how complex the project is.

If I were to start on a game it would definitely be OOP though because:

a) That's where it'd be the most useful; and
b) I need to learn it better.

When I started on a Q3 mod the first thing I did was change the menu items on the main screen from red to blue. You'll find that it's basically English. Change MENU_RED to MENU_BLUE or something to that extent. And you can define your own colors as well. Just look at what RED is ((1.00f,0.00f,0.00f,1.00f) maybe?) and change it and see what happens. That's how I learn stuff (mess with it until it barely resembles Quake anymore :p).
 

Cooler

Diamond Member
Mar 31, 2005
3,835
0
0
native C code is somewhat faster then C++ because of some of the dynamic method look ups thanks to OOP. I will tell you from a reading standpoint and STL I much rather code a game in C++. Also i am sure some of the code is written in x86 asm as well.
 
Sep 29, 2004
18,656
68
91
Learn C jsut to understand pointers and such. That stuff is impotant to undrstand.

If you want to learn OO, consider Java. It is a much more pure OO implementation than C++. And you don't have to worry as much about memmory leaks and such (although memmory leaks can ocur in Java)

Scheme is not OO (or even used in industry much), but worth while learning from an acedemic standpoint:
http://www-swiss.ai.mit.edu/projects/scheme/

 

XxPrOdiGyxX

Senior member
Dec 29, 2002
631
6
81
If you want to learn a pure OO then I'd say to go with C# more than Java. Java is great and I love it but it doesn't play well with other languages. With C# and .NET you can use different languages and integrate them together.
 

nova2

Senior member
Feb 3, 2006
982
1
0
@xtknight: right, doom 3 is c++.

@MechaSheeba:
"Also, is it a bad idea to start with C and move on to C++, advantages/disadvantages of doing so?"
learning C and then C++ has disadvantages, afterall various things are meant to be done differently in CPP.

so - make sure you understand the changes between the languages and you'll manage with enough effort.
google searches like this may be of some use to you:
http://www.google.com/search?hl=en&lr=&...oving+from+c+to+c%2B%2B%22&btnG=Search


some info from the experience of others and my own.

> suggestions:

-- get as motivated as possible.
modify some c++ game (half-life 2, etc) as your first project, if that would give you the most motivation.

--archive code snippets, and code that you don't use enough and tend to forget.

--keep notes regarding problems you've had relating to specific c++ compilers, and the c++ language.

--put specific explanations from various books into one (organized) text file.
eg: You may find it very helpful to keep a list of info relating to c++ pointers in one file.
Make it easy to find info regarding topics that are important to you or to the project at hand.

--while reading books type out important info that you think you could forget.

--documenting what you have learned is so important. Once you understand a concept you can rewrite it
to your specifications, so if you need to look at it again, you could be saving yourself time understanding
what you forgot or what you did to fix some problem.

> acronyms.
keep a list of them.

> remember helpful pages, like these:
http://parashift.com/c++-faq-lite

http://research.att.com/~bs
http://public.research.att.com/~bs/bs_faq.html
http://public.research.att.com/~bs/glossary.html
http://www.accu.org/ (they rate books)

Source Code Search Engines
http://www.koders.com/
http://www.codase.com/
http://www.krugle.com/

http://www.gamedev.net/reference/

http://www.mindview.net/Books
Bruce Eckel puts his books on the web for free.
Get his "Thinking in C++" (TICPP) books. 1st and 2nd volumes (not editions).

The C++ Programmer's Bag of Tricks
http://www.kuro5hin.org/story/2002/7/18/3313/01429

> books
get plenty, and get them in digital format too. amazon.com can sometimes be useful for the user comments/reviews.

when learning a concept, check each books explanation, note the ones that help you the most.

a list of books you should consider getting:

The Pragmatic Programmer: From Journeyman to Master (Andrew Hunt, others)
C,C++ Programmer's Reference (Herbert Schildt
C++ In A Nutshell ;5m 2003; (Ray Lischner)
C++ Primer, 3rd Edition, by Stanley & Josee
Code Complete (2nd Ed) ;6m 2004; (Steve)
Effective & More Effective C++ (Scott Meyers)
Effective C++ ;3rd Ed; (Scott Meyers)
Efficient C++ Performance Programming Techniques (Dov & David)
Practical C++ Programming 2nd Ed (10m 2002) (Steve Oualline)
Accelerated C++ (andrew
Effective STL (Scott Meyers)
Beyond the C++ Standard Library : An Introduction to Boost (Björn Karlsson)
C++ Standard Library. A Tutorial And Reference (Nicolai)
Bjarne, C++ Programming Language Special Ed
More C++ Gems (Stanley Lippman, others)
Introduction to Algorithms ;2nd Ed; (Thomas H. Cormen, others)
C++ Templates: The Complete Guide (David Vandevoorde, others)

> get a computer monitor that is easy on your eyes and on your electricity bill.
if your eyes feel strained after long hours of reading text, and it's not due to glare.
I'd suggest getting an LCD if you look at text for long hours.
if getting a 19'' or greater CRT, note the significantly larger electricity usage of it compared to
a 19'' Dell 1905FP LCD that uses 32watts.
see this forum to help you decide on a monitor:
http://forums.anandtech.com/categories.aspx?catid=31