How to spawn player in a procedural generating maze

I made a maze generating algorithm, that using predefined meshes procedurally generates a new maze every time I start a new game. The problem I have right now, is that I want to make the player spawn in the maze but I can’t use a fixed player spawn cause the maze generates new everytime.

Help would be much appreciated

Hi there, without knowing how your maze generation scripts work it’s a little difficult to give you exact steps but something along these lines is how I’d tackle it:

Step 1: Determine a Spawn Point

You need to identify a suitable spawn point within the newly generated maze. This could be the starting point of the maze or any designated area based on your maze generation logic.

Step 2: Store the Spawn Point

Once you have determined a suitable spawn point, you can store it in a variable to be used for player spawning.

Step 3: Spawn the Player

Use the stored spawn point to spawn the player character at the beginning of the game.

Implementation

  1. Maze Generation Blueprint:
  • Add a variable to store the spawn point (e.g., SpawnPoint of type Vector).
  • After generating the maze, set the SpawnPoint variable.
  1. Game Mode Blueprint:
  • On Event Begin Play, call the maze generation function.
  • After the maze is generated, get the SpawnPoint variable from the maze generator.
  • Use the Spawn Actor node to spawn the player at the SpawnPoint.
  • Use the Possess node to make the player controller possess the spawned player character.

I hope this helps.

First of all thank you for your reply.

At the moment the Problem lies in determining the current Spawn point. My original Approach, was to get the Maze Blueprints Transform, and set it as the Playerspawns Transform, but that didn’t do anything, and it shows me that the Transform is 0 in Rotation and Translation. I also tried to fix the Playerspawn to the Maze and Instance manager, using get actor location, but the problem with this is, that my maze automatically generates from a corner and not from the center, and so for around 50% of seed that I use, the Maze doesn’t generate a tile at its origin location, which makes the player spawn in midair. A possible fix I think, would be to get the location of the starting and end tiles, which are actually defined in the Spawn Maze Meshes function, but I haven’t been able to figure out how.

And that is a photo of the part of my Spawn Maze Meshes function, that spawns the end and start tiles.