Hello,
Let’s examine this basic diagram for an RTS game as an example:
(link if the picture does not show : Excalidraw | Hand-drawn look & feel • Collaborative • Secure )
Multiple BP_Buildings are constructed on the map, meaning all their variables, textures, functions, and other elements are already loaded.
All these BP_Buildings on the map are also stored in an array within the BP_GameMode. This approach makes it potentially easier to save their states, positions, and variables in a file save, invoked by the game instance (GI).
Additionally, there is a specific building, a Town Center, with an Influence Zone, where all buildings within the radius are “linked” to the TC. Consequently, any action performed on the TC can also affect all buildings within the radius.
Now, I am curious: since the buildings are already present in the game and on the map, does referencing them in an array in the GM double the amount of memory they consume? Furthermore, does adding some of them in the BP_TC actually triple their memory usage?
Is this approach considered a bad or good practice in terms of memory management and performance?