Hi, I’m trying to make a map that is a constant 5x5 grid of tiles that are centered on the player. My goal is that as the player moves, the tiles behind the player unload and new ones load in from a weighted pool (making certain tiles more likely to spawn than others), but if the player backtracks, another new set of tiles load in rather than the tiles that had previously been there.
I’ve found a lot of information that seems close to what I want to do, but with how new I am I’ve been unable to figure out how to use that information to make something from scratch and am hoping someone can point me toward some resources that might help me get a clearer understanding of what I need to do to pull this off.
The goal of this is to essentially make a near infinitely explorable and ever changing labyrinth where the player will have to exhaust all the tiles in the pool before they ever see one for a second time. Each tile will be hand crafted so that I don’t need procedural generation and can ensure the right feel for the level.
perhaps a trigger box thats parented to the player and trigger boxes on the tiles? Then using an Overlap event you can detect if the player gets within range of other tiles. Don’t know if that would be the performant way to go but it would work.
I was thinking about something like that, but is it possible to have the tiles spawn in with the collision boxes in place?
I imagine I would need to build the tiles with a collision box large enough to cover the center/player tile and have it programmed to stay loaded as long as the player’s box is interacting with it and unloads it when the player leaves the box, then a second one that calls other tiles load into the appropriate coordinates when the player enters the tile.
Otherwise, I’d have to pre-place hundreds if not thousands of collision boxes.
Basically all you really need to know is if the player leaves the currently centered tile and which direction they went in right? Based on that information you can generate the next 5 tiles in whichever direction is required and unload the last 5 ones.
You could have a BaseTile Blueprint from which all tiles inherit. If you put a collisionbox in this blueprint it will show up on all tiles you generate and disappear as soon as those tiles are unloaded.
Then using EndOverlap event you can check if the player left the middle tile.
Ooo…nice. I’ll give that a go.