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.
43
votes
17answers
14k 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 ...
40
votes
3answers
7k 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?
22
votes
10answers
9k 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.
21
votes
9answers
4k views
OpenGL optimization tips
What tips or tricks do you have when it comes to making the OpenGL more efficient?
21
votes
6answers
842 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 ...
18
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. ...
17
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, ...
16
votes
3answers
681 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 ...
14
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 ...
13
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?
13
votes
2answers
6k 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 ...
11
votes
3answers
3k 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
5answers
1k 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 ...
10
votes
1answer
681 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
2k 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
3k 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 ...
9
votes
1answer
178 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 ...
8
votes
11answers
664 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 ...
8
votes
9answers
1k 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
6k 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 ...
8
votes
1answer
230 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 ...
7
votes
2answers
1k 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
3answers
535 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
152 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
616 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
1answer
324 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
4answers
699 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.
...
6
votes
1answer
772 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
673 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
213 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
4answers
913 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 ...
5
votes
3answers
264 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
568 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
1answer
149 views
Player Visibility Problem
I'm looking into designing and implementing an online RPG (or more accurately, redesigning an existing piece of server software).
One of the problems is that of managing visibility. Update data for ...
4
votes
3answers
458 views
why is it faster to draw lots of small arrays than one big array?
This application on-line here has interesting performance characteristics:
Sorting the rectangles to be drawn so it keeps having to change colour is faster than sorting the rectangles by their colour ...
4
votes
2answers
151 views
Optimizing models & improving performance
I've created a map editor for a game I've been developing. The maps (planets) are made using a form of meta ball editing. Basically, in the end the Marching Cubes algorithm is used to get my final ...
4
votes
2answers
272 views
Why is keeping a constant FPS harder than keeping high FPS?
I've noticed this ever since I started playing games, and now see it in my own experiments. If I don't do any capping my game runs at 200~250 FPS, with random drops to 150FPS, but if I cap the FPS to ...
4
votes
3answers
231 views
Are there methods faster than Strings for sending a sprite's state over UDP?
I'm programming a 2.5D networked game in Java. The networking works like this right now:
Create new networked sprite object at the client. Send it to the server. Server distributes and saves it. ...
4
votes
2answers
170 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. ...
4
votes
4answers
975 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 ...
4
votes
1answer
134 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 ...
4
votes
2answers
183 views
Space-efficient data structures for broad-phase collision detection
As far as I know, these are three types of data structures that can be used for collision detection broadphase:
Unsorted arrays: Check every object againist every object - O(n^2) time; O(log n) ...
4
votes
0answers
228 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 ...
3
votes
2answers
715 views
Rendering a lot of Models at once with XNA
In an hexgrid based game, I render all terrain tiles as a separate model, reusing the same texture objects on all similar tiles. The tiles is a pretty simple model.
When the terrain is set to be at ...
3
votes
2answers
847 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 ...
3
votes
3answers
891 views
Optimizing Bullet and ODE Physics on consoles and mobile phones
I'd like to use either Bullet or ODE on low powered devices (mobile and consoles), but the frame rates are below the acceptable 25-30fps for simulations.
I've found that one articulated body by ...
3
votes
2answers
448 views
OpenGL: Precompute a texture rotation
I'm trying to speed up particles, and one way to do that is by precomputing the texture rotations. What I want to do is load the texture, rotate it and save it to a handle.
How would I go about doing ...
3
votes
3answers
201 views
Javascript board game: looking for optimization
I posted this question on stackoverflow before but received no answers so I decided to post it here and see if someone could suggest me something.
I'm working on a html/javascript game for android. ...
