How to create an array of int points to find a grids "rings" from center.

I’m sorry I couldn’t figure quite how to phrase this in the question but I thinks this explanation should be sufficient.

I would like to create a array of arrays containing int points so that I can create and select different rings on a grid starting from the center.

I have managed to get this working by creating a structure of int point arrays. For example:

Ring 1

(-1, -1), (-1, 0), (-1, 1), (0, 1) ,(1, 1), (1, 0), (1, -1) ,(0, -1)

Ring 2

(-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), (-1, 2), (0, 2), (1, 2), (2, 2), (2, 1), (2, 0), (2, -1), (2, -2), (1, -2), (0, -2), (-1, -2)

Ring 3

(-3, -3), (-3, -2), (-3, -1), (-3, 0), (-3, 1), (-3, 2), (-3, 3), (-2, 3), (-1, 3), (0, 3), (1, 3), (2, 3) (3, 3), (3, 2), (3, 1), (3, 0), (3, -1), (3, -2), (3, -3), (2, -3), (1, -3), (0, -3), (-1, -3), (-2, -3)

Etc

I then can assign different values to these cells on in my grid.

My question:

How can I add arrays to this structure using blueprints. For example if I have a 10 x 10 grid I will need the co ordinates as above for 10 different rings which would take a long time to enter as a structure and I would potentially need much larger grids.

I would like to be able to create this using math (which im bad at)

I hope this makes sense and thanks in advance!

I would either just have a single array grid of all points ( there’s a macro for that ), or make a blueprint which you tell it the corner coordinates, and it draws one ring and keeps the coordinates in an array.

Trying to do it as one massive thing is very 70’s, whereas the engine is object orientated. And working with nested arrays and structures in blueprint is a bit of a mare… :slight_smile:

grid

Thanks for your answer! Oh interesting, I will have a play when I get back to my computer. I’ve basically been trying to make a more advanced version of mine sweeper so that is why i’m obsessed with neighboring cells.

I guess the corners of each ring will always be the same math but how would I make it draw a ring… I shall also try work it out on me tod as well x

By draws a ring what do you mean?

1 Like

I mean, one approach could be to make a BP that just does one ring, given the coords of the corner. Then a whole grid would just be multiple copies of this BP with gradually incrementing parameters.

ohh I seeeeeee… I guess because I need the cells to communicate with there neighbors on 8 sides this isnt an option. So im basically making Minesweeper in an actual mine if this helps.

This is a very good lesson on being specific as there are a million ways to do one thing i guess!

1 Like

Specific is good :slight_smile:

If you want cells communicating with each other, the having each cell being a BP might make sense, and then you can position them with another blueprint, so you don’t have to do it manually.

It’s probably also possible with just a large number of meshes, and doing something with hit events, but I’m not so good at that :rofl:

So I think I will stick to my int point coords I just got ChatGPT to make me a copy and pastable list up to a 20 x rings which will be more than enough for me to make a vertical slice.

Thank you for your help though. I might rebuild the grid using the macro at some point.

1 Like

And hit events might be the way to go, but to be honest I’m just building something to then look for programming help. I’m more of an art guy and want to make a simple game but thought a prototype would help sell the idea.

1 Like