#multiplayer

1 messages · Page 132 of 1

limber gyro
#

gime a sec

#

same name in c++

#

i think should be the same

#

not 100% sure

upbeat basin
#

That's for pawn

limber gyro
#

oh so u want for anything

upbeat basin
#

Yes, for the case that I don't know what the Actor actually is

sinful tree
#

If I understand the net roles correctly, GetLocalRole() on an actor owned by the local player controller should be NM_Authority (If it's something spawned on the client) or NM_AutonomousProxy (Replicated from the server but they control)

limber gyro
#

ive never done that but i think ive seen people ask about that before in here, i think what u want to do is go through the ownership chain and then check the last one?

upbeat basin
#

Well for sanity check, I'm doing this for some interactable objects in the world to give them "Possess" like logic to set the owner to interacting player, so their local inputs can call server RPC

limber gyro
#

i dont think theres anything built in for that

upbeat basin
#

In case this is a bad approach I can change the design as well

#

I'm calling EnableInput/DisableInput on ownership changes to not call RPC that would be dropped

sinful tree
limber gyro
#

ive never done stuff like that but thats what ive gathered from conversations here

upbeat basin
#

I wanted to go this way to not fill the controller with RPC for interaction with different objects, so each object can be modular and keep their logic within themselves without requiring the controller to be specialized for them

limber gyro
#

You probably want something like an interface

upbeat basin
#

That would be implemented from controller?

limber gyro
#

ur interactable actors would use the interface with a method like "interact"

#

and then u can override that per specific actor class

#

but then again

#

ive never done it

#

but i think theres something like that in the documentation

upbeat basin
#

Oh no no, I'm not questioning the interaction logic, I've already handled that, through a component that resides in pawn so it can handle server RPCs. Interacted object's owner is set as the interactor on server, so they can call server RPC

#

I wanted to add Enable/Disable Input to not call RPC's if the actor is not owned and doing that on OnRep_Owner

#

So I was checking if previous owner is locally controlled

#

Which is why I wanted to see if the previous owner can be checked to see if locally controlled, in case it's not a pawn

limber gyro
#

im gonna take a wild guess here but i dont think ownership should be used like that

#

theres probably a better way to do what u want, im just not aware of it

#

if ur actor is not owned the RPC's shouldnt go through by default i think

#

since they need an owning connection to go through

sinful tree
#

It won't, but I think he's trying to circumvent the warning messages.

upbeat basin
#

Exactly

#

Can I just let them be there?

limber gyro
#

i have warnings in my project and they havent bothered me yet lol

sinful tree
#

Technically you can, but... It's better if you're not trying to enable/disable inputs on random actors as it becomes a nightmare to manage.

upbeat basin
#

I would like it to be clean so if there is an actual error when I try to send RPCs where I shouldn't I can be aware of that

limber gyro
#

but why would u want to call the RPC's through the actor?

#

why not just go through the PC?

upbeat basin
#

I don't like coupling either

#

Why would I get my PC dirty when the actor in question can handle everything within itself?

limber gyro
#

I think thats just the way that unreal does things, i agree with you that calling it from the actor would feel cleaner but i think ur gonna run into trouble later on, altough im not speaking from experience

sinful tree
#

Is there like more than one actor that you're in control of at a time? Where multiple actors would need to respond to a single input?

limber gyro
#

i actually managed to implement a dash in the CMC, thanks to every one that gave a hand

#

spoke too soon lol, client is not working

hot steppe
#

Hey, is the host considered client after packaging? In listen server. Cause im confused about how to program the logic for host(server). Is he a player or what? Can you explain simply plz

limber gyro
#

you are both the server and a client

#

ur gonna have to be a bit more specific in ur question

hot steppe
#

I mean after publishing the game. Does it work like coop games where the host is the server and the client? Cause i dont know how to put the logic for the host, because i want to make a game like secret neighbour for my friends

#

And i get a lil confused about it

limber gyro
#

ur probably gonan need to look at some tutorials first before coming here

#

also multiplayer is not a good place to start

tawny otter
#

im sorry to interrupt your chat but is someone experienced in dedicated servers?

I have packaged a working Server and Client Game in UE5.2 with shipping, which works on my localhost. I now want to move it to my external dedicated server where i already did port forwarding etc. The problem is that i can’t see a join message in the server logs when joining. On my local machine i could see them.

The server uses port 7777
“LogNet: Created socket for bind address: 0.0.0.0:7777”

The port 7777 is forwarded on my dedicated server. To connect i enter following command in order to join it:
HauntedRealmsTwoClient.exe <IP>:7777 -WINDOWED -ResX=800 -ResY=450

limber gyro
#

is ur remote server a virtual machine?

#

or is it just other pc that u have ?

tawny otter
#

its a real dedicated physical server in Frankfurt am Main in Germany

limber gyro
#

ive used a back end service before that required some aditional setup with ports

#

if its running on a virtual machine ur probably gonna need to connect through a diferent port

tawny otter
#

you mean i need to change the port the server is currently running on or find out the real port?

limber gyro
#

find the real port

#

i used playfab before and the port was something like 16xxx

#

it wasnt the default one

#

try shooting them an e-mail

#

to see if the servers are virtual machines

tawny otter
#

im running a nodejs website on a specific port and can connect to it, can it still be a virtual machine then?

solid river
#

What can we infer from a log where GetLocalRole() returns ROLE_None and GetRemoteRole() returns ROLE_Authority?

hot steppe
limber gyro
#

have u taken a look at the documentation and the oficial utube vids?

#

those are the best way to start if u have very broad questions like that

#

also, exi's network compendium

tawny otter
#

@limber gyro thanks for the ideas, ill check that

hot steppe
frozen wraith
#

So I'm having an issue where if I run the editor as multiplayer it crashes the editor with this code and I'm not sure why, My guess would be it has something to do with replication? It works fine in Standalone 🤔
I posted in CPP before but realized maybe it was a multiplayer issue instead.

pale nimbus
#

did anyone expirience problems with clothing through the client? my model's clothing is seen all buggen from the client, but fine from the server

kindred gazelle
arctic minnow
#

I have in my game in my packaged version of my game where I am using steam advanced sessions to host a server the server loads perfectly but as soon as the client joins the server crashes but I tried doing this again but with unreal engines base character and it works so it has to be something with my character but I disconnected all of my code I could think of event begin play event tick ect and it still wont work? 🙂

I"m going crazy lol I have been trying to fix this for days can someone please help!!!!!!!!!!!! Like I dont know what to do anymore

frozen wraith
worn flint
#

Hey guys quick question how do you send a reference to a player in a multicast function since you can't replicate pointers ?

verbal mist
#

hey guys, I m quite sure the question I have to ask is maybe simple replication but I nowhere found any tutorial on that. I have an playercontroller in an 2 player coop game. I use listen server via steam an everything works quite well. The only thing I don´t really know how i can change the playercontroller mesh so both look different to each other. My thought to this was that not the player can choose but always the client on the listen server should be mesh 1 and the other client should be mesh 2.
But I somehow don´t know how to attempt this goal via blueprint?

safe vapor
#

Hey Folks, hope you are all doing well. I wanted a little help to understand what happens under the hood.

The character is being moved by calling Character->AddMovementInput( Direction,ScaledMovement );
and gravity scale of the character is 1

There are 2 players in the game, P1 and P2
**Scenario 1 **

While P2 is moving(applying inputs), P2 disconnects but for P1 the simulated proxy of P2 continues to move. But as soon as P2 reconnects the simulated proxy is corrected and directed back to the point P2 disconnected. So this clearly tells me that the server had the correct position but didnt update the simulated proxy of P2 in P1 client instance of the game .

**Scenario 2 **

P2 is falling from a great height, P2 disconnects. P1 sees P2 falling and which then continues to move forward indefinitely until P2 reconnects then the simulated proxy is teleported back to the location where P2 disconnected and the fall happens again.

I have used a listen server to see what exactly happens in both cases on the server the P2 ROLE_Authority proxy is stationary in air until the player reconnects

Can anyone tell me why the simulated proxy continues to move and not synced with the state of the server.

THANKS IN ADVANCE

dim zenith
#

Any idea or good tutorials on how to implement VOIP (opt. with online subsystems)

plucky prairie
#

Anyone point me in the right direction for going from a player spectating to possesing a player pawn? I seamless travel from a lobby (where the players are set as spectator) and the new map opens fine but they are still in spectate mode, cant seem to see the correct way to 'unspectate' them and assingn the default player pawn. I've checked 'handle starting new player' which is returning the spectator controller

velvet jacinth
#

For multiplayer, using UObject as an object for Item using OOP.
Possible or too much headache (Using struct would be the only option)?

arctic minnow
sweet sage
#

How do i replicate TArray of UObject?

woeful ferry
sweet sage
#

that is inside an AActor

#

i have PlayerController -> PlayerData(UObject) -> TArray<UItem> (UItem is UObject)

#

i can`t put inside player controller itself because it is a mmorpg and playerdata need to survive even when playercontroller is disconnected

#

(And it changes owner, when new playercontroller possesses same character)

sweet sage
#

Is there any way to do that? UObject don`t have replicated subobjects

latent heart
#

All replication must go through an actor as some point.

#

So the uobject has to belong to an actor or to another object which belongs to an actor.

sweet sage
#

Can i have array of UObject inside another object?

latent heart
#

A good question.

tawny otter
#

anyone got an idea why my packaged client can connect in test mode but not in shipping?

limber gyro
woeful ferry
fierce grove
#

Any examples on forwarding inputs from player controller to controlled vehicles? I don't want to own, I just want to control.

sweet sage
#

How do i change bUseControllerDesiredRotation on multiplayer game without stuttering?

#
    const FRotator DeltaRotator = UKismetMathLibrary::NormalizedDeltaRotator(GetControlRotation(), GetActorRotation());

    const float Delta = DeltaRotator.Yaw;

    const float AbsoluteDelta = UKismetMathLibrary::Abs(Delta);

    const float Speed = GetVelocity().SizeSquared();

    if (AbsoluteDelta > 90.0f || Speed > (25.0f * 25.0f))
    {
        GetCharacterMovement()->bUseControllerDesiredRotation = true;
    }
    else
    {
        const float ClampValue = FMath::Clamp(5.0f, 1.0f, 90.0f);
        const float Min = ClampValue / -1.0f;
        const float Max = ClampValue / 1.0f;
        const bool bInRange = UKismetMathLibrary::InRange_FloatFloat(Delta, Min, Max, true, true);
        if (bInRange)
        {
            GetCharacterMovement()->bUseControllerDesiredRotation = false;
        }
    }

#

This is my code but it breaks at high ping

rancid wren
#

I need advice on how to network a material instance. Can anyone help?

safe vapor
tawny otter
# limber gyro did u investigate the virtual machine possibility?

i tried to figure that out until i got the idea to check the server availability with the client development version which worked, so i just needed to figure out how to get a version working for others too. I cooked and packaged the test configuration which works for everyone. now ive come to some questions. is it best practice to take the test config for release? are there any performance or quality issues or can i use this workaround? what is the benefit of using the shipped version instead of test?

sinful tree
solid river
#

If in the client side GetLocalRole() returns ROLE_Authority and GetRemoteRole() returns ROLE_SimulatedProxy, what does it mean?

tawny otter
solid river
#

For this question, not yet.

tawny otter
#

GetLocalRole() returning ROLE_Authority means that the actor is authoritative on the local machine. This typically means that the actor exists on the server and is responsible for replicating its state to the clients.

GetRemoteRole() returning ROLE_SimulatedProxy means that on the remote machine (client), the actor is acting as a simulated proxy. In networked games, this often means that the client is simulating the behavior of the actor based on the information received from the authoritative server.
limber gyro
#

if u get authority then u are most likely calling that from the server

solid river
#

If GetLocalRole() returns ROLE_Authority in the client side, it means the actor is spawned on the client. But I don't understand why the GetRemoteRole() returns ROLE_SimulatedProxy when the replication does not exist on the server side (because client actor will not be replicated to the server).

#

GetRemoteRole() on the client should return ROLE_None, right?

#

ChatGPT is not helpful for this question.

solid river
#

The second row.

sinful tree
# solid river If `GetLocalRole()` returns `ROLE_Authority` in the client side, it means the ac...

The role you're checking is based on what the current machine thinks the remote role would be of the actor, it doesn't care about if it is actually a server or not, or if the spawned actor actually gets replicated.
A non-possessed actor marked as replicated spawned by the client or server gets a remoterole of Simulated Proxy on the machine that spawned it.
If the actor is marked as non-replicated, then the remote role is none on the machine that spawned it.

solid river
#

If there is an actor A on the level actor L, which one is created first?

#

I found the actor A is created first.

sinful tree
#

@solid river ☝️

solid river
#

Consider the second row. What does it mean?

sinful tree
#

You probably tried to reference a non-replicated actor on a client where that actor doesn't exist. This isn't right.

solid river
#

I have bRepicates=false actor.

This actor is dragged into the level with log on the 2nd row.
This actor is also spawned in level 's BeginPlay() with log on the 1st row.

It seems to me the roles also depend on whether or not the actors are dragged into the level.

sinful tree
#

Placed non-replicated actor in the level. Net Load on Client = true.

#

Setting to false prevents the actor from spawning on the client at all.

#

So it's like the server enforcing the actor to spawn on the client, but that actor has no network connection.

solid river
#

The bReplicates=true for the level.

#

I will show the screen shot for the complete log including the level one in red.

sinful tree
#

I don't think the level replicating matters for this. The actor itself is what determines whether or not it replicates.

devout canopy
#

hey guys, i have this problem where i setup a very simple scene and try to replicate the first person character provided by UE5. The problem is, when i print the name of the remotes, it says "client 0" for both clients... why is it doing this ? (there are only two clients)

lost inlet
#

player controllers only exist on the server and the owning client

#

if there weren't two player controllers you wouldn't even get as far as spawning in

solid river
#

How to use this node?

#

I cannot retrieve the Net Load On Client property of the actor.

plucky prawn
dark yew
#

I'm hoping this is the correct channel. I'm brand new to ue5.

So I'm doing a player info card on the lobby menu of my game. Everything is showing up and working when the second player joins, but it remains blank when it's just the host alone in the lobby.

worn flint
worn flint
#

I'm guessing you're only calling the Create Connected Player Widget node here ?

dark yew
#

sorry, I am new, and following a tutorial. I've spent like 5 hours going back and forth through the video to figure out where i went wrong.

I think this might be closer to what you are looking for? Its the update when someone connects?

worn flint
dark yew
#

Welp. Connect your nodes kids.

worn flint
#

is your class supposed to be called 0 Base 😆

dark yew
#

Yeah lol, Im only focusing on multiplayer functionality right now. Theres literally nothing else to the game. So I just downloaded some random skeleton

worn flint
#

the guy that made the template sure had an interesting naming convention lol

sinful tree
# dark yew

Widgets don't replicate. RPCs do not function in them.
Game Mode also does not replicate and only exists on the host, there is no point in calling any RPCs in it.

sinful tree
# solid river How to use this node?

You'd need to feed in a reference to a "NavSystemConfigOverride" object which isn't the "Net Load On Client" variable you see on blueprints. "Net Load on Client" of the Actor class is only exposed to have its value edited in the details panel, and not viewed or changed in blueprint graphs.

solid river
#

Is it possible to make actors that are placed on the level at design time get spawned only on the client machine?

limber gyro
silk thunder
#

Hello! I have a small question about a server RPC, I created a new project with the first person template in a C++ project, and decided to Implement a Server RPC to the fire function in the weapon. This is the code I'm using to call the fire function on the server from the client, but the code never gets to the ServerFire function when I try firing it from the client, is there something that I'm missing in order for it to work? I am also calling SetIsReplicatedByDefault(true) on the Weapon Component constructor.

#

The function is also marked with UFUNCTION(Server, Reliable)

limber gyro
#

it might be since thats running on an authonomous proxy that u actually have authority this is wrong

#

is that function being called by a character?

silk thunder
limber gyro
#

so i would suspect that you dont have an owning connection

#

RPC's need an owning connection to go through

silk thunder
#

I also tried calling it like this, the Owner of the gun is the Character

silk thunder
limber gyro
#

i think there is a way that you can call it from other actors, there was some one here earlier that did that but RPC's are usualy called through the character or playerController

#

in theory if the owner of the gun is the character it should work but im not sure what exactly ur doing

#

have u checked the owning connection in code?

#

did u set the owner when u spawned the gun?

silk thunder
#

the class that spawns it is a child of ACharacter

limber gyro
#

are those params replicating? im taking a wild guess here cause im not sure

#

but if ur spawning on the server and the weapon is not set to replicate, the client might not know the owner

#

anyhow, you should try calling that on the character just to make sure the function actully does what u expect it to

#

and if it does, try and move it to the weapon

silk thunder
silk thunder
#

I just set the gun replicates to true, and spawned the weapon only if it was the server

limber gyro
#

ur welcome, im actually surprise that i knwe the answer haha

solid river
#

According to ChatGPT, we should not use GetNetMode(), GetLocalRole() and GetRemoteRole() in actor's constructor
because the actor has not been fully constructed so networking might NOT exist.

Is it good idea to do the following instead to make actors that are placed on the level at design time get spawned only on the client?

AMyActor::BeginPlay()
{
  //...
  if(GetNetMode()!=ENetMode::NM_Client)
  {
    Destroy();
  }
}
latent heart
#

There's no might about it. Don't do anything in na actor's constructor except set default values.

limber gyro
#

ur gonna have to make sure they are not set to replicate

solid river
#

The actors are not replicated (bReplicates=false;).

limber gyro
#

in theory what u have should work i think, u might wanna try to do that on "postInitialize" function, might work the same way and be a bit better for loading performance, not sure tho, just guessing here

solid river
#

But I am not sure networking is ready to use before BeginPlay(). 🙂

lost inlet
#

overriding NeedsLoadForServer probably works too

worn flint
worn flint
#
void AEnemySpawnerButton::RPC_Server_SpawnEnemy_Implementation()
{
    const auto dir = AUndeadDirector::GetInstance();
    dir->RPC_Server_SpawnEnemy(GetActorLocation(), GetActorRotation(), mTeam);
}

Anyone have idea on why the second RPC_Server_SpawnEnemy function is called but not executed ?

#
    UFUNCTION(Reliable, Server, WithValidation)
    void RPC_Server_SpawnEnemy(FVector pos, FRotator rot, ETeam Team = ETeam::AI);

This is the function's declaration

#

both classes have bSetReplicates to true

shell leaf
#
{
    ASPlayerState* AttackerPlayerState = AttackerController ? Cast<ASPlayerState>(AttackerController->PlayerState) : nullptr;
    ASPlayerState* VictimPlayerState = VictimController ? Cast<ASPlayerState>(VictimController->PlayerState) : nullptr;

    if (AttackerPlayerState && AttackerPlayerState != VictimPlayerState)
    {
        AttackerPlayerState->AddToScore(100.f);


        FString VictimSteamName = VictimController->PlayerState ? VictimController->PlayerState->GetPlayerName() : FString();
        AttackerController->ClientSetHUDEliminated(VictimSteamName);
    }

    if (ElimmedCharacter)
    {
        ElimmedCharacter->Elim();
    }
} 

void ASPlayerController::ClientSetHUDEliminated_Implementation(const FString& VictimName)
{
    SHUD = SHUD == nullptr ? Cast<ASHUD>(GetHUD()) : SHUD;

    if (SHUD && SHUD->CharacterOverlay && SHUD->CharacterOverlay->Eliminated)
    {
        EliminatedTimerHandle.Invalidate();

        UHorizontalBox* Box = Cast<UHorizontalBox>(SHUD->CharacterOverlay->Eliminated->GetChildAt(0));
        if (Box)
        {
            UTextBlock* VictimNameText = Cast<UTextBlock>(Box->GetChildAt(2));
            if (VictimNameText)
            {
                VictimNameText->SetText(FText::FromString(VictimName));
            }
        }

        SHUD->CharacterOverlay->Eliminated->SetVisibility(ESlateVisibility::Visible);

        GetWorldTimerManager().SetTimer(EliminatedTimerHandle, [this]() {
            //Set visibility to hidden after 3 second
            if (SHUD && SHUD->CharacterOverlay && SHUD->CharacterOverlay->Eliminated)
            {
                SHUD->CharacterOverlay->Eliminated->SetVisibility(ESlateVisibility::Hidden);
            }
            }, 3.f, false);
    }
}
#

The visibility of my HUD element is correctly being set to visible when a player is killed. I am invalidating the timer before setting it to visible so that if several players are killed in a short succession, it shows for 3 seconds before disappearing after the last kill is made.

Unfortunately this does not work, the timer never seems to be invalidated and the HUD element is only visible for 3 seconds starting from the first kill. Any ideas?

limber gyro
#

how come one shot calls (like launch character) in both the server and client work perfectly in high latency but continuos stuff like dashing doesnt?

keen hound
#

why is this spawning the player underneath the map at 0,0,0

#

it only occasionally works

dark parcel
#

You should only spawn stuff on the server side. Actors that are spawned on client side will only exist for that particular client

dark parcel
#

I mean that doesn't solve the problem at hand.

#

but spawning stuff with multicast RPC... I haven't done MP stuff but it sounded very wrong

#

You only want to spawn stuff on client side when it comes to cosmetic stuff or a proxy bullet

keen hound
#

beyond all posibility it did

shell leaf
#

Kinda did tbf

dark parcel
#

Run the timer, not looping. Make the time 3 seconds

#

calling it again should reset the timer

#

so whenever another player died just call the timer again I think

shell leaf
#

Yee I tried this but it didn’t work, I thought invalidating it would clear it :/

devout canopy
#

hey guys, I want to spawn an actor on every client and on the server. I do this in an event in the "game mode" object but it doesn't work (also the event is set to "multicast") i guess it's not the right way so where should i put it ? and should the even be "on server" "mulitcast" or "not replicated" or "owning client" ?

dark parcel
#

You don't need RPC to spawn replicated actor.

  1. Make sure the actor you spawn is set to Replicate
  2. Have the Server Spawn the actor
#

Game mode only exist on server, just call the spawn function there

devout canopy
#

thx a lot !

grave lynx
#

In editor, can we start a client later so we can test RepNotify stuff? (if server open a door, check the door is open is client connect after)

dark parcel
#

i will try to find the video

grave lynx
dark parcel
#

Time stamped

#

54:12 to be exact actually

grave lynx
#

ggreat thanks

#

I can even see a door example lol

dark parcel
#

😎

shell leaf
dark parcel
# shell leaf Any other possible solutions?🤔

I haven't done any mp stuff apart from small test.
What I would probably do is to keep the function and timer internally in the widget.
When you send Client Rpc , Get Hud -> Get Widget -> DisplayEliminatedEnemy

Something like that maybe 🤷‍♂️

#

i'm still stuck at movement and customization for my mp project

devout canopy
#

hey sorry to bother again, but now the only problem i have is that : (see image) The construction script can't find the data table because the "spawning" event is only called on server side so the "client" side item doesn't have a "item data table" variable set to something...

sinful tree
devout canopy
#

ok i'll try that

#

thank you so much !! it works now !

ruby lodge
#

I am setting an On Rep notify variable inside a run on server event right now in which I attach an actor to a different actor. Both actors (Interacting Player and Self) are valid for both the client and the server but still this attachment is not visible on the client. What could be the issue?

shell leaf
#

On rep only runs on client. Try attach actor to other actor on server

#

Also make sure your actors are set to replicate

thin stratus
#

If done on the server of course

ruby lodge
#

and it works on the server

#

but from the clients eprspective it's not really working

#

everything besides that in the on rep replicates just fine

#

perfectly

#

for both

thin stratus
#

My point is you don't need to replicate that attaching by hand

#

Is the actor replicated?

ruby lodge
#

yes

ruby lodge
#

So the character bp calls the interface

#

and the interface calls the onRep

#

the interface event is inside the vehicle bp

#

both actors are replicated

#

that's what it looks like. It's not so much code

#

tried it with event interact directly connected to set interacting player and it does the same, I just didn't change it back yet

#

that's all code basically.

#

regarding that functionality at least

#

couldn't find a solution for 1 month now lol 💀

sinful tree
ruby lodge
#

their player controller possesses it

#

so yes, basically

tame sapphire
#

When in an actor I am trying to use the "Event ActorOnClicked". Is it possible to check if the button pressed key structure is equal to an "EnhancedInputAction" in some way?

sinful tree
#

So if you're calling this interface without already running on the server, it won't work unless the vehicle is already owned/possessed.

ruby lodge
ruby lodge
plucky prawn
#

im setting UStaticMeshComponent::SetCollisionProfileName on the server but the clients arent receiving this. is there a good way to network this call? or do i just make a replicated property and call this in the notify?

solid river
plucky prawn
#

its already replicated

#

i managed to solve it by scrapping this piece of code all together lmao

solid river
# plucky prawn im setting `UStaticMeshComponent::SetCollisionProfileName` on the server but the...

Is your idea roughly like this?

UPROPERTY(VisibleAnywhere) UStaticMeshComponent* Mesh; 


UPROPERTY(ReplicatedUsing=OnRep_ProfileName)
FString ProfileName;


UFUNCTION()
void OnRep_ProfileNameChanged();


void AMyActor::DoSomethingOnServer()
{
    if(HasAuthority()) 
    {
        this->ProfileName="Pawn";
        OnRep_ProfileNameChanged();
    }
}

void AMyActor::OnRep_ProfileNameChanged()
{
  Mesh->SetCollisionProfileName(ProfileName);
}
plucky prawn
#

ye basically

#

i tried doing this but im guessing there was some race condition with the OnRep vs setting the mesh. its something specific to my setup but i ended up trashing it like it said. i appreciate you helping me out though

solid river
#

Version 2:

UPROPERTY(VisibleAnywhere, ReplicatedUsing=OnRep_ProfileNameChanged) UStaticMeshComponent* Mesh; 

UFUNCTION()
void OnRep_ProfileNameChanged();


void AMyActor::DoSomethingOnServer()
{
    if(HasAuthority())
    {
         OnRep_ProfileNameChanged();
    }
}


void AMyActor::OnRep_ProfileNameChanged()
{
  Mesh->SetCollisionProfileName(ProfileName);
}
#

I don't know whether replicating static mesh component is cheap or not. 🙂

limber gyro
#

does any one know why the function launch character works perfectly even with latency?

thin stratus
#

How are you using it

#

Simple answer is cause it's integrated into the CMC

limber gyro
#

ye, thats what i figured, that it was an already built in thing

#

is there like a list of those movement functions that are alaredy built in?

#

i know that teleport is

#

but it would be nice to know what else is there

#

is it safe to assume that any function that is from the CMC that tries to move the character like "addForce" for example works the same way as "launchCharacter"?

thin stratus
#

Afaik those only work automatically if you ensure it's called in same timestamp.

E.g. if you call LaunchCharacter when stepping on a jump pad, you don't need to replicate it

#

Cause server and client step on the launch pad in the same movement timestamp

#

If you call it outside if movement, so by e.g. pressing a key, then it might be that the CMC does something to not have you correct

limber gyro
#

by "those" u mean all the movement functions in the CMC?

twin juniper
#

can someone help, the client and server info about the player-character location is unsynched

#

it's just the forward vector of the actor, the regular world-location of the actor seems to be fine

limber gyro
#

i think theres suposed to be a bit of a gap in that info

#

theres also a var in the player character that u can change to improve precision

#

i cant remeber the name tho

limber gyro
#

in my search to understand the CMC i found to way to pass data to it, one is illustrated in this doc:
https://docs.google.com/document/d/1UO6Ww6Lfpti3YElVdo9uioTUtQJQ9CoSLvd9kF8hvJo/edit#heading=h.irlzv6ukhpxb
And the other one is just with a simple server RPC like this:

#

so which one is the right method? what are the merits and downsides of each one, besides the obvious increase in lines of code

#

can some one shed some light on this for me?

thin stratus
#

Server RPC is probably wrong

#

You want to send the data via the already existing server rpc

limber gyro
#

so i am assuming that the document that i put above is the correct way to do it, isnt there a less verbose way to do it?

grizzled stirrup
#

Is Steam Sockets the correct way to do Steam networking these days? Since it seems the default (non Steam Sockets) way shares IP addresses with other clients and is considered to be the legacy option (please correct me if I'm misunderstanding)

fervent leaf
#

Hi I have a postprocess component that i want to apply only on a client. I need to do it on OnRep, because I use replay system. I just have a server function that I call that sets boolean that launches OnRep - ActivatePostProcess. Currently it works, but instead just applying it to client, it applies postprocess for the server also. The component is replicated as propably i cant use OnRep, if its not. Am I doing something wrong as I don't really understand why it happens on the server also

grizzled stirrup
#

It won't get called on the server unless manually calling the OnRep func there too

#

If you are testing in editor try checking the "Use Separate Process" checkbox when running multiplayer games

#

As it may be techically changing the post process component on the server since it's in the same world as the client and it's unbound

fervent leaf
#

It also enables the post process and plays the sound on only on client. But the post process gets applied on server also. Even though i dont call the Onrep on server-function so thats why I'm confused

#

Use Separate Process, i could test that one

grizzled stirrup
#

It's likely that as the non separate process PIE thing is sharing one world with the client

fervent leaf
#

ah because its prolly “Run under one process”

upper lodge
#

hello, I'm kinda new to multiplayer game development, I have this specific situation where I may not understand how does the replication works. I have a dialogue component that I add to my NPC. Whenever someone steps into sphere collision, the dialogue is started. Now let's assume that Client 1 is stepping into this sphere collision. The widget is put on his screen with the dialogue text. Now I want to do something where if for example Client 2 or Server comes close to the location of the NPC (NPC is spawned from spawner, spawning is replicated on the server, NPC has checked Replicated checkbox) the message is also displayed to them. I don't have system based around to check whether you're being close to the NPC, for now I'm trying to make it so that the message when started by client 1, will be also replicated on the server and multicast to everyone else. I have 4 functions withing the dialogue component. Can any of you explain to me what I'm trying to do and how to do it? Thanks in advance guys

limber gyro
#

if u wanna run ur server on steam u do it throught the steam net driver, ip net driver is just the default net driver that comes with the engine

#

which u can also use for direct connections

grizzled stirrup
#

But from testing it, it does seem to increase latency quite a bit on average and doesn't have a 100% consistent connection rate which is why I'm curious if people are using it over the legacy one still

grizzled stirrup
limber gyro
#

sorry, i miss read ur question, i am not sure if is ºthe default way, all i know is that the new stuff is safer

upper lodge
#

I've checked in branch on interaction with NPC if player was equal to get pawn (0), when obviously the only pawn with id (0) is the one that has created session, so server host, that's why only he could display the message

fervent leaf
digital tulip
#

how can i server travel inside the gamemode using steamcore-pro plugin?

hushed rain
hushed rain
digital tulip
#

i bought it today so im still pretty new with it

#

What blueprint would i use to server travel? i could tell you if i got any errors.

hushed rain
digital tulip
#

oh i tried that but nothing happend when i executed it

hushed rain
#

yeah mine would just fatal error which is supposedly fixed in 5.4 but idk if i need to do something prior to travelling because i am switching modes i think

digital tulip
#

I know there is other plugins that works great and i used it before but switched to steamcore hopping it would be better but it seems that was a mistake

hushed rain
#

Yeah im using steamcore because steam functionality is broken until 5.4 so they say

digital tulip
#

hope it gets fixed

hushed rain
cinder goblet
#

I'm trying to get an "OwnedTiles" value to update for either of two players whenever they click on a tile. The value is stored in the Player Pawn. When the player clicks, if they clicked a tile, then I replicate to the server that a tile changed owner. The tile then updates a color enum that is passed to it. This change replicates and is seen by both players. Next, the tile tries to increment the number of owned tiles by 1 no matter what (I plan to add conditions after this step is working) by calling my "Update Owned Tiles" method implemented by the Player Interface. This isn't updating the value for the players. I think I'm not getting the player from my Game State correctly. Below pics are in order: Calling ChangeOwner from the BasePlayer, then the ChangeOwner section in the Tile.

sinful tree
#

To fix this, move your cast before the branch, then it should be ok.

arctic minnow
#

“LogOutputDevice: Warning: Script Stack (1 frames): GameModeBase.HandleStartingNewPlayer”
“LogWindows: Windows GetLastError: The operation completed successfully. (0)”
“Log file closed, 11/02/21 15:56:41”

I have in my game in my packaged version of my game where I am using steam advanced sessions to host a server the server loads perfectly but as soon as the client joins the server crashes but I tried doing this again but with unreal engines base character and it works so it has to be something with my character but I disconnected all of my code I could think of event begin play event tick ect and it still wont work? 🙂

PLease someone help me!!!!!!!!! 🙂 God bless you all jesus loves you!!!!!!!!! 🙂

cinder goblet
#

@sinful tree Thanks a bunch, that fixed it!

ruby lodge
sinful tree
#

Apart from what Cedric said before, namely you don't need to replicate the attachment how you are and should be able to do it solely on the server, the other thing that I can see is that you're trying to do the attachment in the OnRep of Collision Enabled but it also utilizes additional variables like the "Interacting Player" but there's no guarantee by the time that Collision Enabled's OnRep fires that the "Interacting Player" has replicated too.

mental linden
#

Hi, does anyone has a knowledge of dedicated server CPU usage by tasks in general? Lets say for a game like Fornite with 100 players? How much of the CPU time spend on collisions, relevancy checks, tickflush, gameplay logic, movement etc?
I will try to test this myself with some simulated connections, just looking for a starting point.

fossil spoke
#

Your game will have different numbers

#

Entirely different

#

Because its a different game.

#

YOU need to profile your game.

safe vapor
#

Hey Folks, I wanted to get some clarity on why the simulated proxy behaves as it does. Explained the scenarios here.
#multiplayer message

echo snow
#

Does using IsServer do the same thing as using Run On Server with a custom event?

limber gyro
limber gyro
#

not 100% sure there might be some details that i dont know

#

it will probably depend on what u call on the RPC, there is some info that is only available to the client like button presses for example, so if u were to use a "isServer" in a button press function it wouldt be the same

#

some one correct me if i am wrong

safe vapor
upbeat basin
#

Right now I don't see PostNetInit function being called for the Actor's server copy or for standalone net mode for PIE. Can I safely assume this only does work on client copies of a replicated actor?

ruby lodge
#

I don't want to manually attach each component

frozen wraith
#
{
       //removed unrelated code for clarity
      //////

    if (bIsSprinting && !MoveComp->IsFalling())
    {
        StaminaCurrent -= StaminaConsumed;
    }
    else
    {
        StaminaCurrent += StaminaRegen;
    }
}``` so I have this little check from CharacterMovementComponent, refered as MoveComp. Whenever I use any variable in multiplayer from CMC, the editor crashes. I'm quite confused as to why this happen. SprintChecks() gets called on Tick if user is client atm.
frozen wraith
#

can it be because I need to check for ControlledPawn first?

#

It was me not initializing CMC properly 😁 fixed it

unborn nimbus
#

How would I send arbitrary payloads from client to server? For Instance, I want to create a USTRUCT, FPayload, and create children that would be replicated with a method like this.

UFUNCTION(Server, Reliable)
void Server_SendPayload(FPayload& Payload);

Where Payload is some child of FPayload

cinder girder
#

Digging through Reddit. If using client side hosting. No dedicated servers. Is it really that bad to make a multiplayer game? Any good resources?

gray hemlock
dark parcel
cinder girder
gray hemlock
gray hemlock
#

ie - a driving game, perhaps not 16 users

cinder girder
#

It's always a bit nerve racking. I know games need to be built from the start with the multiplayer scope in mind.

echo bough
#

host need stonks cpu 😆

true stream
#

So I've spent some time into trying to open my router's port to test-play some prototype with a friend online, doesnt seem like my ISP allows me to, but also I would like to be able to simulate a listen-server and client playing on my same PC as if the client is playing online, I think a VPN could allow me to do this, is that correct?.

gray hemlock
#

I'd say don't let it get to you, focus on core replication framework, it will transfer to dedicated server builds as well as p2p for the most part(DS having more variables to work on/with)

gray hemlock
true stream
#

I checked with nmap and telnet to confirm my port is not open

#

and I've read in some forums my ISP doesnt allow me to open it

#

so Im looking for alternatives, someone mentioned Hamachi here I think

gray hemlock
#

change the default port

dark parcel
#

Damn Hamachi

true stream
dark parcel
#

I thought portforward is a thing you do in your own modem

gray hemlock
#

you should be able to brute force the port on a packaged game during authentication portion of your code

true stream
#

Im not coding it right now, also I wouldnt know how to do that

cinder girder
gaunt crown
#

I'm doing muzzle vfx on a weapon for the owning client to see for instant response but also want to show the muzzle vfx to other players. How would I go about it doing a server to multicast and not make the owning client do the vfx a second time ?

gray hemlock
gaunt crown
#

I guess so 🙂 I'll give a whirl.

gray hemlock
#

er

#

possibly also isvalid node instead before bool then the bool logic

#

and for the playerchar ref - you need the controller for that character as the primary character to bool against

gaunt crown
#

Yeah I was gonna say. If I do Get Player Controller index 0. All clients know themselves as 0. So it would just stop them all

#

I gotta be specific with what one

gray hemlock
#

this is multiplayer - if you aren't on a DS I assume you are using sessions?

#

where ever you do your account / player auth attach an identifier variable and call from that player controller reference

#

Multiplayer is fun right? 😄

gaunt crown
#

For sure 😛

dark parcel
#

or if you are doing it with RPC,
Play the Sfx locally right away -> tell server to multicast it.
Exclude the player that plays the sfx. You may be able to use the Is Locally Controlled bool for that.

For reference, I haven't done much MP so take it with grain of salt

dark parcel
limber gyro
#

do custom PhysMovements have prediction and corrections? since u do send the new mode to the server with a byte i am assuming its gonna sync somehow?

limber gyro
#

also, when am i suposed to used bit flags, custom mov modes or the more complex way to pass custom data to the CMC? why cant i just use custom mov modes for everything?

thin stratus
limber gyro
thin stratus
#

You don't need custom MovementModes for everything

#

Dashing can totally be handled in PhysWalking or PhysFalling

#

Oder just via different CalcVelocity values

#

The Flags are limited to 4, that's true, but I think if you really can come up with more than 4 more flags, then you can use the MoveData Container to send additional data I guess

limber gyro
#

but wouldnt it make more sense since we have a whole byte for custom movement modes to just implement everything in movement modes? would it be wrong to just use movement modes for everything? i know about the data container, some one told me that it was available from .27 onwards and im on .26 so i dont think thats an option but that aside im just trying to understand what was intended for the "end programmer" to do when the CMC was created

#

for example in a game like overwatch, you ahve like 10 or so movement abilities that are all triggered by key presses, what would be the correct/optimal way to do that sort of thing in unreal?

cinder girder
eternal canyon
#

or copy its net serialization log

true stream
#

sup, I managed to play my game with a friend online, listen-server, now to not bother him all the time I would like to recreate this locally, is running through a VPN the client a good idea or is it a better way?

true stream
unkempt lodge
#

Oh yeah wtf i thought i was in cpp sorry

verbal heart
#

His GAS course is really good too

cinder girder
sweet jasper
#

I just grabbed a couple of these today on sale !

meager fable
#
FActorSpawnParameters HandSpawnParams;
HandSpawnParams.Owner = this;
HandSpawnParams.Instigator = this;
HandSpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;

LeftHand = GetWorld()->SpawnActor<AHand>(HandClass, HandSpawnParams);
LeftHand->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetIncludingScale);
//returns false
LeftHand->IsSupportedForNetworking();

Why is spawning an actor this way result in it not being supported for networking?

#

I'm checking for authority before and the spawned actor is set to replicate

patent portal
#

I'm curious about an idea here and how hard it might be to implement, currently the game we are making will not be co-op however, if we did, how hard would it be to add in a "voice filter" into the game so that when speaking through in game chat dependent on your character a filter would be applied?

fossil spoke
#

But it wouldnt be difficult.

fossil spoke
patent portal
#

I was worried it would be extremely complex or something, I'm gonna talk to the rest of my group about it, and the many other changes we might do if we go with co-op, thank you!

fossil spoke
#

AActor::IsSuportedForNetworking returns true literally

fossil spoke
patent portal
#

that makes sense, I've never even touched voice in unreal yet, but this sounds like fun

azure geode
#

Hey fellas, I'm starting a project in Unreal and am looking for someone who is proficient in net code for games, I'm coming from a web background and have never really had to deal with the intricacies of network code for games and have a bunch of questions id like to ask, would anyone be so kind as to be able to spare me some time for a small brain picking session?

fossil spoke
#

Otherwise just ask your questions here and whoever has the time and knowledge to answer them will do so.

#

Don't ask to ask.

#

Just ask.

azure geode
fossil spoke
#

🤦‍♂️

rare wharf
#

hey all, doing splitscreen local multiplayer, the user interface widget isnt showing up for the player 1

regal solar
#

Is there anyone here who uses AWS GameLift?
EC2 instance not activating after upgrading from GameLift Server SDK version 4.0.2 to 5.1.0?

#

I did run it locally using GameLiftAnywhere and it worked fine

fossil spoke
#

@regal solar Does the Logs mention anything?

regal solar
#

these are the last lines

fossil spoke
#

I mean in the Gamelift backend

regal solar
#

I accessed EC2 instance and viewed MyGame.log

#

it seems my dedicated server can't read env variable of AL2 instance, it tried to write all env variables of instance but there is nothing about websocket, hostid, fleetid etc

regal solar
limber gyro
#

if ur gonna use a paid service you might wanna look into PlayFab, their setup is way easier than AWS, at least the last time i checked

meager fable
#

hence I cannot replicate a UObject that this actor owns

sharp vigil
#

Maybe Im misunderstanding their use but can gameplay tags be an easy way to identify who is on what team in an rts?

fossil spoke
fossil spoke
#

So the short answer is yes.

meager fable
fossil spoke
#

There are other resources that explain how to manage this

#

Its hard for me to link to on my phone

#

But they arent difficult to find.

#

Search for “how to replicate uobjects” or something.

#

There also maybe something in the Pinned Messages in this channel.

meager fable
#

thanks a lot for providing an anchor point, I will look more into it

#

and your intuition wa right pinned messages had the anwser, gotta love this server 😄

gilded merlin
#

Hi folks, I'd like to ask you something. What "should" happen when client would call RPC function on actor A, while that client is outside of relevancy distance of actor A?

#

The first time that function is being called, nothing happens, however it seem like it changes actor relevancy, since from the first call that client is able to call another RPCs that are being executed, even though client is nowhere close to A relevancy area.

hard violet
#

One question, the previous one in PlayerState works well, but the latter one in GameState doesn't seem to work.

scarlet vortex
#

Hi there, I'd like to inquire what tools you use for collecting metrics from your dedicated servers? By metrics, I mean technical ones (machine resources/traffic/average ping/etc.) and the information for game designers (retention/DAUs/etc).
I’m using Prometheus + Grafana for both, but interested in worthy alternatives and real experience with them.

p.s. Here's my guide about Prometheus+Grafana+UE, perhaps, someone might find it useful.
https://corgineering.notion.site/Prometheus-Grafana-for-UE-c2ce18cb1e3c4308a557f26d26bef7fb

dusk fable
#

so in a multiplayer game , im trying to keep score for each player across a series of levels , i read that the best way to do it is through game instance , but thats going to load the same score for every level , so question is how do i save the score for each player and load the correct score for each playerindividualy ?

faint eagle
#

I have a replicated array where item type is derived from FFastArraySerializerItem (and the array itself is a FFastArraySerializer struct). How do I handle new item replicated to client? I mean I know there are 3 methods: "PreReplicatedRemove", "PostReplicatedAdd" and "PostReplicatedChange", but how do I access the actor that contains the replicated array from there? 🤔

gaunt cliff
#

I have a couple of actors that are placed in the map but I do not want them to be spawned/loaded at all on the server, client only, is there something to specify that or do I just do BeginPlay check if server and destroy ?

serene kestrel
gaunt cliff
#

what about this function ? its Editor only so I think it means this will exclude it from being cooked on the server entirely ?

arctic minnow
#

CAN SOMEONE PLEASE HELP ME! 🙂

“LogOutputDevice: Warning: Script Stack (1 frames): GameModeBase.HandleStartingNewPlayer”
“LogWindows: Windows GetLastError: The operation completed successfully. (0)”
“Log file closed, 11/02/21 15:56:41”

I have in my game in my packaged version of my game where I am using steam advanced sessions to host a server the server loads perfectly but as soon as the client joins the server crashes but I tried doing this again but with unreal engines base character and it works so it has to be something with my character but I disconnected all of my code I could think of event begin play event tick ect and it still wont work? 🙂

PLease someone help me!!!!!!!!! 🙂 God bless you all jesus loves you!!!!!!!!! 🙂

arctic minnow
#

Can someone please help me with this 2 weeks And I still cant fix it 🙂

gaunt cliff
#

no one can debug that without more logs, crash dump

stuck ginkgo
#

I'm making a game that moves with physics but there is lag, could it have something to do with the code or do I need to change something from the character?

#

capsule simulate physics on

#

I move it by applying impulse

gaunt cliff
#

Physics simulation that runs on server and replicates the client is not always efficient nor straightforward to implement, I'd say start with making a good clock synchronization and go from there

#

IMHO: multiplayer physics is one of the dark souls games in game development terms

gaunt cliff
stuck ginkgo
#

there's just a slight lag in the turns

obtuse field
#

What is the maximum reccomended size of the array(Lets assume of int32) to be sent via RPC? I remember that when i wanted to send a really big arrays, like e.g. 2000 items(but these were structures, that hold e.g. transforms), it threw an error/warning? I know its byte dependent, not size dependent

bright lynx
obtuse field
#

I know

#

That's why I wrote to lets assume an int32 array

boreal scarab
#

Is there a way to dynamically mark something as "should not be replicated"? I'm trying to implement the concept of public and private information. Private information should not even be sent to clients that dont own the information.

Is something like this a built in feature I can leverage?

#

Importantly, the same data member can change between private and public information

sinful tree
sinful tree
sinful tree
magic vessel
#

I have an ability that will essentially lerp a post process effect and make other players visible through walls. My main concern right now is how do I replicate the parameter collection? An alternative solution I've come to as well is to use a dynamic material instance with post process effect and replicate that instead

#

Since it would be very disruptive if players could somehow cheat and become client side authoratitive with this, I need some advice with this 🙂

#

Really the only thing I need to replicate is the lerp value, but I was wondering if there was anything else I would need to consider

sinful tree
# magic vessel Since it would be very disruptive if players could somehow cheat and become clie...

It won't matter. If you're sending the location information of players all the time, then someone will likely come up with some way to see through walls anyway.
The only true way around this is to have something that ensures that only actors that should be on screen for a client are actually being replicated to that client. Adding something that allows players to see through walls would likely mean needing to include any actors that are within the camera fustrum up to a certain range away to that list of actors as well during the duration of that ability.

#

Then it wouldn't matter if a client changes the value client side as they wouldn't be able to see other players that aren't being replicated to them.

magic vessel
#

The way I'm doing it by gameplay cue, essentially an actor that gets spawned in when the ability starts and ends with the gameplay effect. It is not persistant and that is what is being used to draw to the custom depth

#

I was asking more about how to replicate this effectively and without losing security

#

Or authority over the ability

sinful tree
#

As I'm saying, you're losing authority from the get go as Unreal normally just replicates any actors within relevancy range. This means anyone could piece together a way to know the location of anyone client side anyway, regardless of your ability.

The only secure way is to not replicate all actors all the time and only replicate actors within the frustum that they can actually see (ie their mesh is visible on screen) up to a certain distance away. Your ability would then add all actors to be replicated that are within the camera frustum up to a certain distance away, regardless if they are visible to the player or not. So even if someone does change the value client side, they wouldn't see anything additional beyond what they already can see. There's the authority of it.

cinder girder
#

Just messing around in a tutorial. When using Printf(TEXT("Client %d: OnRep_ReplicatedVar"), GPlayInEditorID)); I am only getting "Client 0: ...." showing. It is not showing the Client ID number. Am I missing something? Sorry newb here lol

#

It is obviously working, but just not getting the ID sent across 😦

bold dune
boreal wadi
#

Has anyone integrated bullet for deterministic networked physics? How tough was it?

cinder girder
hard violet
#

Hi guys, the previous repNotify works really well in PlayerState but I couldn't figure it out how to do it in GameState in the latter. Can someone help me?

sinful tree
sinful tree
# hard violet Is it like this?

Yeah that should work. It's not great to have the cast value being pulled across to the other event, but it should still work ok in this situation.

hard violet
sinful tree
#

Promote the gamestate cast to GS_TestOne to a variable and access that variable in the new event, or, get the gamestate and cast again in the new event.

hard violet
#

Should I DM you to explain thoroughly?

sinful tree
#

It's likely because you're doing it on begin play of player controller and I'm guessing you're doing listen server?

sinful tree
#

Actually, none of what you have here really relates to displaying the board twice. No nodes dealing with visibility or constructing the widget and adding to viewport.

hard violet
sinful tree
hard violet
sinful tree
#

Still not clear. The OnRep should only get fired once if you've set the variable once, which would only trigger the event dispatcher once for each client, which should technically only trigger the event dispatcher bind on each client once.

Additionally since you're doing this bind on begin play of the controller, you may want to gate the bind behind a "IsLocallyControlled" check to ensure that you're only attempting to update UI on the client that owns the player controller and not the server. You're probably getting a few errors in your log right now that pop up every time the OnRep is triggered.

#

@hard violet ☝️

hard violet
# sinful tree <@323043637384708106> ☝️

I'll try to figure it out later. One question, if I want to add a timer for each player's turn, where should I make that event? on GameState and call it later in GameMode or just in GameMode?

rich dune
#

Hey,

I try to trag a ragdoll body in multiplayer. However it crashes after a while with the following log.

Any ideas why?

silver pendant
#

anyone knows why Pitch Control Rotation Isn't replicated by default while the Yaw is, I don't see my character looking up or down from the other player window

fossil spoke
#

Pitch can be different depending on the type of game you are making.

#

First Person vs Third Person.

#

For example.

silver pendant
#

where Is it disabled, or should I make It's own Replication code?

fossil spoke
fossil spoke
#

You need to replicate it yourself.

silver pendant
fossil spoke
#

Though it could exist in UE5. I dont use UE5.

#

@silver pendant Actually looking at it now

#

There is RemoteViewPitch in APawn

#

Its replicated

#

If you call GetBaseAimRotation it will return it for you

#

So it does exist.

#

Just in a confusing spot.

silver pendant
#

yeah I thought It's a check box or something I can just trigger
I wanted it in blueprint

#

but it's ok

fossil spoke
#

It is in Blueprint

#

In your Pawn

#

Call the function GetBaseAimRotation

silver pendant
#

but not the other one

fossil spoke
#

What other one?

silver pendant
#

removeviwepitch

fossil spoke
#

GetBaseAimRotation is that

#

It contains the Pitch Yaw and Roll of the ControlRotation from the Server

silver pendant
#

It's just a get function

fossil spoke
#

Break the output

#

It will give you Pitch

silver pendant
#

no I meant I want this to be replicated by defualt

#

but only yaw is replicated

fossil spoke
#

🤦‍♂️

silver pendant
#

which is weird

#

I just found that Yaw is replicated while pitch isn't

solid river
#

When clients download UWorld from server, does it mean that all assets used on the level are also downloaded from the server?

lost inlet
solid river
#

I think clients load the UWorld from server.

lost inlet
#

there is no transfer of the map itself

solid river
lost inlet
#

this is explaining netmodes and does not say anything close to what you're saying

#

actors replicate through actor channels whether they're level placed or spawned at runtime

#

if a server somehow had a newer version of a map, the client wouldn't know of it.

solid river
#

Quoted from the video above from 2:02:

... As we saw in a previous video, when you start up your game, you get a UGameInstance object that is tied to the lifetime of the process, and then the game browses to a URL - either a server address or a map name. That causes the game to LOAD a map, which gives it a World, and the World's net mode will differ depending on how your game instance has started up. ...

From where does the client load the map?

lost inlet
#

The disk local to you

solid river
#

For a standalone game, the game certainly loads the map locally via a map name.
But for multiplayer games, do they also load the map locally? If yes, what is the purpose of browsing to a server address?

lost inlet
#

Maps are cooked into the game build

#

The purpose of browsing to an IP is to actually make the connection. The server then tells you to travel to the map, which is loaded off the local disk

solid river
#

OK. Thank you. Back to my question several days ago.

A non-replicated actor is placed on the level at design time. In the client machine I get the following logs:

Network Mode: Client
Local Role : ROLE_None
Remote Role : ROLE_Authority
Replicates: False

A non-replicated actor is spawned at runtime. In the client machine I get the following logs:

Network Mode: Client
Local Role : ROLE_Authority 
Remote Role : ROLE_None
Replicates: False

If we compare it with the previous result (the case in which the actor placed on the level at design time), the roles are just swapped.

From these results I made a hypothesis that the map was probably downloaded from the server as the authority refers to the remote machine.

latent heart
#

Authority doesn't refer to the "remote machine"... Remote role refers to the remote machine

lost inlet
#

That was a bit of a stretch from roles and net modes. Clientside spawned actors at runtime does result in the local role being ROLE_Authority

solid river
#
Network Mode: Client
Local Role : ROLE_None
Remote Role : ROLE_Authority ===> This authority refers to the remote machine.
Replicates: False
latent heart
#

Unlike a hud actor, which is entirely client owned.

#

Even if it's not replicated, that actor from the map still exists on the server and the client and the client has no "authority" over it.

solid river
latent heart
#

Local role none seems a bit off, though.

lost inlet
solid river
#

I am trying to log it from the server machine. What will be the result.

latent heart
#

Because it's the server and unreal is a server authoritative engine?

#

...So many corrections...

solid river
#

Log from server side:

Network Mode: Listen Server or Dedicated Server
Local Role : ROLE_Authority 
Remote Role : ROLE_None
Replicates: False
latent heart
#

As expected.

mystic estuary
#

Hello, is it possible to get world opening arguments from BPs? If I do open MapName?something other arguments, I'd like to retrieve the whole string

magic vessel
#

Sorry to tag onto the message chain from earlier, is there a way for a server to load in a map that is a variant to the cooked map? I would love to be able to provide a level editor of sorts with my game but if everything will need to be a replicated actor in order for it to actually work then it might not be feasible

surreal plaza
#

Where is the toggle to simulate a dedicated server in PIE?

limber gyro
#

whats the proper way to set values for abilities along with cmc movement, say for example im ultimating and my ultimate moves me with my custom cmc movement but i also wanna set a bool that says "isUltimating", do i just send an RPC for that variable or can i just set that value to true trough the cmc like "getChar()->isUltimating=true" and it will set it in the server because the cmc exists in both places?

magic vessel
limber gyro
#

nop

plucky prawn
#

is there a good way to replicate data in a struct? i understand i cant replicate a struct but i dont want to make a new uobject and try to replicate that because it sounds like a bad time. this is what i have so far.

plucky prawn
#

the answer is remove Replicated from the uproperties and it works fine

true stream
#

is it normal when trying to read a property of an object that exists in my level to not get it

#

Im trying to read the playerStart rotation using get all actors from class, but rotation comes back as 0

#

I do get the actor, the position is there, but the rotation is reset somehow.

weak linden
plucky prawn
#

ill look into this thanks

weak linden
# plucky prawn ill look into this thanks

There's some nice functions it includes for client side events (PreReplicatedRemove, PostReplicatedAdd and PostReplicatedChanged) when items are added, removed or changed too

fierce grove
#

On a coop game would you make a replicated client side inventory or host controlled inventory?

limber gyro
#

i have a replicated var that belongs to a character that i set to true and false in the CMC but for some reason the value is not replicating?

plucky prawn
fierce grove
#

Yes of course, that I understand. It was more an architecture matter, I open my inventory on a client should the client has his own representation of his inventory or ask the host for what inventory he has. More stress on the server for sure

blazing spruce
#

Hi, quick question.. when doing checks to see if an action can/should be completed, should I do the checks when the player is pressing the input key itself or let the input call the event and have the event do the checks? or does it not matter either way as long as the checks are done before the action is executed?

mystic estuary
#

Hello, can someone confirm whether the behavior I get is correct. So, I have a player state BP that has a bool bIsReady with RepNotify which replication condition is set to None, and anytime I change its value from client the OnRep function is called only there, i.e. not server-side. Since PS are owned by the clients, I would expect any modification of a RepNotify property to fire OnRep function on every machine. Are my expectations wrong? If so, how should I modify the value client-side, through a server RPC perhaps?

thin stratus
#

Replication will only, ever work Server to Client

#

The only thing Client to Server are ServerRPCs

#

And those have to be called inside Client-owned Actors, such as a the PlayerState

mystic estuary
#

Oh, thank you, alright, I'll use a server RPC then 😄

thin stratus
#

The OnRep only calls cause OnReps in BPs are smokes and mirrors

#

They are actually OnPropertyChanged callbacks

#

In C++ you wouldn't have that

mystic estuary
#

Also, I have another problem, unrelated to the previous one. I need to know whether clients are travelling to some new map, or being disconnected from the server because it destroyed the world without any seamless travel. Do you know how I can detect the last case?

#

I need to know that client-side obviously

thin stratus
#

GameModes Logout function for example?

#

Ah

#

EndPlay of their PlayerController?

#

GameInstance also has callbacks for NetworkFailure and TravelFailure iirc

mystic estuary
#

Oh, yeah, I remember seeing some function that returned an enum with all these things, but forgot which one. Thank you again 😄

mystic estuary
thin stratus
#

For example yeah

mystic estuary
#

Alright, thanks

dusk fable
#

hey , i have this problem that i havent found much info about it , how do i keep score through a series of levels in a multiplayer game ? (using blueprints)
-(i read that using Save To slot isnt good implementation because players can easily cheat )

#

goal is to have players collect credit in the side levels , and get the total credit back to the main level

fair latch
#

Dont worry soo much about cheating imo, if they want to cheat in your game they can do it anyway. Just do server validation for important things like checking if the score gain is abmormal.

dusk fable
#

okay so , i dont have to worry about the score loading up the same for everyone else ?

#

or this happens just because im using same pc and same saved file ?

fair latch
#

I dont know the context

#

If every machine gonna have their own .sav then test it outside pie imo

magic vessel
#

Could do something with seamless travelling, have a component on the game mode or player controller that keeps track of each score and copy over the value every time you transition to a new map?

magic vessel
echo snow
#

Would doing this to replicate camera rotation cause lag for the owning client?

magic vessel
#

You could instead set a replicated camera rotator variable and have the client set their camera to that value in a rep notify

magic vessel
fair latch
echo snow
#

How can I let the client keep their own control rotation value so they don't need to rely on the server, but still replicate for other clients so they can see the camera movement?

gusty slate
#

Keep the actual control rotation client side and just send it to the Server to replicate to all clients

#

camera rotation isn't something that really needs authority so keep the logic to control the camera client side

#

and then periodically (figure the best interval) send that value to server and distribute it to all clients

marble ether
#

Hey guys, I've got a really weird issue with my character Aim Replication. All the details are within the video. Any help would be appreciated. Please and thank you

rancid wren
#

Question about seamless travel. If want to keep my pawn, I added him the getseamlesstravel actor list, correct?

flat halo
#

Hey folks.

I have a simple component inheriting from USceneComponent and to implement position replication smoothed on the client.
But the default replication of USceneComponent fights mine. Default replication of USceneComponent is really jittery.

Is there any way I can disable it, without changing the USceneComponent source?

I searched in the server and I didnt find a solution, although @chrome bay posted this:
"You really should avoid replicating USceneComponent derivatives if you can"

Why is that? If so, where would I put my component replication code? In the actor?

Thanks in advance!

dark edge
echo snow
fathom aspen
fathom aspen
flat halo
# fathom aspen Read on conditional property replication. You use a mixture of PreReplication an...

hey, so I read the documentation page and I dont see how that will help me.

In my derived component, I dont have visibility of the replicated properties of the base type USceneComponent, they are private.
If I did had visibility, I guess I could just DISABLE_REPLICATED_PROPERTY.

I tried not calling Super::GetLifetimeReplicatedProps(OutLifetimeProps) from my component, but in that case my own replicated properties wont replicate.

lost inlet
#

Although, is it a root component?

flat halo
lost inlet
#

Disabling the default replication on RelativeLocation, RelativeRotation, etc, is your best bet

#

though any changes to the replicated position takes effect in USceneComponent::PostRepNotifies(), which is virtual

#

so you could completely change that behaviour

#

OnRep_Transform sets bNetUpdateTransform to true

flat halo
#

ok, with that I think I can "hide" the behavior, but network data is still being sent from server to client if I am not mistaken. So I am wasting bandwidth.

#

ya, I am losing hope there is a nice way to solve this.

might as well just move all the code to the Actor, disable replication in the child USceneComponents, and control them from the actor.

dark edge
#

I would just hook in and override the bit that does the actual moving of the thing

#

you still want to replicate movement, just smooth it out

#

you can do that there

brisk swift
#

This is nullptr for client, how do I make it not

dark edge
#

probably calling it too early

brisk swift
#

yeah it's in begin play

dark edge
#

yeah the PC might not have a pawn yet

#

you want to set those refs after possession

brisk swift
#

I put it in OnPossess and still doesn't seem to exist, maybe I set it in the character class?

dark edge
sinful tree
marble ether
#

My aim replication isnt working, one player can control both head rotations on their respective windows. I followed a tutorial and everything. How would I fix this?

viscid tapir
#

Is it dumb to only replicate an inventory content to the owner since other clients can't do anything with the inventory data ?

sinful tree
viscid tapir
marble ether
#

heres the system in the character bp. then the called variable in the anim bp.

#

all rotation variables are replicated as well

dark edge
#

show how you're getting the character

marble ether
#

the character blueprint calls it from the look input, the anim bp calls it from the event update anim

#

and the last shows the transform plug in

#

heres a print string showing the pitch values for both players

final bluff
#

Hey yall

#

im new to networking and trying to understand communication between server and clients

#

trying to use Rep Notify and running into an issue , hopefully someone could shed some light on it

#

When Box collision overlap occurs , It calls the event "Player Claimed Zone" successfully , which then sets the Bool "Zone Claimed" to true , This then calls the OnRep function "OnRep_ZoneClaimed" for that bool On both the servers and client successfully.

The Issue im running into is that i want to call the function "Player Claimed Zone" via a key input instead of overlap . When i call that function via an Input Key , it no longer successfully gets called on the client and server , it only gets called on the client

#

why is this happening? Why is the function working perfectly fine when triggered via overlap but does not called when triggered via key input?

.

#

(Ovelap Event) 👇

#

(Rep Notify Funtion called "OnRep_ZoneClaimed) 👇

#

(Calling the function via a key input) 👇

sinful tree
# final bluff (Ovelap Event) 👇

Overlaps can be detected on clients and on the server, so that means each client as well as the server is going to detect the overlap, and attempt to loop through all the players and do the rest of what you have there. Assuming this isn't an actor that a player would possess or own, you shouldn't be sending a server RPC here either as it's something that can be done on just the server.

First, have the overlap use a "Has Authority" node before everything. This will ensure that the code is only being executed on the server.
Second, you shouldn't need to loop through all the players and checking if the actor is the one overlapping. All that is required is to check if the overlapping actor is of the class of the player - assuming you have a specific class you use for players and players alone, you could cast "other actor" on the overlap to your player character's class, if the cast succeeds, then you can set the values as you desire.
Third, again, remove the server RPC. Just set the bool after this point as you're already running on the authority.

final bluff
#

i knew the loop iwas doing was weird , i was just trying to figure out a way to find the player without casting . But i guess thats not needed

covert mirage
#

Hello, sometimes when I travel (using UEngine::Browse) to the destination map I get a connection Timeout and return to the default map during multiplayer session. How to solve this is or there any solution related to this?

final bluff
#

Thanks for the response! , Ive changed to what i believe is what you had noted.

#

And to confirm what you had said , this code is being written on an actor not owned by the player

#

The actor in question is set to replicate within class defaults

#

But the issue is not resolved

#

When pressing the key 1 and setting the Rep Notify variable "Zone Claimed" on the server , it executes the OnRep function on both server and client

#

But When pressing the key 1 on the Client , it now executes OnRep function on neither , Where as before it executed on only the client

final bluff
#

wait i think im just casting wrong , looking into how to just cast to a class rather than a specific instance of one

sinful tree
#

Should be like this.

#

The enable input won't work correctly as enabling input is only for the local client (or the listen server host)

final bluff
#

I need to change that rep notify bool via an input

sinful tree
#

Well you can't do it through this actor. Inputs are local only and you can't RPC through unowned actors.

final bluff
#

GOTCHAAAAAA

#

i think thats whats been realling holding me up

sinful tree
#

Additionally replicated variables are only set by the server, not clients.

#

Clients can change the value, but only locally.

final bluff
#

Thank you so much!! , going to read over what you said do some more research and keep working on this . ( This is my 1st online project )

#

Pointing out that inputs are local only , is def helping me get pointed in right direction

final bluff
radiant hinge
#

Hey quick question. Is there a name for transferring in and out of game levels on a multiplayer session?

#

what is it known as ^

fossil spoke
#

There are 2 types of travelling in UE.

#

Hard Travel

#

Seamless Travel

#

Hard Travel is when you connect to a Server for the first time.

#

Seamless Travel is when you transition from one level to the next on the same Server.

radiant hinge
#

ok perfect is one better than the other when it comes to multiplayer level transitions?

fossil spoke
#

Its not so much about which is "better"

radiant hinge
#

ahhh yeah I see

#

thanks! will do some research

fossil spoke
#

Good luck!

#

👍

safe vapor
safe vapor
#

I am watching this live stream: https://www.youtube.com/watch?v=CDnNAAzgltw but an article to read would be great.

Working on a multiplayer game? Are there many players in-game together? On this livestream, our networking team will demonstrate 4.20's new Replication Graph Plugin and the server optimizations that were implemented for Fortnite Battle Royale.

NEWS

Unreal Engine Drives Monster Puppet for The Mill and Monster.com
https://www.unrealengine.com/...

▶ Play video
heady copper
#

hello good morning guys

#

scripted an ai bot for a multiplayer client side bot works fine but for server bot doesnt aim an shoots itself please help

frozen wraith
#

Been reading around on networking stuff as I have the vanilla build from the EG launcher. So as I've understood this, even if you only want people to create sessions and not have dedicated servers for your online game, you still need to build the engine from source, am I correct? Vanilla build is technically strictly for SP games?

quasi tide
#

No you are not correct

#

Source is only required for dedicated servers

frozen wraith
#

Ohhh, I see! That will save me further headache I suppose 😁 so is there a limit as to how many clients you can have connected to a session? Or does it just depend on the hosts connection?

quasi tide
#

Depends on multiple factors.

#

Hardware, code, connection

frozen wraith
#

Ah yea ofc, cheers!

eager rivet
#

Hello !
As part of setting up an experience on Unreal 5,
I would like to implement integrated screen sharing in the world in non-local multiplayer.
I found a few plugins that allow screen sharing but none are replicated.
Does anyone know of a solution in blueprint or with a plugin?
Or should I look into C++ and if so, what would be the best way to do it?

fierce grove
#

How to have a begin play on playerstate only fire on one client "the real owner" if I may say?

tall drum
fierce grove
#

Yes yes but my problem is the spawning Order GM -> PC > Playerstate ... so what I do a delay inside the PC ? I hate that 😢

tall drum
#

You should avoid delay, it doesn't solve, in fact, its quite the opposite 😬
MMh, perhaps, you can try with GetOwner or PawnPrivate in playerState

fierce grove
#

except If I do a full "Loading player into world...getting his inventory...async loading shit then saying ... small delay then "Hey I Just connected bros"

#

what I know Is that OnPostLogin should not be used (well only to store PCs ref)

tall drum
#

Hey Guys

I was working with FFastArraySerializer for replicating AddInstance on ISMComponent and it does work. Client can see Instanced Static mesh component.
However, I have another value TArray <FTileStruct> GridTiles; in my FFastArraySerializer struct which seems not being replicated for some reason..

void FPTGridSerializer::PostReplicatedAdd(const FPTGridArraySerializer& InArraySerializer)
{
    GridTiles.Add(Tile);
    ISMComponent->AddInstance(Tile.TileWorldLocation, true);
}

Below is a function from a AClass

    //Some stuff before
        InstancedTiles.GridTiles.Add(InstancedTiles.Tile);

            ISMComponent->AddInstance(InstancedTiles.Tile.TileWorldLocation, true);
            ReplicatedInstancedTiles.MarkItemDirty(ReplicatedInstancedTiles.Items.Add_GetRef(InstancedTiles));

My ISMComponent is correctly replicated but not my GridTiles array.
I tried to fill and replicated an array from my AClass, it is correctly replicated but I would like to keep it with FFastArraySerializer because I can have a lot of values

Do you know if FFastArraySerializer work with Array? Is there a step missing? I have no idea where to look

woeful ferry
#

How do meshes get replicated, through path?

tall drum
#

In my FFastArraySerializer struct, I have an ISMComponent

    TObjectPtr<UInstancedStaticMeshComponent> ISMComponent;```

Then in my function from my AClass which has an ISMComponent set, I pass like this:

`InstancedTiles.ISMComponent = ISMComponent;`

And it does the work
marble gazelle
#

so you have a struct that has your component and an array of tiles?

tall drum
#

exact!

struct FPTGridSerializer : public FFastArraySerializerItem
{
    GENERATED_USTRUCT_BODY()

public:

    // ISM Component for the grid
    UPROPERTY()
    TObjectPtr<UInstancedStaticMeshComponent> ISMComponent;

    //Tile
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
    FTileStruct Tile;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
    TArray <FTileStruct> GridTiles;
marble gazelle
#

so why do you call GridTiles.Add in post replicate? wouldn't you add your entry on the server and then just mark the item dirty?

tall drum
#

When I set a breakpoint there, it pass there for each generated instanced static mesh
I though it would replicated the array for client there, like it did for the ISMComponent

marble gazelle
#

in theory it should.
How ever, if it doesn't, my solution would be to wrap the array with a struct and write a simple net serialize function for it

tall drum
#

👌
Okay, by wrapping, if I understand correctly, I should create another FStruct and move my TArray <FTileStruct> GridTiles inside?

marble gazelle
#

exactly

tall drum
#

A simple struct, not with FFastArray stuff ?

marble gazelle
#

not sure if nested fast array works^^' / it worth it
I'd start with just normal struct serialization without delta, just to check if this is the issue

tall drum
#

got it, thank you! I'll dig in now 😄

tall drum
#

Thanks, I didn't know, I will update!

compact plume
#

For folks familiar with Unreal Tournament's implementation of Projectile Prediction and forward-ticking the projectile on the server: I'm having trouble understanding why the server forward-ticks the replicated projectile by 1/2 * ping when its spawned, instead of the full ping value.

I'm drawing it out in a table where I'm matching server states to client states ovewr the time interval, and in this scenario, it seems like the fake client projectile has to sync "backwards" (or at least, there exists 1 replication update where the projectile hovers in place and doesn't move forward) once it receives the replicated one to replace it

compact plume
#

ahhhhhh i think I see in BeginPlay() that the projectile that's spawned on client (from replication?) is invoking CatchupTick for another 1/2 * ping, so that might be the missing 1/2 i was thinking of...

if my understanding of this is totally off though please correct me 😅

surreal plaza
#

Are there any disadvantages to depending on TArray replication? I am assuming order is maintained. I can't see the array getting bigger than, say, 500 members or so.

young spoke
#

does a moba / rts use net-relevancy for sparsely spread units?

  • assume no fog of war.
  • assume a player can instantly move their camera to a location on a minimap and expect to see the actors there instantly
eternal canyon
sweet marten
#

I have a actor in my level that when interacted with should send an integer to the server via a bpi, how could I do that since my client isnt the owning actor and thus can "tell" the server to change a var

quasi tide
#
  1. Interacting actor calls a server RPC with the thing it wants to interact with
  2. Server validates that it is legal and then does the logic
#

Pretty much how any interaction type thing works honestly.

sweet marten
#

Soooo I cast to the actor that called the interact event and then send the rpc?

quasi tide
#

No?

dark parcel
#

@sweet marten

quasi tide
#

The actor that is doing the interaction (which is going to be the player, because they are the only external thing to be able to influence things) will just call a server RPC on themselves

dark parcel
#

2nd pic is from the object u r interacting

quasi tide
#

That way also works

sweet marten
#

alr imma try and see how to make it work

quasi tide
#
  1. Player calls server interact
  2. Server Interact method is a server RPC that just calls "Interact" on the object that was passed through the server interact event.
#

That's it

#

Replace the method names with w/e fits your game

dark parcel
#

What's the equivalent to server_validate in bp? Is there even such thing

quasi tide
#

Not that I'm aware of

#

And people have largely moved away from the _validate method from what I've heard

dark parcel
#

0o I c

sweet marten
dark parcel
#

You want to run rpc on things you own. Your character or your controller

#

@sweet marten send to server via your character or controller. Then server can change the value in game state. If the value changed is set to replicate, the client will eventually be updated

sweet marten
#

First screenshot is my BaseCharacter, after that is my gamestate and then finally the actor which is getting interacted with

#

What am I doing wrong here?

dark parcel
#

Don't touch Ur game state like that

#

Have a server rpc in your character. Call it serversettheint. Have a parametre of int, that you want to send. Here you can get a ref to your game state and set the replicated in in game state ( at this point its the server anyway )

When Ur actor in the level is interacted, switch has authority. If remote, get interacting character, call the serversenttheint

#

Tldr only let your server change the value in gamestate. Client can use server rpc on what they own, which then tell the server to set a value in the game state

#

That's all I can say, can't hand hold you no more than this.

sweet marten
#

so basically like this?

dark parcel
#

No

sweet marten
#

I just checked and it works (not for the server rn obv) but client works

#

Anyway what did I do wrong?

dark parcel
#

Hard to say, what's doing what. But you probably set the value locally as the client instead telling the server to set the new replicated value

sweet marten
#

Heres where that actors bpi goes to if that helps in any way

velvet jacinth
#

Hey guys,
I have an architecture question.
Calling a DropItem function (for example) on the server will help to reduce cheating when on a dedicated server.
But is it the same case on a Listen Server?
Because on a Listen Server the "Server" is like a single player - player.
So he can still cheat basically.
As I understand it, creating an Inventory on the owning client would have no difference between create it using the client/server RPCs because they both could cheat that way or another (as long it's not a dedicated server).
A server RPC call is only good when you want to replicate something to other players in that case.
Am I right? 🤔

brisk swift
#

trying to spawn a projectile in multiplayer game, client and server both see server projectiles but server doesn't see clients, clients call spawning the projectile on a server rpc though

fair latch
#

@brisk swift show code

brisk swift
compact plume
# eternal canyon because ping is the trip time in both directions

Right, but in the clients case, by the time they've received the replicated projectile, ping amount of time has passed due to a complete round-trip. So the server projectiles we're receiving has only traveled approx half the distance of the fake client projectile so far?

And furthermore, when the server receives the projectile request and handles prediction forward-ticking, it's been ping amount of time since the server was in the same world state that the instigating client was in

eternal canyon
#

it has traveled the full distance

#

that the client has

#

msot likely

#

since we cant prove it

#

due to relativity smthn smthn

eternal canyon
#

so server forward ticks

#

thats it

eternal canyon
compact plume
#

Sorry im still a bit hazy - when the server sends back the real projectile, the client has traveled another half ping of distance tho right? So now it's ahead

eternal canyon
compact plume
#

Unless this is resolved by the additional forward tick in BeginPlay that gets invoked on client receiving a rep projectile

eternal canyon
#

whcih at that point seems kinda pointless

#

so u just keep the fake

#

since it should be fairly deterministic

compact plume
#

But then in this case since the fake projectile is synced to rep proj, it moves backwards for one tick?

eternal canyon
compact plume
#

So if proj is moving at 1000 units/sec and ping is 100ms:

  • Client shoots at t=0
  • Server receives at t=0.05
  • Server forward ticks at t=0.05 to 50units
  • Client fake proj is at 50units at t=0.05
  • Client receives rep proj at t=0.1
  • Client fake proj is now at 100units, but the authority proj it's receiving from server is at 50
  • And fake proj is synced to rep one, so it moves 50 back?

What am I misunderstanding here

fair latch
#

You want to see your projectile rubber banded?

compact plume
#

The only thing I can think of is that the Client also forward-ticks the received rep projectile by another 1/2 ping after receiving from server, which I thiiiiink is happening in BeginPlay

compact plume
compact plume
eternal canyon
#

cause it kicks the player doesnt it?

#

it should just reject the rpc

eternal canyon
quasi tide
#

I don't have all the exact reasonings. But from what I've seen people say is because it kicks people if it returns false. And sometimes it may not necessarily be an "accurate" reason to return false.

#

So it's been getting handled manually.

fair latch
#

Yeah but dont u want to kick ppl when they r being naughty?

#

If damage is over 99999 gtfo

eternal canyon
quasi tide
#

Mayhaps. But it's the second part that is the real takeaway

fair latch
eternal canyon
#

it would be better if it would just refject the rpc

compact plume
eternal canyon
# compact plume Why not?

cause the whole point of the forward ticking is to compensate for the clients time to send the rpc, if its fairly deterministic they should be in the same state

fossil spoke
#

@eternal canyon AFAIK Validate is run prior to the Implementation, so you dont necessarily need to return false if you find that validation is incorrect.

eternal canyon
#

bonk

compact plume
eternal canyon
#

tho that would require a lot of changes i would think lol in their code

fossil spoke
#

Or an enum that defines the behavior

eternal canyon
#

yep

fossil spoke
#

It would actually be nice if validate also passed through the inputs as reference so they can be modified before being passed through to the implementation

#

So you can correct them to some degree

eternal canyon
eternal anchor
dark edge
#

I haven't done it but I think the ideal projectile is probably something that's fairly deterministic everywhere and uses clientside hit reg with serverside sanity checks

eternal anchor
#

it entirely depends on how fast projectile is moving, if it is physics sim, and how much do you care about server protections

compact plume
eternal canyon
compact plume
eternal canyon
dark edge
eternal canyon
#

if ur projectiles are just a straight line

dark edge
#

What im talking about is the projectile flies the exact same everywhere

eternal canyon
#

with a little drop off

#

or no drop off

dark edge
#

just at different times

unborn nimbus
#

What's the function that is essentially "IsLocallyOwned" ie. It's a replicated actor and I'm the owner

dark edge
#

you can just get owner on the thing

compact plume
compact plume
#

side-note: if possible, i'd love to chat w/ folks that are familiar with the UT implementation in VC today evening and walk through the code flow

dark edge
#

so it just goes forward less fast

#

during the lerp

compact plume
#

So I guess my original question is why do that instead of forward ticking the received replicated projectile on client to account for rep time (which might actually be what happens in BeginPlay)

#

(which is equivalent to a total forward ticked time of ping for the instance of rep proj on that instigator client, but may vary on other clients based on their ping and is only half that value on server)

dark edge
compact plume
dark edge
#

At any given moment, do you want the client to see the projectile in the place it expects it to be, the place the server has it, or the place the server had it ping/2 ago?

compact plume
#

well potentially with the atomic forward-tick on server and then per-client forward-tick on receiving the replicated projectile, those should all converge

#

err, the first 2 should converge

dark edge
#

the clients character is ahead of the server by ping/2, do you want their bullets to also be ahead (locally simulated), be in line with the server (server simulated + some adjustment), or be behind the server (just naive replication)

#

someone somewhere has to see a projectile diverge from its usual local flight

#

for them to line up at any given moment in time

#

or not, and just let the client say "I hit this guy" and the server say "yeah it looks like you could have"

compact plume
dark edge
#

I'd have to think about how that'd interact with moving pawns

#

End of the day, I think a client hitting another on their screen should be a hit, as it feels way worse to hit but not actuallt then to be hit but not actually from your point of view

#

with predicted movement there's always going to be 3 views of the world at any given time so everyone can't be correct

compact plume
#

yea where it gets funky is that the world state itself fundamentally differs from when the client fires vs when the server receives the request, and im trying to avoid a solution involving rewinding

dark edge
#

I'm glad my project is just saying no prediction lol

#

server simulates, you see it ping/2 time later, end of story

#

It's a combat vehicle building game though so not super twitchy

#

would never work for Counter Strike

compact plume
#

honestly i dont need this granularity of prediction and physics simulation but im trying to properly grapple with it conceptually

dark edge
#

I wonder what most shooters use nowadays

#

I think it's some variant of clientside hit reg with serverside sanity chekcs but I'm not sure

compact plume
#

if you have the compute to afford rewind and replaying the physics sim, thats probably most effective

dark edge
#

Since every client is in the future vs other clients on their own screen you can probably just record state and do your rewind that way.

#

the movement a shooter saw in the pawn they hit actually happened, just not at the same time as the shot

compact plume
#

so i think the solution i proposed somewhere earlier should solve this, barring any issues im totally overlooking:

(all this assumes within some ping threshold)

  • client shoots, fake projectile spawned
  • server receives request
  • server spawns a projectile, forward-ticks by 1/2 ping, replicates it out to everyone
    • this is where its kinda murky because someone who was in the path of projectile on client may have already moved out of the way on server, and server won't know this if its less than the distance traveled by that 1/2 ping forward tick
      • that's the only case for clientside reporting here i can think of, but we'd have to reconcile on server with target's cached movement history
  • original client receives the replicated projectile, and forward-ticks that one by 1/2 ping to account for replication time
    • this should line up with their fake projectile at this point -- so we can disable the fake projectile and let the replicated one take over, no blending required
  • a different client that receives the replicated projectile would forward-tick it by 1/2 their own ping, not the instigator's ping to account for their own unique replication time
#

and honestly can prob do a hitscan linetrace rewind for that 1/2 ping server forward-tick prior to spawning rep projectile

dark edge
#

Here's mine:

  1. Shooter shoots, RPCing the relevent data to server, begins simulating projectile locally
  2. Server shoots, RPCing the relevent data to clients besides owner, begins simulating projectile locally
  3. Other clients shoot, simulating projectile locally just for cosmetics. Projectile is flying locally on all relevent machines
    LATER
  4. Shooter hits, RPCing the data to server and doing predicted hit effect stuff
  5. Server gets hit data, sanity checks it and notifies if it wants to override it (rare)
compact plume
dark edge
surreal plaza
#

Anyone know if it is possible to display wireframe views on PIE client windows?

eternal canyon
#

forget which

young spoke
#

does a moba / rts use net-relevancy for sparsely spread units ( or just bAlwaysRelevant = true;)?

  • assume no fog of war.
  • assume a player can instantly move their camera to a location on a minimap and expect to see the actors there instantly
eternal canyon
#

Depends on the networking type

young spoke
solid river
#

Is there any non-trivial example in which spawning replicated actors on the client is mandatory?

#

If there is no such example, why didn't EPIC make replicated actors always get spawned only on server and never on client? In this way we no longer need to do net role check if(HasAuthority()) everytime we spawn replicated actors on the server.

Any idea?

radiant hinge
#

Hey quick question: Is it possible to have multiple players on one server but on different game levels? thanks in advance if you know the answer

gritty kestrel
radiant hinge
twilit sage
#

Hey guys - im trying to mod the MenuSystemPro, and cant figure out how to get a level name from session data. Any ideas?

#

You cant break the data struct, and session info isnt level name specific

#

Is there a c++ fix? If so, i can certainly do something with that

twin juniper
#

very usefull info, used google, searched on unreal documentation, nothing, only here I was able to find that info

#

yeah lol

#

that was the most recent thing that popped out

solid river
#

If we place a replicated actor on the level, why is there only one actor on each client rather than 2 actors (one is replicated from server and the other one is spawned locally by the client)?

mystic estuary
solid river
#

Drag the replicated actors onto the level at design time.

#

In this case the replicated actors are not conditionally spawned with if(HasAuthority()) check.

mystic estuary
#

The design time is prior to play time, right?

solid river
#

Yes.

mystic estuary
#

Well, the clients are essentially getting a copy of the server world, which has only one actor. If you would spawn the thing on play time, and the code would be executed both server and client sides, you would get two actors client side, and only one server-side

solid river
#

But map is loaded locally by each client rather than downloaded from the server, right?

mystic estuary
#

Yeah, but I think things that are marked as replicated are not spawned client-side, but replicated rather, unlike things that are not usually marked as replicated -- walls, floor, lights

solid river
#

It looks like as if there is if(HasAuthority() executed in the level script running on each machine.

limber gyro
#

does any one know whats the proper way to do security checks with the CMC, for example, i want to spawn something in the server, so i do a server RPC and in that RPC i can check if my cooldown or my resources or whatever has a valid value in the server, but in the CMC ur just setting the bit flag and its being sent, theres no RPC, so how would i check if my cooldown has a proper value in the server?

severe quiver
#

Was wondering if anyone here had any insight regarding a replication problem I'm facing. Basically I am making a multiplayer inventory system and am running into the problem of the server not replicating the item array to clients.

I have the inventory as an actor comp, set to replicate of course, with the replicated props code to go along with it. My items are a custom C++ struct (don't know if this can cause replication problems).

Users should modify the inventory via the UI by drag and dropping. When this happens, a Server RPC gets called which modifies the inventory array but that is where it all goes wrong. The modification is good on the server and it shows the correct array information, but on clients it is as if the drag never happened + the UI never updates so it appears as if the slots are empty. To update the UI I am using a multicast delegate broadcast.

#

This is the replication code I have, variables are set to 'Replicated' of course.

#

I have this gimmic code in place which could easily be the problem. This is the code I have in the slot widgets OnDrop function:

#

I cannot call a Server RPC on an actor which isn't controlled by a player so this way I am trying to call the method from the Player actor. The functionality is still the same as before, just a wierd way I found to go around the issue.

#

So yea that is it, sorry for the long read, hopefully someone sees something here that I am missing, if you need more pictures do tell me

limber gyro
#

but from what u put there i cant see a problem ur probably gonna have to show more, also keep in mind that UMG doesnt replicate, ur gonna need to pass that RPC through a replicated actor

true spade
#

I have a question about child actor component, Im using it for guns in game, and I attach it to GripPoint socket on the player, and while testing in the standalone/listen server everything works fine but when I tested with client the gun has a large offset (as shown on image) is there any solution to it or what I might miss? Thanks

severe quiver
limber gyro
#

if u have a player it must have a PC so it shouldnt be an issue eve nif it is the default class

#

ive seen people have problems with replicating arrays in here so ur issue is not unusual and i think that if u search enough u will find an answer

#

some days ago some one had marked the properties inside the struct to replicate and it wasnt replicating because of that

#

turned out he only need to to mark for replication the array itself

#

im sorry i cant help more i havent done replicated inventories yet

thin stratus
#

@severe quiver Are you sure the items aren't updated? Where is the Multicast?

#

Can you show how you try to update the UI?

silver pendant
#

what Reliable does?

true spade
fierce grove
#

In a multiplayer context for let's say an interaction system, would you do traces On both server and client or only client?

dark parcel
#

I would just let the client trace and report to server with little checks

#

Client will be ahead of the server anyway. If you have a one second delay, when you trace. What you hit may not be what the server hit

thin stratus
#

I think this is the same with any other predicted action

#

If you care about cheating, do it on the server.
If you care about cheating, but want a bit more responsiveness for the client, do it on the client and double check with limits on the server.
You can, e.g., send the Location the Player traced from and then check if that is in a limit of distance between current location and what the client said.

If you don't care about cheating, do it on the client.

fierce grove
#

it's mostly coop

dark parcel
#

Then maybe for most of RPC, you can just let client send and tell server to "trust me bro"

severe quiver
#

This is a multicast delegate of course

#

I've debugged it and it does fire when it needs to, just the clients have wrong info (the not updated items) and that is why it shows wrongly. All in all the entire problem is that clients don't recieve the correct info about the items array

thin stratus
#

The Multicast can come in earlier

#

If you need a callback for Data being replicated you need to use an OnRep

#

And for Arrays of inventory items you then usually use the FastArraySerializer stuff

severe quiver
#

The OnRep method saved me now actually, now it works finally

#

Basically I am still using the server method to do the updates and then in the OnRep I've put my update delegates and it does show correctly

#

Thanks everyone for pushing me in the correct direction 😄

echo snow
#

I want to find a widget in my game world and execute a function in that widget when a session invite is received.
How can I get world from a game instance class?

#

Apparently I can just call this function without a reference to the world

echo snow
#

game instance

dark edge
#

Yeah that's strange. If it was an actor at least it'd be able to infer the world.

#

Does it work?

echo snow
#

yeah it works

#

it can find actors in the world

dark edge
#

I wonder how tf it picks the world but if it works it works

brisk swift
#

Hi, when I kill an enemy the client and they drop their weapon the client sees one weapon dropped and another floating in place. ```void ABaseCharacter::Die()
{
EquippedWeapon1->DetachFromActor(FDetachmentTransformRules(EDetachmentRule::KeepWorld, true));
MulticastHandleDeath();
}

void ABaseCharacter::MulticastHandleDeath_Implementation()
{

EquippedWeapon1->WeaponMesh->SetSimulatePhysics(true);
EquippedWeapon1->WeaponMesh->SetEnableGravity(true);
EquippedWeapon1->WeaponMesh->SetCollisionEnabled(ECollisionEnabled::PhysicsOnly);
EquippedWeapon1->WeaponMesh->SetCollisionResponseToChannel(ECC_Pawn, ECR_Ignore);
EquippedWeapon1->WeaponMesh->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Block);

}```