Questions tagged [c++]

C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.

What is C++?

C++ is a statically-typed, free-form, (usually) compiled, multi-paradigm, intermediate-level general-purpose programming language; not to be confused with C. Building on C, C++ improved type-safety and added support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.

Usage

When you ask a question, be sure to include any relevant source code as a minimal, complete, and verifiable example. If there are any compiler errors, be sure to indicate:

  • Which compiler you are using, including its version.
  • Exact error messages, including the lines on which they occur (mark those lines with comments)

Stack Exchange Resources

4309 questions
150
votes
22 answers

STL for games, yea or nay?

Every programming language has its standard library of containers, algorithms, and other helpful stuff. With languages like C#, Java, and Python, it's practically inconceivable to use the language without its standard lib. Yet, on many C++ games…
munificent
  • 12,045
  • 4
  • 34
  • 35
87
votes
9 answers

Why don't C++ Game Developers use the boost library?

So if you spend any time viewing / answering questions over on Stack Overflow under the C++ tag, you will quickly notice that just about everybody uses the boost library; some would even say that if you aren't using it, you're not writing "real' C++…
James
  • 2,119
  • 1
  • 16
  • 16
21
votes
10 answers

Competing with C++ for games programming

I'm curious as to why C++ is so popular for games development, and not other languages instead. I know you can create very fast code with it, but what exactly is it that makes it popular? Is it just because it's fast? Is it some other feature in the…
KasMA1990
  • 311
  • 2
  • 5
18
votes
6 answers

Where do I begin if I want to write a C++ 2d game?

I am a C# web developer and I want to expand my skillset and have some fun while doing it. I know some of the basics of C++ and I would love to write a simple 2d game/game engine for myself using C++. What other libraries or SDKs do I need and where…
quakkels
  • 293
  • 1
  • 2
  • 5
10
votes
1 answer

Do any of the current gen console or handheld compilers support C++11?

I am not asking for full support but do any of the current gen support C++11? I know VS C++ supports lambda and the auto keyword and I believe gcc supports both as well. Do any of the current gen consoles or handheld (3ds, sony vita) support it?
user1047
7
votes
4 answers

Pros and cons of using dlls

I wonder about create every game engine module (render, input, sound, etc...) into dlls (renderer.dll, input.dll, etc...). What are pros and cons in your opinion of divide game into set of dlls ? I see only need to write game module in separate dll,…
piotrek
  • 1,388
  • 1
  • 14
  • 23
7
votes
2 answers

How can I implement framerate-independant updates?

Edit: I fixed the problem by making jumpvelocity the one that is modified and added onto, and yvelocity just equal jumpvelocity * t. This is what I have right now: if (GUI->Space && grounded){ jumpvelocity = -185.f * 2 / gravity; grounded =…
user975989
  • 244
  • 2
  • 10
6
votes
4 answers

What data should I use to track the player position on a world at the same size of the earth in a multiplayer game?

I guess this kind of game or simulator already exist somewhere, but I'm not sure... Let's imagine I'm making a game where the proportions of the planet earth and the humans beings on it are the same as in the reality. I can't only use…
jokoon
  • 5,243
  • 8
  • 38
  • 59
5
votes
4 answers

C++ friend class, rendererer and mesh

I often hesitate to use friend classes in C++. Since it often does not feel right, or just seems to be an indicator of bad design. Though, in this case I think a friend class might improve the design. Let me explain: Let us say I have a very simple…
5
votes
3 answers

Why do games dynamically link to the CRT?

Almost all big titles that I have played require you to install the MSVC runtime. There have been numerous questions about "statically vs. dynamically linked CRT" on StackOverflow, the reasons for dynamic CRT generally boil down to: Reduced memory…
kizzx2
  • 171
  • 4
5
votes
2 answers

Variables in static library are never initialized. Why?

I have a bunch of variables that should be initialized then my game launches, but must of them are never initialized. Here is an example of the code: MyClass.h class MyClass : public BaseObject { DECLARE_CLASS_RTTI(MyClass, BaseObject); …
Coyote
  • 3,220
  • 1
  • 18
  • 35
4
votes
1 answer

Game Programming Gems series still of value?

Former Nintendo dev Mark DeLoura wrote a series of books called "Game Programming Gems". (http://www.satori.org/game-programming-gems/) Do these books still contain valuable concepts, considering where games are today, the engines that are…
Jasmine
  • 188
  • 6
4
votes
4 answers

C++ game-programming; What would be the "next step"?

I'm reading C++ Primer Plus 5th Edition. I'm over at Chapter 8 exercises, which is more than half of the book to go but I was wondering what would be the "next step" after I'm through with the book? I want to use SDL/OpenGL and whatever…
user5560
4
votes
1 answer

What are the performance and size tradeoffs of Eigen::Transform versus Eigen::Matrix4f?

We finished migrating from DirectXMath to the Eigen math libraries for our 3D-Game Engine last week for portability reasons. After implementing transformations with matrices as we know them, we found out about Eigen::Transform, which seemed like a…
iFreilicht
  • 232
  • 1
  • 7
4
votes
2 answers

How to remove an object from a std::vector

So I have a vector of bullets that show up on the screen and I do not want these bullets to live forever. I want them to "die as soon as they go off screen or collide with an enemy. How can I make sure they are removed from the array and no longer…
joncodo
  • 293
  • 1
  • 5
  • 16
1
2 3
9 10