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

learn more… | top users | synonyms

16
votes
6answers
1k views

Should Vector3 inherit from Vector2?

I'm creating a couple of classes Vector2 (X & Y) and Vector3 (X, Y & Z), but I don't know whether to make Vector3 inherit from Vector2, or whether to re-implement the member variables m_x and ...
16
votes
8answers
5k views

Determining Poker Hands

I have been making a Texas Hold'Em game as a part of an assessment, and I have been mulling over how to examine the 7 available cards and determine if hands exist. The only possible method I can ...
16
votes
5answers
6k views

When should vector/list be used?

I can understand when to use lists, but I don't understand when it is better to use vectors than using lists in video games: when it is better to have fast random access ? (And I understand why it's ...
16
votes
12answers
2k views

3D theory before graphics APIs? [closed]

I'm a software engineer and I'm hoping to move my career towards game development. I'm reading a book right now on 2D using C++/DirectX. When I get into 3D I know I want to do it correctly. For ...
16
votes
5answers
3k views

Can I develop games for mobile platforms in C++?

I have a good grasp in C++ and C and have also experience developing AAA game using C++. Now, I'm shamelessly thinking to dive into mobile game development either in iOS or Android. Unfortunately, I ...
16
votes
4answers
4k views

How can I make message passing between threads in a multithreaded engine less cumbersome?

The C++ engine I'm working on currently is split up into several large threads- Generation (for creating my procedural content), Gameplay (for AI, scripts, simulation), Physics, and Rendering. The ...
15
votes
5answers
17k views

Objective-C or C++ for iOS games?

I'm pretty confident programming in Objective-C and C++, but I find Objective-C to be somewhat easier to use and more flexible and dynamic in nature. What would be the pros and cons when using C++ ...
15
votes
2answers
9k views

I can't figure out how to animate my loaded model with Assimp

I have loaded in a model to my C++ OpenGL game. It is a COLLADA file type that I have loaded, and I setup an animation under blender for the file. The problem is I don't know how to animate the model. ...
15
votes
3answers
3k views

Does allocating and freeing a huge chunk of memory at startup “clean up memory”?

The book Game Coding Complete, Fourth Edition, chapter 5 (Game Initialization and Shutdown), section Checking Memory contains this interesting code sample: bool CheckMemory(const DWORDLONG ...
15
votes
6answers
14k views

Best C++ Math Library for Game Engine? [closed]

I'm looking for a fast opensource C++ math-library for my game engine with the following features: fast (sse?) vectors matrices quaternions suitable for both opengl and directx
15
votes
7answers
3k views

What scripting language would you recommend for a C++ game project? [closed]

By scripting here I mean not just putting config data in a script, but scripting parts of the project like some class methods, test specific game loop, etc. This would be not just to accelerate ...
15
votes
3answers
6k views

How do you add a scripting language to a game?

Let's say I have a game written in C++. But I want to add some modding or scripting functionality to it. How would one go about adding a scripting functionality to your game?
15
votes
3answers
4k views

Finite state machine in C++

So, I've read a lot about using FSMs to do game state management, things like what an FSM is, and using a stack or set of states for building one. I've gone through all that. But I'm stuck at writing ...
15
votes
2answers
2k views

Advice on game architecture/design patterns

I've been working on a 2d RPG for awhile now, and I've come to realize I've made some bad design decisions. Theres a few things in particular that are causing me problems, so I was wondering what sort ...
15
votes
4answers
3k views

How can I write a Save/Load system for my game?

I'm trying to figure out a way to write a save/load system for my game in C++. As of right now, I'm doing it all using binary flags. Anyone got a clue on how to do it another way? I don't mind using ...
15
votes
2answers
5k views

Designing a component based game

I'm writing a shooter (like 1942, classic 2D graphics) and I'd like to use a component based approch. So far I thought about the following design: Each game element (airship, projectile, powerup, ...
14
votes
7answers
2k views

Is C++ necessary to learn if I ever want to get a job in the game industry?

Is C++ necessary to learn if I ever want to get a job in the game industry? I am extremely familiar with C# and have a basic mastery of making 2D games in XNA 4.0. Right now I am only 13 years old and ...
14
votes
2answers
868 views

What advantages does bare OpenGL provide over frameworks/engines to small developers? [closed]

I've noticed a trend of indie developers steering away from frameworks and engines, and moving towards using bare OpenGL, or using it combined with SDL/SFML2. As an indie developer, I can't see what ...
14
votes
3answers
4k views

Is C++ “still” preferred in game development?

I am a 2D Game Programmer.Some programming languages which I am good at are C,Java ,C#. I also know Actionscript 2.0,3.0 and some javascript. I'm interested in learning 3D Game programming. So far ...
14
votes
2answers
1k views

Best way to gain C++ working experience for a job in games (coming from C#) [closed]

I am a software developer, experienced with C# (5 years experience) alongside a few other languages. My "dream job" is working in video games as a developer. Most jobs require knowledge of C++, ...
14
votes
4answers
3k views

how does HDR work?

I'm trying to understand what HDR is and how it works. I understand the basic concepts and have an slight idea of how it is implemented with D3D/hlsl. However it's still pretty foggy. Say I'm ...
14
votes
2answers
2k views

Using C++11 for cross-platform Game Engine Development

Note: This is not a 'give your opinion' question about C++03 and C++11. Our game engine, written in C++03, is designed to be compiled on Windows, OSX and iOS. Linux support is planned for the (very) ...
14
votes
1answer
7k views

Quad tree vs Grid based collision detection

I'm making a 4 player co-op r-type game, and I'm about to implement the collision detection code. I've read a lot of articles and stuff about how to handle collision detection, but I'm having a hard ...
14
votes
2answers
507 views

How do you prepare for out of memory conditions?

This can be easy for games with well defined scope, but the question is about sandbox games, where the player is allowed to create and build anything. Possible techniques: Use memory pools with ...
14
votes
3answers
1k views

Is there any documentation comparing/contrasting C++ standard library implementations?

(This is not game programming per se, but I'm certain if I asked this on SO I'd get told not to prematurely optimize, even though history tells us every large game ends up worrying about these ...
14
votes
2answers
3k views

Animation Blending Basics

Say I have a framework with characters that can run and walk and of course, stand still. Am I right in thinking that animation blending is the process of smoothly transitioning between these by ...
13
votes
6answers
7k views

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

Clarification: I'm not asking for the best place to start. I'm just asking for a place to start. I am a C# web developer and I want to expand my skillset and have some fun while doing it. I know some ...
13
votes
1answer
941 views

Normals vs Normal maps

I am using Assimp asset importer (http://assimp.sourceforge.net/lib_html/index.html) to parse 3d models. So far, I've simply pulled out the normal vectors which are defined for each vertex in my ...
13
votes
3answers
856 views

Game loop, how to check for conditions once, do something, then not do it again

For example, I have a Game class and it keeps an int that tracks the player's lives. I have a conditional if ( mLives < 1 ) { // Do some work. } However this condition keeps firing and the ...
13
votes
8answers
2k views

Which unit test framework for c++ based games? [closed]

Which combination of testing tools do you feel is best? Given the framework / library of your choice you might consider: suitability for TDD ease of use / productivity dealing with mock objects ...
13
votes
4answers
1k views

Optimizing collision engine bottleneck

If this is your first time on this question, I suggest reading the pre-update part below first, then this part. Here's a synthesis of the problem, though: Basically, I have a collision detection ...
13
votes
3answers
4k views

Logging library for (c++) games

I know a lot of logging libraries but didn't test a lot of them. (GoogleLog, Pantheios, the coming boost::log library...) In games, especially in remote multiplayer and multithreaded games, logging ...
13
votes
1answer
2k views

Procedural star field generator

Is anyone aware of any code to procedurally generate star fields? Ideally I'd like it to be physics-based so I can have realistic planets and moons. Best would be in C++, open source, and workable ...
13
votes
3answers
3k views

Tips for implementing MMO quest mechanics?

What tools, patterns, or best practices would you recommend to implement the quest mechanics given below listed requirements? I am talking about software architecture (how generic should you be) and ...
13
votes
1answer
2k views

Which is the best LOD method for planet rendering?

I'm currently working on my thesis, it is an engine to render terrains of planetary size. I'm still finishing my research and I have encountered a lot of stuff about this subject, the problem is that ...
12
votes
4answers
1k views

Hide game data from player?

I'm working on my first (C++) game, and I want to use a component based design. I've read a lot about this lately and yesterday I decided I wanted to store object data in external JSON files, to allow ...
12
votes
7answers
2k views

Why does the resolution of floating point numbers decrease further from an origin?

My OpenGL scene has objects that are positioned at ridiculously far distances away from the origin. When I view these objects, and pan/rotate/zoom a camera around them, they 'jitter'. That is, the ...
12
votes
2answers
1k views

What are the common rendering optimization techniques for the geometry pass in a deferred shading renderer? [closed]

I have been developing a game engine using OpenGL 3 and C++ (and glfw for window management). I have advanced so far, got most of the things done except sound entities and optimizations. The engine ...
12
votes
5answers
8k views

Complete Math Library for use in OpenGL ES 2.0 Game? [closed]

Are you aware of a complete (or almost complete) cross platform math library for use in OpenGL ES 2.0 games? The library should contain: Matrix2x2, Matrix 3x3, Matrix4x4 classes Quaternions ...
12
votes
6answers
2k views

Am I hurting myself by not knowing C++ for game design?

Right now, I feel I am strong in both Java a C#. (Not much of a leap from one to the other really). While I don't expect a game designer/programmer is an attainable goal early on in my career, This ...
12
votes
6answers
3k views

Should an object in a 2D game render itself?

I'm making a 2D street fighter-like game that is not tile based. Usually people recommend that entities be given to a renderer that render them, not them render themselves, but it seems the inverse is ...
12
votes
2answers
2k views

Why is C/C++ preferred for game developers?

Some people say it offers more control to developers, but what is it precisely that can be controlled through C++ which can't be controlled using, for example, Java?
12
votes
2answers
2k views

Random numbers on C++

Recently I got used to modern languages which include a stock good random generator, which usually is the Mersenne Twister; now that I got back to C++ I have to decide what to use. I searched for ...
12
votes
3answers
7k views

Starting out with OpenGL when most tutorials are out of date

I'm sure there are already a bunch of questions like this asked, but the constant updating of the OpenGL library throws them all away, and in a month or two, the answers here will be worthless again. ...
12
votes
5answers
3k views

What is the recommended library for using Lua from C++? [closed]

I am currently planning how to integrate Lua scripting in my 2D Game Engine, and i would like to go straight to the most adequate solution for having C++ classes and objects exposed. I've read this ...
12
votes
5answers
1k views

How should game objects be aware of each other?

I find it hard to find a way to organize game objects so that they are polymorphic but at the same time not polymorphic. Here's an example: assuming that we want all our objects to update() and ...
12
votes
1answer
5k views

How can I tell how much video card memory I'm using?

I want to programmatically determine at runtime how much video card memory is being used by my program. Specifically I'm wondering about how to do it on a Windows machine using OpenGL, but am ...
12
votes
5answers
3k views

How can I handle sprite sheets with nonuniform sprite dimensions?

For a spritesheet with non-uniform sprite dimensions, how can I get the bounding-rectangles for each individual sprite (i.e. the blue boxes in the following image / I only drew a few examples)? What ...
12
votes
1answer
1k views

How do I simulate a doppler effect in a game?

I am trying to simulate the doppler effect in a game (a car racing game). I am not using a specific sound library that simulate the effect, I only have a callback function where I mix the data. I ...
12
votes
1answer
4k views

Designing a ResourceManager class

I've decided I want to write a central ResourceManager/ResourceCache class for my hobby game engine, but am having trouble designing a caching scheme. The idea is that the ResourceManager has a soft ...