Inherited Player Start broken with 4.10

Good Evening,

I came across a problem when porting my game from 4.9.2 to 4.10. Before I start to explain my problem, let me tell you that this works well in 4.9.2 and does not cause any problem whatsoever.

The issue has to do with the spawning. I have written my own gamemode and overriden “IsSpawnpointAllowed” and “IsSpawnpointPreferred”, as well as created a new class inherited from “APlayerStart”. My class “Coop Player Start” does have a “uint32 checkpoint”.

The idea behind this was that i will simply compare the checkpoint value of the player start and a specifc value in my player-state to determine if the player is allowed to spawn at this position. Of course at the very first beginning both numbers (in playerstate + the default spawn point) are 0. So far so good, but my 4.10 version won’t let me spawn on any custom player start. I can just spawn by using the normal “player start” (and only then when my custom playerstart’s id does not match with the id in my player state).

Even if i increase the numbers and walk to some kind of checkpoint to also increase the value in the player state. Normally if my character dies, it will be respawned at the last checkpoint reached. However if i reach a checkpoint (e.g id=1) and then kill my pawn it won’t respawn anymore at all. I am devastated at the moment because it has to have something to do with the upgrade to 4.10.
I hope that anyone can help me :slight_smile:
(I do use in fact nearly the same code to check the spawn points as the shooter example does)

Here are some code snippets (in case this might be helpful)

bool ACoopMode::IsSpawnpointAllowed(APlayerStart* SpawnPoint, AController* Player) const
{
	ACoopPlayerStart* PlayerSpawnPoint = Cast<ACoopPlayerStart>(SpawnPoint);
	if (PlayerSpawnPoint)
	{
		ABasePlayerController* PC = Cast<ABasePlayerController>(Player);
		if (PC && PC->PlayerState)
		{
			ABasePlayerState* PS = Cast<ABasePlayerState>(PC->PlayerState);
			if (PS && PS->GetSavepoint() == PlayerSpawnPoint->CheckpointNumber)
			{
				return true;
			}
		}
	}

	return false;
}

CoopPlayerStart.h

UCLASS()
class COOPBASIC_API ACoopPlayerStart : public APlayerStart
{
	GENERATED_BODY()
	
public:
	UPROPERTY(EditAnywhere)
	uint32 CheckpointNumber;
};

PlayerState.h & cpp

    	/* id of last savepoint */
    	UPROPERTY(Transient, Replicated)
    	int32 LastSavepoint;
    
    //cpp
    
    int32 ABasePlayerState::GetSavepoint()
    {
    	return LastSavepoint;
    }

If it helps I can also try to uploade a video of the way it is right now and how it should be.

P.S: If i do have the normal “playerstart” and my own “coopplayerstart” (with id 0) placed in the level, the character doesn’t get spawned and I’m like stuck in the ground and can’t move, like here:

Cheers
Theo

parent game mode: ACoopBasicGameMode
child game mode: ACoopMode

http://puu.sh/lLQEe/3da041e727.png

http://puu.sh/lLQGo/bda0f6c366.png

http://puu.sh/lLQIm/59c2e4179c.png

http://puu.sh/lLQLd/3f685cb54c.png

sadly not fixed with 4.10.1

Hello Theololz,

I don’t know immediately of any changes to PlayerStarts that have occurred between 4.9 to 4.10 so nothing comes to mind immediately. Due to how involved this process is and the time it would take to set up a reproduction case, would it be possible to get a sample project that this issue occurs in? If you can and wish for it to remain private, you can send it to me in a private message at [this link][1]. Otherwise you can post a link to a download to it here.

If you are unable to for any reason, please let me know and I’ll work on getting a reproduction case set up, as this seems like something that would require some debugging.

Thank you for sending me the project, Theololz. Nothing is jumping out at me immediately but I did notice that you’re using Git source control. Do you happen to have a version of the project from 4.9 or earlier that works correctly? It would be useful to have both the working copy and the broken one. I’ll continue investigating either way.

You are welcome, . I do happen to have the 4.9 working version and I am going to send it to you later today. Regarding Github, I actually used it in the project but not any longer than the very first few days. Thank you so much for looking into this.

I reckon it could have something to do with this: [createplayer is not spawning pawn][1]. But I’m not quite sure. It might still be me doing something wrong.

Edit: Yes it is the same problem. The player can’t be spawned because it says that there was a collision at spawn location. However I only spawn 1 character so there shouldn’t be any collision at all.

http://puu.sh/m3rrd/02869961f3.png

Something definitely seems to be up with the difference between Player Starts and classes inheriting from it. There is also an issue with collision obviously. If you move your player start up about 50 units in the Z axis, it should work perfectly fine, meaning it is somehow having collision problems with the floor. Another odd thing is that this also happens with the normal Player Start, but the normal Player Start knows to spawn the character in the middle of the map instead of at 0, 0, 0.

I’ve found something else interesting as well. If you create a new map and place a normal Player Start over the default floor and then hit the “End” key (snaps it to the surface below it), it’ll work correctly. If you place one of your custom player starts in the level and then remove it, the original player start then begins spawning the player at the middle of the level when it is on the floor.

I’ll be investigating and most likely reporting this issue. In the meantime, I’d suggest not letting your player starts touch the floor.

Have you had a chance to see if you’re getting the same behavior, Theololz? I want to be sure that the workaround can work for you for now at least.

Yes! It does work when i put the player starts up in the air. Thank you very much :slight_smile:

Hello Theololz,

I can’t seem to reproduce this issue in a fresh project and without a clear reproduction, it’s hard to look into the cause. As there were no major changes to Player Starts between 4.9 and 4.10 that doesn’t give much of an idea either. If the workaround works well enough for you, I’ll be dropping my investigation into the issue. If you are still having issues however, please let me know and I’ll continue investigating.