Jump to content
The Dark Mod Forums

C++ Programming Books And Resources?


woah

Recommended Posts

But writing in C++ only because it is much more useful in a master's hands is virtually the same as dropping out of Universities because Bill Gates did. Not all people can become millionaires in this sphere. Carmack uses C. Should everyone use C now? You'll write better in C# than in C if you are not a doctor in programming. But if you here are all experts - well sorry. I thought if you WERE you wouldn't need a DooM 3 Engine.

 

I think you misunderstand Ishtvan's comment about using C++.

 

C++ is not being used in order to be like Carmack, but because the mod is being written for a game that uses C++ and there is no option but to use the same language to extend it.

Link to comment
Share on other sites

  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

Except that the average users are not the ones making the decisions, it is the developers of the games. I can almost imagine it:

 

"Sorry Mr Carmack, OpenGL is outdated and possibly can not keep up with current demands so you should use the much modern DirectX interface...click...hello?...hello?"

 

Carmack is not really the average user, and even he has to bend to market. If MS manages to kill OpenGL and it's support with GFX cards, then even Carmack wouldn't continue using it probably.

Gerhard

Link to comment
Share on other sites

Not all people can become millionaires in this sphere. Carmack uses C. Should everyone use C now? You'll write better in C# than in C if you are not a doctor in programming.

 

Where did you get THAT strange notion from? I have seen a lot of programmers, and the choice of langauge has absolutly NO impact on wether you write good or bad code. In fact I have seen programmers writing in C++ as if they were still coding in C and this was even worse as if he had used C in the first place. And I strongly doubt that you automatically write better code just because you use C#. C# is just a clone of Java and even in Java you can write bad code.

Gerhard

Link to comment
Share on other sites

I have seen a lot of programmers, and the choice of langauge has absolutly NO impact on wether you write good or bad code.

 

Actually it does. Some languages encourage good programming practices while others don't. It is certainly the case the bad code can be written in any language and a good language will not make a good programmer, but it is not true to say that there is absolutely no impact.

Link to comment
Share on other sites

A good programmer can write good programs in any language. But it requires more discipline in some languages. It certainly may also require some experience with that particular langauge, because coding style is not the same for all languages. Nevertheless a good programmer will adapt a better coding style on other languages as well, which means that the choice of language has no impact after some time.

Gerhard

Link to comment
Share on other sites

whats so great about opengl?

and whats wrong with directX ?

 

Speaking as somebody who has never programmed either:

 

1) I have seen suggestions that OpenGL is easier/more pleasant to code for, although this may be subjective and without merit.

2) More importantly, OpenGL is an open standard which is available on multiple platforms. DirectX is only available from Microsoft on Windows operating systems, which severely limits the portability of games written for it.

 

I have no idea whether there are any technical or performance differences between them.

Link to comment
Share on other sites

When I started to program 3D I bought books on DirectX and tried to learn it. Even though I had some experience with COM I had a pretty rough time to understand the examples. I also looked into OpenGL because I wanted to evaluate both of them to see which one offers me more. I was leaning towards OGL though, because I also use Linux and OGL is portable which DirectX is not.

Anyway, the first time I looked into OGL samples I immediately understood them OGL is elegant and easy to use and very straightforward. The concpet to use it is pretty simple. Thus I started to use OGL for my own apps, because I don't want to learn an API, I want to programm my applications. Time spent in learning an API is better spent in coding the app that you need, because the API is only a tool to meet your ends. Learning OGL is MUCH easier and what is also important, the maintenance of the code is also easier because of that.

Gerhard

Link to comment
Share on other sites

To sparhawk - so, I guess you live in a place where programmers can learn to write in C++ easily on their own and not reinstal their Windows at the same time? Don't you know about all C++ problems with the memory leaks and all that? My dad knows C++ and he wrote in it all his life, but know he can use C# and he says C# is MUCH better to work with because it doesn't have all C++ problems. And the better the language is, the more complex the tasks can become. I wonder if you wrote in C# yourself. C# is not Java, either. In fact, most normal programs but games are going over to C# now. What, they all gone crazy? And with Management DirectX, maybe games will too, when there are enough C# programmers about...

 

I wasn't talking to Istvan about why you use C++. I was talking about whether it makes sense for new programmers to write in it. Of course, if you want to make DooM mods you'll need to know it.

 

c777 - explain this idiotic hate of Microsoft, please. I wonder where the regular people be now, if it wasn't for Microsoft. Trying to istall a completely carzy OS of some ingenios programmer who didn't give a back thought of how regular people should get along with it?

Too late to save us but try to understand

The seas were empty -- there was hunger in the land

We let the madmen write the golden rules

We were just Children of the Moon

We're lost in the middle of a hopeless world

Children, Children of the Moon watch the world go by

Children, Children of the Moon are hiding from the Sun and the Sky

 

© The Alan Parsons Project - Children of the Moon

Link to comment
Share on other sites

@Forsaken: Every programming language has their advantages and disadvantages. In applications where efficiency is not of paramount importance, it makes a lot of sense to sacrifice some performance in exchange for easier maintenance and debugging. Things like Java and C# are much better than C or C++ if you're writing a business application. However, adding such overhead is simply not acceptable for most professional games, especially FPSes. They need all the computing power and memory efficiency they can get, so C or C++ are much better languages for them.

 

Also, C and C++ are great for learning and teaching the underlying architecture of computers. It has a nice high-level syntax and high-level features, which makes it easy to use, and yet is almost as low-level as assembler in many respects. I had a compilers teacher who once described C as a "machine independent assembly language".

 

As for Microsoft, they're notorious for making bad design decisions that leave their products open to exploits, not to mention numerous bugs and crashes. All the recent buffer overrun vulnerabilities of Microsoft products make me wonder if MS programmers are incapable of properly writing something as simple as a buffer.

Link to comment
Share on other sites

In fact, most normal programs but games are going over to C# now. What, they all gone crazy?

Indeed.

 

And with Management DirectX, maybe games will too, when there are enough C# programmers about...

Some will, some won't. Even people who don't hate Microsoft don't necessarily want to be in its pocket.

 

Nor is C# the only high-level language available by any means - Java, Python, Perl, PHP all have their uses and will not be replaced by C# for many applications.

 

c777 - explain this idiotic hate of Microsoft, please.

Microsoft use anticompetitive and illegal business practices, deceptive FUD campaign against competing products, fund kamikaze lawsuits against their competitors, conduct personal smear campaigns against those who try to move away from their products, and lobby for IP legislation that will benefit them but drive smaller enterprises out of business. No matter how good or bad their technical projects are, there are many who would not wish to associate with them or their bullying tactics.

 

I wonder where the regular people be now, if it wasn't for Microsoft. Trying to istall a completely carzy OS of some ingenios programmer who didn't give a back thought of how regular people should get along with it?

 

You are aware that Microsoft have never invented anything? They are very good at marketing, but everything they produce was invented elsewhere and picked up by Microsoft as a commerical product.

 

Microsoft wrote Windows, but they certainly didn't invent the concept of an easy-to-use graphical operating system - that was done by Apple and Xerox before them.

Link to comment
Share on other sites

To sparhawk - so, I guess you live in a place where programmers can learn to write in C++ easily on their own and not reinstal their Windows at the same time?

 

Sorry that absolutely makes no sense to me.

 

Don't you know about all C++ problems with the memory leaks and all that?

 

C++ is a language. Memory leaks are a programming problem, not a language peroblem. There are ways to test against memory leaks, but if a lazy programmer doesn't test for it then it's the programmers fault and not the language's.

 

My dad knows C++ and he wrote in it all his life, but know he can use C# and he says C# is MUCH better to work with because it doesn't have all C++ problems.

 

I don't know which problems you are refering to. There are some problems with people who don't understand C++ and what it does behind the scenes. Such people sloppily use all kind of C++ stuff without maybe realizing and then wondering why their code is slow and bloated. Again this is not a language problem itself, it is a lack of training.

 

And the better the language is, the more complex the tasks can become. I wonder if you wrote in C# yourself.

 

Well, that depends on your definition of 'complex' and 'better'. Obviously a more bloated language is less ideal to write more complex programs, because all that stuff that makes such a language easy to use, inadvertantly means that it requires more overhead somehwere else.

 

C# is not Java, either. In fact, most normal programs but games are going over to C# now. What, they all gone crazy?

 

They don't need to be crazy. It's enough if they dont understand computers and how they work, and of course the often feel the urge to follow the hype because it's cewl. I remeber the same happening when C++ was introduced. The same happened when DLL came up (even though the concept existed on Unix for ages). Suddenly every shitty little program had a DLL because it was a fad, it was 'in' and it was 'cool' to have DLL. Makes you look like a big programmer. Same for C++. Many didn't even understand the concepts but companies required it because it was the new star on the horizon. The sanctuary that makes all programming problems go away. Something that you MUST have in your portfolio if you want to be a real man. And now It's C# which is simply a Java clone. LOL. MS couldn't get control of Java, as they did with many other protocols, applications or standards, so they invented their own. With a big marketing department and enough money you can easily do this, and now people think this is the sanctuary that makes all programming problems go away. Something that is cewl, dadada...

 

And with Management DirectX, maybe games will too, when there are enough C# programmers about...

 

And that means what? Because games might use it, it means it is THE thing?

 

I wasn't talking to Istvan about why you use C++. I was talking about whether it makes sense for new programmers to write in it. Of course, if you want to make DooM mods you'll need to know it.

 

A language can be easily learned. I can learn a new language and start writing programs in it in a few days. Not that it means I will be an expert at this language, but it is sufficient to get me going. A few years ago I have never heard about Java more than it's name. Still I debugged a Java application for a collegue because he had a problem and our Java expert, had no clue what the problem was. When I fixed that bug in the Java application it was the first time that I had seen a Java code. You know why I managed to find the problem and fix it? Because I know how computers work, and I know how computer languages work. Languages mean nothing. If you are moderatly smart you can learn any language in short time, but if you don't understand how computers work, then you will never be a good programmer. And with "understand how computers work" I don't mean that you are capable of launching Windows.

 

I wonder where the regular people be now, if it wasn't for Microsoft. Trying to istall a completely carzy OS of some ingenios programmer who didn't give a back thought of how regular people should get along with it?

 

One would think that MS inventeded computers. They did not. There were already good programs out there at the time, but Bill Gates was a good business man, which made MS successfull. Not because it is such a good OS, because it isn't. It suffers a lot of problems, which are there because it was badly designed and for compatibillity they couldn't redesign it.

Gerhard

Link to comment
Share on other sites

They need all the computing power and memory efficiency they can get, so C or C++ are much better languages for them.

 

Actually waths even worse for high-end games is the garbage collection which is unpredictable. I wouldn't be surprised if C# also uses garbage collection. And this is a very bad thing for games, because it can kill your framerate a lot and you can't even know when it hits.

 

Also, C and C++ are great for learning and teaching the underlying architecture of computers.

 

Hmmm ... <_<

 

It has a nice high-level syntax and high-level features, which makes it easy to use, and yet is almost as low-level as assembler in many respects.

 

Hmmm ... <_<

 

I had a compilers teacher who once described C as a "machine independent assembly language".

 

C - yes. C++ not.

Gerhard

Link to comment
Share on other sites

As I just said, people don't know Management DirectX, and so don't know that possibly C# can be almost as powerful as C++, but faster and more effective to write in. Some games are more optimised than others, didn't you notice? Many games with equal or lower graphics slow down on my computer and other computers, while DooM 3 runs flawlessly(Serious Sam, Half-Life 2, Starship Troopers). People don't all write the same in C++, so optimisation paramounts are not that crucial, Half-Life 2 sold better than DooM 3, in fact. Carmack's engines are the best, but there will always be games that have worse optimisation.

 

C# uses Garbage Collection, but it can be controlled and even turned off...

 

If you say C#, just like C++, was a new star on the horizon, how come C++, being such a star, the most powerful language today?

 

Languages mean nothing? Do you hear yourself? Yeah, you may learn C#, Java, whatever, after C++, they are simple. But can you learn C++ and write well in it easily if you are a Java programer? I don't think so. It will at least take you much time.

 

You didn't say whether or not you used C# properly.

 

I seen old Apple next to Windows 95-98, and windows is easyer to get along with(looks better too). They didn't envent anything. They didn't have to. A new invention is not much use until it is worked on. Yeah, Linux is better than Windows, Novell is better than whatever equivelent of Windows was, maybe, but they are made more for programmers than users. But I guess only a user can understand this. Programmers will simply continue to harp on bugs, which are more often in Windows than everywhere else. But Microsoft is for users, and, of course, they don't allow same programms installed on two different OS'es, but, em, this is competition, every large company will be called ugly and sinister by those who preffer something else and Microsoft doesn't really let them. Now, though, Windows is fading, for everything does, and games can be installed on Linux and Windows both. Nothing for you to worry about.

 

Also, my dad's programs WEREN'T slow and bad and hard to follow. Don't offend people just because of your hate of opposing talk. I can show you some of his C++ code for you to check, I guess.

 

But I see there is no sense in talking to Microsoft-haters and know-it-alls. Thanks to Gildoran for respecting to the conversation. I probably won't say no more(to sparhawk, at least), this will go to flame and avoidance, I feel.

Too late to save us but try to understand

The seas were empty -- there was hunger in the land

We let the madmen write the golden rules

We were just Children of the Moon

We're lost in the middle of a hopeless world

Children, Children of the Moon watch the world go by

Children, Children of the Moon are hiding from the Sun and the Sky

 

© The Alan Parsons Project - Children of the Moon

Link to comment
Share on other sites

Programmers will simply continue to harp on bugs, which are more often in Windows than everywhere else. But Microsoft is for users

 

Somehow I doubt it's only programmers that get annoyed when a security hole in MS is unearthed and exploited for virus transport by some hacker to cause millions of dollars in damages. More often than not, MS's response is "Oh yeah, we've known about that bug for 6 months, but made no attempt to patch it." That's completely understandable though, because who would expect the largest employer of software engineers in the US to be able to spare a whole 20 man-hours to fix a huge security hole within the time period of 6 months?

Link to comment
Share on other sites

As I just said, people don't know Management DirectX, and so don't know that possibly C# can be almost as powerful as C++, but faster and more effective to write in.

 

Quite possibly, and there may well be applications for which C# is suitable, including some games. This doesn't mean that it's the overall best language and everyone should switch to it however.

 

If you say C#, just like C++, was a new star on the horizon, how come C++, being such a star, the most powerful language today?

 

C++ added major new functionality to the C language. C# is just Microsoft's attempt to jump on the Enterprise Language bandwagon, since they can't control or kill Java like they wanted to.

 

Languages mean nothing? Do you hear yourself? Yeah, you may learn C#, Java, whatever, after C++, they are simple. But can you learn C++ and write well in it easily if you are a Java programer? I don't think so. It will at least take you much time.

 

Most people today will not bother learning C++ unless there is a specific need for it, like modding Doom 3 or something. I don't like pointers and machine-dependent stuff so I would not be very good with it, but it does have its devotees.

 

I seen old Apple next to Windows 95-98, and windows is easyer to get along with(looks better too). They didn't envent anything.

 

How old is old? Apples had graphical interfaces before Windows even existed, and there are version of Windows much older than 95 (Windows 2.0 anyone?). If you compare a very old Apple with Windows 95 this is not a fair test since the Windows version is probably more recent than the Apple.

 

Now, though, Windows is fading, for everything does, and games can be installed on Linux and Windows both. Nothing for you to worry about.

 

I don't think Windows is fading quite yet, and as we were discussing, if Microsoft succeeds in killing OpenGL then there will be a lot less incentive for companies to develop for it, which exludes Linux automatically (unless Wine's implementation of DirectX can take over).

 

Also, my dad's programs WEREN'T slow and bad and hard to follow. Don't offend people just because of your hate of opposing talk. I can show you some of his C++ code for you to check, I guess.

 

But I see there is no sense in talking to Microsoft-haters and know-it-alls. Thanks to Gildoran for respecting to the conversation. I probably won't say no more(to sparhawk, at least), this will go to flame and avoidance, I feel.

 

What's up with all the persecution complexes this week? HINT: people not agreeing with your choice of language/company/text editor/game does not make them a hater or a know-it-all.

Link to comment
Share on other sites

If you say C#, just like C++, was a new star on the horizon, how come C++, being such a star, the most powerful language today?

 

As long as you don't define the terms 'powerful', 'best' and 'fastest' it doesn't really make sense to answer. These terms in relation to computer languages are ambigous and depend on your requirements. There is no such thing as 'the best' language.

 

Languages mean nothing? Do you hear yourself? Yeah, you may learn C#, Java, whatever, after C++, they are simple. But can you learn C++ and write well in it easily if you are a Java programer?

 

Go ahead and try it. The syntax is even the same and also the concepts. So far the ONLY language that I found to be radically different than any other language so far (I have learnt) is SQL. The reason is that normal computerlanguages are linear, while SQL works on groups, which require a radcially different way of thinking when you write prorams in SQL.

 

You didn't say whether or not you used C# properly.

 

I could never haves used it properly, as I never used it, and I have no incentive to learn it at this point.

 

Yeah, Linux is better than Windows,

 

Define 'better'.

 

Novell is better than whatever equivelent of Windows was, maybe,

 

Define 'better'.

 

Programmers will simply continue to harp on bugs, which are more often in Windows than everywhere else.

 

LOL! Guess why. :)

 

But Microsoft is for users,

 

Yeah. MS is for users and users don't need bugfree programs. :)

 

Also, my dad's programs WEREN'T slow and bad and hard to follow. Don't offend people just because of your hate of opposing talk. I can show you some of his C++ code for you to check, I guess.

 

I can't help you if you think you were insulted and take offense. Maybe you should read what is written there, instead of reading what you THINK is written there.

Gerhard

Link to comment
Share on other sites

Forsaken, Doom 3, and Serious Sam (while well programmed) are bad examples of "how a well programmed game can run fast". There's nothing really that complex going on behind the scenes apart from the graphics. You can't compare them to a game like T3 which has so much more CPU intensive stuff going. Can't comment on HL2 or Starship Troopers but I sure bet they don't have the level of T3's light gem calculations, sound propagation, and AI behaviour.

Link to comment
Share on other sites

HL2 is technically several years behind. The only advanced stuff is the physics, but it is using Havoc, and was purchased as a package. The real good thing about HL2 is the gameplay, but I'm sure that HL2 could have also be done severaly years ago, and you wouldn't really notice much difference.

Gerhard

Link to comment
Share on other sites

C++ added major new functionality to the C language. C# is just Microsoft's attempt to jump on the Enterprise Language bandwagon, since they can't control or kill Java like they wanted to.

 

You're truly right IMHO. C# and new .NET architecture is intended to counterstrike Java. Microsoft had to develop a virtual machine system to compete enough. C# is just a "new" "language" (or if I have got to be correct, is just a parser to .NET intermediate language) with the properties of Java (and more) and the syntax close to C++, so C programmers will find easy to learn it and to develop non-required-efficiency programs at minimum cost and expending the less time possible.

.NET also increases this feeling to the point that you can program in 15 different languages and integrate them together in a single application, because they have ported Foltran, Basic and some others to .NET. So it has its benefits.

Also in computer engineering the "efficiency of your algorithm" is thousand times more determinant to the results you can get by optimizing the code to fit your machine. But of course, once you've got good and fast algorithms, using a well-know and extended language such as C helps a lot to optimize the final application.

 

I conclude that C# or Java are good enough if you want to create an Enterprise application at minimum cost at time, but if you want to make a game, you've got to drain every computing cicle of your machine. Maybe in the future C# or Java accomplish better performance with newer tools than C, but I think this will not happen.

 

I'm experienced in C# and I find it so high-level, speed up and comfortable that I nearly always get bad-coding :P. I found that when I program in Java I structure the code better and I got the code more robust and maintenable. But maybe it is me :P

Link to comment
Share on other sites

I conclude that C# or Java are good enough if you want to create an Enterprise application at minimum cost at time, but if you want to make a game, you've got to drain every computing cicle of your machine. Maybe in the future C# or Java accomplish better performance with newer tools than C, but I think this will not happen.

 

Quake 2 has been ported to Java and runs with good performance - check out http://bytonic.de/html/jake2.html

 

In theory Java applications can run faster than C/C++ because the VM performs run-time optimisation based on common code paths, which simply cannot be done with precompiled binaries. In practice the frame rate can be limited by factors such as the Java/OpenGL bindings.

Link to comment
Share on other sites

Optimization based on common code paths is also done on CPUs. It is named Branch Prediction there. Also Q is quite old for current standards, so it is fine in Jave, but of course running Doom 3 within a Java environment would show you how fast Java really performs. :) In a few years Doom 3 might be ported to Java, but then we will have much bigger machines. I doubt that you can run Java-Q2 on something like a 200MHz Pentium, which Q2 original run (or was it even slower?)

Gerhard

Link to comment
Share on other sites

Optimization based on common code paths is also done on CPUs. It is named Branch Prediction there.

 

Yes, but it is much simpler because the CPU does not see enough of the code at one time to really optimise it. Branch Prediction is still a darn sight better than nothing though.

 

In a few years Doom 3 might be ported to Java, but then we will have much bigger machines. I doubt that you can run Java-Q2 on something like a 200MHz Pentium, which Q2 original run (or was it even slower?)

 

The problem with Java, as everyone knows, is its memory footprint. I think this is a design decision since memory is cheap, and you can do more optimisation and get better performance if you don't mind inflating the memory usage a bit. I expect that we will see the likes of D3 on Java, but it will be using even more memory at that stage.

Link to comment
Share on other sites

Judging from the performance info on that site, the Java version of Quake runs about as half as fast as the C version of Quake.

 

How good is Java memory management? Can you avoid memory fragmentation like you can using C++ by avoiding excessive use of "new" and "delete" by initialising everything you need at the start of the program? I learnt Java but we didn't go into that level of detail.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...