I’m working on a project for College in which I need to create a 2D sidescroller game that has the capacity for procedurally generated levels. I’d like to be able to create this feature using only the in-engine blueprints, as Im rather new to the coding aspect of Unreal. So far, I’ve only come up with some concepts as to how the procedural generator would work:
A box (I guess something like a trigger box?) is fixed to the player’s ingame character, and is positioned infront of the player character. As the player moves into an area of the level that does not contain any generated terrain, terrain would be procedurally generated within the fixed box.
A large area within a blank map is specified as the area within which the level can be procedurally generated.
The level procedurally generates until a specific point is triggered (could be time based, or based on the distance the player has travelled?)
I’m not particularly sure which option would be best, from a simplicity standpoint (As I said, I’m rather new to Unreal, especially the coding aspect).
I’m wondering if anyone can suggest which of my concepts would be best, or if a better alternative is available?
Additionally, can anyone provide some assistance with creating the blueprints, or points in the right direction?
It’s done in 3D but the same idea would apply in 2D. You’ve got the right idea in your notes above, I think now you just need to get your hands dirty with Blueprints to see how things actually shake out, and there are plenty of BP tutorials out there.
For some reason, i think a cleaner approach would be to have the empty level be partioned into a grid. Each cell spawns as soon as a player steps into a cell adjacent to it.
Having the “terrain generator” volume be attached to a moving actor could potentially run into trouble spawning terrain thats misaligned (of course this all depends on how the backend logic operates).
It’s good to hear that I’m on the right track, conceptually speaking. The only other idea I had from a conceptual standpoint fits in with 6ixpool’s idea, whereby “terrain frames” are made, each with multiple entry and exit points for the player character on the left and right hand side of of each terrain frame. (Each of these entry and exit points would align with exit and entry points on all other terrain frames. Ideally, 6-10 frames would be made, with a start and finish frame as well.
The game would start on the start frame, with an algorithm/blueprint handling the placement of these extra pre made frames as the player moves through the level, essentially fitting the frames together like a jigsaw puzzle. As the game progress past a certain point (time elapsed or distance travelled based) the chance for the end frame to be used would increase exponentially, thereby providing a final end point to the game.