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
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
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
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,749
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
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
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
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 ...
3 votes
3 answers
546 views

Ways to make my game world bigger without slowing users CPU

I've been developing my first game for a little while now, but I've found that I want to make the game world MUCH bigger. It's currently about 300*300 tiles, but has creatures and bad guys running ...
user avatar
1 vote
2 answers
435 views

Efficiently determining which buildings are connected by roads

I have a question about the most effective way to detect road connection in a tile based world. Some time ago I already asked for "How to improve performance for expensive functions in 2d city builder"...
Yheeky's user avatar
  • 305
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
14 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,136
10 votes
2 answers
19k views

Should I use an SQL database to store data in a desktop game? [closed]

Developing a Game Engine I am planning a computer game and its engine. There will be a 3 dimensional world with first person view and it will be single player for now. The programming language is C++ ...
danijar's user avatar
  • 5,661
6 votes
2 answers
7k views

How can I improve my collision detection's performance?

I'm new to programming and want to speed up the collision detection in my C++ 2D platformer game engine. Currently, only the player's collision detection works: Every frame, the player's update ...
barwin's user avatar
  • 63
3 votes
2 answers
21k views

Massive CPU Usage by WaitForTargetFPS in the Profiler

So I was checking the Standard Assets Example Projects of Unity, and they all have high FPS numbers in the Profiler. I started a little project myself, just a simple sprite with movement via ...
Gardener's user avatar
  • 321
2 votes
1 answer
553 views

When should I load assets for optimal performance?

I'm writing a game using LWJGL and Java, and was wondering if there were best practices for when to load resources. I have seen examples that load all resources when initializing the game (XNA), ones ...
Peteyslatts's user avatar
9 votes
2 answers
6k views

Voxel Face Crawling (Mesh simplification, possibly using greedy)

Edit: This is just for my own learning experience, it is NOT for performance reasons that I ask this question. This is in regards to a Minecraft-like terrain engine. I store blocks in chunks (...
Mythics's user avatar
  • 1,486
8 votes
2 answers
631 views

Efficiently updating building effect radius coverage

I've already searched for answers but I was not able to figure out the best approach for handling expensive functions/calculations. In my current game (a 2d tile-based city building) the user is able ...
Yheeky's user avatar
  • 305
6 votes
4 answers
6k views

Object pools for efficient resource management

How can I avoid using default new() to create each object? My previous demo had very unpleasant framerate hiccups during dynamic memory allocations (usually, when arrays are resized), and creating ...
GameDevEnthusiast's user avatar
3 votes
2 answers
2k views

Which is better practice in Unity? GetComponent<>() or making the variable public?

There are two main ways I am aware of to modify an attached component. Say, the component attached to an object is of type Animator and the name is ...
padawan's user avatar
  • 233
2 votes
1 answer
7k views

Efficient modification of Texture2D at runtime for a 2D painting game in Unity3D

I have spent some time looking for different solutions to be implemented in a mobile painting game I'm creating. At this time, everything is working but I have some serious performance problems on ...
Notbad's user avatar
  • 1,075
0 votes
1 answer
4k views

Unity Performance: How many Materials per Object?

I have learned that a Mesh with 4 Materials each 1024x1024 in Size is somewhat slower than a Mesh with 1 Material 2048x2048 in Size? In my usual workflow I tend to seperate different Materials into ...
AzulShiva's user avatar
  • 659
0 votes
3 answers
2k views

How to optimize collisions

I'm building a 2D MORPG using JavaScript, Node JS and socket.io To prevent cheating, I have to run all collisions for all players on my server. I'm currently doing fairly simple square collisions ...
Pascal Claes's user avatar
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
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
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
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
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
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,661
14 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
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
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
12 votes
3 answers
4k 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
11 votes
3 answers
9k views

Rendering performance for Flash games

I was reading on SO about native flash rendering vs building a custom BitmapData frame buffer and some of the answers were a bit conflicting, so I was wondering: ...
Alconja's user avatar
  • 848
11 votes
3 answers
5k views

Performance degrading when resolution increases for a 4k screen

I am new to Unity. I have a problem where my game has good performance on my non-4k screen. Bur when I play it on my 4k screen, the performance gets really bad. It looks like the resolution is ...
Kims's user avatar
  • 219
9 votes
2 answers
2k views

Is GPU locality of reference worth worrying about?

Does locality of reference make as much of a difference to GPU performance as it does CPU performance? For example, if I send 200 draw commands to the GPU, will I see a (potentially) noticeable ...
Xenoprimate's user avatar
8 votes
2 answers
5k views

Multi threaded game - updating, rendering, and how to split them

From the StackOverflow post (it was recommended I move this): So, I'm working on a game engine, and I've made pretty good progress. However, my engine is single-threaded, and the advantages of ...
CodeBunny's user avatar
  • 205
8 votes
3 answers
2k views

What's a good data structure solution for a scene manager in XNA?

I'm playing with XNA for a game project of myself, I had previous exposure to OpenGL and worked a bit with Ogre, so I'm trying to get the same concepts working on XNA. Specifically I'm trying to add ...
tunnuz's user avatar
  • 624
7 votes
2 answers
7k views

Java single Array best choice for accessing pixels for manipulation?

I am just watching this tutorial https://www.youtube.com/watch?v=HwUnMy_pR6A and the guy (who seems to be pretty competent) is using a single array to store and access the pixels of his to-be-rendered ...
Petrol's user avatar
  • 73
7 votes
1 answer
2k views

Per frame: Many draw calls with fewer total vertices vs fewer draw calls with more total vertices?

Is there any chance draw calls like XNA's Graphics.DrawIndexedPrimitives has an extremely low overhead and performance issues are more than likely due to the complexity of the meshes? If I had a ...
Mythics's user avatar
  • 1,486
6 votes
1 answer
830 views

How can I insert and remove blocks quickly in a Minecraft-style world?

I currently have volume data for the world stored as an array of booleans. I then check each empty block and if it has non-empty neighbors the faces get drawn. This prevents me from sending a bunch ...
Xavier's user avatar
  • 1,633
5 votes
1 answer
386 views

Can I leverage the fact that my scene is often static to improve OpenGL (JOGL) performance?

My scene is drawn based on the location of several (often several million) vertices (kept in VBO's) and a camera. I can easily tell in my code when my scene has changed and when it hasn't. There are ...
Luke's user avatar
  • 355
5 votes
2 answers
2k views

Can frequent state changes decrease rendering performance?

Can frequent texture and shader binding decrease rendering performance? "Frequent" binding example: ...
kravemir's user avatar
  • 1,657
5 votes
4 answers
2k views

Is Carmack right about PC performance? And does Windows 8 address his concerns?

Here John Carmack claims that PCs are still slower that current gen console hardware because of the overhead. "A lot of it's driver overhead issues, where there's so much that we do in the game, ...
Daniel Iankov's user avatar
5 votes
2 answers
4k views

Implementing fog of war in opengl es 2.0 game

Hi game development community, this is my first question here! ;) I'm developing a tactics/strategy real time android game and I've been wondering for some time what's the best way to implement an ...
jmacedo's user avatar
  • 521
5 votes
1 answer
880 views

Is it more efficient to render full size with AA, or scaled down with no AA?

Which is more resource-efficient (given a typical modern 3D game scene): Rendering it at 100% scale with anti-aliasing, or Rendering it larger and scaling it down to fit the screen, but without AA? ...
user1306322's user avatar
  • 1,379
4 votes
1 answer
2k views

Improving SpriteBatch performance for tiles

I realize this is a variation on what has got to be a common question, but after reading several (good answers) I'm no closer to a solution here. So here's my situation: I'm making a 2D game which ...
Richard Rast's user avatar
4 votes
3 answers
4k views

Why do we use physics engines for collision testing or raycasting?

There is a thing I don't understand about game engines: why it is so common to use physics engines to do raycasting or collision testing? Say that you have a 3D scene loaded in your scene manager (...
tunnuz's user avatar
  • 624
4 votes
2 answers
328 views

What does "kTriangles/s" mean in hardware graphics benchmark reports?

I've looked around and found several sites offering benchmarking statistics for mobile platforms and I've been seeing the unit of measure as "kTriangles/s". Originally I misread this, missing the 'k'; ...
swquinn's user avatar
  • 143
4 votes
1 answer
2k views

Efficient minimum distance between two axis aligned squares?

I have two 2D arbitrarily-positioned axis-aligned squares. I need to find the minimum distance between those squares – i.e. if you were to draw them, what's the length of the shortest line you could ...
Max's user avatar
  • 143