#multiplayer

1 messages · Page 117 of 1

fathom aspen
#

But not sure why would someone call a client RPC on BeginPlay is you get a client execution path in BeginPlay already

#

Yeah indeed

#

And have that option as a CVar

#

I would like to look at how doable that is some time soon™️

woven basin
#

Couldnt we just check DORM_Initial? If it is DORM_Initial - dont BeginPlay?

fathom aspen
#

The problem here is not dormancy. Awake actors have the exact same problem

woven basin
#
    /** This actor is initially dormant for all connection if it was placed in map. */
    DORM_Initial UMETA(DisplayName = "Initial"),
#

but it only applies to Net startup actors?

#

so if it is DORM_Initial - it is a net startup actor that is not yet replicated?

fathom aspen
#

But that will be part of the solution indeed. If we don't take dormancy into account, BeginPlay for example will never get called for such initial dormant actors, and we might want to assess if it's good to starve our actors BeginPlay

woven basin
#

How else do you have DORM_Initial?

pallid mesa
#

no, a net startup actor is any actor that has been preplaced in the level

#

dormancy is just an optimization setting

woven basin
#

but all net startup actors start as DORM_Initial according to that comment?

#

so it is only DORM_Initial until it knows its actual dormancy?

pallid mesa
#

no, all DORM_Initial net startup actors start dormant

#

so you have to explicitly set that setting in the actor

woven basin
#

so just set that client side only, and check for that, which means it was replicated, and do that?

#

so server knows it is not dorminent, replicates, begin play

pallid mesa
#

no

#

dorm initial is a replication optimization setting

#

net startup actors arent necessarily dormant initial

#

you can opt in for dormancy as an optimization

#

but thats not part of the problem here

#

in fact, by default they arent

#

now i have to go!

dire dragon
#

why is that happening

ionic ice
#

hello gyus,

I am trying to test my multiplayer game. I have a lobby gamemode and level by the name of Lobby where I execute the command "open MYIPADDRESS" for local gameplay. My default server map is Lobby as well and once lobby has at least 2 players, it is supposed to move to another level called Teams. I do this by calling ServerTravel(FString("Game/Maps/Team")) but the nothing happens.

I am doing alll this on dedicated server jbtw. Any help"

soft flare
#

Yo dudes for some reason my clients have all super low fps, someone knows how to fix that?

woven bramble
#

My game has no lobby for some reason, I need the PlayAgain button.
Before destroying the current session, I want to save their Steam information to Instance. After Create Session, I want to show Invitation on the screen of these users, if they accept, they will connect to this Session.
Does anyone have any idea how I can do this?

soft flare
#

Someone pls tell me if he knows how to fix that, im not finding anything in the internet

#

its really just the client, the server sees everything in normal fps

soft flare
#

wym?

dark edge
#

play in editor

#

Editor Preferences => General => Performance => Use Less CPU when in Background

#

Check that

keen thorn
#

Hi, has anyone got any idea on how to approach multiplayer animation pose rewind for lag compensation? Normally rewind of player capsule is enough, bu Valorant rewinds also the pose which seems quite tricky.

#

And they say they dont brute force track pose each frame

#

I assume they did something similar to the replay system

#

But idk 😐

hollow eagle
#

They do not, they basically rewrote animgraph to record the input to every node every frame, and then feed that info back in as necessary.

#

The "easy" way is to just iterate relevant bones every frame and record their positions. Valorant doesn't do that because processing animations every tick on the server is slow and they only want to do so when necessary.

dark edge
hollow eagle
#

yes

dark edge
#

that's pretty slick

brazen anvil
#

When I change the size of my character capsule it appears correctly on the server and on other clients. When I move though the character goes under the ground a little. When I stop it goes back up on the ground. Anyone know what could be the issue? I am using a replicated int and when it changes, the capsule sizes should change.

mint stream
#

I'm having an issue with setting a death respawn widget screen on character death. Every time I have one client kill another, I want a death screen pop to request for respawn. It seems that every time I do this, there are 2 issues (because of 2 different ways I was trying to do it):

  1. The screen pops up for both the client and server and then on destruction only the server's screen gets destructed.
  2. When I use a ClientDeath() function for setting the screen, it gets the controller of the server and sets the screen for the client controller, but when I try to delete the screen for the client controller, it gives a "Only Local Player Controllers can be assigned to widgets"

How should I properly be doing this?

soft flare
#

Thanks my man ❤️

#

Btw does someone know how i can make a pickup allways get send to the server? as example i pick up an item that hasnt spawned for host or client but i still wanna pick it up on the one end and get it replicated to the otehr

dark edge
#

the host says what's spawned

soft flare
#

Wait

#

so what i did before was that every enemy drops an item that you can pick up but that did lead so some desyc bcz the items dropped in diffrent directions on everyones screen, wich is okay but it only picks it up for himself

#

So i made it an even that is beeing called in the game instance whenever a enemy dies

#

Think of charge as some kind of XP

dark edge
#

OnRep

soft flare
#

You mean run only on sevrer?

dark edge
#

What is Charge meant to represent?

#

some number of charges?

soft flare
#

So when you kill enemys they dropped charges

#

Problem is that they dropped in random directions so when someone picked it up it might be somewhere else for the other player

#

wich caused the problem that the one picked it up only on his screen

#

So i made it an event

dark edge
#

Yeah so do it like this:

DroppedChargeThingBP:
Overlap -> switch HasAuthority -> cast otheractor to YourPawnClass -> update its Charge count

soft flare
#

When an actor dies he calls this function

dark edge
#

Charge should be a REPLICATED variable

#

and be set by the server

soft flare
#

Ohh okay i try this real fast

dark edge
#

Do you want them to get a charge when they overlap the dropped thing or when they kill the thing?

soft flare
#

Overlap

#

The actor that dies drops an orb

#

you overlap and get it in your inv

#

as i saied it gets launched in random directions so its on diffrent places on both screens

#

and replicating movement eiter doesnt work 100% of the time or is just to inconsistent

#

So i just wanna make it add up no matter where i pick it up XD

#

what do you mean by "switch has authority?"

#

So first that

#

now the part on Charge should be on sevrer?

#

now i did this

sinful tree
#

Immediately after the overlap event, put has "Has Authority" node. Connect the rest to the "Authority" path provided.
Make sure this actor is spawned by the server and mark it as replicated.
Any movement that occurs should be happening only on the server and its location would be replicated to clients.

#

There should be 0 need to have any Run On Server or Run On Client RPCs for an actor that would not be owned by a client.

soft flare
#

Okok i try to follow so first i do the authority thingy

#

Actor spawned by server

sinful tree
#

You're allowing the client to spawn the actor?

soft flare
#

Huh waht?

sinful tree
#

That's what this means. Allow a client to call this function.

#

Which will then execute on the server.

soft flare
#

But it says server

#

how am i supposed to spawn by server then?

#

with game instance?

sinful tree
#

It says "Run On Server", but it's a means of allowing a client to call to the server to run it.

#

Actors can exist on the server and the client at the same time.
Start simple... When your player character gets spawned "Begin Play" fires on the server. When the actor replicates to the client "Begin Play" then fires on the client.

#

Overlap events like you're looking at, can happen on both as well.

#

The Has Authority that you just put in will mean it'll execute on whichever instance has authority over the actor (typically whichever instance of the game actually spawned the actor)

#

I imagine your "Event Death" would already be getting executed on the server.

soft flare
#

Umm

#

wait

#

This leads to the death event

#

Real spagethi my man

#

Nw thats something else xD

sinful tree
#

Simplify...
Let's say you're trying to make an attack...
Client Input > Run On Server > Server checks if player can attack and if so > Executes attack, checking for hit targets etc. > (Still running on server here) > Enemy is hit, enemies dies > Enemy spawns Charge Pickup (All this was running on the server since the original call from the client)

soft flare
#

Yea correct

#

the Orb spawns on both ends aswell

#

It launches in random directions to make it kinda look like minecraft xp kinda

#

Like h

#

the input is run on server -> multicast

sinful tree
#

Why multicast?

soft flare
#

and the dmg taking by the enemy is done on multicast aswell

sinful tree
#

Why?

#

There's where your problem likely is.

soft flare
#

Bcz otherwise it doest play the animations and all of that

#

I mean the attacking and dealing dmg works

sinful tree
#

You can multicast the animations, but the logic behind the attack should be done on the server.

soft flare
#

and the enemy dies on both screens similar

soft flare
#

Hm okay

#

Like the line traces and all?

sinful tree
#

If you're multicasting everything, you're basically asking everyone else to also do those things. So if you're spawning an actor in a multicast, then clients could be spawning their own copies of actors that they shouldn't be.

#

Technically anything relating to values would normally need to be done on the server.

soft flare
#

Hmm okay okay

sinful tree
#

So yes, even line traces to make sure if a client hits something.

soft flare
#

What if i do just the spawning on the server?

#

or doesnt that work if dealing dmg is done on multicast?

sinful tree
#

You shouldn't be dealing damage on a multicast.

#

It doesn't make sense to.

#

You can use a replicated variable to represent the health.

#

The damage can be applied to the health on the server.

soft flare
#

Yea i might have to change that soon

sinful tree
#

If you need updates when the value gets changed on clients, you use "Replicated W/ Notify" and then use the OnRep function to drive UI changes or what have you.

soft flare
#

Other than that there is no way to spawn the orb only on the server? without removing the multicast on my attacks i mean

soft flare
#

if youre down

#

U dont need to talk

sinful tree
#

The simple answer is, you should be spawning the orb actor only on the server when the server has calculated that the actor was killed. That means your server needs to be the one doing the calculation to know it was killed, which means that your server needs to know when damage was dealt to know that the actor was killed.

soft flare
#

Hm okay okay i try arround again

#

thanks for your pacience my dude ❤️

brazen anvil
#

Anyone ran into issue with simulated proxy going into the ground when changing capsule size?

soft flare
#

@sinful tree thanks allot man it works, big love my man ❤️

real ridge
#

guys is it normal when I have widgets on my player ( Crosshair and aim circle ) that other players who join game see widgets of everyone ? it's not replicated I didn't tick it

#

how to hide them?

#

it's not relevant for other

mint stream
#

Who/what is supposed to signal that a client died and that client's UI should now be something else? I think trying to broadcast my character death from my BaseCharacter.cpp and binding the delegate to a function in my PlayerState/PlayerController is giving me an error on only local controllers can assign widgets

unkempt tiger
#

quick question, does increasing the number of RPC definitions in a class increase its network bandwidth somehow?

#

because i occasionally think about this example:

UFUNCTION(Client, Reliable)
void SendClientAnIntegerThatsInBetween1And3(int TheInteger)

// Versus:
UFUNCTION(Client, Reliable)
void SendClientAnIntegerButItKnowsIts1()

UFUNCTION(Client, Reliable)
void SendClientAnIntegerButItKnowsIts2()

UFUNCTION(Client, Reliable)
void SendClientAnIntegerButItKnowsIts3()
hollow eagle
#

no, why would it

unkempt tiger
#

in the first RPC, SendClientAnIntegerThatsInBetween1And3 will need to send extra bandwidth to network TheInteger arg, while the SendClientAnIntegerButItKnowsItsX RPCs don't need to send anything, so did I just gain free bandwidth?

#

(obviously not a very practical example, but its to get the idea of my question across)

hollow eagle
#

it's not free bandwidth, why would an RPC that doesn't have any arguments take up extra room just because another rpc does

unkempt tiger
#

okay so, this doesn't make sense to me network-theory-wise

#

what is preventing me from defining an RPC literally for every possible event x argument permuation in the game, and then I wouldn't have to spend bandwidth sending args at all?

hollow eagle
#

because the possible set of arguments for most RPCs go far beyond the possibilities of anything you could write?

unkempt tiger
#

what if i have a magical machine that can generate those RPC definitions for me

#

a really really fancy macro

#

something isn't adding up

hollow eagle
#

no, you're asking a nonsensical question

fossil spoke
#

Unreal Tournament for example uses Tear Off as its mechanism for determining if the Character is dead.

#

How you choose to manage it is up to you

#

Having a Delegate on something like the PlayerState which the Pawn broadcasts on when it has Died isn't a bad idea.

#

Allowing external systems to know about that event in an easy way is a good approach.

hollow eagle
# unkempt tiger something isn't adding up

A single int32 is 4 billion different possibilities. If RPCs were sent by name (and they're not) then you'd lose any potential bandwidth savings by simply having to write out the names of the RPCs over the wire.
If RPCs are sent by id (which they are) then you simply hit the limit of how many things that id could hold and what you're asking isn't even possible.
You can't magically make the data disappear, at best you can compress it and the engine already has support for oodle network compression out of the box. You'd never even remotely want to do what you're describing because there's zero point to it.

unkempt tiger
#

gotcha, thanks for clarifying. it was mainly hypothetical, I just found myself wondering about this more often recently and needed some straightening out

mint stream
#

Or will I run into the same issue because I messed up something with replication?

fossil spoke
#

How are you handling death of the Character right now?

#

What does death mean to your Character and what is the process it goes through?

mint stream
# fossil spoke How are you handling death of the Character right now?

I am using a HealthChanged delegate with an ability system component in the Player State class. When the character's health reaches 0, it will check if it is alive and if it isn't, it will call a function from my ACharacter class that will rag doll the character, broadcast it's death and then start a respawn timer. I aso remove character abilities, stop them and stop movement immediately. Currently the whole death and respawn process works as intended, but I wanted to create a widget on the player controller that died, giving the controller the option to respawn manually, but I get that error when I try to do that

fossil spoke
#

So you are listening for an Attribute change on the ASC?

#

To trigger the death sequence?

#

Make sure that whatever you are trying to do with the Widget is being called on the Client

#

The error is telling you that you may not being doing that

#

If I was to guess, you are trying to spawn a Widget on the Server

brazen anvil
#

I am currently sending a uint8 as custom data in the CMC. Right now the server is getting the value and storing it in a local variable in the MoveAutonomous(). I want to do something based on if this variable has changed. I feel like MoveAutonomous() isn't the place to do it and was wondering if there is a better place?

mint stream
fossil spoke
#

Can you post the exact error you are seeing?

#

Paraphrasing errors is not very helpful.

#

And can be misleading if you phrase it incorrectly.

#

Best to just post it as it is

left lance
#

I’m struggling to get a physics constraint object that a user can manipulate to replicate properly. It technically has physics on it, which is probably why it’s a pain… does anyone have some general suggestions to try? It typically fails when it doesn’t register a client ending its interaction at the same time as they actually did and therefore will stop sooner/later than other clients. If I turn on replicate movement, it just gets super jittery cause one client will think it should be stopped and the server will tell it to keep moving

mint stream
magic furnace
#

To this day I don't get it

#

why could my play montage not work on Server

#

but work on client

#

when it executes on server, anim instance is valid, animation is valid, skeletal mesh is valid

#

but nothing happens

#

Multicasts to other clients work, it displays

#

the server can see clients do the animation

#

furthermore, in a multicast the clients can see the server perform the animation

#

it just literally does not work for the listen server

#

and standalone

#

what's more, the on interrupted pin fires when I interrupt the montage to play another one as well

#

so the play montage is playing a montage theoretically

magic furnace
timber nacelle
#

I have been working on Multiplayer Lobby all day, and about a minute ago I found out that my code wasn't working because NetMulticast doesn't work with Player Controllers.

My thought process was that the PC would be a client owned actor, and I was calling the multicast RPC at the end of a server RPC so, it was being called from server, and referring to the below image it should have been called on all the clients.

Could someone please help me understand what I am missing here?

magic furnace
#

what, multicast, controllers? what are you actually trying to do

#

Without your attempt I cannot tell you what you're doing wrong

hollow eagle
#

Controllers do not exist on other clients, a multicast cannot run on clients that an actor does not exist on.

mint stream
#

Was sending it to someone else as he asked for the error

magic furnace
#

is there code that ensures it

#

u can get local role to check

hollow eagle
#

You would want "is locally controlled" rather than local role.

magic furnace
#

yup

mint stream
magic furnace
#

is the controller even valid

hollow eagle
#

What error

timber nacelle
# magic furnace Without your attempt I cannot tell you what you're doing wrong

I was trying to implement a lobby where all the clients would connect and it would update the UI for all the players about who has joined and who all are ready.

The way I have implemented it is using a listen server that would host the session and others would join that session. Once they join the session, through HandleStartingNewPlayer on GameMode, it calls a client RPC to show the Lobby UI.

On the Client side, it gathers the data about player(name, ready status etc) and calls a server RPC to update that data on server. In that RPC it updates the server copy of the player data and adds it to game mode and here I wanted to call that multicast to let all the connected players know about this new player and update their UI.

But now I have to spearately call the update ui client RPC on each PC. It works but I wanted to check if my understanding was correct

hollow eagle
#

If you want something to run on all clients that's related to a specific player, use the player state instead as that exists everywhere.

mint stream
timber nacelle
hollow eagle
#

that your code is running on the server? Which is what the original error originally implied, yes.

magic furnace
mint stream
magic furnace
#

since ur basically telling us nothing

hollow eagle
#

You need to be creating a widget only on the owning client. You're apparently trying to create it on the server for a controller that isn't local.
The solution is to not create the widget on the server. Anything beyond that requires more information than you've posted.

mint stream
timber nacelle
hollow eagle
#

Just make a custom playerstate class and do whatever you need on BeginPlay

mint stream
# hollow eagle You need to be creating a widget only on the owning client. You're apparently tr...
void ABaseCharacter::Death() {
  NetMulticastDeath();
  ClientDeathHUD();
}

void ABaseCharacter::ClientDeathHUD_Implementation() {
  ABasePlayerController* PC = Cast<ABasePlayerController>(GetController());
  if (PC)
  {
    PC->SetDeathScreen(5.f, true);
  }
}

void ABaseCharacter::NetMulticastDeath_Implementation() {

    GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
  
  Mesh1P->SetCollisionProfileName(TEXT("Ragdoll"));
  Mesh1P->SetAllBodiesSimulatePhysics(true);
  Mesh1P->SetSimulatePhysics(true);
  GetMovementComponent()->StopMovementImmediately();

  bIsDead = true;
    CharacterDiedDelegate.Broadcast(this);
  

  GetWorldTimerManager().SetTimer(
        ElimTimer,
        this,
        &ABaseCharacter::Respawn,
        ElimDelay
    );
}

APlayerController:

void ABasePlayerController::SetDeathScreen(float RespawnTimer, bool bIsDeath) {
  if (!UIDeathDisplayScreenWidgetClass) {
        UE_LOG(LogTemp, Error, TEXT("%s() Missing UIDeathDisplayScreenWidgetClass. Please fill in on the Blueprint of the PlayerController."), *FString(__FUNCTION__));
        return;
    }

  if(!IsLocalPlayerController()) {
    UE_LOG(LogTemp, Error, TEXT("Not a local player controller"));
    return;
  }

  if (UIDeathDisplayScreenWidget == nullptr) { 
    UIDeathDisplayScreenWidget = CreateWidget<UDeathDisplayScreen>(this, UIDeathDisplayScreenWidgetClass);
  }

  if (UIDeathDisplayScreenWidget) {
    if (bIsDeath) {
      UIDeathDisplayScreenWidget->DeathMenuSetup(RespawnTimer);
    } else {
      UIDeathDisplayScreenWidget->DeathMenuTearDown();
    }
  }
}
#

APlayerState:

void ABasePlayerState::HealthChanged(const FOnAttributeChangeData & Data) {
    float Health = Data.NewValue;

    // Update floating status bar
    BaseCharacter = Cast<ABaseCharacter>(GetPawn());


    // If the player died, handle death
  ABasePlayerController* PC = Cast<ABasePlayerController>(GetOwner());
    if (!IsAlive() && !AbilitySystemComponent->HasMatchingGameplayTag(DeadTag)) {
        if (BaseCharacter && BaseCharacter->HasAuthority()) {
      
            BaseCharacter->Death();
      bWasDead = true;

        }
    }
hollow bridge
#

Hi, once an AI has died I want to destroy it in all clients, stop replicate it and just keep it in the server until it respawned. How can I do it? Should I override IsNetRelevantFor?

gloomy axle
magic furnace
#

I'd check the stupidest things

#

like the UFUNCTION( Client ) preceeding the function

#

whether u didn't accidentally set it to something else

#

since it should be local player controller with ur code unless u made that specific mistake

mint stream
magic furnace
#

I mean ur code is simple and if the RPC to client happens it should be the local player controller

#

there should be no way it fails as long as it actually does run on client

#

worst case throw it into BP temporarily lmao

mint stream
#

lolol

gloomy axle
mint stream
real ridge
#

guys is it normal when I have widgets on my player ( Crosshair and aim circle ) that other players who join game see widgets of everyone ? it's not replicated I didn't tick it how to hide them? it's not relevant for other

#

it has no code it is just in plane hierarchy in viewport

kindred widget
grave widget
hollow bridge
grave widget
#

why

#

You can just set actor hidden

#

Since the spawner and Ai are two actors you can destroy AI and save the info for respawning in spawner.

#

Otherwise , you can just hidden the actor.

#

Keeping an actor sometimes on server sometimes on both server and clients make things complicated and weird.

real ridge
#

character class

real ridge
kindred widget
#

That is a default component.

#

It's the same as using a StaticMesh. You don't replicate StaticMesh components either but everyone can still see them.

real ridge
#

so I have to turn off visibility of them for others in code?

keen thorn
#

This way they can get high temporal resolution, since brute force capture bone transforms would require lots of data for high fps

twin pendant
#

we have a pretty nasty crash that happens very frequent whenever the client tries to leave the match. This only happens on maps that are using world partition though.
It seems like the client fails when checking the world settings here

{
    if (bChecked)
    {
        checkf( WorldSettings != nullptr, TEXT("%s"), *GetPathName() );
    }
    return WorldSettings;
}
thin stratus
#

You should have Warnings in your Log that the WorldSettings couldn't be properly replicated.

#

Had a bunch of peeps with that already.

twin pendant
thin stratus
#

5.3 changes something about the AWorldSettings of these partial maps from World Partition being replicated. They don't replicate them anymore now iirc.

#

So 5.3 might solve your problem.

twin pendant
#

i have a bunch of these warning:

[2023.09.18-10.13.36:279][910]LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: BP_AI_BaseCharacter_C /Game/Maps/Gameplay/LVL_Quarry/_Generated_/LVL_Quarry_MainGrid_L0_X-5_Y-7.LVL_Quarry:PersistentLevel.BP_AI_BaseCharacter_C_UAID_74563C37599FD9A801_1758789905, Channel: 181
[2023.09.18-10.13.36:313][912]LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: WorldSettings /Game/Maps/Gameplay/LVL_Quarry/_Generated_/LVL_Quarry_MainGrid_L0_X-5_Y-7.LVL_Quarry:PersistentLevel.WorldSettings, Channel: 182
[2023.09.18-10.13.36:313][912]LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: WorldSettings /Game/Maps/Gameplay/LVL_Quarry/_Generated_/LVL_Quarry_MainGrid_L1_X-3_Y-4.LVL_Quarry:PersistentLevel.WorldSettings, Channel: 183
thin stratus
#

Yop

twin pendant
#

so that would eventually be fixed with 5.3?

thin stratus
#

I haven't heard back from anyone yet that had the issue and updated, but I got told there is something in the patch notes that touches this

#

Not directly saying if that's fixing any bugs though

ionic ice
#

hello guys, for some reason, dedicated server (my local network on my windows machine) is running smoothly for windows clients but when I try to load the game on my android device, it seems like it is not loading the level

twin pendant
#

interesting, is there anything i can do in 5.2, since we need to wait for some plugins to be updated to 5.3 (wwise mainly)

twin pendant
thin stratus
#

Please don't spam in capslock. You just posted your question. Be patient and wait.

thin stratus
#

Log looks fine

#

Any logs about the connection attempt from the Android one?

#

Both server and client side

ionic ice
thin stratus
#

The Server logs are on your screenshot I assume.

#

The Android ones not sure. Haven't worked with Android in a while. There must be some folder they are in

#

Given you deployed DevEditor and not Shipping

ionic ice
ionic ice
ionic ice
winged badger
#

Seing WorldSettings actor there is a little odd

#

Anyhow, those warnings are not hoing to crash the client

twin pendant
winged badger
#

Its also what holds your world partition config

twin pendant
#

and there the client fails when checking the world setting..

winged badger
#

At this point

#

You could change that function to pull the world settimgs from outer level

#

If first read fails

thin stratus
#

That's an Engine Internal function

winged badger
#

(persistent level) and i know

#

Source engine required

thin stratus
#

I would just check if 5.3 fixes it

#

Before doctoring around

#

After all they address this partially in their patch notes

#

Could also check what they do with the WorldSettings to stop them from replicating for this case and mimic that change if one can make a custom WorldSettings class maybe

brazen anvil
#

Has anyone ran into an issue where your character on your client and server appear normal but on another client as a simulated proxy your character mesh goes into the ground?

twin pendant
#

still super annyoing, but thanks for the help, really appreciate it 🙏🏻

thin stratus
brazen anvil
fierce egret
#

Can i use On Initialized event in widget on a multiplayer game?

#

Because when i use on initialized event with Hello print on a client, all clients print Hello for all other clients

#

As example while there are 3 clients, each of them print 3 times (Total 9)

#

I dont know is it safe or optimized to use in Multiplayer game?

thin stratus
#
        FNetworkPredictionData_Client_Character* ClientData = GetPredictionData_Client_Character();
        if (ClientData)
        {
            ClientData->MeshTranslationOffset += FVector(0.f, 0.f, MeshAdjust);
            ClientData->OriginalMeshTranslationOffset = ClientData->MeshTranslationOffset;
        }
#

That stuff for example

thin stratus
thin stratus
thin stratus
# thin stratus Character also has code for the Initial MeshOffset. Might also be relevant.
void ACharacter::OnStartCrouch( float HeightAdjust, float ScaledHeightAdjust )
{
    RecalculateBaseEyeHeight();

    const ACharacter* DefaultChar = GetDefault<ACharacter>(GetClass());
    if (Mesh && DefaultChar->Mesh)
    {
        FVector& MeshRelativeLocation = Mesh->GetRelativeLocation_DirectMutable();
        MeshRelativeLocation.Z = DefaultChar->Mesh->GetRelativeLocation().Z + HeightAdjust;
        BaseTranslationOffset.Z = MeshRelativeLocation.Z; <<<<<<<<<<<<<<<<<<<<<<<<<<
    }
    else
    {
        BaseTranslationOffset.Z = DefaultChar->BaseTranslationOffset.Z + HeightAdjust; <<<<<<<<<<<<<<<<<<<<<
    }

    K2_OnStartCrouch(HeightAdjust, ScaledHeightAdjust);
}
fierce egret
#

Yes, everyone has the widget. But in 3 client game, everyone must print 1 time (Total 3). It is working right when i use Construct event. It runs on only owning client. But when i use Initialized event, one client prints for all clients. Its like that:

thin stratus
#

Again, you might be creating it on every for everyone

#

Maybe you don't call the AddToViewport for everyone

#

But you are creating it

#

Show the involved code

fierce egret
#

Okay, wait

#

I just create it and print.

thin stratus
#

What actor is that in?

#

The BeginPlay

fierce egret
#

Component

#

I created it

thin stratus
#

And where is that Component added to?

fierce egret
#

Player pawn

#

ThirdPersonCharacterBP

thin stratus
#

Then the BeginPlay will call for every player for every pawn

#

You are creating it 9 times

fierce egret
#

No, begin play calls 3 times total

#

let me try it again

thin stratus
#

What does the CanExecuteCosmeticEvents do?

fierce egret
#

Its engine macro

#

to prevent dedicated server run it

thin stratus
#

Right

#

Yeah I don't see anything stopping this from running 9 times with 3 players

fierce egret
#

There is some code that I want to run even if I don't add the widget to the screen so im trying to initialized event but its weird

thin stratus
#

If you only want to do this locally, then you can't use BeginPlay

fierce egret
#

There are some functions in widget and i want to run these when i created the widget. I shouldnt have to add to viewport. Construct event runs only when i add it to something

thin stratus
#

I mean, I didn't say anything about that

#

I said:

  1. You are creating Widgets on all Players for all Players cause you are running this on BeginPlay.
  2. You seem to only run AddToViewport on the local Players

This will result in Initialize to call 9 times and Construct to call 3 times.

#

If you want to use Initialize and you want this to only call 3 times, then create the Widgets only locally

#

And for that you need a different event.

fierce egret
#

Thanks for help, i will think about it

brazen anvil
soft flare
#

@sinful tree hey man, you got me into thinking yesterday and made me understand multiplayer so much better now, i have just one more question, How should i replicate when i use savefiles? as example i want every player to load his savefile on his computer

#

Do i need to run on server or what do i need to do?

unborn nimbus
#

How can I set a property replication to go to specific clients? ie, I have a "team" that should all receive the rep events but no one else. Is RepGraph the simpilist way or can I do it through property rep conditions?

sinful tree
# soft flare <@218956378654507008> hey man, you got me into thinking yesterday and made me un...

Any time you need to send data to the server, you'd need to use a Run On Server event with inputs included on it.
Just be aware that you can't trust clients and you need to validate what you can on the server. Any data you allow a client to send to the server could potentially be spoofed (eg. a player can easily send to the server and say that they're level 9000, have 1 bajillion hit points etc.). If you don't really care about cheating then it's a bit of a moot point, but be aware of what data you do send, and limit what data you can trust from a client.

soft flare
#

ahh okay

thin stratus
soft flare
#

yea i mean its gonna be a coop game for fun, if someone cheats in it they can ruin the game for themselfes, but i run the save/load on the server than

thin stratus
#

A better way is to have something like an ATeamState : public AInfo actor

soft flare
#

But i run the save on onwing client no?

thin stratus
#

And then overriding IsNetRelevantFor

#

On the PlayerState of each player you can have an ATeamState variable and in the IsNetRelevantFor function of the TeamState you can check if the Actor is set on the PlayerState

#

You can split the Data that only a specific Team should see and the Data that everyone should see into two different Objects fwiw

#

There is also COND_NetGroup

sinful tree
# soft flare But i run the save on onwing client no?

If you're wanting to handle saving on the client, then you would save when you know you're running on the client. It doesn't necessarily mean the server has to tell the client to save, you can have the client save whenever.

thin stratus
#

Not sure I used that before though

#

Think COND_NetGroup can't be used on properties though

thin stratus
#

@unborn nimbus

/**
* Manage the membership of subobject's replicated with a COND_NetGroup condition.
* For a COND_NetGroup subobject to be replicated to a connection, they both need to be part of the same netcondition group.
* A netcondition group is simply an FName. 
* This manager holds onto the groups the subobject is a part of, while the connection's player controller is
* where we hold information on the user's groups.
* 
* Groups are inclusive and non-binding so subobject's can be part of multiple groups at the same time.
* As long as a player is a member of one of the subobject's group, that subobject will be replicated to that connection.
*/
class FNetConditionGroupManager
#

I have never used this, but maybe you can use that inside the TeamState with Subobjects

#

Or something like that

#

(sounds pretty cool tbh)

#
const FName NetGroup = NetGroups[i];

if (UE::Net::NetGroupOwner == NetGroup)
{
    bCanReplicateToClient = ConditionMap[COND_OwnerOnly];
}
else if (UE::Net::NetGroupReplay == NetGroup)
{
    bCanReplicateToClient = ConditionMap[COND_ReplayOnly];
}
else
{
    bCanReplicateToClient = Connection->PlayerController->IsMemberOfNetConditionGroup(NetGroup);
}
#
    /** Returns true if the player controller is a member of the netcondition group */
    bool IsMemberOfNetConditionGroup(FName NetGroup) const
    {
        return NetConditionGroups.Find(NetGroup) != INDEX_NONE;
    }
#

So in theory @unborn nimbus , you could have some SubObject be registered to a Group (E.g. "TeamOne") and put a player into that Group via APlayerController::IncludeInNetConditionGroup(FName NetGroup)

#

If would suggest maybe using GameplayTags as they can resolve to FName just fine iirc

#

Makes it easier to tag a team :P

#

If I find the time I will try this and write something about this on my page. But probably not gonna happen anytime soon.

quasi tide
#

If not you, then @fathom aspen. If he wants to slack, then @pallid mesa.

#

This is my vote.

#

I would vote James as well, but he still owes us a FInstancedStruct blog post 😠

thin stratus
#

Does FInstancedStruct need a blog post though

quasi tide
#

Maybe not for us - but for beginners, yes.

thin stratus
#

Hm okay. Didn't know it was that complex.

quasi tide
#

It's not. But knowing how to actually use it could throw beginners in for a loop.

thin stratus
#

Yeah I guess. Still gonna be a tiny post :D

quasi tide
#

Even if you only know basic syntax for C++, it can be a bit difficult to actually parse the code on how you're supposed to use it and all that.

thin stratus
#
// Define FInstancedStruct
FInstanceStruct MyStructContainer;
// Init with Struct that this InstancedStruct should represent
MyStructContainer.InitializeAs<FMyStruct>();

// Get the Mutable Data from it and modify it
FMyStruct& InstanceData = MyStructContainer.GetMutable<FMyStruct>();
InstanceData.SomeValue = 42;

// Sample function
SomeFunction(MyStructContainer);
int32 SomeFunction(const FInstanceStruct& SomeStructContainer)
{
  // Get the inner Struct again, needs to know the Type
  const FMyStruct& InstanceData = SomeStructContainer.Get<FMyStruct>();
  return InstanceData.SomeValue;
}
#

That's more or less the gist of it or not

quasi tide
#

I don't even do it like that exactly. I have been using the MakeStruct<>() method. Like, otherwise I've been doing it the same.

fathom aspen
thin stratus
#

Been using FInstancedStruct and instanced UObjects excessively the last weeks/months.

unborn nimbus
thin stratus
#

Of course I use normal structs

#

But whenever I can turn something into using InstancedStructs I usually do that

#

It's mostly for situations where I have some Object that has a generic Init function with some data

#

And the child classes need different data

#

Then I use an Instanced struct

unborn nimbus
#

Makes sense

fathom aspen
#

Get roasted ducko

minor halo
#

hi hi is there somone here That can help wil a replication problem i have Im learning To Make MP BP's but im struggling with a basic part code

real ridge
#

guys how I can hide widget components for other players ?

#

so they wont see it

dark edge
real ridge
#

tried this before okay

real ridge
minor halo
#

This is for debuggin Do but this is the main problem with my Code

If the client Tells It to destroy actor Nothing happens But if the server dosE it wil happen

hollow eagle
thin stratus
#

Your code doesn't make much sense tbh

#

What Actor are you getting there with the GetActorOfClass?

#

Depending what Actor that is, you can't perform any RPCs in it

#

Due to Ownership

#

E.g. an Actor in the Scene won't allow for Server or ClientRPCs

#

And since your Health is already replicated, there is no need to Multicast the change (and it also shouldn't be multicasted, since health is a state)

minor halo
#

I already got it to work but thx you

#

XD 🙂 @thin stratus Sorry for wasting youre time

keen thorn
sinful pilot
#

hello, I have a question that's been bogging my mind for weeks. Let's say I have a Character with a character movement component. And I want to add running input to it's implemented reconciliation system ? I've tried sending and rpc when player presses shift but it doesn't look like a goodpractice and it completely destroys the purpose of client sided reconciliation

queen escarp
#

i dont get it when ii call these function my game locks (it dose not breake) but i cant get out on the input modes

real ridge
#

I saw others widgets

thin stratus
sinful pilot
#

or is that not a thing ?

thin stratus
queen escarp
#

yeah thats changed*

thin stratus
#

And adding loads of boilerplate code

#

We have a Git Repo pinned to this Channel

#

That has some examples

sinful pilot
#

Whicih one are you referring to or is it all of them ?

thin stratus
#

7th from the top

#

Post from Vaei

sinful pilot
#

oh ok

#

thank you so much, i'll check that out

thin stratus
#

You should be able to use the Normal just fine, as long as you do the same math with it in the same Timestamp

#

It might, but very small corrections are totally fine once in a while

#

The degree of tolerancy is like sqrt(3) or so

#

In position

#

Again, you should be able to do that just fine

#

I created a mimic of the CMC a few years ago for a hover drone that can drive on all walls and ceilings

#

It works fine

#

The corrections are really not big. It will only be bad if your corrections aren't properly handled

#
bool UCharacterMovementComponent::ServerExceedsAllowablePositionError(float ClientTimeStamp, float DeltaTime, const FVector& Accel, const FVector& ClientWorldLocation, const FVector& RelativeClientLocation, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode)
{
    // Check for disagreement in movement mode
    const uint8 CurrentPackedMovementMode = PackNetworkMovementMode();
    if (CurrentPackedMovementMode != ClientMovementMode)
    {
        // Consider this a major correction, see SendClientAdjustment()
        bNetworkLargeClientCorrection = true;
        return true;
    }

    const FVector LocDiff = UpdatedComponent->GetComponentLocation() - ClientWorldLocation;    
    const AGameNetworkManager* GameNetworkManager = (const AGameNetworkManager*)(AGameNetworkManager::StaticClass()->GetDefaultObject());
    if (GameNetworkManager->ExceedsAllowablePositionError(LocDiff))
    {
        bNetworkLargeClientCorrection |= (LocDiff.SizeSquared() > FMath::Square(NetworkLargeClientCorrectionDistance));
        return true;
    }

    return false;
}
#
bool AGameNetworkManager::ExceedsAllowablePositionError(FVector LocDiff) const
{
    return (LocDiff | LocDiff) > GetDefault<AGameNetworkManager>(GetClass())->MAXPOSITIONERRORSQUARED;
}
#

MAXPOSITIONERRORSQUARED = 3.0f;

#

So yeah, the tiniest offset will trigger it

#

And you won't notice or see it due to smoothing of the Mesh and replaying of saved moves

#

Unless your reconciliation is bad

#

Depends on what you are doing based off of the normal

#

If you utilized SavedMoves etc. properly, then it should be fine

#

As long as you do your code inside of the CMC's functions that are in sync due to Timestamps and executed on server and client, you can do whatever you want

#

That's also why JumpPads don't need to be predicted

#

Cause the client and server step on it in the same timestamp

#

No. If you want to avoid corrections you'll need to ensure that Server and Client Moves on the same Timestamp result in the same End Location

#

And that a Client can replay the moves it made between correction and whatever it is doing now properly

dark edge
thin stratus
#

A forced one?

dark edge
#

Yeah, something with a bit of hang time at the apex or whatever

thin stratus
#

I would suggest you to look into RootMotionSources

#

GameplayAbilities have nodes for them, but they are not locked to GAS at all

#

You can expose them to normal BPs

#

There are versions for Jumps with custom Curves for the Arc

#

And if you properly supply them with the same values on Server and Client and you fwiw Flush Server Moves before executing them, they will be properly synced

dark edge
#

I had thought to maybe make gravity dependent on velocity in the PhysFalling code but that smells like integration errors to me

#

We'll look at RootMotionSources

thin stratus
#

I wouldn't bother with that if all you need is a fixed jump ark

#

We use that for all sorts of Jump Abilities

dark edge
#

in CMC land are you still falling, just modified by root motion?

#

or is it a custom movement mode

thin stratus
#

You can provide it with a MovementMode of choice

#

struct FRootMotionSource_JumpForce : public FRootMotionSource

#
    UPROPERTY()
    FRotator Rotation;

    UPROPERTY()
    float Distance;

    UPROPERTY()
    float Height;

    UPROPERTY()
    bool bDisableTimeout;

    UPROPERTY()
    TObjectPtr<UCurveVector> PathOffsetCurve;

    UPROPERTY()
    TObjectPtr<UCurveFloat> TimeMappingCurve;

    FVector SavedHalfwayLocation;
#

Check UAbilityTask_ApplyRootMotionJumpForce for an implementation example

#

I think you usually just leave whatever MovementMode you have

#

You just have to use one in general, cause something has to tick the RootMotion

unborn nimbus
#

Is there a better way to check if a player state is the local player's other than checking the PS->PC against the local PC?

glacial burrow
#

maybe anyone of you can help me ... im trying to build a nice RPC Connection between my C# Server and multiple Unreal instances. Sadly i want to send RPCs both ways and i cant figure out how to do that. Has anyone of you a good idea of a good library that could help me ?

golden igloo
#

is there a way to replicate uobject contained by another uobject? guess only way to do it from parent actorcomponent?

idle coyote
#

Any ideas where I'm going wrong?

bleak moon
#

Is there a way to check if the local process is a listen server?
Looking for a blueprint node.

fathom aspen
#

There is no node, but there is a combination of nodes:
IsServer && !IsDedicatedServer && !IsStandalone

#

You can make your own blueprint utility function, so you don't need to do it everytime

bleak moon
#

Ahhhhh
IsStandalone

#

I made a c++ function library

#

Using IsNetMode

fathom aspen
#

Ah then there is no need for all I said

#

Yeah then use IsNetMode

#

I thought you had no access to cpp

bleak moon
#

Yeeeah, just was weirded out there wasn't blueprint node for it already

#

Nah I just had to walk my buddy through it after trying to find the node for a while

candid mulch
thin stratus
thin stratus
thin stratus
weary otter
#

Can someone tell me if microsoft playfab is more cost effective than aws services ?

golden igloo
upbeat basin
#

Is there a delegate/event(BP) for when GameState does replicate to clients? I believe it's possible to get null from GetGameState on Actor::BeginPlay on clients, right?

thin stratus
#

Or call the own of Owner being ActorComponent

thin stratus
#

And no you can't get null on BeginPlay of other Actors when getting the GameState

#

Cause it's the one triggering the BeginPlay

thin stratus
#

Ultimately they both will take all your savings

golden igloo
#

Another issue I am having now is; replication of a newly created object. I have array of objects, aka "Status Effects" and I want to notify client when a new one is added, so i can show it on UI. But calling a Client_StatusEffectAdded function right afterwards makes it pointer null, if I wait for a second or so using timer it works, is there a way to know when an object is replicated?

stable seal
#

how to give tag to a player in 2

weary otter
latent heart
#

If you don't have a shit ton of money, a server system that lets players host their own games is probably favourable.

hazy silo
#

hey guys 😊
is there a common practice what to do with the character while stuff is still loading? do you freeze and hide it or something like that?

brisk fulcrum
#

I want to possess our character to the pawn I spawned in my Unreal Engine 5 C++ project. There is no problem on the server side, but the code I wrote on the client side does not work.

latent heart
#

Don't posses the pawn on the client at all.

#

The server does it and notifies you.

#

You should also do !IsValid(Pawn) not !Pawn.

#

That goes for all uobjects you aren't sure are valid.

#

Don't forget to check the pawn in the server function too, in case you call it somewhere else and forget the check. An extra check doesn't hurt.

#

You should also include error output if you pass an invalid pawn.

#

Silent failure is failure.

#

And it won't work at all if you aren't currently possessing the character on the client.

sharp vigil
#

Is it common practice to have an owner property on components such as health stamina.. so you don't have to keep getting the owner every time you want to do some type of role checking etc?

latent heart
#

Absolutely not. The owner value you already have is sufficient.

#

Casting is free in c++

#

No consequences

sharp vigil
#

I was thinking I would have to call getOwner everytime unless I did that.
But you're saying it's perfectly fine to call getOwner every time I want to get the owner? I'm a bit confused

latent heart
sharp vigil
#

hm okay thanks. I was thinking if I was making an RTS had a bunch of characters calling getOwner everytime they want to update health it would lead to some issues

latent heart
#

Rts games don't use characters.

#

Because they simply won't be fast enough.

#

If you want to make an rts game with any kind of scale, you may not even use actors.

#

Check out #cpp from an hour or two ago. Big discussion about it.

sharp vigil
#

Thanks

latent heart
#

Np. Good luck.

sharp vigil
#

Hmm looks like Mass is an option but its experimental

glacial burrow
latent heart
brisk fulcrum
latent heart
#

If you're on the client, only run the server method.

#

Don't possess as well.

brisk fulcrum
latent heart
#

Correct.

#

If that isn't working, there is an issue somewhere outside that function.

#

Like get controller is retuning null or something.

latent heart
#

Or you're spawning the pawn on the client?

#

The pawn has to be spawned in the server.

brisk fulcrum
#

thanks for all Yes

latent heart
#

Np

fervent leaf
#

Hi, I'm using this kind of function on my Input component for the Item to get the inventory component, as when i press the input, it should use the InventoryComponent to store the item. On the green picture I store the item on button press with the InventoryComponent. This is Enhanced Input stuff and i heard that the input happens only on locally. So now I'm little confused should the SetupEquipment -function happen only on the server and replicate the InventoryComponent?

#

As also on SetupEquipment function, i find the "New equippable to Store", which is the item I want to store. So in my mind it should be server function, even if the input stuff happens only locally

magic vessel
#

I'm trying to get animations for my multiplayer game. The servers pawn plays animations on server and client but the client's pawn only seems to play on the client and the server doesn't animate (although it does move)

solar stirrup
#

Started looking into Iris, is it something you're meant to use alongside the replication graph or just another complete replacement?

dark edge
#

I bet you're driving your animations with inputs and not results

magic vessel
#

This is on Update Animation

solar stirrup
#

Seems like a replacement Thonk

magic vessel
#

Got it, I'm not reaching this point as there is a validity check for the controller before entering this part

#

Which won't exist on the client, so it's exiting before getting here

dark edge
# magic vessel

That looks fine, just don't rely on anything but the pawn owner for this.

upbeat basin
solar stirrup
#

Anim blueprints aren't replicated afaik

#

So makes sense that they can initialize sooner

sinful tree
# fervent leaf Hi, I'm using this kind of function on my Input component for the Item to get th...

Any input events on the client are always on their own machine only, so if you want the server to do something based on that input event then you would need to do a run on server event.
Anything with manipulating replicated variables needs to happen on the server, but you don't necessarily want the client to be able to tell the server to do it as sometimes the server can do it on its own when it knows it should. If you do need to call an RPC to have the client to tell the server something, you shouldn't necessarily be extremely specific about things that you're allowing the client to tell the server. It's better to be generic "Move item from slot 1 to slot 2" than to be specific "Move 'item ref' to slot 2" and this usually also provides you with a better means of validating if the operation should proceed.

In your case, the "Server Store Equippable" function has two inputs so at any time you're effectively allowing a client to make that function call and input any values they want. If a client has reference to any replicated "equippable" that exists in the game currently, they could potentially call the server with this "Sever Store Equippable" function and pass through a reference to it, even if its potentially something they don't own themselves (like it could be in another player's inventory potentially).

thin stratus
austere halo
#

Hey guys, I have a bit of a strange situation... I have an actor that generates heightmap data, and then builds a procedural mesh using the heightmap. The BuildMesh() function uses some parameters which are stored in the GameState. Because procedural meshes dont replicate, I'm using a repnotify so that when the heightmap data changes, the clients call BuildMesh() locally, which is all fine.

The problem is that when clients join the server, and the actors are replicated to them (triggering the BuildMesh function), often the GameState hasnt initialised for them leading to a crash. I'm wondering if theres a good solution to this? I could just duplicate the params or set a timer which calls BuildMesh again once the gamestate is loaded, but these all seem rather inelegant...

austere halo
#

Oh well for now I created a queue system on the player which waits for initialization of everything then triggers all the queued build requests, but if you have any better suggestions let me know 😅

solar stirrup
pallid rampart
#

hey guys, im hoping someone here can explain client travel to me. So in my game, I have a dedicated server that server loads a map, and when the clients connect they client travel to the server address. Is this supposed to also load the map the server is on? Or am i supposed to load the map a different way? Currently clients are able to join the session but they're not loading the server map, they're loading the default map which is the main menu. Any help will be appreciated 🙂

austere halo
solar stirrup
#

GameState's BeginPlay: Call an event in a game instance, a subsystem, whatever makes more sense to you, let's call it OnGameStateBegunPlay

Other actors that need the game state:

  • If the game state is null (hasn't replicated) or hasn't begun play, have them bind to OnGameStateBegunPlay
  • If the game state is valid and has begun play (HasActorBegunPlay()), just call the function you'd bind otherwise
fluid summit
#

Hi! i'm using UObjects for my inventory items, i'm seeing UObjects replication and it seems a mess, am i shooting on the foot if i use a RPC to fake replication whenever there's an item change and handle all on the server? (no* security is not a problem)
Edit: justs saw the new replication system for subobjects and it's way simplier and straightforward

sharp vigil
#

confused about the use of SetNetAddressable(), when should I use that in my C++ code when replicating components?

unreal rampart
#

Guys! I need a hand about multi system. The animation blend spaces what i made doesn't work in listen server. Do someone know smth about it?

soft flare
#

Yoyo dudes quick question. I wanna try out how the game loads my characters stats when loading in. for example player A plays with his save file and player B joins with his save files. Now i have the problem that it keeps loading up the same save file on both windows and idk how to make it that each one loads his own one

minor halo
#

try to set the load event on replicate on owning client Maby that works ?

#

@soft flare

soft flare
#

Nono thats not what i mean

#

it saves the files with say name "save1"

#

and no matter wich client tries to load, it loads the file save1

minor halo
#

mmmm

soft flare
#

i tried something fancy

#

look at that

minor halo
#

Yeaa im to noob for that 2 then i gues

soft flare
minor halo
#

Im stuck a little bit 2 ant its the last ting i need

#

Im a little bit stuck here Becos this is on owning clinet call but i want to destroy the actor on both sides

#

if there is somone here that can help me perheps? Im streaming now on twitch IF you are abble to help Username on twitch = Killercknl

stable grotto
#

Whats an efficient way if I want to create an ability for clients to detect hidden actors based on a radius?
For example a hidden trap door that a large sphere collision client component will make visible when overlapped but is it efficient to use sphere collision?

minor halo
#

It all depend on the type of game But if its not like Minecraft redius style I woul prefed Spehere i ghues But its prefrenc how you want the radius to be @stable grotto

And i ghues the best way would be when overlap collision yes abilety

When end overlap Disable abil

Just make a Bool branch the event En youre good to go

stable grotto
#

thing is I'm worried about collision being on tick and want to see if there are any other efficient ways to do it especially if the actor spawns and is not static in level

minor halo
#

Hu collisions on tick ? Its a register event right so it only triggers when you colide with the borders

mystic estuary
#

Hello, does anyone have experience with seamless travel? I'm trying to seamless travel between worlds, and in my player state I have a TObjectPtr with a UPROPERTY which is essentially a UObject I create to save some dynamic data, however anytime I seamless travel I get an ensure that is saying that the UObject is not garbage collected. How should I handle the object if I need it throughout the whole game session (not during the seamless travel though)?

latent heart
#

Put it on a game instance subclass

#

Or simpyl use a game instance subclass instead of your uobject (make it a game instance subclass)

#

It is then not replicated, so that's a consideration for MP.

#

I think there's a way to copy data from one playerstate to another after travel.

#

I have no idea how that works, though.

#

You'd probalny need to rename the uobject (in c++) to change ownership of it to teh new playerstate.

#

Or just create a new one.

mystic estuary
#

Nevermind, I was wrong 😛 The UObject I was working with had outer set to the current world, which made it not GC or something. Not assigning the outer (i.e. leaving it /Engine/Transient) doesn't make the ensure to trigger, and everything works

#

The only problem is that it's impossible to get the world using that object, but there are other works around for that

hybrid crown
#

Little question : condition repnotify initial is recalled everytime an actor enter/re-enter net relevancy, right ?

quartz dock
#

Hi guys, can we replicate uObject?

hybrid crown
mystic estuary
quartz dock
#

Thanks

fiery wadi
#

Hi I am working through a Udemy course but am not sure what I am doing wrong,
The issue : When i Crouch on the server it crouches on the server but when i take control of a client and press crouch it affects the server AND the client.

#

This is the logic for the crouch function

#

this is when we call the server function

#

As you can see the button press makes the client and server crouch, Anyone help please? 🙂

sinful tree
fiery wadi
#

Is that in the Crouch function? Thank you for the reply.

#

This is how im initializing the Base Character reference.

#

I,ve been trying to use Actor Components more and more so i put all the movement functions inside a Component Named ADMovementComponent and added it to the BaseCharacter.

#

I got tired of keep redoing all the Input Actions and Context Mappings so I thought I could do it this way and reuse the component but i think it,s causing issues with the server/client communication

#

This is the component i added

#

So the crouch function is inside that.

#

I also enabled Replication for the Component (Sorry for the spam just trying to give as much info as possible)

sinful tree
#

I'm curious as if this is what they gave you as an example of what to do on begin play of anything in multiplayer, I'd ask for a refund.

pallid rampart
#

hey guys, im hoping someone here can explain client travel to me. So in my game, I have a dedicated server that server loads a map, and when the clients connect they client travel to the server address. Is this supposed to also load the map the server is on? Or am i supposed to load the map a different way? Currently clients are able to join the session but they're not loading the server map, they're loading the default map which is the main menu. Any help will be appreciated 🙂

sinful tree
# fiery wadi This is how im initializing the Base Character reference.
  1. You can't properly use "Get Player X by Index" in multiplayer reliably, especially when running on the server. Instead, your component should probably "Get Owner" and cast that to your character class instead, assuming this component is attached to your character. To get the player controller, you should be able to take your cast and use a "Get Controller" from the and then cast that to Player Controller.

  2. Begin Play fires on both the server copy and the client copy of the component. So if this component is attached to your character, when a new character is spawned, the begin play for that particular character will fire on both the client and the server, even if it's the server character or the client character, it'll trigger on both still, so then you're basically executing this code twice on both the server and client, once for each character. For at least the input mapping context, you only want that happening if the character is the one that is locally controlled. You could do this by checking if the As BP Base Character "Is Locally Controlled".

  3. There's no point in check if something is valid immediately after casting. If the cast succeeds it'll be valid.

sinful tree
fiery wadi
#

@sinful tree Thanks for the replys I had to restart my machine windows updates... I,ll have to read through your reply and I guessed that Hardcasting to the player might be a bad idea I,ll transfer all the input actions i have in the component to the main character blueprint so i dont need to cast to it.

#

Ahh i,ll try the Get Owner first that kind of makes sense.

#

Omg your reply makes a lot of sense and a great deal of explanation, Thank you so much !

#

And yup the code inside the component is executing twice as you stated. 🙂

#

@Datura Thank you so much for that reply I am at the exact same point in the video now, Where they have clients replicating crouch animations correctly but the server isnt replicating to the clients but I think hes going to explain that next.

#

And you was 100% correct with the Get Owner and Get Controller.

real ridge
#

how to hide widget component for other players in game ? tried these but not workijng

#

output is still this I see ui of another 😄

#

i wanna somehow hide it

#

solved

low helm
#

Anyone know why a client might not receive ONDESTROY message when the server destroys an actor? It fires successfully about 90% of the time.

dark edge
low helm
#

No multicasting, the setup is so simple I can describe it. At BEGINPLAY, we Bind Event to OnDestroyed. The server destroys the actor (from some damage). The Clients run the event 90% of the time.

#

Am I at least correct that clients should be getting the OnDestroy message every time.

upbeat basin
thin stratus
low helm
#

Thanks that's a good answer

brazen anvil
#

Does anyone know what the difference between PhysWalking and PhysNavWalking is?

latent heart
#

One is probably on a nav mesh?

#

Or using the nav mesh to navigate?

brazen anvil
#

Oh I didn't know what a Nav Mesh was. But that kinda makes sense.

thin stratus
#

It's used for AIs and iirc it's mainly used to ensure the AI is literally stuck to the NavMesh.

twin juniper
#

Hello!

Does anyone have any tips for having different idle animations on the client vs server?

zealous knoll
#

does somebody knows a solution for this'

zealous knoll
twin juniper
zealous knoll
#

some branch maybe?

quasi tide
#

Animations are driven locally. So there shouldn't be any need to check if client or server

#

If you're idle, just let the ABP pick a random idle animation.

#

It would be no different than if the game was single player in this case

twin juniper
#

That's true in my case, anyways

quasi tide
#

You replicate data to the character and the ABP gets its information from that to drive itself

#

In this case - they just wanted a random idle animation, not other parameters. So you just build it like you would a single player game.

twin juniper
#

I'm confused by your response. Random idle animation? I want a specific idle animation to play for the client and I want a different idle animation to be playing for other players

quasi tide
#

Oh - I read that wrong. Apologies.

twin juniper
#

No prob

dark edge
languid oar
#

Hey guys, are using the voxel plugin and show a loading screen until the world is loaded. If a new client joins, the other players can already see and attack the joining client. Is there a common way to delay spawn a joining client?

woeful ferry
#

most simple way

blissful talon
# zealous knoll does somebody knows a solution for this'

Avoid loading the last save game file, and make more than one save file. The idea is to make each window select the save itself, so that each game instance can use on a separate save.

As for the first part, you essentially will need to use different names for the save files, like SaveFile_0, SaveFile_1 etc. As for the second part, you would need to not automatically load a save file, but display a widget containing a list of button like 0, 1, 2 etc; clicking on a button would tell the save system to load a certain file, afterwards the game would work exactly the same. Make sure to remember the loaded save file, so that you know which one you have to write data in.

As for the packaged games, make sure to either manually remove the selection widget, or make it always select save 0 without even displaying. Perhaps you would need to think more about on this part. 😛

zealous knoll
solar stirrup
#

Yep

sinful tree
zealous knoll
#

how to create that for every client, in debuggin mode where I test locally a multiplayer

#

the player index is always 0, for every window that opens

#

doesnt matter it is PIE or standalone

gleaming crane
#

Hey all! How would i go about setting up save information for dedicated servers? Would i have all of the clients save their info on separate save games on the hosts pc only, and load it when they log back onto the server?

soft flare
#

Yoyo dudes, i have a actor that moves with "move component to" but its super stuttery for clients, any idea?

#

it also faces the player with a "set world rotation" wich is stuttering aswell

latent heart
#

Probably because it's only updating the client every so often, so it's lagging behind the server and updating every 5 frames or whatever, so teleports.

#

You could, instead of relying on transform replication, turn that off and run everything on the client as well as the server? Idk how people do this normally, but there's definitely some interpolating and client simulation invovled.

soft flare
#

You mean by multicast?

latent heart
#

The rotation, for instance, you can not replicate and set locally, right? That's just always looking at the player. You don't need to send that information over the network at all.

soft flare
#

Wait i did this now and it actually worked

#

so the

#

Uhm wait i just send pics

latent heart
#

Movement is harder.

soft flare
#

The event tick does this

#

the randomizing does it on the server aswell but the Mc fires off for all clients

#

and he moves smoothly now

#

Thanks ❤️

#

When exactly should i use Mc?

#

for movements aswell?

#

i heared u should only mc on animations and mesh changes etc

latent heart
#

MC is... not something you should really use all that often.

soft flare
#

Hmm

#

then how am i gonna replicate the movement properly

latent heart
#

Honestly I don't know the best solution for your situation.

soft flare
#

Hmmmm

#

for now i keep the mc spam

#

until i have a solution if i dont forget abt it

sinful tree
#

MC Spam can be part of the problem. Multicasts are not supposed to be the end-all-be-all do the networking thing. They are a tool to broadcast one-off events to any clients that have the actor relevant.
Movement is a change of state, which means that it should be getting handled VIA a replicated variable or in this case, it could just be that the movement just needs to happen on the server and if the actor is replicated I believe the moving of the component would be replicated. If component movement is replicated and you're moving on all that means the server's updates would supersede whatever is being done on the client, causing jittery movement.
Add to the problem here, you're multicasting and calling "Random Float In Range" and plugging that into the Z location? So then on every screen it'd be moving to a different Z location.

soft flare
#

Oh okay

#

Do i need to run the movements localy or on server?

sinful tree
#

Try moving it only on the server, see if it replicates. If it doesn't, try enabling replication on the component you're trying to move. If that's still failing, then MoveComponentTo is not the appropriate solution.

#

Movement should mostly be getting done on the server. You can have clients interpolate movements too, but it wouldn't be done through a multicast

muted pewter
#

I have a dediated server up and running on my local machin, so whenever i try to connect a client with it it connects but there's already a map opened on that server(does thta mean theres already a session created on that server?) how can i just simply connect client with it and no map opening.

soft flare
#

Im using it bcz im making a flying enemy

#

what i did now is moving the function form the parent to the child and now for some reason it started beeing kinda smooth again(im confused but i take it)

#

this good or im dumb?

#

well it still stutters...

#

someone hmu if he can go quick dc call, im not spammin yall i just keep trying until i go to sleep

soft flare
#

i finally solved it omg

finite pumice
#

If anyone else has problems with your pointers not being assigned properly from Begin Play on clients, I have noticed UE doesnt wait for a controller to be assigned to run the Begin Play event. I have made a macro that is in my opinion, necessary to deal with any of these odd issues. This is also useful when needing the playerState as that is also not assigned until after the controller is assigned so using onPossessed may not be sufficient to get a pointer to your playerState. If anyone has better insight on this please feel free to correct me; these are just my observations/results

hollow bridge
#

Is it a bad practice to override the IsNetRelevantFor for despawned actors? (I keep them in the server for a future respawn, no point to replicate them to client until they are respawned)

chrome bay
#

Far better off putting them into dormancy

hollow bridge
#

Thanks

sinful tree
# finite pumice If anyone else has problems with your pointers not being assigned properly from ...

It's more about knowing what events to use to properly handle when certain things happen. Begin Play is basically the place where a the thing is spawned, but that doesn't mean all the pointers it needs have been replicated to clients yet. Pawns have a function that gets called on clients when their controller changes, NotifyControllerChanged, which would be a good time to know on a client when their controlled character gets possessed by their controller.

sinful tree
finite pumice
sinful tree
#

To expose it to blueprints yourself.

#

I know it's a lame answer, but that would be the best solution, and saves you from having to do that delay check :/

finite pumice
#

Wouldnt just using a RepNotify function/variable work as well? I usually set the player controller pointer to repnotify to tell the client to do UI stuff. I suppose all are 'solutions'

sinful tree
#

Technically it could, but that's just replicating something that's already being replicated - An example, would be that characters already get a reference to their controller (if its the owning client of course) so why replicate a pointer to their player controller if they're already going to be getting one? Again, a function exists for that OnRep in a Character too, OnRep_Controller(), but it's just not exposed to blueprints.

naive elm
#

how can i estimate how network intensive would be having 5000 players shooting at each others?

sinful tree
#

Have 1 player shoot. See how intensive that is. Multiply it by 5000.

naive elm
#

is it that simple? don't projectiles have a bunch of parameters like travel distance and more?

solar stirrup
#

Because that's nowhere near anything Unreal Engine can handle vaultsweat

naive elm
solar stirrup
#

In multiplayer

solar stirrup
#

You probably wouldn't even reach 200

dark edge
#

How often do they shoot and how many players are close enough to care about the shot?

#

Every player you add will add another player shooting AND another player who needs to know about what's happening. So it scales worse than linearly. If every player cares, then it's 25,000,000 x as intensive as one player

naive elm
#

i dont have anything but what would happen if they were in a 2000m radius and some projectiles reach 800m and some 2000m?

dark edge
#

There's a reason nobody has done this. It's basically impossible.

#

With very very clever programming you could maybe get 1000 people

#

it all depends on how much data needs to fly around

solar stirrup
#

Not without heavy engine modifications

dark edge
#

yeah

#

basically, if you have to ask, no

solar stirrup
#

Doubt even Iris would help in that case

fossil spoke
#

Its not even worth pursuing. The level of optimization required to even get to 500 players would likely dictate the removal of any actual gameplay, making the "game" unplayable anyway.

dark edge
#

you can do a lot with a 1 hz tick rate

#

lol

fossil spoke
#

Last time I checked we were in an Unreal server?

#

Does EVE use UE?

dark edge
#

no lol

fossil spoke
#

Purpose built proprietary engines are not part of this discussion.

#

His question was in relation to unreal.

#

I remember tech demos and the like where they had thousands of live players

#

In battles

#

So of course its do-able

#

If thats literally what your engine is built for

#

But Unreal isnt

pallid rampart
#

Do I have to setup port forwarding to use dedicated servers on EOS? I’m struggling with figuring out how to connect to a server without doing port forwarding on other machines… do I have to use something like playfab for this or would eos work?

spice gorge
#

What's a safe way of teleporting in multiplayer and overriding the character's rotation?
If I teleport a player via:
this->TeleportTo(DestLocation, FRotator::ZeroRotator, false, false);
The server character rotates (to face zero), but a connected client overrides the rotation because the camera and I presume therefore the player controller stomps on the teleport rotation.

fossil spoke
spice gorge
candid mulch
#

how would i switch from having client prediction to waiting for the server's calculated movement for a player's movement and have that be changed whilst in game?

spare moss
#

Have listen servers changed at some point in unreal 5? Can't get any to work for a prototype

#

Opening the level via the in game console with ?listen on the end for the host opens the level

and then 'open {ip}' for the client doesn't result in a connection even locally using public ipv4

cursive steeple
spare moss
cursive steeple
spare moss
cursive steeple
spare moss
hard violet
#

Hi guys, I'm relatively new here. First, I have this function in UI_Auction, to update items to the auction. UI_Auction is a child of UI_Main.

#

Then I'm trying to pass the data from the GameMode to the PlayerController, which handles the UI, which can be seen here.

hard violet
#

What did I do wrong?

fossil spoke
#

What data are you trying to pass from the GameMode?

#

What is the goal here?

#

Also, just saying "it gets the variable note as you can see above." tells us nothing.

#

Yeah we can see it says "NOTE", but we dont know what thats even complaining about.

#

If you hover over it, it will tell you.

#

Paraphrasing Errors or Warnings doesnt help. Be very specific.

#

If you see an error or warning (or note), tell us exactly what it says.

hard violet
#

Sorry @fossil spoke the note is this.

fossil spoke
#

Does refreshing the node remove that?

#

Its not obvious why it would be complaiing about that.

#

Also what isnt working here?

hard violet
#

That is what isn't working.

fossil spoke
#

Ok, where is your RPC down to the Client?

#

Your images are so small its extremely hard to tell

hard violet
#

This is from the PC (which handles the UI) to the UI.

#

And this is from the server to the PC.

#

I'm relatively new so what is the typical way to do the RPC?

fossil spoke
#

GetControlledPawn??

#

Do you see why thats wrong?

#

Please dont say INTPlayerController is a Pawn...

hard violet
fossil spoke
#

GetControlledPawn returns a Pawn.

#

If your UpdateAuction interface function is implemented on a PlayerController.

#

But you are calling it on a Pawn?

dark edge
# hard violet Sorry <@223322728424407042> the note is this.
Epic Developer Community Forums

I have an event node in my player class that executes on server and it takes an array parameter of a custom actor component class I created. When using the event node, there is a note on the bottom of it that states: No Value will be returned by reference. Does anyone know what would cause such a thing as well as a potential fix? The value its...

#

I'd just have a struct for your auction though.

hard violet
fossil spoke
#

So why would you think it would work by using GetControlledPawn???

hard violet
fossil spoke
#

Question is, why are you using an interface?

#

Whats your reasoning there?

hard violet
fossil spoke
#

Why

hard violet
#

It creates hard references.

fossil spoke
#

Sure its a strong coupling, but is your intention then to use interfaces for everything?

dark edge
#

You're making that interface call on the pawn

#

But expecting it on the controller

#

So it just goes nowhere

fossil spoke
#

@dark edge Ive already explained that mate.

hard violet
#

What is the normal way you guys do it?

fossil spoke
#

Usage of Interfaces vs Casts (inheritance) hasnt got anything to do with SP or MP

#

Both have pros and cons

hard violet
#

Enlighten me. I'm eager to learn.

fossil spoke
#

Depending on the needs of what you are trying to build, an interface maybe an entire waste of time.

#

Where a simple function call on a specific type would be sufficient.

#

Which would require a cast somewhere.

#

There is nothing wrong with casting.

hard violet
#

So what would you do in this case?

fossil spoke
#

You would use an interface when your source doesnt care what the target type is, only that its expectation being it can handle the event

fossil spoke
fossil spoke
#

So there is no abiguity as to where the implementation exists.

#

Do you anticipate any other class from handling this operation from that call site?

dark edge
fossil spoke
hard violet
#

Let's just say I have this simple deck with the data. How do you guys normally pass it to the player? I'm trying to learn more from the best, like you guys.

dark edge
#

Explain what the actual mechanic is.

#

And idk about best, go with "most chatty"

fossil spoke
#

Like the difference between Casting (inheritance) and Interfaces

#

What they do and why you might want to use one over the other.

#

Convert what you currently have over to using a Cast and direct function call first.

#

So that you get it working.

#

There maybe other issues.

hard violet
#

Let me test it. Thanks for the help @fossil spoke @dark edge. I have no experience regarding this so bear with me.

hard violet
fossil spoke
#

Read the Pinned Messages in this channel.

#

Especially the Network Compendium

#

Read that twice

#

Also your request is like asking how long a piece of string is.

#

There isnt just a single place to "learn multiplayer".

#

You learn it over a great deal of time

#

Feature by feature

#

Understanding what Replication is.

#

What RPCs are.

#

And the many other facets of what makes up "multiplayer"

#

Start by reading the Network Compendium in the Pinned Messages.

hard violet
#

Thanks @fossil spoke

hard violet
fossil spoke
#

Unreal Tournament
ShooterGame
Lyra

#

🤷

#

I feel however looking at those will only serve to confuse you further, given your level of experience is very low.

hard violet
fossil spoke
#

Research the specific things you need.

#

Read the compendium first

#

Read it a couple of times

#

It is an important resource

stable seal
#

how do i make create and find/join session work in one button

#

i tried like this

#

but not working

short arrow
# stable seal

not sure why that wouldn't work, you can try adding a small delay, maybe a delay just until the next tick and see if your result changes

#

some things don't like to be done on the same frame

stable seal
#

nope not working with delay

short arrow
stable seal
#

even if there is no session it's going for success

short arrow
stable seal
#

isn't it supposed to go failrue

short arrow
#

bro add a delay to on success from the find session node

stable seal
stable seal
muted pewter
#

Hi, Where can i write a dedicated server's logic? like level change and handling multiple players and their movements? Which class should i choose and where can i write all this logic?

reef arrow
#

Has anyone tried to integrate UE4GameLiftClientSDK? When i add the plugin and the regenerate the vs code files, it's throwing an error saying the name PublicLibraryPaths doesn't exist in the current context in plugin/clientSDK/cognito.build.cs

latent heart
#

Are you trying to use it with UE5?

dark edge
muted pewter
#

Can you explain me a bit more im totally new to it?

#

Theres literally nothing on internet regarding this

latent heart
#

Dedicated server logic is what source does, right?

#

Forget everything you know about Source and Unity.

#

You just put your logic in whatever class you are using and check if you're on a server or client at the appropriate time.

muted pewter
#

Okay so how can i communicate between server and client?

#

i was studying about rpc and used some of them but didnt get any clue whether they are getting executed on server or not

#

like how can i put logs on server?

latent heart
#

Have you read all teh pinned messages in this channel?

muted pewter
#

No, let me go through them

latent heart
#

The game mode class is server-only, though. But that can't be used for everything.

muted pewter
#

I am able to connect with my dedicated server using open level function but dont know how to implement multiplayer game a bit confused where to start but im going through the pinned messages hope will find answers

dark edge
muted pewter
#

Thanks

shrewd ginkgo
#

Can you recommend a good resource on multiplayer gun firing and death in terms of understandability?

upbeat geyser
#

Just to understand it,
Lets say I have a car, to manipulate the values of it as player character I will need to have RPC from the player character blueprints accessing the vehicle pawn right? cuz if he isnt the server it will not give him the option to do so

latent heart
#

You need the RPC functions on your player character.

#

Where you call them from doesn't matter.

humble wadi
#

Hey there!
Is anyone familiar with the Pause logic in the default APlayerController class?
I'm scratching my head over the implementation Epic made as it raises many questions.

So APlayerController has a function like so:
/** Replicate pause request to the server */ UFUNCTION(reliable, server, WithValidation) void ServerPause();

The purpose of this function is to call the the SetPause() function like so:
void APlayerController::ServerPause_Implementation() { SetPause(!IsPaused()); }

Currently, this method has a _Validate counterpart as well, which goes like this:
bool APlayerController::ServerPause_Validate() { #if UE_BUILD_SHIPPING // Don't let clients remotely pause the game in shipping builds. return IsLocalController(); #else return true; #endif }

So basically, if you're running a shipping build, and you are calling this on a client player controller (which means that IsLocalController will return false on server-side), this validate function will kick you out of the game because you're not calling ServerPause() on a server player controller. So this raises a couple of questions:

  • First, if you need to call this on a server player controller, how on earth are you supposed to do that on client-side, given the fact that you only see your local controllers and nothing else
  • Second, if I were to RPC a pause request in my own method over to the server so the server can find a local controller on his side, on which it can call ServerPause(), what the hell is the purpose of the Server rpc then? It could be a simple function call without RPCs as we are already on server side.. and we can't just call this server RPC on the client because of the 1st point i've mentioned..
  • Lastly, how is this even acceptable on dedicated servers? As far as I know, dedicated servers have no local player controllers, meaning, no server PCs.. how do you pause there?

Is Epic's intention to overwrite the ServerPause_Implementation and _Validate functions?

#

Also as an extra note, why the limitation on ServerPause, why can't it be called on client PCs?

#

One additional note: I know there's a SetPause function already that we can use for whatever we want, but Epic was kind enough to let us know that we should call ServerPause to pause a networked game (indicated by their comment above SetPause)

/** * Locally try to pause game (call serverpause to pause network game); returns success indicator. Calls GameModeBase's SetPause(). * @return true if succeeded to pause */ virtual bool SetPause(bool bPause, FCanUnpause CanUnpauseDelegate = FCanUnpause());

thin stratus
#

@humble wadi Things like these are mostly remnants from Epic making an Engine for UT.

#

They don't want Clients to Pause the game or request a Pause.

#

If you want to allow that, feel free to make an RPC or override this one.

#

I assume the idea behind it is mostly that the RPC should work in Test and DevEditor Builds, for debugging mostly I assume.

#

Lastly, how is this even acceptable on dedicated servers? As far as I know, dedicated servers have no local player controllers, meaning, no server PCs.. how do you pause there?
Well, you just don't call the RPC and pause with SetPause on the Server directly.

#

DedicatedServer has PlayerControllers of each player.

#

All it does is this:

bool APlayerController::SetPause( bool bPause, FCanUnpause CanUnpauseDelegate)
{
    bool bResult = false;
    if (GetNetMode() != NM_Client)
    {
        AGameModeBase* const GameMode = GetWorld()->GetAuthGameMode();
        if (GameMode != nullptr)
        {
            bool bCurrentPauseState = IsPaused();
            if (bPause && !bCurrentPauseState)
            {
                // Pause gamepad rumbling too if needed
                bResult = GameMode->SetPause(this, CanUnpauseDelegate);

                if (AWorldSettings* WorldSettings = GetWorldSettings())
                {
                    WorldSettings->ForceNetUpdate();
                }
            }
            else if (!bPause && bCurrentPauseState)
            {
                bResult = GameMode->ClearPause();
            }
        }
    }
    return bResult;
}
#

So you could just call SetPause on the GameMode directly fwiw

#

ForceNetUpdate on the WorldSettings might have some reason

#

But either way, just calling SetPause on the First of any PlayerController should be fine

#

Ah yeah the WorldSettings hold which player caused the pausing

#
bool AGameModeBase::SetPause(APlayerController* PC, FCanUnpause CanUnpauseDelegate /*= FCanUnpause()*/)
{
    if (AllowPausing(PC))
    {
        // Add it for querying
        Pausers.Add(CanUnpauseDelegate);

        // Let the first one in "own" the pause state
        AWorldSettings * WorldSettings = GetWorldSettings();
        if (WorldSettings->GetPauserPlayerState() == nullptr)
        {
            WorldSettings->SetPauserPlayerState(PC->PlayerState);
        }
        return true;
    }
    return false;
}
#

But yeah, the WorldSettings seem to actually drive the Pause state. So if that PlayerState is set, it will pause.
I guess a DedicatedServer without players is not pausable.

#
    // If paused, PlayerState of person pausing the game.
    UPROPERTY(transient, replicated)
    TObjectPtr<class APlayerState> PauserPlayerState;
marble sparrow
#

any way to make unreal multiplayer in a blueprint game?

thin stratus
#

Multiplayer in UE is too complex to be done solely in Blueprints. Some simple games will work just fine though I guess.
Really depends on what you try to accomplish.

marble sparrow
#

so what i whant to do is to let other player's join a player's game

thin stratus
#

There should be quite a lot of tutorials and resources about this. The general gist of it is:

  • If you want Players to join via IP, you can do that via the ExecuteConsoleCommand node, where you have to put in open followed by the IP and Port.

  • E.g. open 127.0.0.1:7777. 7777 being the default port. The hosting player will be required to open their 7777 port on their router in this setup.

  • The hosting Player will need to call OpenLevel with the Level of your choice and listen in the options field.

  • If you want Players to join via a Server List, you will need to use the CreateSession, JoinSession, FindSessions and DestroySession nodes.

  • The hosting Player would need to call CreateSession before calling OpenLevel with the Level of your choice and listen in the options field.

  • The searching Player/Client needs to call FindSessions followed by JoinSession if a Session was found.

  • JoinSession will take care of actually opening the hosts level

The Session solution will by default only work in LAN. It uses #online-subsystems , where you'd need to, in the future, choose one that suits your platform.
An example would be Steam. Without that you can't host/find/join Sessions online.

#

In addition, the Session nodes that UE offers are very limited. Sessions usually allow to actually provide some settings to display or filter by.
That requires either C++ or the use of a Plugin (e.g. Advanced Sessions).

humble wadi
#

Thank you for answering. Yes, we thought about overriding it but were unable to reason with their decision with the "Validate" function. Sure we can use the SetPause as i've said but the comment they've added makes this especially confusing given the fact that the whole RPC thing there will disconnect the client. The ForceNetUpdate thingy seems to be there because the moment you pause the game it seems all replication stops as well, so they just sneakily force in a net update that'll be dispatched before everything pauses so clients will get the replicated "PasuerPlayerStatate" on their end.

thin stratus
#

I can tell you that after 8 or so years, I stopped to reason with stuff in UE

#

Ignore the Validate/RPC part if you don't need it to work that way

#

UE has tons more of code that makes no sense for you to discover :D

haughty sierra
#

hey somebody got a guide how to handle persistent data (Player Location, Abilities, attributes etc.) with playfab?
The Login is working... now how can i handle persistence?

greetings Eric

thin stratus
haughty sierra
#

well first i need to get how i can handle persistent data in unreal.... its like i should save players location in every tick?

#

then send it to the DB?

thin stratus
#

I wouldn't do that every frame. That's potentially multiple times per second.
Sending it at a fixed rate that serves your game should be enough

sinful tree
# haughty sierra well first i need to get how i can handle persistent data in unreal.... its like...

That's more a question of what the requirements are for your game. How far back are you willing to accept players would be rolled back if there is a server failure before the most recent save is done? Players won't care so much about exact frame precision of their character location, but they would be infuriated to lose that legendary item they may have just picked up that they've been waiting for months to get. So then it really all depends on what you're saving and how important it is should dictate how often you may save it to an external database. I second Cedric in that you wouldn't necessarily want to save every single frame, so you can rely on event driven approaches to save, like any time the player's inventory is changed, or timed approaches like every minute or so to save their location or any other details that aren't extremely significant that a player could easily shrug off, or not even notice, if they lost a bit of progress. Again, it all depends on what and how long you're willing to accept that they get rolled back in case of a failure.

One would likely save any unsaved data about a player when they're leaving or had been disconnected from the server too.

haughty sierra
#

thats how i want to do it. and i need to research how to do that.

humble wadi
twin pendant
#

When i leave/destroy a session, by default the player always travels back to the game default map, is there a way to override that? Since i would like to have a different game default map for starting the game and travel back after the player leaves a session?

twin pendant
grave lynx
#

Hey, i'm trying to create a private lobby and the host have to be able to invite players, here is a part on session settings:

SessionSettings->bAllowJoinViaPresence = true;
SessionSettings->bShouldAdvertise = false;
SessionSettings->bAllowInvites = true;

bShouldAdvertise is false so FindSession can't see it. bAllowInvites and bAllowJoinViaPresence are true, but host can't send invite, any idea?

twin pendant
grave lynx
#

working fine, thanks

twin pendant
grave lynx
mortal mica
#

it's been a while and I forgot, but how do you differentiate between client side players vs server side, including the listen server's local client? switching on authority to remote only works on really remote pawns, not for the server's own pawn

#

I guess I basically want autonomous proxies, but not sure how to check for it

fathom aspen
#

Usually IsLocallyControlled

#

You have to be careful to call it after the pawn is controlled tho

#

Tips and tricks article goes over how to filter for owning client execution paths

mortal mica
#

ah! that sounds like it

#

ok yeah that was it, I couldn't for the life of me remember that one 🙂

magic helm
#

There is also a C++ only function(eventually I'll make a PR to expose it to BP) where you can check if the actor has an owning client or even if the owning client is local to this machine

#

HasNetOwner & HasLocalNetOwner for checking if it has ownership

#

To get the owner you just use GetOwner

gloomy axle
#

Hey guys, on my GameMode blueprint class, I have this teaming system that basically puts pawns into two separate arrays. For some reason, it's not replicating to other clients and I'm unsure why. Before calling "Create Teams" in the first linked blueprint, I set up a RPC so the RPC_Server is ran on the sever and RPC_Client is set to multicast. Not sure why it's not replicating to other clients

https://blueprintue.com/blueprint/qpekadpu/

https://blueprintue.com/blueprint/ssdhbv-9/

#

this is sort of my first time messing with a multiplayer game, no clue why it's not replicating what pawn goes into what array

fossil spoke
#

@gloomy axle The GameMode only exists on the Server

#

Therefore it wont have anything to Replicate to or call RPCs on.

#

You will want to move this functionality to the GameState instead.

gloomy axle
peak mirage
#

How would I use custom replicate condition? The doc point to SetCustomIsActiveOverride(UObject* OwningObject, const uint16 RepIndex, const bool bIsActive) function but I found no example on how to use that function.

I tried to call it in PreReplicate but don't know what is RepIndex and what should I put in that parameter.

gloomy axle
dark edge
#

Show what you're trying to do

fossil spoke
#

Use the GameState.

hard violet
#

Guys are there any good tutorial on youtube about a full multiplayer game?