Sorry for the vague title I’m not sure what to call it LOL
I have a planet blueprint (space game) and for each planet I want to have a list of possible elements that can be mined / gathered from it
I created a struct with “ElementName”, “ElementPicture”, “ElementDescription” as that’s where I want to start - but now I need to load in the 30-40 elements that I want to have possibly available and I’m not sure where to stick the variable for the element struct array - do I put it in the planet blueprint? but then later on when I am managing my elements for my player I don’t want to reference the planet anymore, and I don’t want to duplicate my efforts (or the long list)!
I don’t want to put it in the level blueprint because I will have several maps / levels
Do I save it to the disk in XML or something and load it into the level each time or something?
I just want to make sure I do this right
There are multiple solutions to this and you’ll just have to make an executive decision
I would suggest GameState or similar, they are persistent between levels and never go away. It’s easy to reference from any BP (get GameState - cast to (your particular GameStateBP) and then you can reference it (maybe make the array public or create Get/Set functions)
Also you can create an array of those structs…
thanks rodstone! Yes i was thinking I’d have an array for the structs, just wasn’t sure where to put them - I will give the GameState a try! Thanks!
If the data in question is PERMANENT (i.e. not procedurally generated at runtime, but constant for the game) an even easier way is a DataTable… Which is basically just a hardcoded array of structs which can be called easily from any Blueprint.
Awesome - thanks for the ideas - I will check out DataTable as well - my Elements WILL be permanent I think so that may be the way to go
I looked quickly, and it doesn’t look like Datatables can store pictures? I need a pic / thumbnail of the element as well
To reference an image (texture) you need to have syntax such as this in your .csv file as well as making sure in the structure you have it set to texture.
You can store just about all variable types in data tables. Its just knowing the syntax for the .csv