Best practices: Minimap Tracking System

Hi,

i have created a minimap with render target, scene capture 2d and a material that puts all the stuff together and draws the whole minimap.

It works, but now i want to add little points for characters or enemies and icons for locations into this minimap.

I have different solutions to realize this, but these solutions are uncomfortable. The bad thing is using “Get all actors by class”. It is a slow function and cannot be run at every tick. And creating an dynamic array and add/delete trackers is something that i would avoid.

I have thought a while about this and got a first idea: Like in real world soldiers have a tracking device, i would suggest to create a special component and pin it at the root of a Character BP for example. But how can i request all these trackers without massive performance loss.

If anybody is familiar with Minimaps, please tell me how can i solve this. How is that handled in other games?

Thanks in advance

Hi!

Tbh I would try to use a dynamic array and add/delete trackers. :slight_smile:
But since that’s not an option: Have you thought about using a timer and an event dispatcher? Maybe it would be a nice idea to let your minimap check for your target actors in regular intervals of ~0.1s or so via a custom event and bind another custom event “On begin play” to the event dispatcher.

This could essentially look like this:

→ Minimap Widget

→ Player Controller

→ And finally your Character, which stores the Minimap widget in a variable and sends his position back to it when requested by the Event dispatcher.

Good luck! :slight_smile:

“I have different solutions to realize this, but these solutions are uncomfortable. The bad thing is using “Get all actors by class”. It is a slow function and cannot be run at every tick. And creating an dynamic array and add/delete trackers is something that i would avoid.”

Do you mean you want to avoid dynamic array because you think that is the only way to use it? My suggestion is to make it more object oriented, rather than have the minimap class assemble the array from the actors in the world, let each actor add itself to the array on spawn and remove itself from the array on destruction. So long as your not using threading this would be ideal/efficient and would avoid the use of “get all actors” method.