Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ObsidianWhisper |
I’m trying to figure out which would be the most efficient. I tried to look it up and found some stuff that was a little over my head, but boiled down to a script is lighter than a node in some cases. I’m in the planning stage of something akin to Cataclysm, and I’m trying to decide how I want to implement items. Be that in inventories or on the ground.
My current ideas are either using a Node2D with a small sprite as a child and a script holding the item info.
Or creating a complicated nested array that stores a tilemap coordinate, an array of items on that coordinate, each having either an array or dictionary containing the item information, and lastly the combined mass of all the items stored up next to the coordinates. Then I use the tilemap to project the latest item placed at those coordinates.
The array sounds like a nightmare to code around, but I also think in the long run it’ll be less taxing than a few hundred sprites sitting on top of one another and a node tree a mile long. That said, those individual nodes would only be accessed by proximity, while the entire massive array would be accessed every time the player moved, searching the top of the array for any coordinates that are within reach.
I’m still leaning towards the array though. Am I going in the right direction? Or is there a better way of implementing this that I’m oblivious of?