The process of modifying software to make some part of it work more efficiently or use fewer resources. Generally, this means it executes more rapidly, or will require fewer resources.

learn more… | top users | synonyms

55
votes
17answers
25k 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 ...
46
votes
3answers
10k views

Optimizing an XNA 2D game

Does it make sense to implement the logic to skip rendering objects outside the viewport or should I not care about it and let the Framework do it?
43
votes
7answers
9k views

How to improve Minecraft-esque voxel world performance?

After playing Minecraft I marveled a bit at its large worlds but at the same time I found them extremely slow to navigate, even with a quad core and meaty graphics card. Now I assume Minecraft is ...
29
votes
9answers
25k views

What is the fastest way to work out 2D bounding box intersection?

Assume that each Box object has the properties x, y, width, height and have their origin at their center, and that neither the objects nor the bounding boxes rotate.
23
votes
6answers
988 views

Spell casting - How to optimize damage per second

Imagine we have a wizard that knows a few spells. Each spell has 3 attributes: Damage, cool down time, and a cast time. Pretty standard RPG stuff. Cooldown time: the amount of time (t) it takes ...
21
votes
9answers
6k views

OpenGL optimization tips [closed]

What tips or tricks do you have when it comes to making the OpenGL more efficient?
19
votes
7answers
2k views

Optimizing gravity calculations

I've got a bunch of objects of varying size and velocity which gravitate towards each other. On every update, I have to go over every object and add up the forces due to gravity of every other object. ...
18
votes
6answers
2k 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 ...
18
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, ...
17
votes
3answers
902 views

In modern AAA games with open environment and lot of static content (eg : crysis), how is occlusion culling performed?

Two ideas i have in mind : 1) Scene is rendered to a invisible buffer, using low resolution and low polygon count models (or even using only bounding volumes like cubes or spheres). The buffer is ...
15
votes
7answers
3k views

How does one optimize an HTML5 Canvas and JavaScript web application for Mobile Safari?

I've created an HTML5 Canvas and JS game that runs great on a desktop or laptop in Chrome (30fps), but on mobile Safari I only get around 8 fps. Are there any simple tips or tricks to increase the ...
14
votes
2answers
1k views

Why are big files better than small files for consoles?

Why do console game developers use large files to store game data instead of small files like on PC? Less streams in memory? Need to access file tree many times? Other reason?
14
votes
2answers
512 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 ...
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
2answers
12k views

How can I make huge terrains in Unity?

How can I make extremely huge terrains in Unity? It seems like I can set width and length to large values. But the Heightmap resolution only goes up to 4097 and the Detail resolution only goes up to ...
12
votes
2answers
2k 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 ...
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 ...
11
votes
5answers
2k views

Why do computer games differ so much in size?

There are alot of PC games out there that have (seemingly) roughly the same graphics (with bump-maps, shaders, etc), sound complexity and play-through time yet one of them needs 4GB space while the ...
11
votes
11answers
836 views

In general how often and when should I optimize my code?

In 'normal' business programming optimization step is often left until really needed. Meaning you should not optmize until it is really needed. Remember what Donald Knuth said "We should forget ...
11
votes
3answers
4k views

Optimizing a mesh for voxel cube landscapes

Playing around with creating minecraftish/lego world landscapes in Unity 3D (procedurally generated voxel landscapes with cubes), I'm finding that the meshes created for these landscapes take up a LOT ...
10
votes
3answers
7k 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: Is it generally best practice to go ...
10
votes
1answer
243 views

How are entity systems cache-efficient?

Lately I've been doing a lot of reading on entity systems to implement in my game engine (C++/OpenGL). The two key benefits that I constantly hear lauded about entity systems are 1) the easy ...
10
votes
1answer
218 views

Good resources for learning about graphics hardware

I'm looking for some good learning resources for graphics hardware (and associated low level software). Basically I want to learn more about what goes on underneath the opengl/direcx API layers in ...
10
votes
1answer
1k 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 ...
9
votes
6answers
4k views

Make pygame's frame rate faster

By profiling my game, I see that the vast majority of the execution time of my hobby game is between the blit and the flip calls. Currently, it's only running at around 13fps. My video card is fairly ...
9
votes
5answers
4k views

OpenGL's matrix stack vs Hand multiplying

Which is more efficient using OpenGL's transformation stack or applying the transformations by hand. I've often heard that you should minimize the number of state transitions in your graphics ...
8
votes
9answers
2k views

Large FPS vs consistent FPS

When optimizing the frame rate of a game, when should I focus on a large FPS and when should I focus on a consistent frame rate. This is often a hotly contested issue, so please note I'm not asking ...
8
votes
3answers
912 views

Are collision detection always O(n^2)?

Are physics engine able to decrease that complexity, for example by grouping objects who are near each other and check for collisions inside this group instead of against all objects ? (for example, ...
8
votes
1answer
278 views

Chunking/caching large levels in a singleplayer game

Does it make sense to try to offload a large nonlinear level into file-based chunks, and load those on demand? We've implemented level chunking to improve rendering performance, but still all level ...
8
votes
1answer
552 views

GL ES: Fragment shader optimization

Summary: I get FPS slowdown as soon as I try to tint the sprites (i.e: multiply texture with color in the fragment shader) Details: Hardware: iPod touch 4 I am drawing 700 sprites on the screen ...
7
votes
4answers
1k views

Efficient 2d Java Line of Sight for a lot of entities?

My problem today is this: I have many civilians going around, they are classes stored by an arraylist. The idea is when they see another civilian panic, they'll start to panic and it will spread. ...
7
votes
2answers
2k views

Frustum Culling with VBOs

I have terrain being rendered in my project using VBOs in OpenGL. I would like to apply some Frustum Culling but have no idea how to access each polygon as its drawn to check if it is in view. I think ...
6
votes
7answers
1k views

Wikipedia A* pathfinding algorithm takes a lot of time

I've successfully implemented A* pathfinding in C# but it is very slow, and I don't understand why. I even tried not sorting the openNodes list but it's still the same. The map is 80x80, and there ...
6
votes
4answers
1k views

Is it possible to use the GPU on a mobile device to accelerate a particle physics engine?

I am interested in answers for any mobile device but I am mainly considering the iPhone and devices that run Java. I am developing a game that relies heavily on a particle physics engine for core ...
6
votes
3answers
607 views

Is Frustum Culling by itself enough for Consoles and Mobiles?

Software occlusion culling is often expensive, especially for smaller and older devices. Is frustum culling alone adequate on systems that can optimally display 10k triangles at most? If not, are ...
6
votes
2answers
1k views

In DirectX 11, batching primitives for performance, how does this actually work?

I don't seem to be able to understand this. Microsoft says that one of the possible optimizations of for a Direct3D 11 if to batch primitives draw calls. For example in order to draw say 300 triangles ...
6
votes
2answers
770 views

Correct way to handle path-finding collision matrix

Here is an example of me utilizing path finding. The red grid represents the grid utilized by my A* library to locate a distance. This picture is only an example, currently it is all calculated on ...
6
votes
4answers
2k views

Smoothing found path on grid

I implemented several approaches such as A* and Potential fields for my tower defense game. But I want smooth paths, first I tried to find path on very small grid ( 5x5 pixels per tile) but it is ...
6
votes
1answer
416 views

Display Lists in OpenGL

I heard that there was a faster method of displaying vertices, rather than recreating the GL_TRIANGLES, each time the scene is drawn. I thought I read somewhere that this method was obselete. Why ...
6
votes
1answer
933 views

Is the STL efficient enough for mobile devices?

When it comes to mobile game development on iOS and Android NDK, some developers write their own C++ containers, while others claim that STL is more than adequate for mobile game development (For ...
6
votes
2answers
894 views

How to loop over a part of an ogg vorbis stream?

I'm successfully streaming ogg vorbis data to openAL with the Java library JOrbis, but now I want to loop over a part of this stream, e.g from 30" to 1'30". I thought that at the end of the loop, I ...
6
votes
1answer
267 views

How do texture lookups for trig functions work?

I have a pixel shader that calculates a mandelbrot fractal. It uses the standard formula: z = z2 + c I'd like to extend it so the power z is raised by varies. To do this i have the following ...
5
votes
2answers
2k views

Which opcodes are faster at the CPU level?

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 ...
5
votes
2answers
203 views

Game has noticeable frame drops but when through a profiler it always runs smooth

I'm trying to optimize my PC game but I can find the bottleneck since every time I run it through a profiler (gDEBugger) it runs smooths. When running outside gDEBugger I get these annoying hiccups. ...
5
votes
1answer
416 views

Cheap ways to do scaling ops in shader?

I've got an extensive world terrain that uses vec3 for the vertex position attribute. That's good, because the terrain has endless gradations due to the use of floating point. But I'm thinking about ...
5
votes
3answers
321 views

Drawing the same mesh or drawing the same material?

I was wondering. Suppose I have a 1000 grass meshes. They all have the same material, but I create them separately, because they look slightly different, because they have different heights. Does my ...
5
votes
2answers
728 views

What are the time-efficiency characteristics of these voxel data structures?

Real-time, high-resolution voxel raycasters tend to use one of the following optimising data structures in order to achieve interactive frame rates. What are the pros and cons to these, and what other ...
5
votes
2answers
163 views

Handle movement with QuadTree

I currently have a QuadTree that contains all my Entities. It works well and I've optimized it pretty decently, but the one thing that hurts is that I am removing from and inserting to it almost ...
5
votes
2answers
292 views

How can I optimize a parallax effect consisting of multiple transparent layers?

I have a parallax effect in MonoGame consisting of multiple semi-transparent layers of textures. The effect is simple, but rendering multiple transparent layers on top of each other is rather slow. ...
5
votes
2answers
579 views

How to generate portal zones?

I'm developing a portal-based scene manager. Basically all it does is to check the portals against the camera frustum, and render their associated portal zones accordingly. Is there any way my editor ...