As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [performance]

The quality, efficiency, and speed of running gameplay as a result of several factors in the design and structure of the game and its architecture.

Filter by
Sorted by
Tagged with
174 votes
10 answers
35k views

Why is it so bad to optimize too early?

After looking into optimization a bit, I have discovered (literally everywhere) that it seems to be a universally recognized sin to optimize a game too early. I really don't understand this, would it ...
mr-matt's user avatar
  • 2,739
93 votes
3 answers
15k views

How can I clean up excessive player-created rubble?

In my latest game I'm making, you can slice a 2D object arbitrarily, demonstrated in this gif: You can continuously cut it into hundreds or thousands of pieces. This doesn't create a lot of lag, ...
Ducktor's user avatar
  • 1,030
88 votes
8 answers
37k views

How many threads should I have, and for what?

Should I have separate threads for rendering and logic, or even more? I'm aware of the immense performance drop caused by data synchronization (let alone any mutex locks). I've been thinking of ...
j riv's user avatar
  • 1,013
66 votes
6 answers
19k views

How do bullets work in video games?

I came across this question when I was designing a video game in C#. If we consider games such as Battlefield or Call of Duty, hundreds or even thousands of bullets are flying at the same time. ...
Eric's user avatar
  • 783
46 votes
5 answers
36k views

Should I use textures not sized to a power of 2?

In the early days of OpenGL and DirectX, texture sizes were required to be powers of two. This meant interpolation of float values could be done very quickly, using shifting and such. Since OpenGL 2....
Will's user avatar
  • 6,937
44 votes
6 answers
8k views

When is the best time to consider performance?

I am coming from software development background. During the software development cycle, we usually focus on functionalities and the working product. At the end of development, we start optimizing ...
Emad's user avatar
  • 1,126
42 votes
7 answers
13k views

What are the performance difference between unsigned and signed integers? [closed]

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 ...
Luis's user avatar
  • 521
35 votes
7 answers
19k views

How can I improve rendering speeds of a Voxel/Minecraft type game?

I'm writing my own clone of Minecraft (also written in Java). It works great right now. With a viewing distance of 40 meters I can easily hit 60 FPS on my MacBook Pro 8,1. (Intel i5 + Intel HD ...
Martijn Courteaux's user avatar
34 votes
12 answers
9k views

How can I make A* finish faster when the destination is impassable?

I am making a simple tile-based 2D game, which uses the A* ("A star") pathfinding algorithm. I've got all working right, but I have a performance problem with the search. Simply put, when I click an ...
user2499946's user avatar
27 votes
3 answers
8k views

How to handle a large number of pickups in a MMO game

How do games like Minecraft, or really any MMO game that has pickups, handle them? Say terrain spawns 3 pickup drops of "dirt" everytime you dig said terrain. Say every item has a rotation ...
Alakanu's user avatar
  • 705
27 votes
2 answers
19k views

How can I reduce the performance impact of rendering trees?

I'm making a low poly stylized kind of game. I have a terrain with some water, and I want lots and lots of trees; I have 10,000 trees mass placed, at the moment. Each tree consists of no more than 200 ...
mr-matt's user avatar
  • 2,739
26 votes
7 answers
9k views

Is the Microsoft recommendation to use C# properties applicable to game development?

I get that sometimes you need properties, like: public int[] Transitions { get; set; } or: ...
piojo's user avatar
  • 602
24 votes
6 answers
7k views

How to optimize the distance function?

While developing a reasonably simple RTS-like game, I noticed my distance calculations were causing an impact in performance. At all times, there are distance checks to know if a unit is in range to ...
Grimshaw's user avatar
  • 3,101
24 votes
3 answers
9k views

Is it normal for a game to use 100% CPU?

I just implemented multi-threaded input handling in my game engine where the code that polls the OS to gather input from it and time stamps them is in a separate thread and each frame in the main ...
The Light Spark's user avatar
23 votes
4 answers
8k views

Intentionally using "worse machines" to develop a game?

I am developing a game intended for desktop computers. I am afraid of developing a game that will be too costly in aspects of performance, so I am wary of using a machine that might be better than the ...
tmighty's user avatar
  • 869
23 votes
1 answer
5k views

Optimization of rendering of cube world

I have a world made of many cubes (like in Minecraft), they have only color (not texture). I am rendering them using OpenGL 3.3 core profile (GLFW3, GLAD, GLM). I am already have done some ...
galaxy001's user avatar
  • 369
23 votes
2 answers
22k views

How do OpenGL's texelFetch and texture differ?

I understand the main differences between texelFetch and texture, but have some questions about the details: Does ...
Martin Perry's user avatar
  • 1,106
21 votes
5 answers
4k views

Improving an O(N^2) function (all entities iterating over all other entities)

A little bit of background, I'm coding an evolution game with a friend in C++, using ENTT for the entity system. Creatures walk around in a 2D map, eat greens or other creatures, reproduce and their ...
Alexandre Rodrigues's user avatar
21 votes
3 answers
11k views

Why does OpenGL >= 3 only allow VBOs?

I see that OpenGL versions 3 and up eliminate the use of client-side rendering. Immediate mode has been eliminated, and vertex arrays seem to be deprecated. Instead, if I understand correctly, VBOs ...
Gravity's user avatar
  • 319
20 votes
4 answers
27k views

Which opcodes are faster at the CPU level? [closed]

In every programming language there are sets of opcodes that are recommended over others. I've tried to list them here, in order of speed. Bitwise Integer Addition / Subtraction Integer ...
Robin Rodricks's user avatar
20 votes
4 answers
7k views

Is there any harm in having the main game loop run uncontrolled?

I was wondering if there is any possible harm when my game loop runs as fast as the system allows? I currently have a loop, that, by measuring passed time in nanoseconds, runs the game logic and ...
dot_Sp0T's user avatar
  • 1,992
19 votes
1 answer
16k views

What is the benefit of triple buffering?

I read everything written in a previous question. From what I understand in double buffering the program must wait until the finished drawing is copied or swapped before starting the next drawing. In ...
user782220's user avatar
18 votes
5 answers
23k 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++ ...
Martin Wickman's user avatar
18 votes
4 answers
4k views

How can I efficiently load huge volumes of star systems?

I am working on a space exploration and combat game, and I can create galaxies, nebulas, solar systems, and load and unload them procedurally as needed. Meaning the stars that the player can see are ...
Battle's user avatar
  • 1,241
18 votes
4 answers
4k views

Cache misses and usability in Entity Systems

Lately I have been researching and implementing an Entity System for my framework. I think I read most articles, reddits and questions about it that I could find, and so far I think I am grasping the ...
Grimshaw's user avatar
  • 3,101
17 votes
5 answers
19k views

Preferred way to render text in OpenGL [closed]

I'm about to pick up computer graphics once again for an university project. For a previous project I used a library called FTGL that didn't leave me quite satisfied as it felt kind of heavy (I tried ...
dukeofgaming's user avatar
17 votes
3 answers
10k views

Small, High-Speed Object Collisions: Avoiding Tunneling

EDIT/UPDATE: My biggest question right now is whether step 3's "t=..." equation is a good idea or there a better way to do it. Most other issues have been partially or fully addressed, but no ...
16 votes
3 answers
3k views

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

(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 things.)...
user avatar
15 votes
5 answers
2k views

Why is chunk size often a power of two?

There are many Minecraft clones out there and I am working on my own implementation. A principle of terrain rendering is tiling the whole world in fixed size chunks to reduce the effort of localized ...
danijar's user avatar
  • 5,651
15 votes
2 answers
7k views

How should I account for the GC when building games with Unity?

*As far as I know, Unity3D for iOS is based on the Mono runtime and Mono has only generational mark & sweep GC. This GC system can't avoid GC time which stops game system. Instance pooling can ...
Eonil's user avatar
  • 949
15 votes
4 answers
8k views

Logging library for (c++) games [closed]

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 ...
Klaim's user avatar
  • 2,604
15 votes
1 answer
10k views

What is the optimal texture size?

I recently added a texture packager to my project that will pack a certain amount of textures into a single one, like this: So for example this one is 582x1023 pixels in size. The goal of adding ...
flotothemoon's user avatar
15 votes
2 answers
3k views

Is precomputed pathfinding still relevant?

Context Old Lucas Arts (ScummVM era) point and click graphic adventure games used precomputed pathfinding. Here's a rough outline of the technique. Step 1 The floor in each room was divided into ...
David Gouveia's user avatar
14 votes
5 answers
7k views

Python Performance vs Game Maker [closed]

I was originally thinking of creating a game with Python and SFML. I understand Python is slow compared to C++, but how is it compared to Game Maker? The main reason I ask is I recently played a Game ...
user avatar
14 votes
2 answers
4k views

"Optimal" game loop for 2D side-scroller

Is it possible to describe an "optimal" (in terms of performance) layout for a 2D side-scroller's game loop? In this context the "game loop" takes user input, updates the states of game objects and ...
MrDatabase's user avatar
  • 1,951
14 votes
1 answer
1k views

Is * calling *= (or *= calling *) slower than writing seperate functions (for math library)? [closed]

I have some vector classes where the arithmetic functions looks like this: ...
user112513312's user avatar
14 votes
4 answers
6k views

How to continuously find all entities within a radius efficiently?

I have a very large number of entities (units). On each step, each unit needs to know the positions of all units near it (distance is less then given constant R). All units move continuously. This is ...
OCyril's user avatar
  • 304
14 votes
2 answers
3k views

Speeding up procedural texture generation

Recently I've begun working on a game that takes place in a procedurally generated solar system. After a bit of a learning curve (having neither worked with Scala, OpenGL 2 ES or Libgdx before), I ...
FalconNL's user avatar
  • 241
14 votes
1 answer
1k views

Is there any performance benefit to sharing shaders between programs?

OpenGL allows you to share the same shader between multiple programs. Aside from saving small amounts of memory and a shader handle, are there any GPU-side performance benefits to doing this?
user avatar
13 votes
2 answers
8k views

Why does Unity use reflection to get the update method?

Why does Unity use reflection in order to access MonoBehaviour message methods like Awake, ...
Emad's user avatar
  • 1,126
13 votes
3 answers
12k views

How do C# and UnityScript differ in Unity development? [closed]

Other than the obvious language differences, how do UnityScript and C# differ when developing games in Unity3D? Is there a noticable performance difference? Is the UnityScript code packaged as-is? If ...
Kostas's user avatar
  • 453
13 votes
4 answers
6k views

Which Database (RDBMS vs NoSQL vs BOTH) to use for a Realtime Multiplayer Game?

I'm working on a realtime multiplayer game that will require a database (for features such as player profiles, friends, unlocks, news, etc.) This is a standard PC game (not browser-based) and will use ...
Andrew's user avatar
  • 131
13 votes
3 answers
49k views

Most efficient way to convert Vector3 to Vector2

What is the most efficient and fastest way to convert a Vector3 to a Vector2? Casting: Vector2 vector2 = (Vector2)vector3; Initializing a new Vector2: ...
starikcetin's user avatar
  • 5,140
13 votes
1 answer
2k views

Information about rendering, batches, the graphical card, performance etc. + XNA?

I know the title is a bit vague but it's hard to describe what I'm really looking for, but here goes. When it comes to CPU rendering, performance is mostly easy to estimate and straightforward, but ...
Aidiakapi's user avatar
  • 255
13 votes
3 answers
7k views

3D models budget. What matters more number of triangles or vertices

When I am making a model for a 3D game what should I take as a measure in my budget Polygons (triangles) or vertices? I have made an experiment with two sets 40000 cubes one with 8 vertices and 12 ...
Michał Leszczyński's user avatar
13 votes
4 answers
6k views

Is SVG a viable technology choice for web-based game? [closed]

I have started to read up about the web technology available for doing web-based game with only Javascript, but I have no where got feedback about SVG with HTML5. Is is a viable choice ? Does it ...
HoLyVieR's user avatar
  • 233
13 votes
5 answers
4k views

How can I optimize a collision engine where order is significant and collision is conditional based on object group?

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 ...
Vittorio Romeo's user avatar
13 votes
1 answer
2k views

Is nVidia's CUDA suited to performing pathfinding calculations?

I want to know if it would be worth executing pathfinding on the GPU (using nVidia's CUDA, or an equivalent) in certain situations, or whether it would be a wasted effort. The situation I imagine ...
Keeblebrox's user avatar
12 votes
3 answers
6k views

How to handle multiplayer in JavaScript?

I'm just doing a bit of research into tech to use for a mobile multi-player game. It's more an experiment at present so for the moment, the only thing that Players need to be aware of is the other ...
OVERTONE's user avatar
  • 237
12 votes
3 answers
3k views

Grouping entities of the same component set into linear memory

We start from the basic systems-components-entities approach. Let's create assemblages (term derived from this article) merely out of information about types of components. It is done dynamically at ...
Pythagoras of Samos's user avatar

1
2 3 4 5
15