In PureBasic with Gadgets (UI) it was possible to GetGadgetData(#Gadget) or SetGadgetData(#Gadget, Value)
For what? It was so possible, to add e.g. a structure (Type) or an ID from a List, Array, Map, Pointer, what ever you wanted and save there more informationen about "your" "gadget".
In AppGameKit I think of the following:
objID = CreateObjectBox ...
...
Maybe 100 times, But I don't know, with objIDs I will have. Because it could be there are some objects created inbetween and so on.
So how would I save aditional information in an array without complicated hashing?
On idea is, I get the objID from a RayCast .. okay, that the easy part.
Now what?
1. -> An array from 1..100000 and the objectID would be the ID in the Array
or
2. -> I know, that I only have 100 Boxes created and have an Array 1..100 and have to cycle and search eachtime for the specific ID.
or
3. -> I could SetObjectData = ID from my Array and with GetObjectData, I have the index of my Array without the need of a realy big array or to cycle to all positions everytime
or
4. ? I don't know, how to make it easy in AppGameKit, but it could be worst decition, if I would have more objects and types. So maybe, you have some experience or best practise?
>> I can't use "SetObjectName" for that, because there is no function like that, but I could use GetObjectName(), if I could set it before
>> I could use SetObjectTransparency, because there is GetObjectTransparency, but that would influence the visuals of the object
What if I wanted to build an easy simple "Minecraft-Clone" with tousends of boxes, but I have to know, which box is which matirial, or health or something?
I know, Minecraft and Boxes is maybe not the best example, that could be done in an three-dimensional-Array for the complete world.
But what is with complex scenes or trigger boxes. Do I have to cycle every frame throu all objects?
Maybe I am thinking to complicated, or I am to simple. I have an idea, how I would realise that in an object orientated programming language. I also know, how I would do it with LinkedLists and cycleing throu all the objects, but maybe there is a much better way, and I don't think of that yet.
I found two threads:
https://forum.thegamecreators.com/thread/204334 (Hashtables)
https://forum.thegamecreators.com/thread/218176(Nearly same wish I have, but it's DarkBasic, and maybe there are other options now)
Thanks for help. Kind regards.