On the hex grid, moving left is equivalent to alternating upper-left and lower-left hex movements. On each move I would essentially be adding or subtracting 2 separate numbers from my baseline index. If I wanted to move from 0 to 72 it would be (+7M) + (+2). So now I am trying to wrap my brain around the math of jumping around this grid. I modified my vector generator to better fit an array and each vector is fed into it as it is created. Yeah now that I am getting into the hard math, pure functions sound like a pretty good idea. Neighbors in the same row will just be the same index + or -1. You will either have to add or subtract one to find both of the diagonal neighbors etc. So to find one of the neighbors in the next row you could just subtract 1X the number of hexes in a row. You may need to occasionally be able to identify neighbors using the 2D too which is why it can be useful to look up values by X and Y. They are functions that have no flow execution nodes, just variable inputs so you can execute a few math functions and get the result. This type of thins is what “Pure Functions” are made for. As you said it is easier for square grids, but the solution for hexes is not too different and it sounds like you have it figured out already with the half offset thing. Yes, you just need to to make a function to converts from an X and Y value to a 1D array value. Of course, the math for a hex map is quite a bit more complicated than a plain square map… So if I am trying to simulate a field, then I should already have a good idea of the index for each vector on my map right? For instance, say a square tiled map is 10x10, then X1 is Index 1-10, X2 is 11-20, etc? Then I could just references the indexes based on what I already know and self-reference the rest of the generation against the seeds? I also don’t know much about how macros work so I will have to do some research there as well. It has been terrifically easy to generate a random 2D map, but getting it to generate more intelligently has been the hard part.Īnd yeah, the math for this setup makes me wish I had given a **** about math back in high school.Īlso, I am generating 2D hexmaps, so the array setup should be pretty simple right? I am still learning arrays so I am trying to figure out the process of retrieving information intelligently from the array. Right now my generator doesn’t know how to reference the space it is generating into in order to place things more organically(or geologically as it were). What I would like to do is seed information out into the field and then grow the terrain from that seeded information. So essentially it stripes my hexes together in 2 sets. Then it repeats it except it offsets(roughly diagonally) the next set so they mesh with the first set. Right now my generator places each tile sequentially up the Y, shifts over in the X by ~1.5 hex, and repeats to the end of the map. Usually though for simple data arrays like int, float or vector you simply do “get” and supply the index. if the array is another BP you may need to come off the “get” node using a “cast to” with the right class selected. You can even make an array of specific other blueprint classes then pull out any information about that class, including all the variables etc. Regarding putting stuff into arrays, you can make an array of any type. Let me see if that macro is available to you guys. I made a macro to convert from 2d index to 1d although it may not be exposed. I would make a macro if there isn’t one already. It will actually be a 1d array and you need to do some math to convert from 3d to 1d each time you use the index. Generating random vectors in 3d space should be simple enough though. I am not 100% sure I can visualize your usage case. It just depends on what you want to use it for. It is likely not ready for prime time though so I wouldn’t expect to see it soon. It lets you create splines within the field and the splines ‘stroke’ the vectors into form depending on proximity. One of the tech artists on Fortnite made a blueprint that lets you author vector fields inside of the editor and use them In blueprints. That’s not to say you couldn’t create a blueprint that makes its own vector field using generic data. Yes I do believe vector fields are only for use inside of particles at the moment.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |