Server call from SimulatedProxy ?

Hello !
I’m trying to make a debug widget to show data from server and proxy versions of the same actor, so each one would send a RPC call to a replicated actor, which would store the values. But there is a problem :
Can you somehow call a server RPC from a simulated proxy ? It doesn’t have any owner so I don’t know if it’s possible, even if it’s a hack it doesn’t matter since it’s just about debugging.
Thanks :slight_smile:
Rémy

PS : I know about AddDebugMessage, but it’s ugly :stuck_out_tongue:

I’m afraid you can’t. Such an RPC event will be dropped.

I don’t know of any hacks that will let you do this, perhaps someone else can chime in.

Okay :frowning: thanks !

if what I’m trying to do can’t be done, it must be dumb anyway xD

You could use the PlayerController to pass data to the server, from your SimulatedProxy. The thing you have to figure out is how to store the pointer to the PlayerController. But that shouldn’t be much of an issue. :slight_smile:

Mmh not sure which controller you’re talking about. Let’s take the example of a possessed Character, the AutonomousProxy of it has an owner, which is the client PC controlling it.
But the SimulatedProxy doesn’t have any (GetOwner() returns nullptr ), in fact if I’m not mistaken the only Controller it could eventually get access to is the one of the player associated with its GameInstance ? Because both its client and server PCs “controlling it” don’t exist at all in its game instance, if I’m not mistaken once again ?
So maybe the trick would be to manually assign it as its owner ? Without owner it can’t make RPCs in all cases.

Yeah I’m quite new to UE Networking so some things are still confusing to me, I think it’s a bit too much for now, I’ll go back to it when I understand a bit more how everything works. And I never saw anybody with a debug UI working with multiplayer, it doesn’t exist in the marketplace, so not sure if it’s possible at all.

It would be great tho, because printing to screen or to logs suck a lot, I wish I had an UMG widget, where I could sort everything as I like, enable / disable stuff on the fly. I did it for single player and that’s soooo much better.

Anyway thanks for the answers !

There’s a PlayerController on the client where the SimulatedProxy exists. When you want to “log” your stuff, you find the controller, like this:


APlayerController* const PlayerController = Cast<APlayerController>(GEngine->GetFirstLocalPlayerController(GetWorld()));

Then you call a method on the controller which you’ve created, which sends the RPC to the server. The server then stores whatever you want stored.

The server can also call this method, which will just store the value without any RPC.

Is that what you had in mind? :slight_smile:

Oh yeaah I’m dumb I forgot you could easily get the local controller like this, that’s a good start !

So it would go like SimulatedProxy(client) -> (calls a function on) -> LocalController(client) -> (calls RPC on) -> LocalController(server) ? The proxy would just call a function on the controller, and the controller would make the RPC itself ?

Ehhh it could work thanks a lot, I’ll try that !

Does it really work ? Can any actor call a function on the local PC which upgrades it to a RPC ? That would be convenient, I’ll try that when I get home

Yeah, as long as the client owns the controller.