Player controller index

I’m just trying to wrap my head around something. When you start up a default third person game and put a keyboard event print string in the character to print the player controller it shows up as player controller for the server and player controller 1 for client 1.

does it run as a LAN connection test?

And if not, wouldnt both come back as player controller as the client 1 should not be able to tell it’s the second controller?

Thanks

Are you running the game networked? UE4 does quite a few things with the PLCs (Player Controllers) behind the scenes…-

First if you’re running the game networked, UE4 actually creates PLC stubs (dummies) on the server that it uses as a kind of mailbox for networking. It creates this for the hosting player running the server as well. So PLC(0) is the local host players actual PLC, PLC(1) is their network stub/mailbox, PLC(2) is the remote players actual PLC running on the remote client, and PLC3 is the remote players PLC stub/mailbox created on the server… These indexes also get incremented each time a new level is loaded (as the PLCs are destroyed/reinstanced with each new level load/session join), so will increment to PLC 4/5/6/7…

Also when running networked in PIE UE4 does some bookeeping for you and knows that you are running 2+ players so instances the remote PLC with an incremented value, I guess as although its simulating two remote machines, its actually instancing them from a central core where it increments the index… It does actually help when debugging in development as well as you know from the PLC index whether its the host/remote/stub etc…

Edit: Scrap what I said above, see post below

Well,
I started creating a networked game, and had players create their characters then join their own starter maps, from there they could take their character and host/join into a listen server. Before I went much further I figured I’d test it.

The server has PLC0 and PLC1 in the controller array (when running 2 in PIE) and when I run a print string to get the PLC name, both the server and the client return a PLC0. Which at first I thought made sense.

So then I decided to create just a blank 3rd person test game and run the same print string to pull the PLC name, which returned PLC0 for the server and PLC1 for the client, which made me question how I set things up.

So, if PLC0 and PLC1 are the servers PLC and stub, then the client isnt being fully recognized yet?

Hey, I ran these tests a couple of years ago, so it could have all changed a bit… Below are screenshots of the code I put into the PLC to auto run at Begin Play to try and work out what it was doing…

(Note: Print String node enable “Print to Log” as the logfile print also includes the object instance indexes)
(DbgOpPrefix is just this player controllers get display name)

Sorry, scrap the first post above, I misremembered, you got me curious so I went back and had a look at my old run logs. Yep there is a PLC 0 for the local player on both the client and the server, PLC1 and PLC2 are the mailbox/stubs on the server. Probably worth running the tests again though if you want to be sure…