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

learn more… | top users | synonyms

108
votes
22answers
21k views

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 ...
79
votes
9answers
31k views

What are some programming design patterns that are useful in game development? [closed]

I have a few books on Design Patterns, and have read some articles, but cannot intuitively figure out which programming design patterns would be useful in game development. For example, I have a book ...
55
votes
17answers
27k views

C++ low-level optimization tips

Assuming you already have the best-choice algorithm, what low-level solutions can you offer for squeezing the last few drops of sweet sweet frame rate out of C++ code? It goes without saying that ...
53
votes
9answers
7k views

How can you put all images from a game to 1 file?

I've just finished a basic RPG game written in C++ SFML, I've put a lot of effort into the game and I'd want to distribute it, however I've ran into a small issue. Problem is, I have well over 200 ...
46
votes
9answers
47k views

Good GUI for OpenGL [closed]

I am starting to learn OpenGL with FreeGLUT using the Superbible and the knowledge i have from my elementary graphics to brush up on my skills. To get more from this experience i want to integrate a ...
45
votes
5answers
2k views

Is there a pedagogical game engine? [closed]

I'm looking for a book, website, or other resource that gives modern 3D game engines the same treatment as Operating Systems: Design and Implementation gave operating systems. I have read Jason ...
42
votes
8answers
31k views

Is Java viable for serious game development? [closed]

Ever since I was a little kid, my dream has been to develop games. Well, now that I am older, more mature, and have some programming experience, I would like to start. However, I would like to turn ...
42
votes
10answers
10k views

Game State 'Stack'?

I was thinking about how to implement game states into my game. The main things I want for it are: Semi-transparent top states-being able to see through a pause menu to the game behind Something ...
41
votes
9answers
41k views

Easy to use cross-platform 3D engines for C++ game development? [closed]

I want to try my hand at writing a 3D game. However I don't want to start at such a low level of drawing individual triangles and writing my own 3D object loader and so on. I've heard of things like ...
40
votes
7answers
6k views

How does Lua work as a scripting language in games?

I'm a little hazy on what exactly Lua is and how a game that is programmed in C++ would use it. I'm asking primarily about how it is compiled and run. For instance when you use a program written in ...
40
votes
9answers
27k views

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

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 ...
38
votes
9answers
11k views

C++: Smart pointers, Raw pointers, No Pointers?

Within the scope of developing games in C++, what are your preferred patterns in regard to use of pointers (be it none, raw, scoped, shared, or otherwise in between smart and dumb)? You might ...
37
votes
6answers
6k views

What's a way to implement a flexible buff/debuff system?

Overview: Lots of games which RPG-like statistics allow for character "buffs", ranging from simple "Deal 25% extra damage" to more complicated things like "Deal 15 damage back to attackers when hit." ...
36
votes
1answer
1k views

How do I create particles that react to the player and enemies?

I'm currently making a game with my own game engine which I've written in C++ and I'm using the most recent directx SDK. The game is a top down space shooter (with a pretty interesting twist) and ...
35
votes
2answers
8k views

How to create adjustable formula for RPG level up requirements?

I'm trying to create a formula that can be modified simply by changing two values: number_of_levels, and last_level_experience. This is to enable people modding the game to change the levelling ...
35
votes
7answers
6k views

What are the performance difference between unsigned and signed integers?

I am aware of the performance hit when mixing signed ints with floats. Is it any worse to mix unsigned ints with floats? Is there any hit when mixing signed/unsigned without floats? Do the ...
35
votes
9answers
4k views

How are deterministic games possible in the face of floating-point non-determinism?

To make a game like an RTS networked, I've seen a number of answers here suggest to make the game completely deterministic; then you only have to transfer the users' actions to each other, and lag ...
34
votes
6answers
3k views

Is it unprofessional to leave game resources to the open eye?

I'm still having problems packing my resources, after going through complicated APIs and basically just zip files which are exhausting my brain, I thought I could also pack the game with the resources ...
33
votes
5answers
5k views

Any tips for creating cross-platform games? [closed]

Do you have any tips/recommendations when creating a cross-platform game in C/C++?
31
votes
2answers
10k views

Entity/Component Systems in C++, How do I discover types and construct components?

I'm working on an entity component system in C++ that I hope to follow the style of Artemis (http://piemaster.net/2011/07/entity-component-artemis/) in that components are mostly data bags and it's ...
28
votes
3answers
3k views

Several classes need to access the same data, where should the data be declared?

I have a basic 2D tower defense game in C++. Each map is a separate class which inherits from GameState. The map delegates the logic and drawing code to each object in the game and sets data such as ...
24
votes
4answers
3k views

Finding the nearest object

I have a sizable game engine and I'd like a feature for finding the nearest of a list of points. I could simply use the Pythagorean theorem to find the distances. I know I can't simply add x and y, ...
24
votes
3answers
15k views

Android game development in c++

So being a primarily c/c++ developer, I've always thought that the only option for mobile game development for me was using iOS, which allows for c/c++ (and minimising objective C). I heard from a ...
24
votes
4answers
2k views

game story event programming

I have developed a game engine in c/c++ and DirectX. I have a tile engine for the maps, animated player/npc sprites, talking to the npc, menus, and level changing but there is no game, it just feels ...
23
votes
9answers
10k views

What C++ GUI library can you suggest? [closed]

I'm building my own game engine in C++ and I'm currently deciding on what user interface I should use. Should I use a library? Should I make my own?
22
votes
2answers
4k views

Is it safe to use Sleep() in game loop (on Windows)?

Is it safe to use Sleep() function on Windows in game loop (C++)? I want to have fixed frame rate.
22
votes
6answers
4k views

How to solve the big video memory requirements in 2d game

We are developing 2d game (Factorio) in allegro C/C++ and we are facing the problem with increasing video memory requirements as the game content increases. What we currently do is, that we gather ...
21
votes
5answers
2k views

Try-catch or ifs for error handling in C++

Are exceptions used widely in game engine design or it is more preferable using pure if statements? For example with exceptions: try { m_fpsTextId = m_statistics->createText( "FPS: 0", 16, 20, ...
21
votes
3answers
2k views

Should I use text files for my save data?

My question is whether or not I should use text files to save my game data. I have some basic concerns over doing this: There's really no way to protect the data, and thus, the user could screw up ...
21
votes
3answers
1k views

Making walls in tile-based games: what am I missing?

After spending time today to jot down some notes regarding the implementation of walls into my tile-based game, I've suddenly realized it's not going to be as simple as I imagined before. While the ...
21
votes
1answer
623 views

My game seems to be incompatible with recording software. What could be causing this?

I've just finished a little Game-Dev project for university and I need to record a video to accompany my submission (just in case they can't get my source to work). Basically my game doesn't work at ...
20
votes
9answers
12k views

I prefer C/C++ over Unity and other tools: is it such a big downer for a game developer? [closed]

We have a big game project using Unity at school. There are 12 of us working on it. My teacher seems to be convinced it's an important tool to teach students, since it makes students look from the ...
20
votes
7answers
5k views

Is C++ being replaced by C# in industry games?

In industry games I mean like Quake, CoD etc.
20
votes
6answers
13k views

How do I create a save file for a C++ game?

I am coding my final for a Video game Programming course, and I want to know how to create a save file for my game, so that a user can play, and then come back later. Any idea how this is done, every ...
19
votes
7answers
2k views

How to avoid game objects accidentally deleting themselves in C++

Let's say my game has a monster that can kamikaze explode on the player. Let's pick a name for this monster at random: a Creeper. So, the Creeper class has a method that looks something like this: ...
19
votes
5answers
2k views

Learning to optimize with Assembly

I am a second year student of Computer Games Technology. I recently finished my first prototype of my "kind" of own pathfinder (that doesn't use A* instead a geometrical approach/pattern recognition, ...
19
votes
7answers
6k views

How can one implement hot-swappable C++ modules?

Fast iteration times are key to developing games, much more so than fancy graphics and engines with truckloads of features in my opinion. No wonder many small developers choose scripting languages. ...
19
votes
4answers
4k views

Should collision detection be done server-side or cooperatively between client/server?

I am working on an online game that will have very heavy collision detection processing. Player models will collide with other players, mobs, structures, terrain, and solid objects that only exist ...
19
votes
3answers
1k views

Do I need to learn C++ to use Open GL?

Do I need to learn C++ to use Open GL?
19
votes
7answers
13k views

What languages are used to develop MMORPGs like EVE Online and WOW?

As I understand it, MMORPGs are games that run on your computer like any other normal 3d video game but, with each action that happens with in the game, changes are made to the universe via HTTP calls ...
19
votes
6answers
546 views

Finding direction of travel in a world with wrapped edges

I need to find the shortest distance direction from one point in my 2D world to another point where the edges are wrapped (like asteroids etc). I know how to find the shortest distance but am ...
19
votes
1answer
5k views

File format for static and animated 3D models

I'm currently writing a 3D game in C++ with OpenGL and I'm coming to the part where to load 3D models in. Therefore I'm looking for popular file formats and techniques to display static meshs and ...
18
votes
10answers
5k views

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 ...
18
votes
3answers
5k views

How much assembly is really used in modern game code?

On average, how often is assembly used in modern game code? Specifically on platforms that already have good C++ compilers, like x86, PPC, or ARM--because I assume games on embedded systems make ...
18
votes
3answers
3k views

How does one do unit testing in a game engine?

Much to my shame, I have never written a proper unit test, only small unorganized test programs that I would then dispose of after the test succeeded. I don't really have a clear idea of how unit ...
18
votes
4answers
2k views

Game architecture / design question - building an efficient engine while avoiding global instances (C++ game)

I had a question about game architecture: What is the best way to have different components communicate with each other? I do really apologize if this question has already been asked a million times, ...
17
votes
7answers
1k views

How important do you find exception safety to be in your C++ code?

Every time I consider making my code strongly exception safe, I justify not doing it because it would be so time consuming. Consider this relatively simple snippet: Level::Entity* entity = new ...
17
votes
8answers
6k 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 ...
17
votes
2answers
10k 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. ...
17
votes
6answers
2k views

Separating game data/logic from rendering

I'm writing a game using C++ and OpenGL 2.1. I was thinking how could I separate the data/logic from rendering. At the moment I use a base class 'Renderable' that gives a pure virtual method to ...