• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About Chr0n1x

  • Rank
  1. [quote name='raigan' timestamp='1295213448' post='4759790'] I'd love to hear other peoples' experience/thoughts on this, to me it's the most interesting/confusing aspect of DoD since most of the presentations are very vague/abstract and don't explicitly discuss this sort of implementation detail that is nevertheless of supreme importance. [/quote] A number of presentations I have seen go for the MAX_OBJECTS approach with arrays, but in a lot of cases this would probably depend on the game itself. If you are working with particles, you could probably work with a reasonable cap and not need to go past it, just be careful with how fast you emit the particles. Preventing extra allocation is probably the best way to go, maybe even at the expense of some memory; or you can be smart about extra allocations. That is what std::vector does when extending itself, it increases by say 1.5x (actual amount is up to implementation) and that way the allocation cost is amortised. Short-lived objects should still make use of a pool system for re-use later on to avoid allocations, and the rest of the objects are usually created at load time. If not, you could probably get away with occasionally (read: rarely) increasing the size of the array, as long as it remains contiguous so you can iterate over it sequentially and make good use of the cache.
  • Advertisement