So I’m working on a kind of “tetris-like” game where the player is controlling a sidescrolling character and must platform around on the falling pieces, which they can also control. It’s a sort of multitasking challenge where the player has to make sure they don’t build to the top of the screen while simultaneously avoiding getting squished or falling off the screen, etc.
Anyways, I’m trying to create a robust system for designing different piece patterns. The blocks within the pieces can sometimes be swapped out with platforming elements like ladders or platforms, so the way my current system works is, when a piece spawns in, it randomly picks something from an array of arrays of vector3s (accomplished using structs), with the X and Y values determining the location of each block in the piece and the Z serving as a kind of “ID” to change the block’s type. Here’s an image of the values for the classic “T” piece, as an example.
And here’s a modified version of the 4x1 piece, one big ladder topped with a platform.
Needless to say, this system is really impractical, messy, and inefficient. I have plans for all sorts of patterns and variations, and an array of arrays of vector3s isn’t going to cut it. At first, I tried looking for a kind of “hybrid variable,” say, a vector 2 and an int, so I could make an array of those instead, but even if such a thing does exist, I feel like it still wouldn’t be the best way of doing this. Any suggestions on what I could do to make this system better?