Tag Info

New answers tagged

0

It's called a Hash data structure aka an associative array. It is often used to represent a sparse array. For instance like in your case, a huge world with myriads of tiles, that is sparsely occupied by only hundreds or thousands of units. It is very fast because it knows where to look for values (in your case units) with a certain key (in your case ...


3

In my experience with android, it is the garbage collection the kills the performance, not the allocation, although these two are tied hand and hand. As mentioned on the comments, pre-allocation is a way to deal with this issue. This is known as a memory pools. Another similar solution is object pool pattern. An object pool allocates as needed, but does ...


2

Flocking behaviors is the way to go. This link gives a great explanation on how to code flocking in really any game engine.


2

The only way to know for sure is to try both ways, as they can both be faster than each other in different circumstances. The first can be faster because less computation is done, the second can be faster because data is smaller which normally helps avoid costly cache misses. It depends totally on the context. Put another way, I could construct one benchmark ...


8

The real implications in performance here depend 100% on the platform used. Say you have written code as in option 2. When using a statically compiled language such as C++ the compiler will presumable not notice that container.left + offset.x is constant for as long as the object lives and it will not optimize it. When using a language that uses ...



Top 50 recent answers are included