# Question about Player Controller and Networking

**URL:** <https://forums.unrealengine.com/t/question-about-player-controller-and-networking/1710111>\
**Category:** Programming & Scripting\
**Tags:** Networking, playercontroller, unreal-engine, Blueprint, question\
**Created:** [February 24, 2024, 6:39pm UTC](https://forums.unrealengine.com/t/question-about-player-controller-and-networking/1710111 "2024-02-24T18:39:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pajgla1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pajgla1/32/755355_2.png) [@Pajgla1](https://forums.unrealengine.com/u/Pajgla1)\
**Post date:** [February 24, 2024, 6:39pm UTC](https://forums.unrealengine.com/t/question-about-player-controller-and-networking/1710111/1 "2024-02-24T18:39:22Z")

</div>

Hi all,

At some point I thought I understand how to handle replication, but I am more lost then ever. Here is quick description of my setup, I will get to the question after:

I am using PlayerController to handle inputs (Enchanted Inputs)., here is a quick snippet:  
[Player Controller snippet posted by anonymous | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/z4xjtau6/)

And this works okay (since I ask for controlled pawn specifically), but I also do a traceline on Tick event in the same Player Controller to check if player is looking at interactable object and I just noticed it executes on every player controller (server + client). Even if I move my logic to player controlled pawn, it will execute for all pawns - locally controlled and replicas.

Also, HasAuthority returns true only on server for all player controllers, which I understand, since the server is owner of these, but is it possible to have a ‘local only’ logic somewhere or somehow?

This is a co-op game, and I do not need server to check everything or to have the whole logic on the server. If client says that, for example, it wants to interact with an actor, server should trust that and replicate the event.

Bonus question: since lots of tutorials rely on server to check the collision (basically everything), doesn’t this make more performance stress on the server? Why can’t we do collision check on client side and just notify the server that we hit something?

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [February 25, 2024, 4:11am UTC](https://forums.unrealengine.com/t/question-about-player-controller-and-networking/1710111/2 "2024-02-25T04:11:32Z")

</div>

the 2 main reasons are cheating and desync since the client will always be behind the server due to lag it’ll get incorrect collisions.

for local coop though nothing should need to be replicated because everyone is on the server.

---

<div class="post-metadata">

**Author:** ![Pajgla1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pajgla1/32/755355_2.png) [@Pajgla1](https://forums.unrealengine.com/u/Pajgla1)\
**Post date:** [February 25, 2024, 12:10pm UTC](https://forums.unrealengine.com/t/question-about-player-controller-and-networking/1710111/3 "2024-02-25T12:10:03Z")

</div>

Thanks for the answer!

I actually made a mistake, its not a ‘local’ coop game, just a coop game.

I still do not understand how should I handle trace for checking if the object we are looking at is interactable. Seems like an overkill for server to trace each character and send an event when client is looking at something that can be interacted with.  
Is there a way to do it locally only, for the owning pawn?

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [February 25, 2024, 1:34pm UTC](https://forums.unrealengine.com/t/question-about-player-controller-and-networking/1710111/4 "2024-02-25T13:34:35Z")

</div>

yep, use this

> **[APawn::IsLocallyControlled](https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/GameFramework/APawn/IsLocallyControlled/)**
>
> Returns true if controlled by a local (not network) Controller.

but i dont recommend it, you’ll still want server authority, for example if 2 players try to use the same interactable at the same time you could get problems/bugs.

---

<div class="post-metadata">

**Author:** ![Pajgla1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pajgla1/32/755355_2.png) [@Pajgla1](https://forums.unrealengine.com/u/Pajgla1)\
**Post date:** [February 25, 2024, 8:56pm UTC](https://forums.unrealengine.com/t/question-about-player-controller-and-networking/1710111/5 "2024-02-25T20:56:20Z")

</div>

I already do use it, but I wasn’t sure if that’s an okay approach.

Regarding 2 players using an interactable item, wouldn’t it be sufficient to only consider who contacted the server first?

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [February 26, 2024, 3:49am UTC](https://forums.unrealengine.com/t/question-about-player-controller-and-networking/1710111/6 "2024-02-26T03:49:31Z")

</div>

exactly, but that has to be server side due to lag otherwise there will be a brief interval where both can effectively use it

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 27, 2024, 3:49am UTC](https://forums.unrealengine.com/t/question-about-player-controller-and-networking/1710111/7 "2024-03-27T03:49:58Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
