Spawn player manually / Delay player spawn

Hey Guys,

as far as I understand at the moment the player is spawned at an pre-defined PlayerStart point when you start up a map. But my problem is, that I have a procedurally generated Terrain and therefore I don’t know beforehand where the player will start. What I would like to do is:

  1. Generate the world
  2. Have a look for a nice place for the player to start
  3. Spawn the player at that specific location.

Furthermore later in multiplayer the client will request the level seed from the server, generate the according terrain, exchange already changed blocks inside the area, render the world and last but not least, receive the location for the player to start from the server and spawn him there.

Both situations are facing the same problem: How can I spawn my player after a given time or a custom fired event at a custom location?
Or would I simply disable Physics for him, let him spawn somewhere between here and the moon and when I want to “spawn” him teleport him to that location and enable physics back again?

Thanks in advance,
Taces

Bump - Anybody an idea?

Wish I knew the answer because I will run into this at one point as well. :slight_smile:

I found something that may be useful. Game modes have a setting for default spectator class (right click game mode BP > Edit defaults), so players can be in spectator mode. Here is some discussion on it: link.

So to delay player spawn, I think the approach would be to start players in spectator mode, spawn Player Starts via code and then turn off spectator mode. Not sure about the specifics though, hope this helps.

1 Like

You can override ChoosePlayerStart on your custom GameMode, and this will allow you to choose where you want to spawn. This is what I do in my game, there are no default player starts, I choose the location based on a set of criteria, then I spawn a player start at that position then return it from ChoosePlayerStart

That seems pretty good to me, will have a look at it, thanks!

Thanks, I will have a look at this too and try to find out when ChoosePlayerStart is called as only the method probably isn’t sufficient as I cant wait there for my terrain to finish loading without blocking the main thread.

any chance to expose this to blueprints?

I could use a delayed spawn myself in a BP based game. Any new info on this?

I would think you would want to spawn him as some basic pawn (with flying or no movement) and then when the delay is up you spawn the player character and possess him and destroy the old placeholder pawn?

Alright, I’m going to do that.