Question about Blueprints, Structures and Dynamic Arrays.

Greetings,

A) I’m working on creating my procedural level generator, and I need to create a dynamic array of a structure based on the ‘width’ and ‘height’ variables of my construction script. (For example, I want to create a grid that is X by Y size (These will change for every level) so I need an array of structures that is (x*y) in size. I’m quite a bit confused how (or IF) I can do this in blueprints.

B) Also, speaking of structures, I’ve been trying to see how to create a structure through the blueprint system, but all the information I’m coming up with shows creating the structure in C++. I’d rather keep everything in blueprints if at all possible. If not, then I guess I’ll have to mix (which may not be a bad thing since I can probably do what I need to do faster in C++ than in blueprints) but I really would like to do everything in blueprints.

Thanks,

Well, the “arrays” in BP are actually moe like lists. They only have a one dimensional index.
But:
-You could however flatten out the data using an “associate array”.
-You could basically use a linear address for each cell in your 2d array and calculate (zero based): Index := Row*ColCount // Col := Index mod ColWidth // Row := Index div Colwidth

First, Thanks for the reply!

Yeah, I was already aware of the lack of two-dimensional array support, so I’ve already got my indexing scheme ready for the implementation. I guess the first problem I have to overcome is making a structure. Maybe I’m looking in the wrong spots. Whenever I google it, I’m coming up with just C++ structures creation.

Thanks,

In the content browser, rightclick, choose “Structure” from the Blueprint submenu… :slight_smile:

WOW! Thanks! NEVER would have found that! lol