Manage multiple objects at once

I want to find a way to effectively track many objects at once. One practical example that I can imagine is a particle system. How are hundreds of particles tracked? I think I'm on the right track, I found the term "instancing" and I also learned about flytraps. Hopefully someone can shed some light on this and share some tricks with me. Thank.

+3
source share
4 answers

How to track objects very much depends on what you want to do with them. Do you need to quickly access some particles known by index? Then use vector. Are your particles somehow mapped by names? Then you can use map. And so on and so forth.

Hundreds of objects, of course, should not worry about C ++ unless you have chosen a particularly poor data structure. Why are you worried? Do you think you will lose too much memory? Or maybe a slow time? In any case, you must accurately describe the objects involved and the operations they need, and then select the appropriate data structure.

+2
source

You cannot process them without missing them.

( ). , , , .

- , . , , , , - ( , , ).

.

. , .

- , -, , -, , , ( , , ). , , . , , . , , - , .

. . , Boost intrusive container.

, , , .

- .

- . . , , , .., , .

, . - . / . , , , . , , , , .

0

, .

"" , -.

"" , ( ).

, .

, .

0

On the GameProgrammingPatterns website, take a look at the object pool template . It is very well written.

From the article:
Improving performance and memory usage by reusing objects from a fixed pool instead of allocating and freeing them individually.

0
source

Source: https://habr.com/ru/post/1737931/


All Articles