What are some libraries and techniques that game dev's should know?

Started by
7 comments, last by swiftcoder 11 years, 2 months ago

What are some C++/C libraries and some techniques that game developers should know when working with C++?

Like I can do some stuff if I put my mind to it, but it will never be optimized. How can I think in a fashion which I try to get the most power and speed out of C++.

Like I have heard to avoid using STL because of there restricting and "slow" when taking to a advance level.

I am not beginner, but I am also no professional software engineer. I am in school learning, but not many courses seem to talk about advance techniques in C++, like some stuff people don't first noticed until a lot of research.

Advertisement
  1. There is no single answer to this, it depends on what you need and your requirements. A library that someone would classify as inefficient could be the perfect solution for someone else.
  2. Learn to Google. When you know what you want to do, search for how others did it.
  3. There is really only one way to learn, and that is by mistakes. Only geniuses learn from others.
  4. Be careful about optimizations. Don't do it until you can show, from measurements, that it is needed. Optimizations have a tendency to ruin code. It gets harder to read, harder to maintain, takes longer time to create. It is not uncommon that the most simple implementation is the fastest. After doing number 3 for a while, you will slowly get the ability to write efficient code from the start.
[size=2]Current project: Ephenation.
[size=2]Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

  1. There is no single answer to this, it depends on what you need and your requirements. A library that someone would classify as inefficient could be the perfect solution for someone else.
  2. Learn to Google. When you know what you want to do, search for how others did it.
  3. There is really only one way to learn, and that is by mistakes. Only geniuses learn from others.
  4. Be careful about optimizations. Don't do it until you can show, from measurements, that it is needed. Optimizations have a tendency to ruin code. It gets harder to read, harder to maintain, takes longer time to create. It is not uncommon that the most simple implementation is the fastest. After doing number 3 for a while, you will slowly get the ability to write efficient code from the start.

Guess I figured this would be the case. I always do google when I need help, I guess I was just trying not to depend on it so much. Thanks for the input.

Like I have heard to avoid using STL because of there restricting and "slow" when taking to a advance level.

You may have heard wrong.

There are a specific set of conditions under which the C++ standard library ("STL" is an outdated and inaccurate term) is not optimal for use - this happens to include several scenarios that may occur in game development (i.e. consoles which lack support for exceptions).

In almost all other cases, the standard library (used correctly) is going to be faster and more robust than a home-grown solution.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

swiftcoder, on 05 Feb 2013 - 00:40, said:
In almost all other cases, the standard library (used correctly) is going to be faster and more robust than a home-grown solution.

There was even a case on this forum when the Doom3 (or Quake3, I forget which) source code was released and someone tested the iD developed containers against the MS VS 2005 (iirc) implementation and found the latter beat the former by a considerable margin in many cases.

That's not to say that the containers as provided by the C++ Std. Lib are the perfect solution to everything, but don't go thinking you can beat them on speed without having a very specific set of requirements which a general solution can't be optimised towards.

In otherword; use the C++ Standard Library until proven otherwise.

(It still amuses me that C++ remains one of the only languages where people go out of their way to avoid the standard, library instead of learning how to use it properly, based on 10 year old hearsay and rumours...)

(It still amuses me that C++ remains one of the only languages where people go out of their way to avoid the standard, library instead of learning how to use it properly, based on 10 year old hearsay and rumours...)

People are just too obsessed with optimization, and I think when they consider how the library is designed (templates in templates in templates), think they can trim the fat and reap the benefits. I think the biggest problem is a lot of people don't even consider the standard library part of C++. That it was something tacked on after the fact, and started off pretty poorly.

Then there's missteps like Microsoft's implementation doing silly things that degrades performance on simple operations unless you add messy definitions to disable them, even in release builds. It just puts a bad taste in everyones mouth and confuses the issue, perpetuating the idea that it's slow.

It took me quite a while before I trusted the standard library before I ultimately moved to C#. I still feel weird about std::string sometimes, and I don't even know why. It just feels so external to the core language for something so fundimental.

I think when they consider how the library is designed (templates in templates in templates), think they can trim the fat and reap the benefits.

That might be all very well if those same people actually understood why it is designed with templates-within-templates-within-templates.

It is decidedly non-trivial to write a robust and performant generalised container, especially without templates...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]


swiftcoder, on 05 Feb 2013 - 00:40, said:
In almost all other cases, the standard library (used correctly) is going to be faster and more robust than a home-grown solution.

There was even a case on this forum when the Doom3 (or Quake3, I forget which) source code was released and someone tested the iD developed containers against the MS VS 2005 (iirc) implementation and found the latter beat the former by a considerable margin in many cases.

That's not to say that the containers as provided by the C++ Std. Lib are the perfect solution to everything, but don't go thinking you can beat them on speed without having a very specific set of requirements which a general solution can't be optimised towards.

In otherword; use the C++ Standard Library until proven otherwise.

(It still amuses me that C++ remains one of the only languages where people go out of their way to avoid the standard, library instead of learning how to use it properly, based on 10 year old hearsay and rumours...)


that would probably be Doom3, on account of Quake3 being plain C, whereas Doom3 was after id moved over to C++.

IMHO though, the bigger issue with the C++ standard-library, isn't so much the performance of the output code, but rather the hurt it often manages to put on the compile times, which can matter some when a person is left having to regularly recompile their project.

granted, I guess it could be argued that maybe these libraries offer more benefit to the project than the costs to their compile times.


admittedly, I am not much of a serious C++ developer though (I write considerably more C, and C++ is the 3rd-place language in my project, and most of this is in a "C with classes and operator overloading" style), admittedly at this point, mostly because a lot of my code-processing tools don't really understand C++, and those that do, only understand a subset. (the 2nd place language in my case is currently my scripting language, but if tools and misc are included, then C# is the second-place language, and C++ moves to 4th place).

IMHO though, the bigger issue with the C++ standard-library, isn't so much the performance of the output code, but rather the hurt it often manages to put on the compile times

That was a problem in the early 2000's, but compiler performance (and general computer performance) have improved so much since then that this is rarely an issue.

And when it does become an issue, ccache and distcc to the rescue.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

This topic is closed to new replies.

Advertisement