i made myself a (mini)map i need to know if this is a good way to do it.
The map is simply a plane with all objects textures baked onto it, with the same size as the “level” itself, then i transfer worldpositions to the minimap scene, and here the icons will be spawned and moved like anything else. at this point i got myself a nice “worldmap”, so to make it a minimap i used rendertotexture. I got 2 cameras, i can switch the minimap “rotation” mode to rotate or stuck in place and one of them getting rendered to a plane that represents the minimap.
so basically:
a plane with texture
icons grabbing world positions from “level” scene
2 camera’s where 1 is rendering to a small plane to make it a minimap.
Note: It is adding the icons every tick for 1 tick, i tried to do this by just spawning it once, but with added enemies ingame it wont work due to duplicated names, and the icon for that object going to track the first object with that name, leaving enemies without an icon.
But i want to know if this is a good way to do it?
Nobody can tell me if this is a good way to do it?
i wonder this due to the fact that the icons are added every tick. and maybe theres a better way to do it.
Looks like a good method except for spawning the icons every frame. It is possible to spawn multiple objects with the same name, you just must make sure to store their references somewhere and use those instead of the objects name.
except for spawning the icons every frame. It is possible to spawn multiple objects with the same name, you just must make sure to store their references somewhere and use those instead of the objects name.
yes indeed but then the script need to work even more, because not every object is getting added trough a script.
And/Or i need to put an always sensor on every icon so that it tracks the potition on its own, this will only make it heavier right?
and i am using a range, only enemies, quests, etc in range are spawned every tick.
This way got a few upsides aswell (i think).
now you can use it as a map, minimap and radar(just set the freq of true pulse(but you need to use 2 always sensors then)
also icon change on the fly(just by altering the icon name in the object).
But i guess i can take it offline and be happy with it, if it was a bad try then people would have told me.
You can use the Python Controller with the module option to execute a function to add the object and register the referece, and never use the logic brick for that (you would be replacing logic bricks, not adding more). Thats why BGECore forbids logic bricks in the first place.
And/Or i need to put an always sensor on every icon so that it tracks the potition on its own, this will only make it heavier right?
No. When you use scene.addObject, you add that reference to a list, then you loop throught the list once every frame seting the position of every element on it. The loop call is only done from one object, so only one object needs the always sensor. In BGECore no object would since you could implement this in a behavior.
Notice that your method is simplier, if you are happy with it you should stick with it.