Creating a sanbox style logic

Is this possible with nodes? From my understanding I just need an 3D array. I’m currently experimenting with the arrays and the vector array seems to be an 3D array. Or am I missing something?

I’ve been able to randomly spawn objects and populating the vector array with them.
But that is not the same as an 3d array. I kinda don’t understand how to create one with nodes since there is no customization of arguments for the node arrays.

There is no multi dimension arrays in Haxe , but you can create them using work around

https://try.haxe.org/#BbD31

https://stackoverflow.com/questions/16317567/how-to-declare-2d-arrays-in-haxe

We should try create some Array class and create a logic node version.

I always thought multidimensional arrays were basic coding tools. I remember having used them >10 years ago in gamemaker. It’s kinda frustrating to read that haxe doesn’t support them. To me it looks like haxe is a bad choice for a game engine. They’ve been around for so long I can’t imagine a text based programming language to not have them.

1 Like

Umm, isn’t a multidimensional array just an array of arrays. That would be supported in any language that lets you store arrays in arrays. There shouldn’t be any reason you can’t do that in Haxe. I guess arrays in Haxe don’t have a set length, but that shouldn’t cause problems should it?

1 Like

Here is an example that builds a two dimensional array and assigns some values to the table:

https://try.haxe.org/#9Fb83

class Test {
    static function main() {
        var a:Array<Array<Int>> = [for (i in 0...5) [for (j in 0...5) 0]];
        
        a[0][0] = 1;
        a[4][4] = 8;
        a[2][3] = 3;
        for (val in a) {
             trace(val);
        }
    }
}
1 Like

Ah, here is a fixed sized collection class for Haxe if that helps. It probably ends up using arrays for statically typed language targets.

https://api.haxe.org/haxe/ds/Vector.html