I’m running my game in “Play As Client” mode with Number of Players set to 1, and I’m observing a mismatch in network roles:
My Character appears as ROLE_SimulatedProxy instead of ROLE_AutonomousProxy.
My Controller shows ROLE_AutonomousProxy.
I haven’t overridden any functions in GameMode, so I’m not sure why the Character’s Role doesn’t match the Controller’s. Has anyone else run into this issue?
your character is not being correctly replicated. and probably you’re testing a different character.
also a very common issue is that the world settings is spawning characters, ai, and spectators automatically. do verify that.
this is good as long as your controller, replication settings on the character, is fine. and you don’t spawn characters manually.
it might as well be that your player is not possessed by the controller at the time of replicating.
btw dont delay and then do once. call do once first, then delay. also i recommend using a timer instead.
if you are going to use a do once, then you don’t even need a tick. just add a timer on begin play.
it will save performance since you can disable the tick.
if any of this helps you please mark this post as solution, thanks.
Thank you for your response. I switched to a source-built version of the engine and debugged the PossessedBy function. It appears that SetAutonomousProxy(true) never runs, so I gathered more information and observed this behavior. In theory, NetMode == NM_DedicatedServer and IsLocalController() == true should never coincide, right?
My settings are still “Play As Client” with Number of Players set to 1. I’m using the correct GameMode class (a subclass of GameModeBase with no overrides), and I’ve configured the proper DefaultPawnClass and PlayerController. There are no Character instances placed in the level, and the spawned Character and its PlayerController are correct—I can even open widgets via the PlayerController.
the only way you can have a dedicated server is if you run a source build of the engine. you weren’t having that before right?
should is a really unhelpful word. what you say sounds logical, but still happens.
is your character set to be replicated right? have you ensured your controller is not doing anything weird? i suggest you go back to your world settings and set your character and controller to the default one. then see if the issue still persists. if it does one of them is creating issue. then add one at a time to figure out which.
(you can add a different blueprint to the world to query their attributes but be careful there could be more than 1 controller/character)
it might well be that your character is spawned not by the controller, but automatically.
that happens in some cases, i can’t recall when. i think it’s when you let the world spawn it automatically.
i cant recall 100% but i think the last time i did networking i was spawning my character from the controller itself. making sure i set the owner to the controller (spawn replicated actors on the server not the client.)
make sure your character is set to be replicated on the constructor (cdo) not begin play.
Yes, I had never used a source-built engine version before. Following your advice, I replaced both the Character and PlayerController, and finally discovered that the issue was with my PlayerController Blueprint. I subclassed the same base class to create a new PlayerController Blueprint and replaced the old one—and everything started working. I used Diff Selected to compare them and noticed the old Blueprint had “Replicate Using Registered Sub Object List” checked—however, even when both Blueprints had exactly the same settings, the old one still failed while the new one worked. It’s weird, but in any case, that fix did resolve the issue for me. Much appreciated!