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

learn more… | top users | synonyms

95
votes
22answers
17k 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 ...
74
votes
9answers
26k 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 ...
54
votes
17answers
21k 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 ...
52
votes
9answers
5k 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 ...
45
votes
9answers
38k 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 ...
41
votes
10answers
9k 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 ...
38
votes
8answers
23k views

Is Java viable for serious game development?

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 ...
38
votes
9answers
29k 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 ...
37
votes
9answers
9k 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
9answers
20k 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 ...
35
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
6answers
4k 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." ...
34
votes
7answers
5k 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 ...
33
votes
6answers
2k 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
4k views

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

Do you have any tips/recommendations when creating a cross-platform game in C/C++?
33
votes
7answers
4k 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 ...
33
votes
8answers
3k 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 ...
32
votes
2answers
6k 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 ...
30
votes
2answers
8k 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 ...
27
votes
3answers
2k 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
14k 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 ...
22
votes
2answers
3k 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
9answers
8k 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?
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
546 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
10k 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
4k views

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

In industry games I mean like Quake, CoD etc.
20
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, ...
20
votes
6answers
10k 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
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
10k 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
499 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
4k 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
4k 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
5answers
1k 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, ...
18
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 ...
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
7answers
4k 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. ...
17
votes
4answers
10k views

Is there anything like XNA for c++? [closed]

I love the features of XNA but I want to get into c++ game dev. The problem is that I now have to worry about everything from loading a png file to opening a window. This is a little bit annoying. I ...
17
votes
6answers
1k 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 ...
17
votes
3answers
2k 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 ...
17
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, ...
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
5answers
5k 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 ...