#multiplayer

1 messages · Page 28 of 1

abstract pike
#

It seems like unloading the old one is that correct?

fathom aspen
#

I have no idea what's that

#

This is a cropped image

#

Of code that I have no idea what it does

abstract pike
#

Ahh yea I found the other in source, it's the entry and exit of the function logs I see

#

OK yea so HandleSeamlessTravelPlayer is called 3 times when it should be called 4 times

fathom aspen
#

Being fully dependent on logs isn't something you will want to stick to on the long run

abstract pike
#

So not all 4 players are travelling it seems

abstract pike
fathom aspen
#

I mean it should happen again ofc for you to be able to debug it

#

But it seems that my fears are true

#
abstract pike
#

Oh UE5 related

fathom aspen
#

You are probably being faced by this nasty bug

abstract pike
#

That makes sense, it happens since we upgraded

fathom aspen
#

100% this then

#

And it's hard to repro

abstract pike
fathom aspen
#

This the bug that I will be trying to PR because it doesn't seem that anyone have reported it yet

abstract pike
#

I was having trouble

abstract pike
fathom aspen
#

And it's UE5 related. Didn't happen in the UE4 days

abstract pike
#

Gosh it's nice knowing what the problem is

#

I was really lost

twilit radish
#

The Unreal experience™️

abstract pike
#

Thanks so much for your help walking me through that

#

I was fearing a week of being confused and stressed

fathom aspen
#

No worries, you gained some traveling knowledge along the way

#

Make sure to read that compendium

abstract pike
#

It's so so nice to find good resources for unreal which is often such a mystery

fathom aspen
#

It's not hard to fix it, as they walk you through fixing it

abstract pike
#

I see a few people mentioning it seems to be fixed in 5.1, do we think it's worth just going to 5.1 for it?

fathom aspen
#

But it would be much far better if Epic provided their own version of fixing it

fathom aspen
#

Or where do you see that?

abstract pike
#

In the thread you linked it was an edit

#

I haven't paid any attention to 5.1 till now though, is it somewhat unstable since it's preview?

fathom aspen
# abstract pike

Hmm, ok I have missed that, but still not quite sure if that fixes it, as that code somehow already exists (not in this form ofc) in 5.0.3

#

I will take a look at their github branch

abstract pike
#

I think given we're alpha we can probably go 5.1 preview just fine until the proper release since the biggest issue we're facing at the moment is definitely this bug

vernal gorge
#

soo need help i can create instanses/server and i can join with another instance/client to the server but another client can not move and ik its a code issue but i have no idea how to make it work lol im in 5.0.3

fathom aspen
#

Wow, that saved some few precocious hours

#

What's weird though is that they did it all silently... good one Epic

#

And fwiw there's another bug that is travel-related that they fixed in 5.1

abstract pike
abstract pike
fathom aspen
vernal gorge
fathom aspen
#

This question usually goes to the OP. Of course this happened after you did something something that I'm not aware of

vernal gorge
#

welp fuck

fathom aspen
#

Anyways look into the logs

#

That's at least what I will start looking for

vernal gorge
#

well there is no error im pretty sure the clients have no way to move because it cant talk to the server

#

just idk how to do that

fathom aspen
#

Yeah there's no error I can see

#

You don't know what? To look into the logs?

vernal gorge
#

no..

#

to make the client talk to the server..

fathom aspen
#

server RPC

#

Usually

vernal gorge
#

RPC is what...?

fathom aspen
#

Remote Procedure Call

#

A function that is executed async and is called in one space and executed in another

vernal gorge
#

im so confused... xd*

#

currently im using p2p

#

and only server client can move

fathom aspen
#

Listen-server it's called

#

That's not useful info to me

#

You can't expect me to magically tell you what's going on with trivial description to your problem

vernal gorge
#

ik...

#

but i also have slighly no idea what i have to do/What working lol

#

sorry for being so inexpersience..

fathom aspen
#

I already told you where to look, but you didn't get the time to look there

#

And you are being determined that they have no errors

vernal gorge
#

well... i cant find anything called rpc or listen-server

#

i dont even know where to look to find it

#

ik networking/servering is not magic and its hard and i was the only one that said sure ill dab in to it to try to understand.. its slight pain

fathom aspen
#

Ok this gets you one step closer to finding the problem. The logs can either be found in the Output Log window or in /Saved/Logs

fathom aspen
#

Along with the other useful resources in this channel pins

vernal gorge
#

thanks ill do that tommoro when i have a brain..

#

welp i think i figured out why it cant move
will remember the /saved/logs

fathom aspen
#

And that is probably being logged because you have a PlayerStart that is encroaching geometry

#

Make sure you have enough PlayerStarts and they are placed well in the level (nothing encroaches them whatsoever)

vernal gorge
#

wait so it matter how many players starts i have?

fathom aspen
#

If you only have one then most likely all your clients will spawn in that one

#

So yes it matters

vernal gorge
#

oh well so far that wasnt my least issue

#

but stange its not in any geometry...
if it doesnt count the original start position of the player..

abstract pike
#

Oh that's actually a question I have, is there a way to turn off the requirement for player starts? Our logs always have a warning for no player start found but we spawn all our stuff differently anyway.

fathom aspen
#

That was a pure guess, you should be able to breakpoint that log warning and trace your way up @vernal gorge

fathom aspen
abstract pike
#

Though now I'm thinking I should probably go look through the game mode code as maybe there is a flag

fathom aspen
#

Then override RestartPlayer in your GameMode class and make sure FindPlayerStart isn't being called

#

I'm not sure how your spawning logic works, but if you don't use PlayerStarts then ResartPlayer shouldn't be calling FindPlayerStart

abstract pike
fathom aspen
#

This is an example of an overridden RestartPlayer

void AMyGameMode::RestartPlayer(AController* NewPlayer)
{
    if (NewPlayer == nullptr || NewPlayer->IsPendingKillPending())
    {
        return;
    }

    const AMyPlayerState* PS = NewPlayer->GetPlayerState<AMyPlayerState>();
    if(PS && PS->IsReconnecting())
    {
        RestartPlayerAtTransform(NewPlayer, PS->DisconnectedHeroData.Transform);
    }
    else
    {
        AActor* StartSpot = FindPlayerStart(NewPlayer);

        // If a start spot wasn't found,
        if (StartSpot == nullptr)
        {
            // Check for a previously assigned spot
            if (NewPlayer->StartSpot != nullptr)
            {
                StartSpot = NewPlayer->StartSpot.Get();
                UE_LOG(LogGameMode, Warning, TEXT("RestartPlayer: Player start not found, using last start spot"));
            }
        }

        RestartPlayerAtPlayerStart(NewPlayer, StartSpot);
    }
}
#

For example if the player is reconnecting I restart player at old transform instead of PlayerStart

#

You can find the full context in the compendium I pointed you to earlier

vivid prawn
#

a quick question, if I create a session with bUseLobbiesIfAvailable set to True, do I need to change it to false when I want to start game? otherwise how does FOnlineSessionSearch know if a session is no longer a lobby?

#

or do i need to create another session and set bUseLobbiesIfAvailable to false?

#

but I don't think one user can create more than a single session at a time.

#

correct me if i'm wrong, but what I understood, bUseLobbiesIfAvailable is a way to know if the game is started, if it is not (still in the lobby) other players can join the session.

#

oh there is UpdateSession, i think i got my answer

shy yarrow
#

how can save the highest record with some data of players for a multiplayer game in game? does Steam provide a data base for us?

plush wave
#

Does GetUniqueNetId not exist on the local player anymore?

shy yarrow
#

some data , like the highest kill , what weapons players achieved ,etc

mortal tusk
#

Help my client successfully joined server but it wont travel through levels
what code should i add?

fossil spoke
#

Traveling in the Editor doesnt work in a multiplayer setup.

#

Also make sure you have enabled Seamless Travel on the GameMode.

#

You need to test level transitions in a Standalone build.

mortal tusk
shy yarrow
vivid prawn
#

@mortal tusk or create a .bat file and run it multiple times
Start "" "[PATH]\UE_5.0\Engine\Binaries\Win64\UnrealEditor.exe" "[PATH]\[PROJECT]\[PROJECT].uproject" -game -log

#

so you don't need to package it every time you make changes

thin stratus
#

100% no need to package it every time. You can even just right-click the uproject file and press launch game

brazen glacier
#

I'm building a more data-driven game framework for quick load times. Using a lot of soft refs in data tables and such. I had a thought: I could make it so the dedicated server frontloads everything in the game, all hard refs, so I don't have to worry about it attempting to use soft refs or make wasted loading calls, since initial game load times don't matter for a dedicated server.

Is this a dumb way to think about it, or am I onto something?

chrome bay
#

Depends what it is. The Server doesn't load a lot of stuff, textures, sound, particles etc.

#

Presumably you wouldn't want to load all assets in your game either - but if you can preload things, you generally should.

echo dragon
#

i have some pawn swap behaviour, when i change pawn with the client player everything works fine, but when i do with the host i crash when using GetLocalViewingPlayerController()->SetShowMouseCursor(true);

inside the Restart method, can someone help me understand why?

#

i'm even checking IsLocallyControlled before calling that

chrome bay
#

Callstack + Log should show why. Best guess, it's not controlled by a player controller

clear gate
#

Hello, I have a weird problem. I have a multiplayer game all working correctly, but when I crouch, sprint or jump (effectively when changing speed) the client can see a noticeable jitter. Has anyone encountered a similar problem? May it be a problem with the movement component? I am using ue5 blueprints and am changing movement speed on client, and then on rpc server

low helm
#

post pic of the RPC

clear gate
#

very simple

#

it also jitters a lot if i spam the crouch/sprint button

kindred widget
# clear gate

If you want higher speeds, usually you also need to set the distance error check thing larger as well. And I would encourage you to simplify your system a little.

You don't really need a crouching system. Character already handles that for you.

And your sprint can be nothing but a replicated float. For instance, if you add a third player to your game right now or even sprint on the listenserver pawn while watching it as the client screen, it's going to break. You're not telling anyone except the player controlling the pawn and the server to increase the speed. You should have a single Reliable RPC with a boolean input that RPCS control intentions to the server. Send True for Pressed, false for released. On True, set a replicated float to 800 speed, in it's RepNotify you do the actual CMC movement speed change there. On Release, you set the same float back to 450.

Once this is all working correctly for three players total, then and only then should you start doing local prediction.

brazen glacier
#

Is there any downside to doing it this way?

#

Lets say the game is massive, with thousands of items with static meshes

chrome bay
#

It depends, you might not need them all straight away - and you need to have enough memory to load them all at once in the first place

#

You wouldn't load assets for the map you aren't currently in, for instance

brazen glacier
#

Let's say it's one large map. I think I got the answer though - memory limitations on the server

#

Ty!

twilit radish
#

Just download more RAM™️

clear gate
clear gate
#

Now the sprint works fine on server and other players see it correctly but its super choppy on client

#

Should i set the movement component to replicated?

kindred widget
#

Try to up the NetworkNoSmoothUpdateDistance in the CMC to a maybe 80% of your max speed.

clear gate
#

Thank you, it seems to work very well now, but a problem persists that if i spam the sprint button it gets unbelievably laggy for the client

twilit radish
#

That's because the CMC doesn't really work well with it this way. The logic it runs is probably very often desynced from what you're doing, but this can't be fixed with Blueprints as that code is all C++, hence why Authaer is suggesting to just make the server allow more of the weirdness that comes from it.

clear gate
twilit radish
#

You need to extent the CMC to include the speed into its process. There's a video pinned in this channel that goes over it.

clear island
#

it works very well for me as long as the ping is consistent, but if you have connection problems and your ping has random spkes (even small ones), I get jitter when spamming crouch

kindred widget
#

At least extending the CMC is much easier in 5. 😄 Create a subclass, and just change it in the Dropdown in your BP class.

clear island
#

so the value of NetworkNoSmoothUpdateDistance should be close to the running speed? I'm not familiar with this property

#

and are there docs about it? what does it do specifically?

#

ok I just checked the source

kindred widget
#

That's what usually causes the snappy lagging look. If a character runs outside of this distance on a client, and server sends current position. If you're outside of it at that point, it'll just snap you to server location.

clear island
#

seems like theres a comment

#

ah I see

#

so I guess a higher value would allow for a more smoother/client authoritative gameplay experience but probably more open to possible cheating

kindred widget
#

Not so much cheating. Server still holds the real position. But larger values can eventually lead to a larger desync of where client thinks it is versus where server says it is at times.

#

"Lol wtf, that tank just ran me over. I WASN'T EVEN STANDING THERE"

clear island
#

hmmm I see

rocky night
#

HI, i try to implement Interfaces.. so in the end the BP is printing received on Client... but doesnt do the Customevent. IS there something i miss? IT DOESNT PRINT ON SERVER :X

#

thast how the event is replicated.. if i call it normal without interface it works on client and server...

eternal lake
rocky night
#

i figured it out

#

just now

#

in the player whos causing it i need to replicate the dang interaction to

#

thast really inconvinient

#

its from the BP which i call the action in

#

but works now

#

rpc hell

#

or do i not need to?

real ridge
#

guys do you have idea why nothing of this is called when I run game as listen client?

#

I am calling server function in game mode

clear gate
#

I believe game mode is only on the server and cant multicast

real ridge
clear gate
#

Can you show us how the SetServerName is called?

swift pulsar
swift pulsar
real ridge
clear gate
#

Maybe its trying to run it before the character exists, i suppose you want it to run as soon as the game starts

real ridge
#

in game mode

real ridge
#

and is executed there

clear gate
#

I would put it in actor beginplay instead of game mode, then it should work

swift pulsar
#

I'm not 100% sure, but I think Server events have to be called from Net Owning Clients. That would explain why this one can't be called like this from the server (Game Mode).

#

Try setting the Set Server Name event as Not Replicated. It should be called on the server anyway, as it's called from the Game Mode.

real ridge
#

i know how to replicate everything this worked for me in ue4

#

and here I'm ue5 same way not working

vernal gorge
#

is there anyway to have a varible local or am i thinking wrong? im currently using this to get a smooth rotation added but im pretty sure that "Rotation" is making it not work but i need it there to have a smooth because im using it as a position to mesure distance and then lerp
trying to find the problem but cant find only work on server/host

#

and in the thing

storm bough
#

So now I am trying to implement light switch in my UE5 C++ multiplayer test project. It has replicated property SwitchState. For now I wrote code handling it normally (meaning as if it was owned by player).

    // Client reacts on State change caused by server here.
    UFUNCTION(Category = "Switch")
    void OnRep_SwitchState();
    // Flips switch.
    UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Switch")
    void FlipSwitch();
    void FlipSwitch_Implementation();
    // Response to SwitchState being updated. Called on the server immediately after modification, and on clients in OnRep_SwitchState().
    UFUNCTION(BlueprintCallable, Category = "Switch")
    void OnSwitchStateUpdate();
...
    // True - turned on, false - turned off.
    UPROPERTY(ReplicatedUsing = OnRep_SwitchState, BlueprintReadWrite, EditAnywhere, Category = "Data")
    bool SwitchState;

Problem here is that light switch actor is not owned by anyone (being part of level and any player could use light), so trying to use it has no effect multiplayer-wise (only works on host and even then it is not replicated to client, and client cannot use it at all). What to do in this kind of situation?

upbeat basin
#

So it kind of depends on what kind of control you want your players to have over the switch

storm bough
#

That roundabout way sounds like utter pain in ass. I mean, I would have to implement it for every interactable thing in level.

upbeat basin
#

I don't think that's a roundabout. If you want all your players to be able to change a state in server, then RPC should happen from something they own (I would personally use Controller)

#

So you need a generic interact RPC on your controller and then do the interaction on the server

storm bough
#

yeeeah looks like I will have to do something like that. sigh

upbeat basin
#

Or you can pass the actor that you want to interact on that RPC as well but that might cause security issues

storm bough
#

my game is intended to be single or coop, so security is not as problematic as it could be in competitive deathmath

upbeat basin
#

Design of that part (where the checks should be) totally depends on your requirements. But if you want any of the coop players to be able to switch the light then you're required to implement the RPC on one of your owned actors

storm bough
#

yes, my requirement is that any player can use switch

#

so basically I need to call server using RPC from something I own (like player controller) and with information which object is subjected to interaction

upbeat basin
#

I don't know if that's the only solution to your question, but that would be my way to do it

storm bough
#

thanks for help

dark edge
#

You can only RPC (Run on Server Event) in an actor that YOU own as client. THat's your pawn, playercontroller, playerstate, or anything that you're set as owner of.

storm bough
#

interaction component (that I already have) on player character should qualify

#

so pretty much I will be doing it on pawn

dark edge
storm bough
#

interface

#

interaction component traces stuff in front of player and checks if any detected object implements interaction interface

dark edge
#

Ya that's a good and common way to do it

twin juniper
#

Is PostLogin executes after the client has loaded all replicated actors on the level or before?

latent heart
#

I would expect before.

#

There's no "after everything is replicated" event.

kindred widget
crystal crag
#

Yep. That's why Lyra has a system in-place to check if things are properly replicated before handing control over to the user

blissful dagger
#

Guys, is it possible for an actor to do something on BeginPlay depending on which players computer it has just been loaded? Like check if player has something

errant hollow
#

is it necessary to do the port forwarding to create a multiplayer game, someone help me im a beginner

dark edge
#

Yes, if you're not

errant hollow
dark edge
storm bough
#

Can replicated variables be changed (and replicate successfully) when called from normal UFUNCTION (without Server/Client etc parameters)?

dark edge
storm bough
#

hmmm

dark edge
#

That's kind of the point

kindred widget
#

Oh, hi lag spike. O.o

#

Didn't see Adriel's reply. 😄

storm bough
# kindred widget Yes. As long as that function is ran on the server.

and it is fine if was called on server in different place? My chain is like this:
InteractionComponent.Interact() (called from keyboard input in local player character) -> InteractionComponent.ActuallyInteract() (this is Server RPC, component knows what actor should be interacted with) -> InteracteeActor.TriggerInteraction() (this is interaction interface) -> InteracteeActor.FlipSwitch() (this is where replicated variable - state of light - changes)

#

currently it works only on host... it does not seem to replicate to client

#

in fact client can interact with light and it will light up on server but not on client!

kindred widget
#

What is InteractionComponent on?

storm bough
#

on player character

#

it is owned by player

kindred widget
#

Seems fine. You're using an OnRep?

storm bough
kindred widget
#

Is Switch an actor or component?

storm bough
#

LightSwitch is actor

kindred widget
#

And the actor itself is replicated?

#

Make sure to check the instance in the level as well if it was preplaced.

storm bough
north forge
#

Is player controller 0 always the Host pc on a Listen server? If not how can I determine which one is?

kindred widget
#

PlayerController0 will return the first player controller created on a machine. This is "Usually" the listenserver controller, but you cannot promise it in some cases.

north forge
kindred widget
#

GetWorld()->GetGameInstance()->GetFirstLocalPlayerController()

#

That will safely get you the actual local controller regardless of creation time differences.

blazing spruce
#

Hi, I'm having an issue getting a widget to display correctly.. I have a base class (bottom image) which all of my interactable actors are children of, in the base class it has 2 overlaps, a sphere overlap where, when inside, a widget is displayed indicating that something can be interacted with, then a box overlap that when inside, will display the interaction key (E key) widget

There are certain doors in the game that can be locked, so if the player holds the interaction key it'll lock the door, this is where the widget with a padlock should appear indicating that its locked, the issue im having is that the padlock widget doesn't display immediately to all players who are within the box overlap at the time of locking the door, I do however have it set up with my overlaps.. because the padlock should only be visible to players who are within the box overlap of the door, based on the if check in my interaction base BP it'll display the widget fine for all players properly when they enter the box overlap and remove itself when they leave but I need it to display when the player actually locks the door.. right now if you lock the door you have to leave the overlap box and re-enter to see the locked icon

I tried calling the LockedWidgetFadeIn event after locking the door but that made the widget display only to the server player if they were the one to lock the door or if the client player locks the door the widget only displays to the server regardless of if they were in the overlap or not.. I also tried adding it into the IsLocked rep notify but that displays it to all players regardless of if they were in the overlap or not as well

#

Any ideas on how I can get the padlock icon to appear immediately for players who are within the overlap at the time the door is locked without displaying it to everyone else?

sinful tree
#

and do what's needed based on what the IsLocked boolean currently is.

dark edge
#

lock and unlock can be repnotified but enter/exit should be local

tidal ruin
#

yo what protocol sub/pub would have the least latency for a c&c program and its clients? (making a game where u can have bot networks, yes i know its sus)

shy yarrow
#

how can I get Steam username on unreal engine game?I want use it for lobby menu

#

does it work? APlayerState::PlayerName

glad escarp
#

Hey guys. Quick question about PlayerControllers in multiplayer. Is it going to cause any problems if I have a menu player controller which is technically the controller which would be connecting to a session... and then loading the playable map where the default player controller is the gameplay pc?

kindred widget
glad escarp
kindred widget
#

Player Controllers, like all other Actors are destroyed when you hard travel. You are required to hard travel when joining a server. The new map or your project defaults will dictate the next controller spawned for play. You can technically have thousands of different controller classes, one per map if you really cared to. It won't make any difference in that regard.

glad escarp
#

I guess by brain hard traveled

kindred widget
#

It happens. 😄

halcyon totem
#

do IOS devs still need to edit the source code in 4.27 to fix the issue of IOS not being able to connect to dedicated servers?

#
#

and in the thread it said to edit the engine....please help

plush wave
#

Can I join a session without level travel?

clear gate
#

Thank you both Authaer and Thom, I managed to get it smooth by extending the movement component in c++

echo pasture
#

I wonder here.. could this ever cause a race condition?

#

since these variables are replicated, that would mean only the server could set them, which means that theoretically, on a client the first 2 nodes here might execute after the third node

#

but I might be completely wrong

sinful tree
echo pasture
#

I know, but it just happened to be very convenient to do it here in this very specific case, I don't usually do it

#

I guess maybe not replicating them might actually somehow fix the race condition tho

#

and just changing them in multicasts

sinful tree
#

Sounds like a horrible idea. If it's a replicated actor, then those values should just be set on the server. If the value of them changing is to drive something else, then you should be using OnReps and using the OnRep functions to do whatever it is you need to do with that particular value - this guarantees the server and any clients have the correct state - if you don't, then when the actor drops out and back in of relevancy the changes on the actor may not exist.

#

Multicasts should only be used for fire and forget kinda things. Like playing sound effects or spawning VFX.

#

If you're needing to replicate two values and you want to guarantee both of them come through with a single onrep, then you may want to use a structure that contains the value types you need and create a replicated variable of that type on your actor and use it to drive the state..

echo pasture
#

k

echo pasture
#

I understand it's not the correct way in terms of state sync and might be a pain to manage

sinful tree
#

...if you don't, then when the actor drops out and back in of relevancy the changes on the actor may not exist.

#

That's what makes it horrible.

echo pasture
#

so you just assumed I didn't have always relevant checked

#

(I do)

sinful tree
#

Yea, I suppose I did, as most people are either unaware of it, or don't use it to ensure that only required actors are replicating.

echo pasture
#

But yes, that is normally correct

pallid mesa
#

if its state the variable needs to be replicated

#

if its for transient stuff then... sure thing.

vernal gorge
#

how can i make openlevel host from adress and a port?
and somehow i can only get a server to work in the engine and not when i launch the game ps idk if i should be here or in oss

nimble parcelBOT
barren ironBOT
hexed pewter
#

Is it possible to test multiplayer features like joining same session using steam subsytem using only 1 PC with virtual machine or do you need multiple PC's?

twin juniper
#

Why does the client creates the replicated actors before creating its player controller on server connect? I've tried to use the local player controller on a replicated actor's BeginPlay event but it does crash because it was null so I am assuming it wasn't created yet.

split siren
split siren
#

Design question, I have a pawn with HP which is replicated to owner only. Upon death, the PC detaches from the pawn and starts spectating.
But that means, the client usually doesn't get the HP update that said the HP updated to 0. So the death plays on client, but the HP is greater than 0.

One option was set the HP to 0 upon bIsDead = true (which replicates to everyone), but then I cannot check if the died character is the one I was just controlling (without any weird pawn caching on the PC).

I ended up with client call on PC ControlledPawnDied(APawn* DeadPawn); which then sets the hp to 0, but it feels like a weird workaround.

#

Any tips?

chrome bay
#

EZ mode is to set the pawns owner back to the controller after un-possessing it.

#

By default the possession logic also changes the owner, you can just overrule it

fleet crown
#

Does someone know why my Dedicated Server executable still tries to make a local player while loading server map?

latent heart
#

A ULocalPlayer or a PlayerController?

split siren
fleet crown
#

Player Controller so

shy yarrow
#

the engine gave this error when I try to host the server in editor TravelFailure: ServerTravelFailure, Reason for Failure: ''. Shutting down PIE.

#

I saw some people can host the server in editor

#

why I can not ?

#

I put the subsystem on Null for now

still arch
#

Let's say I would like to call a client or a server function from my PlayerController on an Actor Component. Would it make any difference if I would call the server function directly or call a regular function which in turn calls the serverfunction? Is there a best practice here or coding standard?

latent heart
#

You can't call it on the component unless that component is in some way owned by the player.

#

So a component of their character would suffice.

still arch
#

Great, it's a component on their PC

latent heart
#

If that isn't the case, then an "InteractWith" function taking a UObject, Actor or Component as a parameter would be the way to go, which you can put in your player controller

#

Then it should work.

#

I would still test to make sure - and not from a listen server.

#

Listen server Server calls will always trigger.

#

(from the server)

still arch
#

Daekesh, would you mind clearify this for me. The InteractWith function you're talking about, I do not really follow what you mean it would do for me? From my PC I want to do a couple of server and client calls on my actor component attached to my playercontroller, thinking of it I do not see where this function fits in.

#

These here are the functions I'm talking about. Right now I'm calling the Server/Client function directly from the PC insteed of the other way around where I would call "ToggleBuildMode" which in turn calls the Client function.

latent heart
#

Show your header too

still arch
latent heart
#

You shouldn't need to do anything with the player controller as long as that component is owned by the player and replicated.

still arch
#

Actually only have the PC to GetPawn()

latent heart
#

The PC counts as being owned by the player too if it's on the PC.

#

On the player's pawn is fine too.

#

Or their player state.

#

It's all good.

dapper obsidian
#

Marking a function called from a client as UFUNCTION(Server) should mean it only gets executed on the server, right? For some reason when I call it I get a null pointer dereference on the client, presumably because it's trying to dereference the Game Session which only exists on the server, which I don't understand because I thought the function was only going to run on the server anyway.

#
[2022.11.02-19.48.54:783][734]LogWindows: Error: === Critical error: ===
[2022.11.02-19.48.54:783][734]LogWindows: Error: 
[2022.11.02-19.48.54:783][734]LogWindows: Error: Fatal error!
[2022.11.02-19.48.54:783][734]LogWindows: Error: 
[2022.11.02-19.48.54:783][734]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000428
[2022.11.02-19.48.54:783][734]LogWindows: Error: 
[2022.11.02-19.48.54:783][734]LogWindows: Error: [Callstack] 0x00007ffc90b8bf81 UnrealEditor-MyGame-Win64-DebugGame.dll!ResolveObjectHandleNoRead() [E:\ArchViz\Projets\MyGameAB\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectHandle.h:300]
[2022.11.02-19.48.54:783][734]LogWindows: Error: [Callstack] 0x00007ffc90b9a28d UnrealEditor-MyGame-Win64-DebugGame.dll!UMyGameGISubsystem::KickPlayer_Implementation() [E:\ArchViz\Projets\MyGameAB\MyGame\Source\MyGame\MyGameGISubsystem.cpp:118]
#

.h

UFUNCTION(Server, Reliable)
void KickPlayer(int Index);

.cpp

void UMyGameGISubsystem::KickPlayer_Implementation(int Index)
{
    if (auto* Controller = GetWorld()->GetGameState()->PlayerArray[Index]->GetPlayerController())
    {
        FText KickReason = FText::FromString(TEXT("Test"));
        // Null pointer dereference here:
        Cast<AMyGameGameSession>(GetWorld()->GetAuthGameMode()->GameSession)->KickPlayer(Controller, KickReason);
    }
}
sinful marlin
#

Yeah to my knowledge that shouldn't run on client at all. Are you 100% sure it's on client and/or GameSession isn't null on server?

dapper obsidian
#

The crash is occurring on the client, the server is running just fine.

#

Maybe it's because I was trying in the editor?

#

Let me try in a packaged game.

#

(To be clear, what I'm trying to do is have a client on a dedicated server who has an admin role and can kick other players, so I'm calling this function that is in a Game Instance Subsystem.)

sinful marlin
dapper obsidian
#

Ah, I was wondering about what exactly was meant by the ownership stuff. So how would I go about solving this?

sinful marlin
#

Game State is replicated, so you could have the RPC on the Game State and have the GIS call the RPC on your game state nvm not for client->server

#

I think, I haven't touched multiplayer in quite a while 😅

latent heart
#

Just don't try to RPC from client to server on the Game State

dapper obsidian
#

Why not?

latent heart
#

Beecause it's not owned by the client.

#

Player contorller, state and character/pawn is what you can use for client to server rpcs

#

Game state is good for broadcasting things to all clients. That's about it.

dapper obsidian
#

But a client doesn't have direct access to another client's pawn, right?

#

Because that's what I'd like to do, have a client kick another client.

#

But presumably they can't directly, since they don't own them.

#

So if I can't call an RPC in the Game State, where can I?

#

Line 1 is what I'm trying to do. Sorry, this multiplayer stuff is all new to me. 😅

#

Won't GetPlayerController() return null on a remote client?

#

That's what the comment says, so I thought that was the case.

#

Ah okay, but I'm worried about this bit:

If the RPC is being called from client to be executed on the server, the client must own the Actor that the RPC is being called on.

sinful marlin
#

Something like

// AYourController
UFUNCTION(Server)
void KickPlayer_Server();

AYourController::SomeFunctionRunningOnOwningClient() {
  KickPlayer_Server();
}

AYourController::KickPlayer_Server() {
  // do your code for kicking the player, since you're now on server
  // GameGISubsystem->KickPlayer() maybe
}
dapper obsidian
#

Since in this case the client doesn't own the PC that's being kicked, right?

dapper obsidian
#

Thank you both! And Dakaesh.

#

Just to check, in the UFUNCTION(Server) RPC that I've put in my PC class, the admin can directly ask the server's Game Session for the kick like this, right?

    if (auto* Controller = GetWorld()->GetGameState()->PlayerArray[Index]->GetPlayerController())
    {
        FText KickReason = FText::FromString(TEXT("Test"));
        Cast<AMyGameGameSession>(GetWorld()->GetAuthGameMode()->GameSession)->KickPlayer(Controller, KickReason);
    }
#

(Sorry for asking again but I just want to be sure.)

dark edge
#

@dapper obsidian how is your request saying which player you want to kick?

#

You don't have their player controller. PlayerState?

dapper obsidian
dark edge
#

Yeah so those are player States I'm pretty sure.

sinful marlin
dapper obsidian
dim trail
#

whats the point of this check if (GetLocalRole() == ROLE_Authority) if youre doing it within an RPC anyway?

#

wont a method tagged server always run on the server anyway?

kindred widget
dapper obsidian
#

@whole grove @sinful marlin @latent heart Thank you so much, got the kicking mechanism working. Now just have to sort out the fact that, as it turns out, the PlayerArray indices aren't necessarily the same on the server and the clients because currently I have my clients kicking themselves by accident. 😅 But I see the Player State has GetUniqueId() so that's fine.

proven fog
#

I have a simple blueprint method, which spawns an actor. In single-player, I don't have any issues, but with a dedicated server and two clients, multiple actors are spawned at the same time. It seems like sometimes only one spawns, sometimes two spawn, and it slowly increases over time.

#

Here's the method.

#

Is a Switch Has Authority needed so that only the server calls the Spawn Actor node?

hallow sand
#

Just make sure that function is only running on the server

#

And not multicasting

dark edge
#

What's the gameplay mechanic you're trying to do here

proven fog
#

The child actor is a weird necessity because of how physics constraints work. I don't fully understand it; it's copied from the VRE Example Project

dark edge
#

If it works then no problem, but there's probably a way more elegant approach to whatever you're trying to do

proven fog
#

There's a "Break Constraint" method, but no easy way to recreate it

dark edge
#

Explain more. Is this a broken actor repair system or what

proven fog
#

The door has a TakeDamage method that accepts a direction vector (the direction of the attack). If the door has been attacked three times, the constraint is broken, physics simulated, etc., then an impulse is added.

#

I want players to be able to repair the door by just holding it arbitrarily close to its original position and orientation inside the door frame for a couple of seconds.

dark edge
#

Is door + frame one actor or two?

proven fog
#

Two actors, but the frame is the ChildActor

dark edge
#

ya that's pretty gross

proven fog
#

Yeah, I don't think the blueprint was meant to be built off of, just a quick example

dark edge
#

I'd do it in one of 3 ways

#

DoorFrame which spawns Door at runtime and attaches it

or

DoorFrame with childactorcomponent with a Door

or

DoorActor which contains both components (I'd do this one)

plush wave
#

Are there platform IDs?

#

Per user?

hallow sand
#

Is net.UseAdaptiveNetUpdateFrequency still disabled by default? Says so in the documentation

short arrow
#

Pretty sure it is, it has big issues if you don't ever plan to force net updates

waxen copper
#

Hi, I'm looking for a bit of advice with a project I'm trying to create. I've been following a few Steam and Advanced Sessions tutorials to connect between two devices. The two sessions can connect but when the next scene is loaded the two sessions only show the client without the other player being replicated. Is there anything glaring that might be causing that?

tranquil yoke
#

After adding item to FFastArraySerializer , and also making itemDirty in the array, do i have to do something else so that it also goes to server and then replicated to clients.

or adding and Updating needs to happen on Server ?

marble gazelle
tranquil yoke
#

so all the additions needs to happen on server. My case is i have this array which has MorphTarget data, and these values will change alot, so do i have to send each individual item for array as separate RPC or i can add everything to Array, then either send the whole Array or ask Server to do get the latest from client and then Replicate, if it is possible.

#

for some reason i thought makeItemDirty will do that automatically on client.
but it seems like it has done on server, but sending RPC for each Morph Value seems problematic to me ?
What do you say @marble gazelle

marble gazelle
tranquil yoke
#

the problem is this data is coming from FaceTracking, i dont see any other way to do it on simulated Proxies, by just sending the whole data.
do you see anyother way ?

#

@marble gazelle

marble gazelle
still arch
#

If I use a Client RPC to spawn an actor, is it the client that owns that actor?

bitter oriole
#

(won't exist anywhere else)

split siren
#

When attacking, zombie can play either right or left hand swing. Is using an atomic ustruct the correct approach to ensure I transmit both bIsAttacking and bAttackingLeftHand together? (I could do bitwise ops on uint8, but ustruct seems a bit cleaner). Just wanted to check if this is the best approach

#

And OnRep I play the correct anim montage on clients

chrome bay
#

I don't know if the atomic keyword affects net serialization, worth testing.. can't see anything in code that suggests it does

#

Why not make it an enum or something instead?

#

Seems there is a bit of redundancy having two properties

bitter oriole
#

Make it a bit set.

#

Add enum for all possible bools, then it's uint |= (1 << EnumValue); to set, uint &= (0 << EnumValue); to clear, uint & (1 << EnumValue) to test

#

Perfectly efficient, no replication shenanigans

#

Unreal might even have a bitset type

split siren
bitter oriole
#

(It does, it's FBitSet)

split siren
#

Thanks @bitter oriole for the suggestion

hexed pewter
#

I have this issue where I UWorld::ServerTravel to some map url with ?listen param, and everything works fine in editor, but in standalone and shipping something weird happens.

The game moves to destined map for split second, and then moves back to my lobby map (map from which I server travelled to new map)
Does that sound familiar? I'm using ue5

woven basin
#

did you actually package the map in your build?

hexed pewter
#

That might be it, but I'm not quite sure how to do that. Last time I tried adding maps in project settings (different issue) it would not work and someone mentioned it might be broken. Any other way to make sure the map is properly packaged?

edit: okay i think i got it, I found this in log
[2022.11.03-10.10.21:785][566]LogNet: Connection failed; returning to Entry

eternal lake
waxen copper
#

When a session is created, I load a level for the host. When a player joins, they do the same.

#

I've got seamless travel enabled and I've got the host opening the level like so

waxen copper
still arch
#

In my component I have a reference to another component which I intend to spawn. When and if I need to destroy and nullptr that value I guess that should be done on the server. I know the destroy propagates but setting the reference to nullptr do I need to replicate that down to clients somehow?

fathom aspen
tame sapphire
#

Does any one have any resources/tutorial links/videos for working with or using an AI Character and Controller using an empty remote follow character. I've got the setup like this for use in a multiplayer click to move scenario but curious as to how to do damage across the characters and displaying a healthbar widget

fathom aspen
#

I don't have any of them but I have a suggestion to do it yourself

#

You can use this channel's search tool with smart keywords. You might find something useful

winged badger
#

and putting a widget component on PlayerState, then attaching the PS to currently controlled Pawn works well

timber hull
#

How do I switch level for all players (that are on the same session)

timber hull
#

like that?

coral ermine
#

Hello, i'm trying to get started with multiplayer, i made a simple RPC with a SimpleMoveToLocation, and it lags ONLY in the client who is doing the action as show in the video, the other clients see a smooth movement, anyone knows why? code for reference: https://pastebin.com/wRFrMknP. My actor has the replication and movement replication flag set to true.

oak prawn
digital agate
#

Hey folks - I've been hearing it's best practices for multiplayer to put commands for controlled characters in PlayerControllers and responses to those commands in the controlled CharacterBlueprints. Am I approaching it correctly with this diagram?

#

I have a paranoia about casts being too expensive (just from reading stuff online), but if this is best practices perhaps that feeling is unfounded

latent heart
#

Casts are very, very cheap.

#

I believe, with characters, you use the Add Movement Input node when you press keys.

#

Whatever that is found on, use it.

digital agate
#

thank you @latent heart ❤️ . I'll do all my output from my character controller then 🙂

static flare
#

Instead of calling a ServerRPC to make the server instantiate an object and replicate it to all clients, is it possible to have one Client do NewObject<UMyObject>(..) and then later pass it on and transferring it to the server, which will then replicate it? If so, how, and when is this recommended?

latent heart
#

It's possible, sure, but not easy.

#

Just don't do it!

sinful tree
# digital agate Hey folks - I've been hearing it's best practices for multiplayer to put command...

It doesn't really matter where you put the inputs, but generally speaking, inputs for a character should probably be in the character itself, just in case you have a variety of different input schemes based upon what character is being controlled, and it saves you from having to do any casting or using an interface. All input commands are routed from the playercontroller to their controlled pawn automatically. So that being said, you're usually better to put generic inputs in the player controller, think things like menu inputs or inputs that would be used the same regardless of controlled character, and any character specific inputs (movement, attacks, etc.) in the character.

Further to this, movement may be something that all your controlled characters use similarly, so then you would probably have a parent class that has the movement code and then child classes for specific characters that may have different actions based upon the input used.

static flare
# latent heart Just don't do it!

I haven't tried either implementation, but I was considering this because I'm concerned that network delay may make the implementation feel sluggish. It's UI-related, clicking a place on a 2D map to create a marker, and I'd like for that marker to appear immediately locally (sharing with everyone is secondary). But I guess I could make a "shadow marker" locally while waiting for the server-created marker.. But that could also create a brain injury for me if I do something fancy with it locally before receiving the server-owned marker.. oyh

latent heart
#

Is there some limiter for markers or can they just be put anywhere?

digital agate
latent heart
sinful tree
latent heart
sinful tree
#

To be honest, I'm not familiar with Enhanced Input, but I imagine it would work similarly.

digital agate
static flare
# latent heart What I would do, I wouldn't even use an object. Unless you're literally creating...

That's a clever idea, but I was planning on having a few properties along with the marker, in addition to the location. Name, color, icon, creation time. Perhaps grouping them by "type", or some sort of filtering system etc.
And it's very practical to have it as a UObject because I can bind these properties directly in the Widgets that show them.
And no, there's no limitation. It's completely client-authoritative on that part.

But I haven't tried the "normal approach" by creating it via a ServerRPC, maybe my fear of network delay isn't justified.

latent heart
#

So have an array of structs with that data and send the struct to the server.

#

You can bind them to functions in your widget which access the player state and then an individual index on the array there

static flare
#

Maybe.. The initial plan was structs, because it makes more sense for normal markers and for networking. But I figured some markers need some active logic as well, such as dynamic markers that are continuously updating, like for a vehicle etc. But those markers would never be stored on server as "marker data", they're just generated locally based on already-server-owned actors that are replicated (or at least have location-info replicated). Since these "dynamic" markers are generated as UObjects, I made the "static markers" UObjects as well, for reusability of widget-code.. But yeah maybe I should make a struct "DTO" for server-owned static markers, and just convert them to locally instantiated map-owned UObjects to put in my map-system.
But then I guess it would be slightly harder to automatically update properties based on the structs' replication after the locally created UObject-version is currently showing.
I guess I'll sleep on it.

dark edge
#

@static flareWhat's the use case? You want markers on a map for..... what

#

like 3d markers in world for navigation WoW or GTA style?

still arch
#

So, lets say I have two values that needs to be replicated at the same time, triggering the same repnotify. How would one go about doing this? As I understand it after some research a USTRUCT isn't the answer since only changes are being sent over and if the values aren't set within the same frame it won't be synced.

dark edge
#

You want to pause replication until triggered later?

still arch
#

How can I make sure they get set in the same frame? Might be a stupid question, I'm new to game dev so bare with me.

dark edge
#

What's the use case? What are you trying to do here

still arch
#

It's to store location and rotation for an actor i'll be moving. I want to move the actor locally, serverRPC the values which in turn repnotify other clients.

#

So the USTRUCT is just a container for a location and a rotation.

dark edge
#

it's a struct that already has location and rotation

#

Either RPC a location and rotation or a transform and you're golden

still arch
#

I did not know transforms existed. The more you learn. Can I break out location and rotation from a Transform? (ATransform.Location/Rotation) so I can use it calling SetActorLocationAndRotation().

#

Very much appreciated!

dark edge
#

SetActorTransform works too

#

Transform is just Location, Rotation, Scale

#

Every scene component has one

#

and implicitly every? actor. Some weird actors don't really use them but that's not an issue here.

still arch
#

This helped a bunch, made my day, thanks!

abstract pike
# fathom aspen https://forums.unrealengine.com/t/ue5-seamless-travel-bug-found-we-found-the-cau...

I'm having some trouble with this workaround. I have two different player controller sub classes for before and after the travel. Should I need this workaround in the one before, after or both? I tried it in the one after because I was on autopilot and it did nothing so then I tried it in the base class for both of them which I could see ran in standalone but it looked like it got stuck on something which may or may not be a real problem when cooked since standalone travel is weird anyway.

I'm testing before only now but just to double check should this only be on the "before travel" player controller?

#

Oh I think it's because of the transition map...

#

We don't use a transition map so that's probably breaking the "fix"

#

Also @fathom aspen It seems like this link on the word transition map is broken

#

Oh unless I'm hitting the github not logged in thing..

formal solar
#

I had the biggest revelation...
I spent MONTHS trying to solve jitter in my multiplayer game thinking it was down to ping fiddling endlessly with character movement replication variables, rescaling levels
Turns out it is mostly to do with camera lag not replicating well
Idk how long this will take to fix but I feel I made huge progress now at least

regal geyser
#

I have pretty annoying issues with rubber banding (Character Movement Component, moving with AddMovementInput), testing with 2 clients, where GOOD player has good internet connection, and strong hardware, meanwhile second BAD player has poor wifi connection, and weak hardware.

If GOOD player is hosting a game, BAD player that connects to it almost cannot even move, he just gets teleported back to his position or he just starts sliding arround even after he doesn't hold any key.

If BAD player is hosting a game, he can move without any issues, GOOD player that connects to the game has very little rubber banding issues.

I don't fully understand why when BAD player is a client, he can't move, but as soon as he is the server everything is fine (I thought that the whole replication would just be broken)

I've been stuck on this for a very long time and I have no idea how to fix it.. In the terms of network profiling my average bandwith is 3Kb/s which should be more than fine.

dark edge
regal geyser
real ridge
#

guys can I ask if I am using dedicated server and I am making changes on client like new replicated values etc do I need again package dedicated server? to see changes and if its working or not?

tranquil swallow
#

Hey guys! I have a question, basically i'm trying to randomly select an actor and spawn it but when I run it on the server its a different one for each user. I've been trying to figure out how to replicate it right but havent got any luck, any help will be great (Blueprints)

tranquil swallow
# dark edge Show your code

Right now it's kind of everywhere but here is my logic

Game Start >>> Select Random Class from Array >>> Spawn actor from class (random from array)

#

I can get it to you in a minute just gotta redo everything

tranquil swallow
dark edge
tranquil swallow
#

this is what i'm working on

#

I can revert to what I had when i asked the question

#

Ok, here we go

#

This is what I'm wondering how to replicate without it being different on each client

tranquil swallow
dark edge
#

either replicate the actor itself OR some seed to spawn them the same everywhere

#

probbaly just replicate the actor itself

tranquil swallow
#

How would I do that? And do you mean replicate the random value selected?

abstract pike
tranquil swallow
dark edge
#

read up on replication

#

If you intend that "everyone else sees what the server sees" then you usually just wanna spawn a replicated actor on server

tranquil swallow
dark edge
#

Read the compendium

tranquil swallow
dark edge
#

You need to replicate the data you want to be the same everywhere too

tranquil swallow
tranquil swallow
fathom aspen
fathom aspen
fathom aspen
#

Right, but what if it the PlayerState wasn't owned by the time you RPCed. IIRC the first safe point is APlayerState::PostNetInit

tranquil swallow
#

Alright, i'm having an issue now where my buildings get generated on my server but not on each client even though the spawner replicated multicast

abstract pike
#

You probably just want to tick replicates in your building

#

And then spawn on server and it'll replicate to client

abstract pike
#

Could you help me understand why the fix works exactly? I guess I don't understand what the problem is that well.

#

It seems like I need to find a condition when I need to set the seamlesstravel count to match the completedTravelCount

#

But at the moment my transition map name is just empty

#

So the condition in the workaround is just always true which seems not right

tranquil swallow
abstract pike
abstract pike
tranquil swallow
#

I deleted the method being called where it was running on the client and still havent had any luck

fathom aspen
fathom aspen
dark edge
#

read up on replicated actors

sinful tree
# tranquil swallow

He means within the building actors themselves - you need to mark them as replicated if you're looking to spawn them on the server and have a replicated copy appear on clients.

tranquil swallow
#

I didn't think about enabling replicates on the building actor itself

#

I just didnt understand

sinful tree
#

Yeah what you had above is marking the variable of "Building" which contains an "Actor Class" as replicated.

dark edge
sinful tree
#

So if you changed the variable, then the variable itself would replicate to clients so they'd have the new value.

tranquil swallow
tranquil swallow
sinful tree
#

If the intention is to have it spawned on the server and then that actor appears on clients, then yes, you'd mark it as replicated.

tranquil swallow
abstract pike
tranquil yoke
#

I am having an issue with FastTArray
LogNetFastTArray: Warning: OldMap size (0) does not match item count (63)

I think i know the problem, so i add the items to Array on Client Side and also make array dirty on client side, I think i have to do this on Server Side. Let me know if this is correct or there is something else i am missing.

Once i have created the array on client side, I RPC the whole array to Server, where it just copies it to the Replicated Property, without calling anything dirty.

So In order to add or change on the fast array, Do i have to call MarkItemDirty on individual index, which mean each RPC for one Update or I can send the whole array at once ?

kindred widget
tranquil yoke
kindred widget
#

A FastArray acts identical to any other replicated property.

#

It simply replicates slightly different, and gives per item callbacks.

tranquil yoke
#

The thing is i have to send Facial Tracked Information from a device to other clients, and It gives me 54 morphs, as they are constantly changing, so they are pretty consistent.

and I just wanted to see how can i send them without creating an overhead on my bandwidth.

so should I rpc the whole array or should i RPC individual Item.. In the individual case, it is going to be lots of RPC's ?

#

@kindred widget

kindred widget
#

How heavy is each item?

tranquil yoke
#

just a float and an index

kindred widget
#

Hard to say. That's not a ton of data in a broad scope. Depends on how compact this needs to be, if it's going to be part of a much larger game with a ton of other networking stuff. If not it probably doesn't really need optimized.

#

Could also cut them down by 50 to 75 percent too. Compressing them to uint8 or uint16. Indexes too if they're never over 255

tranquil yoke
#

so i should not do FastArray, just structs with NetSerialize ?

kindred widget
#

Do you need the per item callback?

tranquil yoke
#

I am not sure what that is ? yet.

#

You mean PostReplicatedAdd , PostReplicatedChange ?

kindred widget
#

Yeah.

tranquil yoke
#

yeah i dont need those,

kindred widget
#

Probably not worth it then. A normal replicated TArray can sometimes be better if you don't need those callbacks.

tranquil yoke
#

okay i will try that then, thanks, I just wanted to compare the bandwidth Difference.

#

I will do it some other time then.

kindred widget
#

If you're going to have constant array sizes at the 54 size. Definitely a normal TArray.

tranquil yoke
#

100% constant.

vestal bobcat
#

I am using UE5.0.3 and I am facing the well known problem of poor movement replication in vehicles controlled by clients. Server is fine but clients are not replicated well. Has anybody found any work around ? Does 5.1 solve this ? I did not see it mentioned in the fixed section, but might have missed it.

bitter oriole
#

There are various plugins on the marketplace that try to provide them

#

There are two competing approaches for that, neither perfect (server-authoritative vs client)

regal geyser
vestal bobcat
kindred widget
#

Can also up the smooth update distance as well to like 50%.

still arch
#

Been fighting with my build system implementation for three days now and decided to recreate everything from the ground up. I think I have the right approach, does this make sense?

1.) Server RPC Spawn build pieace
2.) If LocallyControlled, move build piece setting a Transform variable (ReplicatedUsing and skip owner).
3.) ServerRPC set transform call own Repnotify
4.) In the OnRep_Transform move actor for server and other clients.

#

Feels like there is one last puzzle pieace before it all "clicks" for me.

static flare
#

What's the easiest way to see if a function is natively called server- or client-side? Like AGameMode::PostLogin. I assume it's on server, but how can I tell without having to test it? It has a comment in the header saying

Called after a successful login. This is the first place it is safe to call replicated functions on the PlayerController.

chrome bay
#

You can't tell really, just need general knowledge of the engine. Since it's AGameMode however, it'll only ever be Server or Standalone

short arrow
#

are actors suppose to disappear for clients when a player leaves the cull distance? Because that doesn't seem to be happening 🤔

chrome bay
#

Not if they are part of the level

#

If they are spawned at runtime, then yahs

short arrow
#

I'm spawning these actors at runtime

#

they don't seem to disappear for me wut

chrome bay
#

Yeah then eventually they should despawn, usually takes a few seconds

manic matrix
#

If there's a Has Authority switch right at the beginning of something, will it compile to also exist in the client as well vs a function that's set to only run on the server?

fringe thistle
#

Hey guys, I've scratching my head this for a while and I still cant a solution for this. Basically, I'm making a invisibility ability where the player will be visible to teammate but but invisible to enemies. I have a bool variable to control that but how would I only set it to true on the enemies client but not teammate client?

chrome bay
#

The only way to exclude code from a client build is with the various , preprocessor macros, e.g. UE_SERVER etc.

manic matrix
#

Yeah, I assumed so cause for some games authority doesn't come from a dedicated server

chrome bay
#

Also HasAuthority() can still be true client-side anyway

#

Clients have authority over non-replicated actors, for instance.

#

Or if a replicated actor is "torn off"

manic matrix
#

So if you have some sort of top-secret server code for like security or whatever it should be put in an exclusively server function?

chrome bay
#

Yeah, and wrap that code with if UE_SERVER or somesuch

#

And of course, make sure you never ship a dedicated server build by accident

manic matrix
#

Yeah lol

chrome bay
#

Not much you can do about it if you want listen server support ofc, or any kind of offline play usually

#

Depending on what it is

static flare
#

How should I check if a PlayerState is my own? I have an OnRep that is triggered on all clients, and if it's my own PlayerState I'd like to do some extra stuff. Just check if this == World->FirstPlayerController->PlayerState, or is there some better way with authority/role etc?

chrome bay
#

Cast the owner to a player controller and check if it's locally controlled

upbeat basin
#

Is casting the owner not enough?

chrome bay
#

Might be, depends if it's also meant to run on Server, or split-screen etc.

#

I'd rather be safe though

upbeat basin
#

Server shouldn't receive OnRep function, isn't that right? That's why I asked if casting isn't enough itself. I didn't know about the split screen part though, are splitscreen games also considered as online/uses using replication?

static flare
#

Smart!
True, I should add that this is supporting ListenServer, and that I therefore call the OnRep manually from there..

#

I'm looking over APlayerController::IsLocalController, but it doesn't explicitly check for ENetMode for ListenServer, so I'm not sure what it actually would return for me in that case.. But from the name I assume it should be correct..?

chrome bay
#

A controller being local doesn't depend on the netmode really

#

it means "controlled by the local instance"

ornate crescent
#

Hi, i'm creating a TCP Client to connect to my TCP Server.
I want to create a class to connect and handle data of the TCP, so i create actor for that. But this actor is destoy on level change... so.... what is the best way to do this?

real ridge
#

Guys I have this problem with names when I print names of logged users both will see same name even I am replicating it. here is widget added on player character and in widget I am just getting Name variable from third person character i dont understand why its printing same name

#

Also I have this widget as replicated but i dont see him on another player until I press F too which is totally unlogical and I shall see it whole time above player

upbeat basin
twin juniper
#

Hey there guys. Noob question but can you explain me how does unreal decide which client to send the rpc on a client function? Does he get the controller from the owner of that instance and send to him or another way?

#

Cuz the other way arround seems easy, like the clients know that there's only one server but for the server there are a lot of clients with reference to that class, so I'm wondering if it's by ownership

twilit radish
#

So essentially the server just sends through the connection "Hey client X! Actor Y has message Z for you."

latent heart
#

Except it doesn't really send the Y part.

#

Unless you explicitly pass it as a parameter.

twilit radish
#

It was more the idea.

latent heart
#

🙂

twilit radish
#

Although to be fair I never exactly looked at how they work. But wouldn't it need to specify in some way what actor it is? You can't magically guess what actor should execute what RPC 🤔

thin stratus
#

I have a fun one for those of you who either know or want a challenge:

Some info upfront: The actual issue is a runtime spawned, replicated AbilitySystemComponent, which has SubObjects. Those Objects seem to reach the client before the Component does. In this specific scenario the Objects have an OnRep which require the Component to be valid. So it crashes basically instantly.

Now the more generalized problem would be: Why do the SubObjects of a runtime spawned replicated component reach the client before the component itself does? And is there a way to fix this.

#

The component eventually becomes valid on the client, just not in time.

#

I'll have to look into this over the weekend I guess

latent heart
#

I do believe it might be intentional

#

That all subobjects of an object are guaranted to be replicated before the object itself?

#

Maybe.

twin juniper
#

okay thank you guys! I just found out i can't call the a client rpc from the server to the server, which is sad if he is the one owning the actor

#

Had to call the implementation directly in that case

latent heart
#

Sure you can.

#

It may not work if a client doesn't own the actor, though, even if that client is the server.

#

So it has to belond to a player controller/player state/player character belonging to the server.

#

(and that would have to be a listen server)

sinful tree
solar stirrup
#

Hey! Is the order of elements guaranteed with the fast array serializer?

echo dragon
#

how do i fix this?

fathom aspen
solar stirrup
#

yeaaaaa

#

guess i'm serializing an id sigh

fathom aspen
#

Ez mode

solar stirrup
#

wanted to keep it as lightweight as possible but it's fine tbh

#

you'll never get all elements updating at the same time heh

fathom aspen
#

TMaps replicated when?

fathom aspen
solar stirrup
#

Blueprint support for int16 when

latent heart
#

and uint16, uint32, int64, uint64

#

int8?

fathom aspen
# abstract pike I read it just now really trying to understand and think I have a better grasp o...

World owns Level, so it's not that hard to figure that in the debug menus.

Now back to your previous questions. Ideally you should have a PlayerControllerBase class that has the workaround functionality and any other common base functionality that should be shared among the different PC classes, which they inherit from.

As I stated earlier this bug is fixed in 5.1, you can see how they fixed it and fix it yourself already: https://github.com/EpicGames/UnrealEngine/commit/503690c293cbfa284611c2d1e58abf79fa9b97bc

This is not the sole travel-related bug in ue5, but there is another one that is related to listen-server and hard travel that was also fixed in 5.1: https://issues.unrealengine.com/issue/UE-151220

That said, I would instantly update to 5.1 when it's stable.

fathom aspen
#

There's an MP plugin that has them all

latent heart
#

I 'member back in the day I added support for them all to 4.0

#

Well, limited support.

fathom aspen
#

Heck, the good ol' days

latent heart
#

😄

vernal gorge
#

any smart way to replicate this XD? because i currently have 3 for one thing

dark edge
#

No need to check if you're on server, you can just do the RPC there too if you're host

#

Input -> Rpc

Rpc -> Set Variable

thin stratus
#

But that's working around the problem

latent heart
#

Yeah.

#

I think it's on the documentation for replication somewhere and I asked an Epic guy once, I think.

thin stratus
#

I honestly don't understand why that would be the chosen way

#

Having the outer replicate first sounds more logical to me

#

But well

latent heart
#

I think at the time I was wondering whether a player state would be replicated before a controller or something.

vernal gorge
#

or does that not matter ?

latent heart
#

Perhaps not replicate, but become net addressable.

thin stratus
#

Well they are both actors

dark edge
thin stratus
#

Not the same situation):

dark edge
#

Same code will work

vernal gorge
#

hmm alright

latent heart
#

Maybe maybe!

thin stratus
#

I will try working around it on Monday by caching the OnRep calls as said. Not happy about it but I need the runtime spawning of the asc

latent heart
#

To be fair, I don't think you should expect it to happen one way or the other and you should be robust in the way you do your events.

#

_Is happy he isn't working on mp right now 😄 _

thin stratus
#

Maybe but we are talking about a replicated object replicating other objects. There must the some rule

#

Anyway, will report back :D

latent heart
#

I think subobjects use the actor's replication channel, don't they?

#

So the actor should be there first, you would think...

thin stratus
#

It's not actor

latent heart
#

Oh.

thin stratus
#

It's UAbilitySystemComponent replicating UAttributeSet

#

With the sets replicating first

#

They are active returned as SubObjects by the component

#

And those are added to it in the same frame as the component is created by the server

#

I just don't expect the sets to replicate first.

#

Maybe they don't

#

And the package sends all of it at once

#

But it unpacks it in the "wrong" order

#

Don't know how that all works

twin juniper
#

can I call an rpc from another rpc_implementation?

#

i'm seding a client rpc and on the implementation sending a server one as answer and the server one isn't hitting on the server idk why. Could it be the reason?

kindred widget
twin juniper
#

oof it's a weird custom structure

#

can be the problem also

kindred widget
#

I mean actor class.

twin juniper
#

struct

#

ah it's from within an actor yeah

#

but the information i'm sending is a custom struct

kindred widget
#

What actor class?

twin juniper
#

my custom actor class 😅 it derives from AActor

kindred widget
#

Is the client RPC running on the client?

twin juniper
#

yep

kindred widget
#

And it's owned by a controller?

#

Or owned by something the controller owns.

twin juniper
#

well if the client received it it has to be right?

#

but it's controller yeah

kindred widget
#

Wondering if it's an issue with being set in the same frame.

twin juniper
#

I can double check tho, it's a nice question

kindred widget
#

Not sure if the Owner pointer needs to replicate before the client can RPC back.

twin juniper
#

hmm didn't you ever need to do something like that to respond to the server?

#

How can i do it other way? Delegate?

kindred widget
#

What you're doing is perfectly fine probably. I know we do some stuff like that for initialization, I'm not aware of the details though.

#

I can't come up with a reason it wouldn't be able to RPC back though.

If you mistakenly called it on an actor that wasn't owned the ClientRPC would run on the server.. and the ServerRPC would still run on server. So that's out.

If it can reach the client through a client RPC, clearly the server thinks the client owns it. But if the RPC was sent too early, the client might not realize it owns it yet, so it might not be able to RPC back. You could try a basic delay/timer to test. If that's the case, you could override the OnRep for that actor's Owner, and start the chain with a ServerRPC to request the initial ClientRPC you're already sending.

#

I'm assuming here though. Not sure if client needs the owner set to RPC.

fathom aspen
#

How about the case the client RPC was sent from client though?

twin juniper
#

is that possible?

kindred widget
#

It is depending where you call it.

twin juniper
#

but no, i have 2 visual studios to avoid those mistakes

fathom aspen
#

If you did it then yes it is possible

fathom aspen
kindred widget
#

ClientRPC called on anything on a client will still run, even unowned actors.

twin juniper
#

unowned actors? oh shit insane

fathom aspen
twin juniper
#

but yeah i'm sure someone owns it cuz i can see the beakpoints hitting on the different project solutions

kindred widget
#

It's the client's machine. It's no different than calling a local function on them. There's no networking involved.

fathom aspen
kindred widget
#

Where are you calling the ClientRPC from?

twin juniper
twin juniper
kindred widget
#

What event though?

twin juniper
#

it's just a method to call some serialization on the client

kindred widget
#

But what is the native engine hook?

twin juniper
#

can it be because i'm sending a custom struct on the rpc ? That's the thing that worries me the most. I had to do some cheating to bypass the networking on the struct and that's what i really wanted to test but the server doesn't even receive it cuz rpc is not working

twin juniper
kindred widget
#

Beginplay, PostInitializeComponents, Tick, etc. What starts this chain of events?

twin juniper
#

ooooof it's way beyond any of those, no idea

#

in the real beggining probably it's a tick

#

but has a lot of stuff in between

kindred widget
#

Have you server gated the call?

#

Might try that to make sure it isn't the client calling it.

twin juniper
#

what does that mean? Sorry i can be missing some terminology

kindred widget
#
{
}
twin juniper
#

the client rpc is called by the server yeah

kindred widget
#

Or HasAuthority(). Either way.

twin juniper
#

well i'm certain that that class only does stud server side

#

as i'm saying i have 2 visual studio solutions ahaha i can see which is server or client

kindred widget
#

When you break in the ClientRPC does "this" have it's Owner proeprty set?

#

Actually I'm curious about that. Going to test if that's a requirement.

fathom aspen
kindred widget
#

Already running a new actor class. 😄 Gonna spawn and set Owner, and RPC in same frame.

#

Hmm. Owner seems to replicate immediately.

fathom aspen
#

Lowers NetUpdateFrequency

kindred widget
#

Ah. My mistake. Setting Owner makes it send with the same bunch when the actor itself replicates. 0.2 delay before setting owner and RPCing gets me a nullptr.

#

Aaand.. Nullptr Owner means no ServerRPC. Tested with it null and not. No ServerRPC with it null.

fathom aspen
#

Probably if owner had a low net update and owned had a high one, that won't the case

kindred widget
#

Has a net update of 3 at the moment.

#

Still seems to send with the first bunch when set on the same frame as spawning.

#

Owner's NetUpdate shouldn't matter. It's a pointer on the actor itself. But since it's set to replicate that same frame it's spawned, it just probably sends everything it has replicated already.

fathom aspen
#

Hmm, that's weird. The only gurantee I know of about different objects replicating at the same time (initial bunch in this case) is if you spawn a replicated actor and attach replicated subobjects at the same frame

kindred widget
#

The owner was already replicated. Since it's a Controller.

#

Just the pointer to it needed to replicate on the AActor.

fathom aspen
#

Yeah seems to have replicated

kindred widget
#

Neat little thing to keep in mind when trying to ServerRPC though. 😄 Make sure Owner is set on the client before you try it. Wasn't aware of that little tidbit before.

fathom aspen
#

Yeah I thought that was arbitrary tbh. Pretty damn sure Zlo said it a few times it's safe to start server RPCing from APlayerState::PostNetInit

#

But I get it now

#

PS's net update is low compared to its owner, so it makes sense

kindred widget
#

I would love to know 10% of the things he's forgotten. 😂

fathom aspen
#

(Thanks for the challenge, you're welcome for the help)

#

No idea why they chose to do it that way

thin stratus
#

But doesn't that still mean it would happen in the same frame?

#

I will play around with it a bit

#

Maybe I can put a custom case for the ASC into it

#

And thanks!

fathom aspen
thin stratus
#

I had two assumptions:

  1. The AbilitySystemComponent replicates 1 or more frames later than its Subobjects.
  2. The ASC replicates in the same frame, but the order in which it replicates, and "unpacks" on the Client, makes the AttributeSets call their functions first.
#

If it's 1., then I need the ASC to replicate first. If it's 2. then I need the order to "unpack" the ASC first, so it's valid when the AttributeSets call their functions.

#

Because the AttributeSet instantly calls its OnRep functions, which require a valid ASC

#

(AttributeSet is a Suboject of the ASC)

magic helm
#

Yeah any UPROPERTY replication you do that isn't an RPC will be sent across the network at the end of the frame, but RPC's are immediate for sending it before the end of the frame

thin stratus
#

Yeah it's not about RPC vs property

fathom aspen
thin stratus
#

It's about UActorComponent vs its Subobjects

thin stratus
quasi tide
#

Wasn't there a way to change which variables get replicated in a native class? One from Epic that is

regal geyser
vernal gorge
#

so question im guessing i should worry about tick speed/framerate/updates? Like this what could be causing this? jittering?

kindred widget
vernal gorge
#

to the other

#

the jitter also happens in an online test already tested

echo dragon
#

it does not compile

real ridge
#

Guys I have this problem with names when I print names of logged users both will see same name even I am replicating it. here is widget added on player character and in widget I am just getting Name variable from third person character i dont understand why its printing same name Also I have this widget as replicated but i dont see him on another player until I press F too which is totally unlogical and I shall see it whole time above player

echo dragon
sinful tree
sinful tree
# real ridge

This will also only set the value locally, you won't see it on other clients unless you send an RPC to the server, and set the value in a replicated variable.

#

Game Instances are also not replicated, so anything you set in the Game Instance will only ever be visible to the instance itself. Nothing replicates at all in them.

real ridge
sinful tree
#

Because replication is from Server -> Clients

real ridge
#

also I first tried it via playerstate but there were problems with casting

sinful tree
#

Not from clients -> server. The RPC to the server is the means of telling the server you want it to do something.

real ridge
#

okay maybe another questiion how to secure that names will be set after we will be spawned on map? because I tried print Text after begin play in third person character and my character was automatically created after first window in game even before login

real ridge
sinful tree
#

Widgets also do not replicate.

real ridge
#

i mean newly joined dont see it

real ridge
sinful tree
#

Just because you click replicated doesn't mean it will replicate. Widgets do not have any replication built into them.

real ridge
#

😦

#

so how to replicate widget with name then

#

rpc for set in viewport?

sinful tree
#

You can't replicate a widget. You can replicate variables on actors and have them drive the widgets.

real ridge
#

jo but then will be other players able to see "widgets" above heads? when I replicate only value

#

yea gonna try again player state, but last time i had problem my player state cast always failed

#

it was like this

#

and failed everytime

sinful tree
#

First, create a function in the widget blueprint that takes the string input and sets the value of your text box for your name. You do not want to use widget bindings for dealing with this as each character / player would have a different name, thus the binding can't reference a specific character unless you feed in a reference to the specific character to the widget so it can use it.

Secondly, you'll want to create a "Name" variable either on the character or on the playerstate (playerstate is probably better) that is set to replicated w/notify as this will then create an OnRep function that fires when any name updates come through.

When you want to change a player's name, you need to RPC to Server with a string Name Input. This event can be called on the Player Controller, the Player State, or the Player Character.
You're now running on server. Set the "Name" variable I mentioned earlier that you created. Once that is set on the server, the OnRep will trigger on clients.

Use the generated OnRep Function, you would need to get the character of the player. If you're in playerstate you can use "Get Pawn Private" and then cast to your character class. From your cast, Get the Widget Component and from that Get the User widget, cast to your widget class. Once you're into your widget class, call the function that sets your text value.

real ridge
#

wow thx

real ridge
echo dragon
#

thanks, much appreciated

obtuse field
twin juniper
#

You should put them as UPROPERTY first

twin juniper
obtuse field
obtuse field
#

It worked, ty

small lark
#

anyone here using advanced steam sessions for ue5?

somber lance
#

Hey, hope everyone is doing well!

We are developing a fighting game on UE5 for mobile, and we are looking for someone to work with us to create the Multiplayer part,

Kindly send me a dm if you want to know more, I will send you the Trailer of the game and give you more details. This a really cool opportunity 🙂

hollow eagle
dark edge
somber lance
uneven kraken
#

I'm just using the PlayerMovement component and its built-in networked capabilities; there is a certain person on my team who is from Pakistan (and his internet connection isn't particularly stable), and when running the game, he always gets a ton of rubber-banding whenever he tries to move (and the other players can see him rubber-banding too).

His internet connection is good enough to play the vast majority of other games without such major issues (eg. Valorant, etc.) so I'm wondering if this is a common problem and if it can be solved in a straightforward way (eg. config)?

ionic coral
#

weird stuff for my fps game

everytime someone hosts as soon as they load the world they go straight to the menu

plucky prawn
fleet viper
#

when i create a session and then call open level. Do i have to put in the options: "listen" or "?listen"

latent heart
#

Probably?

fleet viper
vernal gorge
#

i do this currently lol
tho dont think this works with other integrations not sure

latent heart
#

The proper level uri should be mapname?listen?otheroption?option3=7?etc

fathom aspen
fleet viper
#

👍 ⬆️

pallid mesa
#

Updated the list with one more article, it's a very recurrent topic I've seen many people ask, including myself XD

fathom aspen
#

And I already read it and it gets my recommendation 😈

still arch
#

Quick question, I have an actor the server spawns, when debugging, does not matter where I put the breakpoint Owner always seems to be nullptr. My solution is working, I'm just curious, why could it be null?

shy yarrow
#

how can I deactivate Steam for my game? I want when the player goes to the LAN section from the main menu, Steam be deactivated so the player can try to search for LAN sessions

kindred widget
still arch
#

No, I did not, just assumed server would be set as owner. Question is if it is important for it to have an owner?

kindred widget
#

The only real thing that Ownership affects is Client and Server RPCs.

#

Client can't ServerRPC if it isn't through an owned Actor. Calling a ClientRPC from server on a non owned actor will just run it on the server.

still arch
#

Ok, I do not intend to do any sort of RPC in that actor. Though, I have one OnRep which do seem to work in that actor.

#

So it's only RPC effected by ownership and not OnReps?

kindred widget
#

Oh. And the SkipOwner and OwnerOnly replication settings.

#

Normal replication is not. Most other replication settings are not.

#

Can even Multicast RPC just fine without an owner.

still arch
#

Awesome, this clears up alot of stuff.

uncut atlas
#

why is a vpn needed to connect players across different networks?

latent heart
#

It isn't?

barren patrol
#

Is it just me or does PIE server under same process ignore the Server Default Map setting?

#

how do people with serious projects test client/server flows? PIE or nah?

fleet viper
# latent heart It isn't?

if you are testing your game on steam, its region locked. Normally you'd change your download region inside of steam, but i guess a vpn will do too?👀

latent heart
#

They didn't mention steam. 😛

hallow sand
#

Having a weird issue where the collision of an object doesn't move for the clients even though the mesh does, using complex collision. The server/host works correctly, but the client can 'step up' on an invisible mesh, even though the mesh looks like it's in the correct position

copper grove
#

isnt it 100% critical information to tell UE programmers that on actor regain net relevancy the begin play for that actor fires again

#

i've searched far and wide and found no mention/documentation of this anywhere, the only places ive seen it is on 1 non official youtube video and another programmer

sinful tree
#

I wouldn't say it's critical but it is important to know. From what I can tell, the official documentation doesn't even tell you that actors are destroyed when they are no longer relevant, and that when they become relevant they are spawned.
The Actor Lifecycle graph does indicate that whenever an actor is spawned, BeginPlay will end up being called, and that BeginPlay is only being called on the client when they see an actor become relevant as the client is locally spawning a copy of that actor - the server would only ever spawn the actor once, and thus, the begin play only ever fires once on the server.

So knowing that whenever an actor is spawned, including by becoming relevant over the network, BeginPlay will be called wherever the copy of the actor happens to be spawned.

pallid mesa
#

its a feature of relevancy

#

but yes, this is critical

#

and imo it should be written somewhere

#

I actually got impressed today to know this wasn't common knowledge

elder sable
#

Is the network prediction plugin a good choice for handling predictions ? I saw GAS was using something else

fathom aspen
#

Lets pretend it resurrected 🤫

regal geyser
#

Not sure if it belongs here, but after enabling RVOAvoidance, I get a huge amount of network corrections on clients, like they themselves are colliding into their own RVOAvoidance radius, so they can't even move forward.
Is it normal? How can I use RVOAvoidance, because I like the mechanic of characters just sliding around other characters, so they can't block themselves.

elder sable
fathom aspen
#

Last I heard that they are planning to keep it going but no ETA on when that is going to happen

elder sable
#

Ok, so all predictions should be done manually i guess :p I heard about Iris but it seems to be in early version

pallid mesa
#

theres no correlation between iris and prediction

#

iris will simply handle better sending and processing data to connections

pallid mesa
#

you can do prediction on sim proxies.. something that gas doesn't support out of the box

#

you need to be doing custom logic to have sim proxies do prediction

#

ie: writing your own anim tasks...

elder sable
#

Mhh, are you using it ?

pallid mesa
#

NPP? not directly but I'm in contact with people that's using it on a daily basis

#

I've been meaning to pick it up at some point

#

but I have some other priorities I'd like to tackle first

elder sable
#

Ok, i will take a look then, thanks !

tawdry ermine
#

Hey, I am currently trying to figure out multiplayer and got a very simple question I guess. I didnt really understand the difference between replicated variables and a multicast. As far as I got it: I think if I cast to the server and set a variable that is replicated, it will set the variable on the server and then be replicated to all clients. where as a multicast from the server will tell all clients to set the variable themselves. Correct?

I am kind of struggling if I understood this correctly.

fathom aspen
#

cast to the server
You probably meant to say RPC to the server. "Cast" isn't a valid word in this context.

#

And what you said is correct with a grain of salt

#

Read it so you know better (it's found in this channel pins)

tawdry ermine
#

hey, thanks a lot

tight isle
#

Hi guys
I want to spawn projectile (game logic) in specific time during character animation and want to use anim notify for that

Does relying on anim notify safe for multiplayer logic? (Does animations play on server and replicate notify correctly for all clients)

pallid mesa
#

go for it

#

you can trust in anim notifies for gameplay logic, however projectile spawning should be done in authority

tight isle
#

ty

unkempt tiger
#

How do you guys go about adding admin/dev controls (e.g noclip around, change the game flow, give/remove weapons etc) in multiplayer games? I see that the cheat manager class offers a bunch of functionality for this purpose, is it actually useful in a multiplayer/dedicated server environment?

rocky night
#

Hi Gus may i ask ... How would you handle this: Client Player activates something.. ok.. then the Server Player shows a Hat on is head. The Question: How can i manage to do so that only the CLient who activates something sees the Hat on the Server Player? (Means Server can see or not doesnt matter, Client activates can see, other Clients not)

fathom aspen
winged ingot
#

Hey all! I've been using unreal for a time now, knows the basics with blueprints. I'm planning to test out multiplayer, are you able to use blueprints or do you have to use C++? What do you guys recommend to learn and do you know any good tutorials?

fathom aspen
#

You can do basic multiplayer with either option, but BP lacks 90% of the multiplayer tools.

#

In this channel pins you can find the networking compendium with some other starter friendly resources which you can utilize

winged ingot
#

Okay, thx for the tips. Better learn c++ then

fathom aspen
#

😔

#

Lmao. Can you go back to#cpp now?

#

#cpp raid by MP peeps soon™️

odd badger
#

Anyone know of good forum or video regarding local multiplayer for VR? I want to use 2 VR headsets in one computer like when setting up a regular splitscreen multiplayer for regular controllers. If anyone has any info on this, I'd appreciate it peepoBlush

rocky night
elder sable
#

Is it possible to know when actors in an array of actors are replicated ?

fathom aspen
#

Yes, if you tie that array to OnRep

tame sapphire
#

If connecting mid way through a current game, to get current state of vars on the server is event onPostLogin the best node? (e.g. playing a turnbased game that you connected to on turn 7)

fathom aspen
#

There is no such "best node", you get data on demand

#

You may need that data further on when HandleStartingNewPlayer is called

tame sapphire
#

is there an order in which that would be performed or should i check through the docs?

fathom aspen
tame sapphire
#

thank you

valid imp
#

Does the PlayerController replicates with its copy on the client where it exists?

fathom aspen
#

Define "with its copy"

valid imp
#

Counterpart I mean. The matching controller.

fathom aspen
#

PC replicates to owning client only if that's what you meant

valid imp
#

Yes exactly.

fathom aspen
#

Because it's bOnlyRelevantToOwner

valid imp
#

But isReplicated is false, which is what puzzles me. Anyway, thank you for your answer and help.

fathom aspen
#

IIRC bOnlyRelevantToOwner implicitly sets bReplicates to true, but let me check that up

#

They do it dynamically

#

Inside UWorld::SpawnPlayActor

twilit radish
#

👀

azure hollow
#

hey guys I am placing a static mesh in level but when I hit play on client I find root and scale different, any suggestion?

dark edge
fathom aspen
quasi tide
#

Doing 3rd person over-the-shoulder game. Want movement to be based on the direction the camera is facing. So W should rotate the character to point towards the forward vector of the camera and then move the character forward. A should cause the player to strafe left and S should cause them to back peddle.

Is there something already in that I can use to get another player's camera forward? Or do I have to replicate that myself? Or should I just set client's rotation directly? So client will tell server the direction and that info will be replicated to everyone else.

#

Just seeing if there are other options out there for this situation

fathom aspen
quasi tide
fathom aspen
#

Correct, movement is done on the autonomous proxy level, then it's the CMC's responsibility to apply that to simulated proxies

quasi tide
#

Yes. I'm aware.

fathom aspen
#

I mean, you press that W button, then check what direction that camera facing (this is all done locally) and apply movement in that direction.

valid imp
#

I want to execute something on an actor both on the server and on the owning client (not on all clients like a multicast, just on the owning client).
I call two RPCs from the server, one Client and one Server/Unannotated.
It works great, but when playing on Listen Server, function obviously gets called twice (once because it's server, once because it's also the client). Is there an elegant way to check for that specific case and avoid calling both functions? Currently I check if it is locally controlled.

By the way, I don't understand why there is no annotation "On Server and On Owning Client" in Unreal.

fathom aspen
quasi tide
#

I am already doing that.

#

The issue is when I am going backwards.

#

Or sideways

#

Because it still rotates the character when it should not. Because everything is based off the vectors of the camera.

#

(I'm using both orientate towards movement and control rotation, just depends on the state of the character)

#

I have overridden the ComputeOrientToMovementRotation method as well.

#

So I could have this style of movement more easily.

#

The issue isn't the movement being applied. That is happening correctly. The issue is the non-local machines rotating when they shouldn't.

fathom aspen
fathom aspen
quasi tide
#

It moves fine because what already gets replicated with the CMC

fathom aspen
#

You got a footage? 😛