# Pawn not in the iterator list in clients when start points are distant

**URL:** <https://forums.unrealengine.com/t/pawn-not-in-the-iterator-list-in-clients-when-start-points-are-distant/432558>\
**Category:** Multiplayer & Networking\
**Tags:** client-server, unreal-engine, question, CPP\
**Created:** [August 27, 2018, 1:57pm UTC](https://forums.unrealengine.com/t/pawn-not-in-the-iterator-list-in-clients-when-start-points-are-distant/432558 "2018-08-27T13:57:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![domzorg](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/domzorg/32/906605_2.png) [@domzorg](https://forums.unrealengine.com/u/domzorg)\
**Post date:** [August 27, 2018, 1:57pm UTC](https://forums.unrealengine.com/t/pawn-not-in-the-iterator-list-in-clients-when-start-points-are-distant/432558/1 "2018-08-27T13:57:30Z")

</div>

I have a strange behavior with clients connected on a dedicated server.

I have two different maps with start points.

Map5 where the start points (circles in the image map5.png) are placed very close one from the other.

 ![251715-map5.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/e/a/0ea5d9fd1155b8e4f7a8a7008929bc1ce18cdc65.png)

In this map, when the players (two clients) are spawned at start point, the client can see all pawns using the code below from the PlayerState.

```
		for (FConstPawnIterator Iterator = GetWorld()->GetPawnIterator(); Iterator; ++Iterator)
		{
			APawn* Pawn = Cast<APawn>(*Iterator);
			AKPlayerCharacter* Char = Cast<AKPlayerCharacter>(*Iterator);
			UE_LOG(LogKSGMState, VeryVerbose, TEXT("AKCharacterState::GetPlayerCharacter - iterator Pawn=%s Char=%s Char->PlayerState=%s"), *GetNameSafe(Pawn), *GetNameSafe(Char), (Char != NULL) ? *GetNameSafe(Char->PlayerState) : TEXT("NULL"));
			if (Char != NULL && Char->PlayerState == this && !Char->IsDead())
			{
				CachedCharacter = Char;
				UE_LOG(LogKSGMState, VeryVerbose, TEXT("AKCharacterState::GetPlayerCharacter - Found Char=%s assigned to CachedCharacter"), *GetNameSafe(Char));
				return Char;
			}
		}

```

In the client log, I can see the two players  
[2018.08.27-13.52.10:296][962]LogKSGMState: VeryVerbose: AKCharacterState::GetPlayerCharacter - this=KCharacterState\_1 CachedCharacter=None GetOwner()=None GetWorld()=T-Map5  
[2018.08.27-13.52.10:296][962]LogKSGMState: VeryVerbose: AKCharacterState::GetPlayerCharacter - iterator Pawn= **BP\_PlayerCharacter\_C\_0** Char=BP\_PlayerCharacter\_C\_0 Char-\>PlayerState=KCharacterState\_0  
[2018.08.27-13.52.10:296][962]LogKSGMState: VeryVerbose: AKCharacterState::GetPlayerCharacter - iterator Pawn= **BP\_PlayerCharacter\_C\_1** Char=BP\_PlayerCharacter\_C\_1 Char-\>PlayerState=KCharacterState\_1  
[2018.08.27-13.52.10:296][962]LogKSGMState: VeryVerbose: AKCharacterState::GetPlayerCharacter - Found Char=BP\_PlayerCharacter\_C\_1 assigned to CachedCharacter

On Map6, the distance between start points is much bigger.

 ![251719-map6.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/7/3/0738c60e1601bee15f5e287b8d145b072d4e7341.png)

The problem reside in the fact the clients does not have all pawns. Only their pawn and not the other one.  
The same code, to run through pawns have only one pawn.

In the client log :  
[2018.08.27-13.48.29:324][220]LogKSGMState: VeryVerbose: AKCharacterState::GetPlayerCharacter - this=KCharacterState\_1 CachedCharacter=None GetOwner()=None GetWorld()=T-Map6  
[2018.08.27-13.48.29:324][220]LogKSGMState: VeryVerbose: AKCharacterState::GetPlayerCharacter - iterator Pawn= **BP\_PlayerCharacter\_C\_0** Char=BP\_PlayerCharacter\_C\_0 Char-\>PlayerState=KCharacterState\_0  
[2018.08.27-13.48.29:324][220]LogKSGMState: VeryVerbose: AKCharacterState::GetPlayerCharacter - iterator Controller=KPlayerController\_0 Pawn=BP\_PlayerCharacter\_C\_0 Char=BP\_PlayerCharacter\_C\_0

Is there any optimizations made on the server to not replicate players not visible.  
This is the same code and the same map, except the distance between start point.

---

<div class="post-metadata">

**Author:** ![dZh0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dZh0](https://forums.unrealengine.com/u/dZh0)\
**Post date:** [August 27, 2018, 2:33pm UTC](https://forums.unrealengine.com/t/pawn-not-in-the-iterator-list-in-clients-when-start-points-are-distant/432558/2 "2018-08-27T14:33:52Z")

</div>

Yep. There are a few optimizations part of the network code.

I think In your case the characters are occluded by network relevancy.

Check this documentation: [Actor Relevancy and Priority | Unreal Engine Documentation](https://docs.unrealengine.com/en-US/Gameplay/Networking/Actors/Relevancy)

You should be able to go around this if you make all the player characters `bAlwaysRelevant=true`

---

<div class="post-metadata">

**Author:** ![domzorg](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/domzorg/32/906605_2.png) [@domzorg](https://forums.unrealengine.com/u/domzorg)\
**Post date:** [August 28, 2018, 6:57am UTC](https://forums.unrealengine.com/t/pawn-not-in-the-iterator-list-in-clients-when-start-points-are-distant/432558/3 "2018-08-28T06:57:47Z")

</div>

This is exactly the problem.

Thank you so much.
