Arrays vs lists in RTS

NeOmega

New member
Looking though most of these tasks, I see arrays used.
Often it is an array of huntable units with a tag that can be seen or followed by the hunter.
But when a unit is killed, it leaves a null, which causes headaches.
My most basic solution was to have the array rebuilt OnUpdate
But this means every hunter re-updates the enemy array every OnUpdate.
Since I am making a RTS, this does not seem optimal in any way, as there could be hundreds of Hunters.

So I like to have the hunted themselves add themselves to lists, (and various dictionaries) and then remove themselves when dead.
However, thsi still does not help the problem that arises when a different hunter kills a unit this particular hunter was also tracking.

Another more efficient way, I am thinking, would be to use events, BUT, there is that thing where behavior designer can not really communicate with other game objects outside the behavior designer.

However, I have yet to code out any list or event based tasks, and wondering if you have any guidance/tutorials/links on this.
 
Last edited:
Top