Questions tagged [optimization]

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.

Filter by
Sorted by
Tagged with
172 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,759
82 votes
17 answers
59k views

C++ low-level optimization tips [closed]

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 ...
74 votes
6 answers
35k views

How can I optimise a Minecraft-esque voxel world?

I found Minecraft's marvelous large worlds extremely slow to navigate, even with a quad core and meaty graphics card. I assume Minecraft's slowness comes from: Java, as spatial partitioning and ...
SomeXnaChump's user avatar
72 votes
12 answers
127k 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.
Iain's user avatar
  • 6,518
58 votes
3 answers
16k 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?
smnbss's user avatar
  • 701
44 votes
1 answer
11k views

How are entity systems cache-efficient?

Lately, I've been doing a lot of reading on entity systems to implement in my C++/OpenGL game engine. The two key benefits that I constantly hear lauded about entity systems are the easy ...
Haydn V. Harach's user avatar
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
26 votes
9 answers
20k views

OpenGL optimization tips [closed]

What tips or tricks do you have when it comes to making the OpenGL more efficient?
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,121
24 votes
5 answers
41k 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 ...
Daniel's user avatar
  • 3,461
23 votes
1 answer
6k 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
7 answers
5k 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. ...
Carson Myers's user avatar
23 votes
6 answers
2k 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 ...
aaronfarr's user avatar
  • 468
21 votes
5 answers
6k views

Learning to optimize with Assembly [closed]

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, ...
niktehpui's user avatar
  • 313
20 votes
4 answers
28k 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
2 answers
5k 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?
Triang3l's user avatar
  • 606
20 votes
3 answers
11k 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, ...
jokoon's user avatar
  • 5,243
19 votes
2 answers
15k 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 ...
deniz's user avatar
  • 505
19 votes
3 answers
2k 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 ...
tigrou's user avatar
  • 3,214
18 votes
3 answers
3k 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 ...
concept3d's user avatar
  • 12.7k
17 votes
6 answers
5k 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 ...
Daniel X Moore's user avatar
16 votes
4 answers
5k views

How to load a spherical planet and its regions?

I'm designing a game partially composed of planets exploration. I want to use pseudo-random generation for them, regenerating from a defined seed when I have to load them rather than store every ...
Aracthor's user avatar
  • 1,009
15 votes
2 answers
8k views

How do Minecraft know where village's buildings are if the village is not generated yet?

I'm trying to understand how chunk generation works in a deep level and all the information I found does not explain how the villages are generated properly without visual glitches during generation. ...
Guillem Poy's user avatar
15 votes
2 answers
4k 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
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
4 answers
13k views

How do I efficiently check if a point is inside a rotated rectangle?

Part for the sake of optimization, part for learning purposes, I will dare to ask: How can I most efficiently check whether a 2D point P is inside a 2D rotated ...
Louis15's user avatar
  • 569
13 votes
5 answers
3k views

Why do computer games differ so much in size? [closed]

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 ...
Jens's user avatar
  • 159
13 votes
11 answers
4k 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 ...
David Basarab's user avatar
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
6k 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 ...
JayCeeL's user avatar
  • 121
12 votes
1 answer
368 views

Good resources for learning about graphics hardware [closed]

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 ...
Ken's user avatar
  • 6,116
11 votes
1 answer
17k views

Quads Vs Triangles

I'm curious to know which is better for games: quads or triangles? Wouldn't quads be better for rendering performances and smoothing out tessellation?
SICGames2013'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
10 votes
3 answers
4k views

How can I shorten the length of time spent on finding a path using my A* pathfinding code?

I am working on a game where the player and enemies move between discreet tiles, with only orthagonal movement (like pokemon). The game also runs on a turn system, so the player makes a move input, ...
Kyle34562345's user avatar
10 votes
3 answers
2k views

How to reduce the time taken to path-find to an unreachable location? [duplicate]

I have a 2048x2048 map and if I path-find to an unreachable location, it makes the pathfinder go through every node on the map which freezes the thread for 4 seconds. How can I reduce that time? I'm ...
KayleMaster's user avatar
10 votes
6 answers
22k 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 ...
Smashery's user avatar
  • 375
10 votes
1 answer
2k views

In a 2D physics engine, how do I avoid useless collision resolutions when objects come to a rest?

In a physics engine I'm developing (for learning) using love-2d, I implemented collision resolutions in this way: ...
dnk drone.vs.drones's user avatar
9 votes
7 answers
2k 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 ...
Vee's user avatar
  • 261
9 votes
6 answers
9k views

How do I efficiently sort objects by draw order when rendering a 2D game?

I need to render a "tile" game with objects that overlap, because they are taller than the tile they stand on, like the games in these screenshots: I don't know how to render them in the correct ...
Luke Vo's user avatar
  • 465
9 votes
2 answers
6k views

For Vertex Buffer Steaming, Multiple glBufferSubData VS Orphaning?

I was learning OpenGL recently. In games, we need to update the position of game objects frequently, and they will come in & out of screen constantly. So it means in rendering we need to update ...
YiFeng's user avatar
  • 219
9 votes
1 answer
1k 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 ...
mx2's user avatar
  • 119
8 votes
9 answers
4k 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 ...
deft_code's user avatar
  • 7,602
8 votes
5 answers
5k 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 ...
deft_code's user avatar
  • 7,602
8 votes
1 answer
558 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 ...
user802232's user avatar
8 votes
2 answers
3k 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 ...
Krankzinnig's user avatar
8 votes
2 answers
2k views

RTS: Unit sight in fog of war

I am making an RTS game, and like most RTSs, you can see what's going on in a part of a map only if you have a unit over there. I have few ideas how to accomplish this, but there are problems with ...
Hedede's user avatar
  • 245
8 votes
1 answer
2k 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 ...
fakhir's user avatar
  • 409
8 votes
1 answer
3k views

(Unity) Optimised networking solution for many moving objects

I've currently undertaking quite an ambitious project. In short, it's a real time multiplayer strategy game which has bacteria mechanics. Essentially, I have two remote players in the environment, ...
Rachel Cabot's user avatar
7 votes
1 answer
1k views

How are NP-Hard problems managed in game development contexts?

When NP-Hard problems arise in game development, how are such problems dealt with? Through heuristics or solvers or a combination of both?
watchdogs132's user avatar
7 votes
1 answer
1k views

How can City-sim simulate hundreds of characters?

My games usually start lagging quite easily when there are a couple hundred of boxes representing possible characters. While games like SimCity or even Anno have hundreds of characters. I realized ...
MisteriosM's user avatar

1
2 3 4 5
9