#multiplayer

1 messages ยท Page 81 of 1

fossil spoke
#

You cant do anything with it, as there are no functions that take in a NetId like that in Blueprint anyway.

storm zinc
#

But out of like 9 hours of off-and-on research and compiling I managed to get this:

fossil spoke
#

Well done.

#

Is there a reason you wanted it to be a delegate?

storm zinc
#

I tried doing the declare event macro but it wants an owningtype and I couldn't figure that part out lol

#

I tried making a struct with both FStrings in it, and it wouldn't compile. This was the only way I got it to work

fossil spoke
#
UFUNCTION(BlueprintImplementableEvent)
void PreLoginAuth(FString ClientNetId, FString ClientToken);
#

This would have been sufficient to expose a Blueprint event to the GameMode graph.

storm zinc
#

so you would add that in the .h file and then how do you call it? PreLoginAuth(networkid,token);?

fossil spoke
#

Yep exactly like that, its a function.

storm zinc
#

ok

#

I might give that a shot

fossil spoke
#

Its easier to deal with than a Delegate for a beginner.

storm zinc
#

multi-cast would go out to everyone if I have been reading properly so it might just be unnecessary traffic

fossil spoke
#

It allows many subscribers to receive the event, they have to bind to it (like in the image you have).

storm zinc
#

ahhh ya I don't need that

fossil spoke
#
void AMyGameMode::PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)
{
  Super::PreLogin(Options, Address, UniqueId, ErrorMessage);

  // Do retrieval of NetId and Token
  FString ClientNetId = UniqueId.ToString();
  FString ClientToken = ;// Retrieve Token how you need to.
  PreLoginAuth(ClientNetId, ClientToken);
}
#

Might look something like that

storm zinc
#

my flow is something like:

User Logs In on Login Map
API Authenticates and returns Session Token
Joins map with ?Token=123 on Open Level By Name
Custom Game Mode records Network ID and Token
#

At some point, when the actor is going to be spawned, I want to request the users information on the database like their world location, equipment etc., and spawn their character accordingly.

fossil spoke
#

The logging in Client has its PlayerController spawned at the end of the Login chain during AGameModeBase::Login

#

You can decide when to spawn them a Pawn at any point.

#

They will be assigned a Pawn by default though.

#

Which is decided by the DefaultPawnClass on the GameMode.

#

You can leave this empty.

#

And manually spawn them a Pawn whenever you like.

#

Like if there was a Character selection screen or something.

shadow pumice
#

Hey how to save data from the game like a specific player's money count, bought items etc. And retrieve or change this data when needed?

shadow pumice
#

Yes

fossil spoke
#

Im sure there is a plugin that allows you to easily communicate with a DB somewhere

#

Its not an easy question to answer without you doing your own research

storm zinc
#

Currently it holds all the users customizations in a json object that is a structure created in UE5

shadow pumice
#

Thanks for help guys

storm zinc
#

awwww yisss

#

now to try that other thing

viscid tapir
#

Hello, i'm struggling with the FFastArraySerializer stuff. This is basically the code that is called client side whenever the fast array is updated (changed)

void FCardItem::PostReplicatedChange(const struct FCardContainer& InArraySerializer)
{
    for (int32 Index = 0; Index < InArraySerializer.Items.Num() - 1; Index++) {
        if (InArraySerializer.Items[Index].Card == this->Card) {
            InArraySerializer.BookOwner->OnBookUpdated.Broadcast(this->Card.CardRowName, Index);
        }
    }
}```
#

So the server is never calling this

fossil spoke
#

Whenever you Add/Remove/Modify an element of a FastArray you must mark it dirty appropriately.

#

Where you mark it dirty for a modification is where the server should also be manually calling this function

viscid tapir
#

I'm already marking it dirty

#

and i was wrong, the server calls the function

#

but it does not work

fossil spoke
#

There is some very extensive documented examples within the NetSerialization.h header for how to work with FastArrays

#

I recommend taking a look there to verify that you are using it correctly.

viscid tapir
#

Thank you i'll try harder

#

the current setup is not wrong I'd say however it is pretty basic

fossil spoke
#

If you are using UE5 they moved the FastArray stuff

#

Its found here

#

Read ALL of the comments ๐Ÿ™‚

plush wave
#

Trying to replicate a 'seed' for my actor

#

But I only care to replicate it once I don't need the replication system checking it every tick

#

Is there a way to do this? Or better yet, is something like the 'actor spawn time' replicated that is the same for all clients that I could then derive a seed from?

fossil spoke
#

Use InitialOnly rep condition

#

COND_InitialOnly

viscid tapir
plush wave
#

Are there default properties of an Actor that use that?

fossil spoke
plush wave
#

Like say the actor has the ability to get it's lifetime. I know that's not a variable that is replicated for example, but I think some things are replicated. Is there a way to see what tings are currently replicated on a vanilla actor other than checking ever dorep function in the class hierarchy?

fossil spoke
#

Pretty sure you can filter for Replicated variables within the Details panel.

#

You can also filter for all derived variables to

#

So coupling those together you should be able to display ALL replicated variables, at least those that are exposed to Blueprint.

#

That may only work for Blueprint based variables though, not ones exposed through C++

#

Otherwise, im not sure of any other mechanism to display all Replicated vars.

#

If thats what you are asking for?

dusky pecan
#

Hi to all! When i'm trying to play in pie, with 2 clients, or 1 client, 1 listen server, i have two players, that cannot see each other, how can i solve this?

plush wave
opal pulsar
#

Does anyone know when iris is suppose to be released an in a working/shippable state

#

or any updates really?

nocturne quail
#

when replicating a variable , what should I choose so it will work fine

plush wave
#

In the comments it says 'Attempt to send on initial bunch'

fossil spoke
fossil spoke
#

This is still true for net relevancy as well, each time the Actor Channel is opened, it will replicate the variables value, then it is ignored after that.

plush wave
nocturne quail
fossil spoke
#

That is normal replication yes

nocturne quail
#

thank You very much

ivory bear
#

Thank you. It's close, but still seems off a bit. Will keep poking around.

storm zinc
#

Well, I am doing something wrong. It keeps saying that my UFUNCTION has a required return type missing

#
UFUNCTION(BlueprintImplementableEvent, Category = "Authentication Event Dispatchers");
void OnClientAuthCaptured(FString NetworkId, FString Token)
#

do I have to put a 'void' somewhere in the UFUNCTION delcaration?

#

I don't see a 'return type' in the docs for ufunctions

fossil spoke
#
UFUNCTION()
void MyFunction(); // <------- this line
storm zinc
#

ahhhhh

#

ugh C++ ๐Ÿ˜ฆ

#

I give up for the night

#

time to try to relax...

twin juniper
#

Hello guys

tidal shoal
#

Hello guys, may I ask for your help about RepNotifes?

I have 3 simple classes, SwordClass, An ActorComponent named SampleActorComponent, and a Character class.

In the character class, there is a E key pressed feature where the sword is set. Why does the UE_LOG() in the RepNotify function OnRep_Sword is not showing?

fossil spoke
tidal shoal
#

Oh sorry, I am running as a Client

fossil spoke
#

So you are using Dedicated Server as the NetMode?

tidal shoal
#

I am using a Listen Server

fossil spoke
#

Ok well if you are using Listen Server then you arent a Client

#

You are a Host

#

Which means you are the Server.

#

In C++ OnRep_xxx functions are not automatically called for the Server

#

They must be called manually in code for the Server

#

Only Clients get these called for them automatically.

tidal shoal
#

Oh. I am using the Listen Server as a NetMode, but I am playing as a Client, like this:

fossil spoke
#

When the variable replicates to them.

#

Eitherway, what I said is still true.

#

Also.

#

As a Client

#

Setting a replicated variable will only change its value locally for that Client

#

It will not have OnRep_xxx called for it

#

As the value was not changed due to replication.

#

So calling SetSword on the E Key Press will not result in OnRep_xxx being called because you are doing it locally to that Client.

#

You would need the Client to send an RPC to the Server that tells the Server that the Client had pressed the E Key and to perform the necesssary action on their behalf.

icy jetty
#

We need RPC t-shirts, really

tidal shoal
#

In the Server RPC, should I implement it like this?

fossil spoke
#

Sure, if thats how you want it to work.

tidal shoal
#

Is that okay or it could be improve?

fossil spoke
#

Thats fine for a beginner.

#

Networking/Multiplayer is a field you can build a career around, so it gets vastly more complicated.

tidal shoal
#

Yea. That's why I want to learn it

#

Uhmmm, If you do not mind me asking

#

How would you do a Server RPC when E Key is pressed?

fossil spoke
tidal shoal
#

Is that how you would do it also?

fossil spoke
#

It depends on what I was trying to achieve.

tidal shoal
#

Oh okay. After adding that Server RPC, will the "Sample Sword Log Text" appear?

fossil spoke
#

How am I supposed to know what your code is going to do without having the same code to run on my machine?

tidal shoal
#

Oh sorry

#

But I run it and it does not show the log

fossil spoke
#

What is USampleActorComponent attached to?

tidal shoal
#

I created it at the Character class

fossil spoke
#

Can you show me the Server RPC declaration

sinful tree
tidal shoal
fossil spoke
#

Does the Server RPC make it across?

#

You may need to check if NewSword isnt nullptr

tidal shoal
#

Here, I declared a Setter for SwordVariable

#

And used it like this

fossil spoke
#

Yes but is the Server RPC even being called?

#

Do you know what a Breakpoint is?

tidal shoal
fossil spoke
#

You want to breakpoint in the Server RPC implementation and check what the value of NewSword is

tidal shoal
fossil spoke
#

Yes

#

You want to breakpoint line 100 and check that NewSword has a value

tidal shoal
#

Ohhh

#

It returns null

fossil spoke
#

So then you need to find out why

tidal shoal
# tidal shoal

Should I declare another Server RPC in the SwordClass and then call it here?

fossil spoke
#

Your Player isnt having the Sword variable set on the Clients.

#

Its only set by the Server (Authority) because you have gated the Overlap Events from only happening on the Server.

#

Therefore when you press the E Key, the Client is passing the Sword value of nullptr to the RPC.

gray orchid
#

hello, So im trying to set it up to where if the max number of players joins then the session locks and no one can join, for some reason its not working but it looks to me like it should be working, can anyone help me?

fossil spoke
#

You either need to let the Overlap Events be also called by Clients, or, find a way for the Clients to get the Sword value to change when its set by the Server on the Overlap.

fossil spoke
#

Set the max number of Slots.

gray orchid
#

oh

fossil spoke
#

To however many players you want it to support.

#

New players wont be able to join if its already full.

gray orchid
#

well I also want it to not show up on my server list, that part works.

#

so change the get max number of players to get max number of slots?

fossil spoke
#

No?

#

If you set the max number of slots to 4

#

Only 4 people can join.

#

A 5th person wont be able to join.

#

Because they would exceed the slot count

tidal shoal
fossil spoke
tidal shoal
#

Oh okay. I'll try to find another way

tidal shoal
tidal shoal
fossil spoke
#

You cant keep asking me if xxx thing is okay to do. There are many many ways to achieve something and the answer is usually going to be "it depends".

#

Learning how to do things correctly takes time.

#

You seem very very new on your journey.

#

You have a lot to learn.

#

I would be less concerned with doing it "correctly" at your stage right now.

tidal shoal
#

Okay, sorry for that

#

Thanks for the help!

amber barn
#

hi guys, for some reason one of my onrep methods isnt running.

void APlayerPawn::OnHealthUpdate()
{
    //Client-specific functionality
    if (IsLocallyControlled())
    {
    }

    //Server-specific functionality
    if (GetLocalRole() == ROLE_Authority)
    {
    }

    //Functions that occur on all machines. 
    if (CurrentHealth <= 0)
    {
        SetDead();
    }
}

void APlayerPawn::SetDead()
{
    bIsDead = true;
    SetActorHiddenInGame(true);
    SetActorEnableCollision(false);
}

void APlayerPawn::OnRep_IsDead()
{
    // is this function running log
    UE_LOG(LogTemp, Warning, TEXT("OnRep_IsDead is running"));
    
    OnDeathUpdate();
}

    UPROPERTY(ReplicatedUsing = OnRep_IsDead)
    bool bIsDead;

    UFUNCTION()
    void OnRep_IsDead();

    void OnDeathUpdate();

i have confirmed APlayerPawn::SetDead() code is running correctly (both clients and server) but it i never get the log message when the bIsDead value changes, not sure what im doing wrong

fossil spoke
#

If you are setting it locally as well then it wont be called as the value is the same.

amber barn
fossil spoke
#

SetDead() should probably also call OnRep_IsDead()

amber barn
# fossil spoke `SetDead()` should probably also call `OnRep_IsDead()`

hmm ok

void APlayerPawn::OnHealthUpdate()
{
    //Client-specific functionality
    if (IsLocallyControlled())
    {
    }

    //Server-specific functionality
    if (GetLocalRole() == ROLE_Authority)
    {
        if (CurrentHealth <= 0)
        {
            bIsDead = true;
        }
    }

    //Functions that occur on all machines. 
    if (CurrentHealth <= 0)
    {
        SetActorHiddenInGame(true);
        SetActorEnableCollision(false);
    }
}

this has most of the death behavior i want but it still doesnt trigger the onrep isdead for some reason'

fossil spoke
#

Did you forget to add the DOREP for it?

amber barn
#

oh ffs

amber barn
fossil spoke
#

๐Ÿ‘

amber barn
# fossil spoke ๐Ÿ‘

sorry mate...
my death code and behavior is working perfectly and im trying basically the same thing for but respawning but i can't get it to work

void APlayerPawn::OnDeathUpdate()
{
    // log player death
    UE_LOG(LogTemp, Warning, TEXT("Player %s has died"), *GetName());

    if (bIsDead)
    {
        FTimerHandle respawnTimer;
        GetWorld()->GetTimerManager().SetTimer(respawnTimer, this, &APlayerPawn::Respawn, 2.0f, false);
    }
    
    //Client-specific functionality
    if (IsLocallyControlled() && bIsDead)
    {
    }

    //Server-specific functionality
    if (GetLocalRole() == ROLE_Authority && bIsDead)
    {
        bIsDead = false;
    }
}

void APlayerPawn::OnRep_IsDead()
{
    OnDeathUpdate();
}

void APlayerPawn::Respawn()
{
    CurrentHealth = MaxHealth;
    SetActorHiddenInGame(false);
    SetActorEnableCollision(true);
}

code is confirmed to be running but depending where i call respawn i get different behavior (obviously) i would have thought settling the bool on the server... and then doing the respawn function on all machies would work fine?

fossil spoke
#

Whats not working exactly?

#

Respawn should most likely be managed by the Server only.

#

It should also not be handled by changing a variable like bIsDead

#

Let the Respawn function set bIsDead to false

#

Respawn is like "resetting" the pawn.

#

That should be a discrete operation on its own, not tied to the value of another variable.

#

OnDeathUpdate should not be changing bIsDead

amber barn
fossil spoke
#

Why are you only hiding the pawn instead of destroying it when it "dies"?

amber barn
fossil spoke
#

Sure.

amber barn
#

on death though,

void APlayerPawn::OnHealthUpdate()
{
    //Client-specific functionality
    if (IsLocallyControlled())
    {
    }

    //Server-specific functionality
    if (GetLocalRole() == ROLE_Authority)
    {
        if (CurrentHealth <= 0)
        {
            bIsDead = true;
        }
    }

    //Functions that occur on all machines. 
    if (CurrentHealth <= 0)
    {
        SetActorHiddenInGame(true);
        SetActorEnableCollision(false);
    }
}

i hide and disable collisions on both server and clients? i figured the same for respawn?

fossil spoke
#

Its common to spawn a new Pawn upon respawn for a Player.

amber barn
#

ahh ok will switch to that

fossil spoke
#

And let the "dead" Pawn be destroyed

#

That way you dont have to worry to much about correctly resetting them back to a default state etc

amber barn
#

i guess i would then need to do this at the player state level not on the pawn itself

#

makes sense

fossil spoke
#

We handle respawning our Players within the GameMode.

#

The PlayerController has a flag on it that says that Player wants to Respawn

amber barn
#

yeah or gamemode, makes sense

fossil spoke
#

The GameMode constantly checks each Players flag

amber barn
#

yep im planning on doing something similar

fossil spoke
#

If one is true, it calls RestartPlayer on that PlayerController

#

We display a respawn screen on the HUD when the Player dies.

#

They opt into a respawn via the HUD

#

Therefore the HUD sets that Flag for the Player when they want to respawn

#

The GameMode handles the rest from there.

#

AGameModeBase::RestartPlayer is a function you should research.

amber barn
#

ooo thank you

amber barn
fossil spoke
#

The actual source code is what I meant

#

Read the source code for that function and find where else throughout the code base it is called

#

So you can understand how it is used and why.

amber barn
#

ahh yep makes sense sorry

thin stratus
#

Do we really not have a blog post about UObject replication pinned?

#

I could swear we had something

lucid wren
#

I'm having this issue in host client mode, not in solo

thin stratus
thin stratus
lucid wren
#

all the magnify icon in the log open this

thin stratus
#

Yeah BeginPlay is called by every instance of an Actor

#

PlayerController exists on Server and owning Client

#

The Server calls this for Client PlayerControllers

#

You have to put a "IsLocalPlayerController + Branch" in front of the UI stuff

lucid wren
#

it works! thanks

chrome bay
#

I should update that for the subobject list in UE5..

thin stratus
#

Does that Subobject list thing affect UObjects in Components?

#

Couldn't find anything about that

lucid wren
#

I have a pawn that has to replace the character when the player interact with it

#

it works in solo, but in host client works only in host

#

in the client the camera moves like the pawn get possessed right, but no inputs

#

the setvisibility doesn't work too, but no errors in console

thin stratus
#

You make a lot of assumptions here

#
  1. Is this being called on Client or Server? The little Icon on the "Possess" node means that this has to be called on the Server. Destroy Actor also needs to be called by the Authority/Server.
  2. SetVisibility might not be replicated, and if you again call this on the Client, it won't replicated.
thin stratus
chrome bay
#

Urrhm.. I do not know.. but also maybe don't understand the Q ๐Ÿ˜„

#

I'd imagine the non-replicated version doesn't interfere, as the OnRep only cares about the property it's for

thin stratus
#

But I will just assume it does

chrome bay
#

Oh roger.. yeah I'm pretty sure that would be fine

static pebble
#

hello! ๐Ÿ™‚

Does anyone know if there is a way to know when the playerstate has been replicated?

static pebble
#

wait, sounds like what I need ๐Ÿ˜‚

chrome bay
#

OnRep_PlayerState

viscid tapir
#

I found this way to get the last element changed in the Fast Array :

void FCardItem::PostReplicatedChange(const struct FCardContainer& InArraySerializer)
{
    const int32* Temp = InArraySerializer.ItemMap.Find(ReplicationID);
    InArraySerializer.BookOwner->OnBookUpdated.Broadcast(Card.CardRowName, *Temp);

    /*for (int32 Index = 0; Index < InArraySerializer.Items.Num() - 1; Index++) {
        if (InArraySerializer.Items[Index].Card == Card) {
            InArraySerializer.BookOwner->OnBookUpdated.Broadcast(Card.CardRowName, Index);
            return;
        }
    }*/
}```

Is it the way to go or it has some issues ? But it is still not updating server-side, only client side. It might be a widget problem tho
static pebble
chrome bay
viscid tapir
#

Isnt it what i'm using rn ? With PostReplicatedChange() ?

chrome bay
#

The two are different really

viscid tapir
#

How can I use it ?

chrome bay
#

Just declare the stuff you need:

viscid tapir
#

I only read about PostReplicateChange() personnally

chrome bay
#
    bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms);
    void PostReplicatedAdd(const TArrayView<int32>& AddedIndices, int32 FinalSize);
    void PostReplicatedChange(const TArrayView<int32>& ChangedIndices, int32 FinalSize);
    void PreReplicatedRemove(const TArrayView<int32>& RemovedIndices, int32 FinalSize);```
viscid tapir
#

Oh nice

#

So i can isolate the index that has been changed in FFastArraySerializerItem

chrome bay
#

Saves the awkward lookup of the index

viscid tapir
#

or use these ones

#

Thank you i'll try it out

chrome bay
#

I prefer this way myself

viscid tapir
#

Yeah I see

#

But how does occur the "desync" of elements ?

chrome bay
#

They also fixed PostReplicatedChange not being called when UObjects were mapped too, in 5.0 I think

#

There used to be a bug where only the element received that call if an internal UObject was mapped

viscid tapir
#

Oh I see

chrome bay
#

But in my testing, that seems to have been fixed

viscid tapir
#

Looks like okay for me too

viscid tapir
chrome bay
#

So you can access the elements directly

#

e.g.

{
    for (const int32 Idx : ChangedIndices)
    {
        const FInventoryEntry& Entry = Inventory[Idx];
    }
}```
woven basin
#

Super awesome resource.

viscid tapir
austere halo
#

Guys I'm running into a problem and I wonder if anyone could point me in the right direction? =/ I have a listen server which on BeginPlay spawns a few characters (turn based tactical combat game), then places these characters in a list ordered by their turn priority, and then sends a multicast to tell all clients about this list. The thing is that when I send the RPC, the references to the characters on the client side come through empty. I assume this is because the characters haven't actually spawned yet on the client (despite them being replicated), and the RPC is arriving before that happens? I'm just wondering if there's an elegant solution to this?

chrome bay
#

They're never called Server-Side

#

Same for the per-element calls

viscid tapir
#

Oh I see, so replication is like periodic if i remember well (checking every frame which property to send, etc)

chrome bay
#

yeah. Usually all the changes to the fast array are received at once

viscid tapir
#

Ok thanks !

#

Because i have a function that gives 3 cards, a simple for loop that calls AddCard() 3x times and sometimes I just add a simple card.

#

in both scenarios, i should be able to handle the changes

rocky kestrel
#

This is my "Melee attack". It works fine when playing on dedicated server as client but problem is it doesn't work when playing offline/solo.

#

that switch has authority is problem I think but if I connect "authority" then it play like two times when playing client. i mean that sound play 2 times row.

chrome bay
# viscid tapir in both scenarios, i should be able to handle the changes

i.e. the difference btw, this is literally how it's called - so directly afterwards. So it doesn't really matter if you use the per-item or serializer callback, but serializer is just more convenient at times

    {
        Items[idx].PostReplicatedChange(ArraySerializer);
    }
    ArraySerializer.PostReplicatedChange(ChangedIndices, FinalSize);```
viscid tapir
unique cloak
#

how?

#

I just forgot that I cant replicate a uobject

#

I understand how to replicate stuff and what it does

#

I just have a problem with replicating the data.

#

And making an array of UObjects is not a good idea

#

because I need to replicate what is inside the object

viscid tapir
unique cloak
#

so what do you think I should do?

chrome bay
#

Move the data somewhere where it can be replicated. Have clients spawn objects that the list view can look at locally.

#

Don't replicate the objects themselves, that'd be ridiculous

quasi delta
#

Hello friends. I have a problem in a multiplayer project. As in the video, I created a function like repnotify and there is a destroy command in that function. The actor is fully replicated. What I want to do is make the severed head disappear. It works on the server, but the client does not. What would be the reason.

chrome bay
#

I wrote a ListView specialisation that uses FNames as keys instead of objects, so it can be used to index into an array of structs and it still works with BP/UMG. The UMG list view only supporting UObject is pretty dumb IMO

#

There's something hideously ironic about it being a performance-oriented widget, which then needs a UObject created for every entry.

lucid wren
#

Hi, I need a tutorial for possessing pawn in multiplayer

unique cloak
#

that contains the data if want to see it on the list view

viscid tapir
#

The server still does not broadcast the delegate

void FCardContainer::PostReplicatedChange(const TArrayView<int32>& ChangedIndices, int32 FinalSize)
{
  for (int32 i = 0; i < ChangedIndices.Num(); i++) {
  int32 Index = ChangedIndices[i];
  BookOwner->OnBookUpdated.Broadcast(Items[Index].Card.CardRowName, Index);
}```
chrome bay
#

You cannot replicate the objects, so you have no choice but to move it somewhere else

chrome bay
#

If you want the Server to do it, call it manually when you change/add the item

viscid tapir
#

The server actually calls the function but the changes are only made in the clients HUD

chrome bay
#

They are only called when replication data is recieved

viscid tapir
#

like an OnRep

chrome bay
#

yep

unique cloak
chrome bay
#

yes

unique cloak
#

ok thanks I will try that

rose egret
#

anyone knows how is order and deserialization of OnRep_ and netmulticast RPC on client ?
thats what I get from the follwing code.

//this is what I get on client
//bIsOpen is updated to new value
//CastOpen_Implementation is called (both bIsOpen and bNewState have same value )
//OnRep_IsOpen is called then
    UPROPERTY(ReplicatedUsing=OnRep_IsOpen)
    bool bIsOpen;
    UFUNCTION(NetMulticast, Unreliable)
    void CastOpen(bool bOpen);
    void CastOpen_Implementation(bool bNewState)
    {
        bIsOpen = bNewState;
    }
#

this is very annoying cause I need to do different things if its initial replication

#

if they just became net relevent, I dont want to play sound or ...

#

thats why im using OnRep_ and NetMuticast at the same time

chrome bay
#

You can do that a much easier way

#
{
    const bool bIsOpenChannelPacket = GetWorld()->TimeSince(CreationTime) == 0.f;
}```
#

The order between RPC's and properties is undefined and varies depending on RPC type as well. Generally it's not something you can rely on

thin stratus
#

Is there a pretty way to replicate State Data that is specific to a state as well as State Data that is "general"?
I currently have a system with one Struct, lots of Data and a really ugly OnRep. That OnRep handles a lot of "From -> To" State stuff.
I now changed it to be a UObject per State, (instead of an Enum), so I can easier make new States and ensure the specific logic of each state can be handled in Enter/Exit.
A lot cleaner. However I still have general data that is not specific to a State. Like who touched the actor the last time or some timestamps.
Those are important when the state changes (and replicates), so I need them replicated when the State change (UObject pointer) replicates. I guess I can't just replicate them as individual properties.

I assume I would still need the Struct, but have the general data and a pointer to the current UObject State in there, or is there something prettier?

lucid wren
#

how to call event from server to clients?

#

in blueprint

quartz iris
#

How can I reference the only other player in the lobby so I can show their name inside text? This will be used for the end screen to show who won

icy jetty
#

Do you have a variable that stores the name?

viscid tapir
#

The GetOwner->HasAuthority()) is useless since the function is only called by server right ? It will always return true ?

if (GetOwner()->HasAuthority()) {
    if (APawn* MyPawn = Cast<APawn>(GetOwner())) {
        if (MyPawn->IsLocallyControlled()) {
            OnBookUpdated.Broadcast(Book.Items[Slot].Card.CardRowName, Slot);
        }
    }
}```
#

@chrome bay Btw finally got it working !

void FCardContainer::PostReplicatedChange(const TArrayView<int32>& ChangedIndices, int32 FinalSize)
{
    if (ChangedIndices.IsEmpty()) {
        return;
    }
    if (APawn* MyPawn = Cast<APawn>(BookOwner->GetOwner())) {
        if (MyPawn->IsLocallyControlled()) {
            for (int32 i = 0; i < ChangedIndices.Num(); i++) {
                int32 Index = ChangedIndices[i];
                BookOwner->OnBookUpdated.Broadcast(Items[Index].Card.CardRowName, Index);
            }
        }
    }
}```
And in the AddCard() : 

Book.Items[Slot].Card = TempCard;
Book.MarkItemDirty(Book.Items[Slot]);
if (APawn
MyPawn = Cast<APawn>(GetOwner())) {
if (MyPawn->IsLocallyControlled()) {
OnBookUpdated.Broadcast(Book.Items[Slot].Card.CardRowName, Slot);
}
}```

rotund timber
#

Hi All, I've encountered lately an issue when using Blueprints RPC/Multicast - as soon as you introduce lag/latency to the game, it all goes to sh** and get rubber banding like crazy

#

is there a way around that - or only option is to use C++ and use Custom CharacterMovementComponent in order to use the built-in client predictions stuff?

unkempt tiger
#

If I want to add a basic text chat system, how do I do it the right way?

#

Does it amount to just same old RTPCs in whatever-class-that-works (like a player state) or should there be more to it?

unkempt tiger
quartz iris
#

Like how do I get the reference of the other player in the lobby

#

and display it proplery on a widget string/text?

outer sphinx
#

hello guys all right? I have a question. I wanted to make a Bolean type variable update only in the client that needs it and not in all the clients, for that I created this function that I leave in the image. The question is: is what I did correct or is it the most optimal? Thank you so much

dark parcel
#

Hey guys, I am trying to replicate Dynamic Combat System. So I got the character to replicate movement and draw weapon. However if the player switch to combat stance before someone join. The person that join later doesn't see the changes ( Other player still in non Combat stance ). How can I update the state of the game when a person join?

icy jetty
#

Sounds like you need onRepNotify

dark parcel
#

The variable is in sync with connected clients. The problem comes when a new player Connect the game, after the draw weapon is done

icy jetty
#

Yep, you need to notify the new client that the variable has changed.

#

Else, itโ€™ll go with the default

dark parcel
#

Thanks for the help, can I get a bit of guidance >_>

#

Suppose there are 2 players, one of them changed the variable. How can the newly connected client knows the specific actor that have changed it's value?

#

I post the video to illustrate the problem

glossy kettle
#

just replicate bHasDrawnAnimeWeapon

quasi tide
#

They already told you. OnRepNotify

glossy kettle
#

send the bunch -> recv the bunch -> profit

#

(some steps redacted)

quasi tide
#

Read the pinned posts to learn the basics of networking in Unreal.

dark parcel
#

I am still learning the basic, I think I got the concept wrong. Making the variable replicate should keep the value of the variable.
Perhaps my problem is I didn't have component replicate checked

#

gonna see if that fix the issue.

quasi tide
#

For the third time, use OnRepNotify. The variable needs to be an OnRep variable.

#

You will run into future issues with state management if you are not using OnReps

dark parcel
#

Got it, thanks

quasi tide
#

Again, go through the pinned posts.

glossy kettle
glad bramble
#

Hi! I'm testing the Lyra Starter Game project and trying to join to a LAN session, the game find correctly the session I previously create in another PC but every time I tried to join to that session, it fails...Does anyone have the same problem?? I've tried playing the game from the editor and from a development build and get the same results.

quartz iris
icy jetty
#

I think first you need to have a way to store said playerโ€™s name. Like a text box or something that stores the input as a string, so that you can grab that controller and its copy of the variable

unique cloak
# chrome bay yes

So the only thing I changed is to move the UStruct declaration to the game state.

#

Can I replicate the struct variable in the UObject?

#

no I also need to change the place of the variable

#

and replicate it in another place

#

but what about the UObject?

#

I need to add item with data in it.

storm zinc
#

So I'm having an issue in this gamemode now. It seems that when I added this stuff, the PreLogin all gets called, but none of the OnPostLogin is getting called, do I have to add in some kind of call for that somewhere in the C++ so it continues or?

#

going to throw some other debug messages in to see if I can catch where it's breaking.

#

I bet you the network id I am grabbing on the C++ end is not the same as the one from the blueprint...

#

yea.....

[2023.05.04-06.03.53:850][439]LogBlueprintUserMessages: DESKTOP-SDE8QNO-C8057D284D5169947F8C19867A8D73EE
[2023.05.04-06.03.53:850][439]LogBlueprintUserMessages: DESKTOP-SDE8QNO-C805
#

so that has to be fixed somehow ...

fossil spoke
#

@storm zinc Did you forget to call the Super implementation when you overrode PreLogin?

#

Show your code for your PreLogin function

storm zinc
#
void ACustomGameMode511::PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)
{
    Super::PreLogin(Options, Address, UniqueId, ErrorMessage);

    FString playerToken = UGameplayStatics::ParseOption(Options, TEXT("Token"));
    if (playerToken.IsEmpty())
    {
        ErrorMessage = TEXT("Player Token not found");
    }

    OnClientAuthCaptured(UniqueId->ToString(), playerToken);
    UE_LOG(LogTemp, Display, TEXT("The Client's Token is %s"), *playerToken);

}
#

I think it's working but...

#

that UniqueId->ToString() is giving me some serialized data at the end, that i'm not sure how to get that in the blueprint...

fossil spoke
#

You mean this C8057D284D5169947F8C19867A8D73EE?

storm zinc
#

ya, after the C805

#

the bottom row is the one from the..

#

which is just a default one.

#

But that PlayerState doesn't seem to have any 'get unique id'

storm zinc
#

it isn't a real player state object, it's just a default class (built-in)

fossil spoke
#

Huh?

storm zinc
#

it doesn't have an actual blueprint assigned to it

#

it's just the unreal default association

fossil spoke
#

Thats fine

#

The UniqueNetId wont just be the Player name.

#

It all depends on what OnlineSubsystem is being used as to how the UniqueNetId will look

storm zinc
#

ya, the value that is coming back is the pc name, I have steam turned off.

fossil spoke
#

If you were running Steam, it would be your SteamId

#

If you were using EOS it would be some EOS based Id.

storm zinc
#

mm

#

So do you know of any way to pull the controllers unique id from blueprint?

#

like with that extra serialized data, or would that be the replicated part being added.

#

however the engine identifies the unique player should they have the same 'name' assigned in the Name=""

#

when you open a level

#

I assume that's what it does, uuid type of thing for 'randomness'

fossil spoke
#

Dont get caught up in all that. Just accept the fact that the UniqueNetId is a unique identifier.

#

What version of Unreal are you using?

storm zinc
#

right, that I can handle. But the ToString() of that value has the extra characters, that the 'name' of the player does not have. And I don't see any way to get it.

#

It's Unreal 5.1.1

fossil spoke
storm zinc
#

ahhh

fossil spoke
#

The entire string is the UniqueNetId

#

The fact that it contains the name of the Player is neither here nor there.

#

Dont rely on that

storm zinc
#

right

fossil spoke
#

Rely on that the entire thing is unique

#

UE5 might have an exposed UniqueNetId via the PlayerState

#

But I doubt it.

#

You would likely have to expose it yourself

storm zinc
#

mm ya I don't see one, even without context sensitivity on

fossil spoke
#

In the same way you exposed that Event in the GameMode

storm zinc
#

ya that's what I was afraid of LOL

fossil spoke
#

You will probably have to override the PlayerState in C++

#

Or alternatively, create a Function Library

#

That might be easier for you?

thin stratus
#

UE exposed it to BPs via FUniqueNetIdRepl but it's not exposed by default

storm zinc
#

hm

fossil spoke
#

Im on 4.27 so not really sure what 5 exposes or not

thin stratus
#

The go to way is to either have a PlayerState CPP class that exposes it or to write a simple static function in a CPP function library

storm zinc
#

So would I be just writing my own player state in cpp?

#

ahh ok

fossil spoke
#

The easiest approach would be for you to create a Blueprint function library (which is a C++ class) and create a function which takes in a PlayerState and returns the UniqueNetId

storm zinc
#

this is like 200% more C++ than I was hoping I'd have to write HAHAHA

fossil spoke
#

That way you dont have to override the PS and do Casts everywhere

thin stratus
#

Multiplayer will require CPP one way or another

storm zinc
#

:/

fossil spoke
#

If you want to do anything of any complexity

storm zinc
#

ya, I mean, the way this thing is doing is meant for Sessions.

fossil spoke
#

Blueprint only MP is not going to allow you to do much outside of the basics.

storm zinc
#

Which I can't use.

thin stratus
#

Just a matter of time until a given user hits a wall with blueprints. For you it's the unique net Id then

storm zinc
#

for now LOL

#

wait till I have to work on saving the player data

#

ugh

fossil spoke
#

You are already in C++ land anyway already, so why stop now ๐Ÿ˜›

storm zinc
#

oh god

#

I haven't even written the event system and I am starting to regret it HAHA

#

I didn't understand that a dedicated server is one map either.

fossil spoke
#

You wont regret learning C++

storm zinc
#

I thought that your server would run and people could load maps and the server would load the map for that user.

fossil spoke
#

Unreal has always been one server one map.

storm zinc
#

So I am assuming that at some point, if a user say interacts with a portal. The server gets an event fired that triggers a 'load player into a map' but transfers them to a server in some way so it can handle multiple maps / instances

fossil spoke
#

In order for one Player to have a different map, they would have to either be sent to another server that has that map, or load that map themselves as their own session.

#

Depending if you are doing Dedicated or Listen Servers.

storm zinc
#

gotcha

#

for now, I think we're going to just make the 'event' far far away from the rest of the server area. lol

#

give it its own skybox.

#

be done.

#

And that game looks pretty slick DevilsD

#

the ship combat looks pretty smooth.

#

When you do something like that, do you have like... one server that flips maps and just has like 'lobby mode' and then the server loads a map and players connect w hen it's loaded?

fossil spoke
#

Do something like what?

storm zinc
#

With a FPS type of a game

#

like the one you have on your studio with the space combat

fossil spoke
#

The FPS Levels are streaming levels inside the Ship combat levels

storm zinc
#

ahhhh

#

one of the other guys is making a 'train' is a level with one of the new features.

#

he thinks it will work, but I told him I don't know...

#

This train goes around the world in real time, and he wants them to 'port to the level streaming portion' that moves around...

#

but I assume it's still going to affect multiplayer because now you're updating like X number of peoples positions in the world

#

he thought about doing like some camera with texture projections to a remote train area away from other people so they would not be 'loaded' in the same area as they move around... But

#

that way people inside the train would see the outside world as it went around

#

kind of like how a minimap would work in a way

lucid wren
#

How to implement change pawn possession in multiplayer?

fossil spoke
lucid wren
#

I did this blueprint to make the player going on boat, it works in local, it works on host, but not on client

#

on client the camera change correctly, but no visibility change happens and inputs doesn't works anymore

slate basin
#

Hey, if I call a client RPC and pass a pointer to a replicated actor, but that has not yet been replicated to the client, it will call the RPC with a nullptr, is there a way to wait for the object to be replicated before the RPC is executed on the client?

fossil spoke
#

@lucid wren Possessing a Pawn can only be handled by the Server.

#

See these Icons.

#

That indicates that only the Server will execute those

lucid wren
#

so, how can I handle it?

#

May I need to create an rpc from server to client. where is an example?

#

I'm reading this

#

how to create that rpcs?

#

mine are different from yours

storm zinc
#

So these are the two things in the playerstate.h for UE5:

    /** Gets the literal value of UniqueId. */
    const FUniqueNetIdRepl& GetUniqueId() const
    {
        return UniqueId;
    }

    /** Gets the online unique id for a player. If a player is logged in this will be consistent across all clients and servers. */
    UFUNCTION(BlueprintCallable, Category = "PlayerState", meta = (DisplayName = "Get Unique Net Id"))
    FUniqueNetIdRepl BP_GetUniqueId() const;

I am assuming that the UFUNCTION one is the blueprint one that I can see by default, while the other one is the one that is what I want.

#

So perhaps just adding a UFUNCTION thing in there, and putting a different name on it may work?

fossil spoke
#

You need to create a new PlayerState child class though

#

Dont change the Engine Source code

storm zinc
#

ya.

#

So I did this

#
    UFUNCTION(BlueprintCallable, Category = "PlayerState", meta = (DisplayName = "Get Literal Unique Net Id"))
    FUniqueNetIdRepl& GetLiteralUniqueId();
#

And then I have this in cpp:
const FUniqueNetIdRepl LiteralUniqueId;

FUniqueNetIdRepl& APT_PlayerState::GetLiteralUniqueId()
{
    return LiteralUniqueId;
}
#

I am assuming in the constructor I have to somehow assign it maybe?

fossil spoke
#

No you likely want to return it as a string, since your function in the GameMode is passing it out as a string as well

#

Im guessing you want to use it in conjunction with that?

#

To compare?

storm zinc
#

ya just doing a compare to match it up with what was received in the PreLogin part.

#

So right now it looks like this:

#include "PT_PlayerState.h"
#include "GameFramework/PlayerState.h"
#include "GameFramework/OnlineReplStructs.h"

const FUniqueNetIdRepl LiteralUniqueId;

// Sets default values
APT_PlayerState::APT_PlayerState() : Super(ObjectInitializer)
{
    
}

FUniqueNetIdRepl& APT_PlayerState::GetLiteralUniqueId()
{
    return LiteralUniqueId->ToString();
}
#

Not sure if that super thing needs to be there

fossil spoke
#

Why are you adding LiteralUniqueId?

#

Also you cant just return it as a string if the function is expecting you to return a different type

storm zinc
#

I thought that it would get mistaken for the one that exists, and isn't the one that I want

fossil spoke
#

You dont need to make a new one.

storm zinc
#

OOOH right it has to be FString

fossil spoke
#

Just call the function

storm zinc
#

ahh k

fossil spoke
#

return GetUniqueId().ToString();

#

I have to go, someone else maybe able to help you if you get stuck.

#

Good luck.

storm zinc
#

ok ๐Ÿ™‚
ty so much for your help ๐Ÿ˜„

lucid wren
#

I have to create an rpc client to server and call it for Possess?

#

can rpc inputs params have controller object ref?

#

help pls

#

the visibility problem is fixed now

#

but inputs still not working on client

storm zinc
#

Pro-Tip, when you have the UE PlayerState.h file open in VS. Don't Build with it open, because it will select that project and rebuild UE5 LOLOL I caught it afterwards, hasn't completed, now I have to wait for the engine to compile again... then finish my playerstate HAHA

#

sigh

#

thank god for 16 cores I guess

lucid wren
# lucid wren help pls

it's strange... inputs are recognized, but the boat doesn't move it seems that it's trying to go forwards but gets pushed backwards on next frame

whole axle
#

Hello, someone can help me with the replication in all clients?

#

I dont understand the Server,NetMulticas,Reliable flags in UFunction

rose egret
# chrome bay The order between RPC's and properties is undefined and varies depending on RPC ...

afaik that doesn't work if actor is loaded from file and bNetLoadClient=true.
btw GetGameTimeSinceCreation() == 0 made some problems for me I don't remember well but it gave wrong result at level load time. Actor.CreationTime was 0 but MyWorld->GetTimeSeconds() was higher . I finally wrote the following :

bool TDUtils::IsInitialReplication(AActor* actor)
{
    if(!actor->HasActorBegunPlay() || actor->GetGameTimeSinceCreation() < 0.1)
        return true;
    return false;
}```
I finally added a new  replicated property bIsOpenChangedRecently. this way client will be aware if the property changed recently.  it seems there wasn't any other way for me.
lucid wren
whole axle
lucid wren
#

I'm new in UE too, so i don't know much. i'm strunggling with multiplayer things ahha

whole axle
#

I have this with server reliable, playing with 2 player as Clients but dosent move, should move right?

lucid wren
unique cloak
queen escarp
#

how would this become 50

#

if playerstat is preset to "500" default hp

#

and item stats input is set to 50

lucid wren
#

is it better to replicate variable or rpc to server for sending inputs to server?

thin stratus
#

You can't replicate variables to the server

fossil spoke
thin stratus
#

So that option doesn't even exist

fossil spoke
#

So your only option for sending information to the Server is via an RPC

lucid wren
#

this is working!! finally my boats can move even on clients

cosmic yoke
#

hello when i spawn actors on the server i use SetActorLabel and Rename to give them different names but the client doesn't receive the new name, what can i do to replicate that?

whole axle
#

Is too hard to replicate playing as client, works as lisent server but not at client

cosmic yoke
#

what do you mean?

whole axle
#

I cant replicate the movement of a Elevator playing in client, i dont know how to do it

#

If i put the property server dosent work, if i put the property netmulticast only works where i activate the button to trigger the elevator movemetn

scenic turtle
#

Hi all, currently having a bit of issue with this one, Server spawns the users, logic runs fine in editor even running a separate server instance. I get that vale, but when I run it on a live server. There is no value

#

I am guessing it might be something to do with the Unpossess event since that gets unpossessed server side?.. Not sure

fathom aspen
#

Side note: Server RPC is needles as OnUnpossess is server only

#

Unless you have a meaningful use for it somewhere else and you're just calling it here

scenic turtle
#

Right, thanks WizardCell, I want to send the User Id on OnUnpssess which is in the PC and in editor it seems to get through, but as I mentioned on the live server not. Should I store this User Id on the Pawn perhaps?

young kiln
#

Hello everybody!! I have a dumb question realted to the replication graph. When I launch a client from the editor, I can use all the Net.RepGraph.* commands the Replication Graph has. But when I launch a local server, and then I connect to it with a client, I cannot use them. I'm sure I'm missing something obvious here, but I can't find it.
So, do you know how to use RepGraph debug commands from a client?
Thank you very much!

fathom aspen
#

I think you need to run EnableCheats command first to enable the CheatManager on client

young kiln
dark parcel
#

I just noticed replicating movement and predicting isn't an easy task for someone with no knowledge of C++

#

time to grab Udemy Tutorial and learn from the ground up.....

#

Youtube Multiplayer Bp tutorials can only get soo far ๐Ÿ˜ฆ

rose egret
#

@young kiln if those debugs cmds are console variables , then u r just chanaging them on client.
use 'ServerExec Net.xxx value' to run them on server

forest bolt
#

Does anyone know if the player's platform is replicated somewhere?

#

Or is it only possible by calling GetPlatform on the client?

lucid wren
#

every oncomponentbeginoverlap happens server side?

young kiln
quasi tide
lucid wren
#

Spawn Actor has to be made server only or for all?

quasi tide
#

Try it and see what happens

lucid wren
#

server only spawn on everybody, client only spawn on client only.

quasi tide
#

Then you need to go through the pinned posts and learn the foundations of networking inside of Unreal.

#

Cedric's network compendium is pretty much where everyone starts these days.

lucid wren
#

it works!

#

finally i finished the blueprint of my boat to be possessed and unpossessed by players in multiplayer env

slate basin
violet trench
#

Can you make multiplayer in bluprints not even looking at C++?

slate basin
#

yeah

#

depends on what though, if you want to use something like the gameplay ability system, you'll need a bit of c++ to set it up still I think

whole axle
#

I have this with server reliable, playing with 2 player as Clients but dosent move, should move right?

slate basin
#

hey, does anyone have any idea why net.DelayUnmappedRPCs is not reliable? seems to fix the issue of pointers being null in reliable RPC calls when the actor that it points to has not yet replicated
however, with around 400 ping, and 10% pktloss, it just seems to call it nullptr

cobalt notch
#

How to do this in Multiplayer?! Is there a "Play Sequence By Int" or some way to seed this?

red vine
#

I keep getting No owning connection for actor The actor is there on map load, it has these settings.
If I fire a function as client with a keybind, it says it won't process the server function.

#

In my head I believe it spawns once on server, and when a client joins, then it's replicated to them as well so there is 1 per client and 1 on server. how is the server actor not the owner of the client ones?

icy jetty
red vine
#

if it's doing net load on client aren't those actors on the clients owned by the server actor?

thin stratus
#

No Owning Connection means you are calling a Client or ServerRPC on a non-Client owned Actor, or not?

thin stratus
red vine
thin stratus
#

I don't quite follow what your goal is here

#

The Actor is owned by the Server if you don't set a Client as Owner

red vine
#

I'm making a BP_VehicleRequestManager

#

it's a single bp

#

it's loaded on the map

#

and anyone who joins the game should have a client version of it... hopefully

thin stratus
#

Sure, and ?

red vine
#

they can hit a key that's set, and then call a server event (reliable)

#

the server spawns a vehicle that belongs to that requesting player

thin stratus
#

Server RPC on non Client owned Actors don't work

red vine
#

spawning the vehicle and leading up to the event of requesting the vehicle from server is fine

#

ok

#

so how do i make the actor owned by the server?

#

so that clients can rpc using it

thin stratus
#

That's not how that works

#

A given Client has to own it

#

To do an RPC

cobalt notch
red vine
#

the goal was to have these bp managers be things I can plug and play in any multiplayer level

#

so in order to have that kind of communication it could only be done through gamestate/PC/Char?

thin stratus
#

PC/Char/PlayerState

#

You can't ServerRPC in Actors if the aren't owned by the Client that wants to do the RPC

red vine
#

sorry I'm really getting hung up on the net load on client thing then I'm struggling a bit.
So net load on client. The server owns the actor.
but when it replicates to clients. Those clients don't own the actors replicated to them?

thin stratus
#

NetLoadOnClient has nothing to do with ownership

#

Only one Player/Server can own an Actor at a given time

#

Ownership is a property of replication

#

You can provide an owner when spawning replicated Actors on the Server or set them afterwards with SetOwner, but still requires the Actor. And again only ONE Player can own an Actor at a time

#

An Actor in the Level is by default owned by no one. Which is basically similar to it being owned by the Server.

thin stratus
#

It might just be called a bit strange

#

Try "On int" or so when searching

thin stratus
red vine
#

Thank you, yesss I used that alot with the GS/GM/PC/PS/Char replication stuff which I luckily had no problems with when it came to replication.
But I'm definitely failing to understand actor ownership. I'll definitely look into that. thanks again!

unique cloak
#

can someone help me?

#

so

#

AddItem function of the list view requires a UObject with a data to add to the list view but the problem is that the data needs to be in the UObject but I cant replicate it, so I made a struct that contains he data in the GameState and tried to reference it in the UObject but it still wont work because I cant replicate the UObject and I have to use it because of AddItem.
Does anyone have an idea about how to fix that, I am struggling with this for days, Thanks!

#

if you need to see something from my code to help me, just tell me what and I will send it. I really need that help

scenic turtle
#

Hey all, running an event from the exiting player controller OnLogout from the Game Mode, fails to run.. I guess something to do with the controller already destroyed.
I want to get the custom ID of the exiting controller into an array on the server which removes this Id in the end, but i am getting an empty variable instead. Any advice on how to do this? Thanks

kindred widget
# whole axle I have this with server reliable, playing with 2 player as Clients but dosent mo...

If this is a Server RPC, then no, it shouldn't work. You can only trigger a ServerRPC through a client owned actor, which means something that the PlayerController owns. As they're unlikely to own the elevator, you need to make the RPC through something the player owns. Like their PlayerController or Pawn. Usually you can do this by RPCing some generic stuff or a pointer through the controller or pawn and then call an interface function on what you want to use.

icy jetty
# scenic turtle Hey all, running an event from the exiting player controller OnLogout from the G...

๐Ÿง‘๐Ÿปโ€๐Ÿš€Support us on our ๐Ÿ’ฒPatreon for awesome benefits: https://www.patreon.com/kekdot

In this video we start working on a nice base setup for multiplayer projects. We go over how players connect and disconnect and how we can have an overview of the connected players in our session by storing a reference of them in our Game Mode once the OnPostLog...

โ–ถ Play video
nocturne quail
#

doing this on Game Mode and the pickup is spawned in the level but the Pickup mesh is invisible

#

setting replicated for the static mesh works perfectly

#

the actual actor is set to replicated true

#

actors basically replicates sub components, so why the mesh is not replicated?

#

with and without PickupMesh->SetReplicated(true);

#

this red line is draw debug line

meager spade
#

what are you doing @nocturne quail

#

multicast? to spawn a replicated actor?

#

i recommend reading the UE networking basics

nocturne quail
cobalt notch
meager spade
#

you can expose the pins

cobalt notch
meager spade
#

๐Ÿคท

nocturne quail
nocturne quail
cobalt notch
meager spade
#

no it doesnt

nocturne quail
#

the actor is itself replicated

cobalt notch
meager spade
#

like that?

cobalt notch
#

It doesn't work. It just plays one frame and skips to the next one. Hit play and see.

meager spade
#

then you did something wrong

#

i have been using ue for like 6 years, and i know what i am talking about ๐Ÿ˜›

nocturne quail
#

with GM it has problems

cobalt notch
meager spade
#

what is that picture supposed to be

cobalt notch
#

That's using blend poses by int, it's stuttering because it's changing the animation every frame... Plug a random number to see..

meager spade
#

working fine

#

you can't do random int like that

#

that will change every frame

#

that int will change every frame Facepalm

cobalt notch
cobalt notch
meager spade
#

its your logic that is flawed

#

you never stated you are changing the index every frame

#

am i a mind reader?

cobalt notch
icy jetty
#

Thereโ€™s a better way to have this convo, surely

meager spade
#

use a random sequence player

cobalt notch
meager spade
#

little bit of googling and searching can return that

cobalt notch
meager spade
#

it will work in multiplayer

#

just wont be synched :p

cobalt notch
meager spade
#

but most games for idle stuff, they go through the idles in a sequence

#

not randomly, and if you ever played games like CoD, the idle animations are different on each client ๐Ÿ˜›

cobalt notch
#

I'm not making most games.

meager spade
#

like i said, you can not do random, you need to do a seeded random

#

ie, it needs to be determenistic

cobalt notch
#

I already found a couple of solutions.

meager spade
#

as long as there is no rpc's/networking involved, hopefully those solutions work

cobalt notch
#

Can use transitions to branch or select node.. the blend poses and random sequence player do not work for what I'm doing.

#

Your solutions are much weaker / lazier in comparision to these far superior solutions.

meager spade
#

๐Ÿ‘

cobalt notch
#

COD team must be lazy.. I think these modern games are just copying each other.. Playing Redfall feels like Atomic Heart and High on Life.. My game may never get released so I may as well attempt it properly and because I'm a hobbyist and a masochist. ๐Ÿ˜‹

meager spade
#

it's not lazy

#

its the fact, other clients don't really care what idle animation they see

#

so why waste resources/time

cobalt notch
#

You're on the COD team? Redfall has wierd walls of water and then so does Atomic Heart... I do not know how they all got the same idea at the same time.

#

Good point but it's just one int and I have first and third person view with seperate shadow meshes so it gets a bit tricky if I have desyncing. I still have to do that part and will keep this in mind.

kindred widget
cobalt notch
kindred widget
#

How does GAS do that? I haven't looked into that yet. I thought they were using some sort of persistent Cue actor to multicast montages or something.

cobalt notch
#

Oh man I haven't gotten to GAS yet. This sort of thing works for multiplayer. I'm still using random sequence player because it has more options and I may not replicate the idle animations but I have a feeling I'll need this for other stuff because I want to do some of the montage things in the anim bp instead.

cobalt notch
kindred widget
#

I love Lyra for other stuff. I normally deal with UI, and more generic implementations. I rarely venture to the land of animations. I really should cover more ground there some day.

meager spade
#

that above again, will change the animation every frame unless the sequence player does not allow changing, but it will be changing that index every frame

cobalt notch
cobalt notch
kindred widget
#

CommonUI is easy... but maybe that's just because I had to learn it on a broken 4.27 version. ๐Ÿ˜‚

#

IMO if you just get used to the activatable hierarchy, you'll learn CommonUI a lot faster. They handle the automatic input mode switching, the default focus target, and what buttons can be used "Globally"

chrome bay
#

CommonUI just needs a serious amount of hardening.. and ideally splitting the lower level stuff into it's own plugin

cobalt notch
cobalt notch
cobalt notch
#

And if I do that then I may as well use blend poses by int instead of all this.

cobalt notch
# kindred widget IMO if you just get used to the activatable hierarchy, you'll learn CommonUI a l...

I find the lack of Common UI resources to be disturbing. Lyra has a really good implementation but there's a reason why every Lyra Devlog uses the default interface. It's actually not easy to customize. Infact taking this further it's been more a year now and nobody has even made a game in Lyra yet. People are still figuring out how to make really simple changes. It's not easy. I realised they were just doing it to show off / demo new features instead of intending it as an actual template.. People here told me that it's not a proper template at the time but I was being stubborn.

#

Two months wasted down the drain trying to learn Lyra..

kindred widget
#

A year is not really a long enough time for people to be releasing games on it. That's like a third to a quarter of a dev cycle. Except for really small games maybe.

What do you mean by the customization though? The frontend is super easy to customize. And most of the gameplay isn't really CommonUI stuff, that's mostly UIExtensions and CommonGame.

cobalt notch
#

The Common UI is hard to customize and so is the gameplay because you have to do it the Lyra way! Unless you just want to pick some coins doing anything complex is hard and the UI is superhard to customize.. I haven't ever seen anyone do this successfully till today.. not even slight customizations.. everyone's using the default UI even after a year of devving.. look at the Lyra devlogs and see.

kindred widget
#

But which part are you talking about? Frontend or gameplay?

cobalt notch
#

Both.. it's easy to create an experience and add characters but once you get beyond this it all turns difficult.. Mind you there aren't that many steps.. I did get a basic game working. It would be really amazing for someoen who built it themselves to do quick games in it. For me I just want to make one game and I want to understand how it works. I already did a Bp multiplayer template and ditched it for Lyra and now I'm doing C++ mp template which is pretty much Lyra. I wouldn't be doing this if I could actualy understand Lyra. I foudn I had to wait for tutorials for simple things and there aren't many. While it's a lot easier for me to just write things myself.

cobalt notch
kindred widget
#

I mean. Customizing the frontend is super easy. You either edit the base widgets it uses for display, the UserWidgets it pushes to the screen, or the materials used in either of those.

cobalt notch
#

There's many little things like images and all.. it's not that easy as it seems.

#

so many textures and all.. so unnecessary.

#

have to change each one because you can't just copy UI

fossil spoke
#

Guys you are drifting way offtopic here.

quartz iris
#

How can I display the other player in a lobby of 2 on a widget?

cobalt notch
round acorn
#

So my replicated movement just stopped working completely. The client pawn moves on the client's screen but that pawn never moves at all on the other screen(s). I don't think I changed anything that should affect this. E.g. the movement component is still set to replicate movement.

quartz iris
cobalt notch
quartz iris
slate basin
#

Hey guys, quick question, aren't ELifetimeCondition::COND_OwnerOnly and COND_AutonomousOnly meant to the same? i.e if you call SetOwner, won't the actor be an autonomous proxy on the client?
i.e if I have a variable set to COND_AutonomousOnly, it seems to be replicated to all clients, not just the owning client. but when I check the LocalRole, only the owner is Autonomous

dark edge
cobalt notch
quartz iris
cobalt notch
# quartz iris I mean like how do I show the player name of the other player inside the text on...

One way is to store the playernames as variables in the characters then when you grab all the players you can read this and show the mesh. You'll have to setup the rendertarget camera and spawn another mesh unless you want to film the actual characters running around by sticking another camera on them which you can also do. Then you use a postprocess material to hide the rest, which is actually the trickiest part.

fossil spoke
#

Therefore if you only want a variable on the PlayerState to replicate to only its owner, you wouldnt use AutonomousOnly.

cobalt notch
slate basin
fossil spoke
#

Only Pawns and PlayerControllers are ever Autonomous, since they are "Controlled" by the Player.

#

Random Actors cant be autonomous.

#

If you search the code base for ROLE_AutonomousProxy you will notice its mostly restricted to PlayerController

#

There is a function called SetAutonomousProxy in the Actor class.

#

Which is pretty much only called for Pawns during possession.

#

And the PlayerController when it is spawned.

slate basin
fossil spoke
#

Setting the Owner doesnt magically change its role.

slate basin
#

wtf, how has any of stuff been working so far. I always assumed that the role is set by the server when I call SetOwner

fossil spoke
#

Look at what SetOwner is doing

sterile plaza
#

Can you change an actor's role? I've never tried.

opaque pivot
#

is this a correct network basic model?

fossil spoke
fathom aspen
#

Nope, for a few reasons:

  1. GameMode isn't replicated.
  2. Even if it was, not all Actors can do Server RPCs.
  3. And even if they were, not all of them can do them as soon as BeginPlay is called @opaque pivot
#

Tips and tricks article in pins should hopefully make that clear once and for all

nocturne quail
sterile plaza
#

Server

nocturne quail
fathom aspen
#

It's an Actor, like any other, but it's mainly for setting what the game rules are. That's why it exists only on the server

sterile plaza
#

It exists for me to put server only components on.

nocturne quail
fathom aspen
#

I find it rare to need to attach components to it

quasi tide
#

Authaer has been leaning more into the component approach and has been doing components on their game mode

fathom aspen
#

I mean yeah better encapsulation, but I kinda hate it when that encapsulation adds network bandwidth (replicated comps ugh)

hollow eagle
#

GM comps aren't an issue there though

fathom aspen
#

Which is not the case here obviously

hollow eagle
#

GS would be, assuming the components are replicated.

fathom aspen
#

I'm trying to eradicate the ASC from our GS ๐Ÿฅฒ

fossil spoke
#

You put an ASC on the GS?

hollow eagle
#

why does a GS have an ASC on it O.o

fathom aspen
#

Haha yeah literally no idea

hollow eagle
#

oh wait, lyra did a dumb thing like that too

fossil spoke
#

What was the idea behind that?

hollow eagle
#

"hey we need a state machine for game phases, you know what'd be great? abilities for states"

fossil spoke
#

Oh wait, dont tell me thats how they managed their GameStates

#

....

fathom aspen
#

It's used for some kind of a GameplayCue stuff on some other Actor that gets destroyed before their GC gets to run, but well I don't like it that it's on the GS

#

But yeah right Lyra has it for game phases iirc

fossil spoke
#

I liked the idea of the phases when I first looked at Lyra but when I thought more about it, they seemed to overengineered.

hollow eagle
#

that's my feeling as well

#

a simple blueprintable state object would work plenty well

fossil spoke
#

Pretty much everything in Lyra appears to over engineered.

#

But i guess thats what happens when you want a project that can be/do anything

hollow eagle
#

I find that most of lyra actually makes sense for building a specific kind of live service thing. Except for phases.

fathom aspen
#

I mean this works all and well in single-player, but from a multiplayer pov, I hate it. Just adds an extra needless bandwidth, that could be utilized for something else

hollow eagle
#

"iris will fix everything"

#

who cares about bandwidth, iris will fix it ๐Ÿ˜„

fossil spoke
#

Iris will be nice lol

quasi tide
#

3 years from now though

fathom aspen
#

Yeah indeed, just turn on that flag

hollow eagle
#

hey iris did just finally get async asset loading...

#

in ue5-main, not sure if it's in the 5.2 branch

fossil spoke
#

It is experimental though, so dont hate on it to much lol

hollow eagle
#

no iris is great, just unfinished

#

and also not an excuse for wasting bandwidth

fossil spoke
#

Thats what I mean, dont get upset for things it doesnt have yet lol

quasi tide
#

Speaking of Iris - has anyone messed with the new online stuff that got introduced in 5.1 and is supposed to be a replacement for online subsystems?

fossil spoke
#

Whats replacing OSSs?

fathom aspen
#

Online settings they called right? I can barely remember the name ugh...

quasi tide
#

Online Services Plugin

fossil spoke
#

So they are just moving OSSs to plugins?

hollow eagle
#

it's a new api iirc

hollow eagle
#

OSS is old as shit anyway

quasi tide
#

I can't link to the specific spot

#

Just search for Online Services Plugin

fathom aspen
#

Shit they are just replacing everything online-wise

fossil spoke
fathom aspen
#

New system of replicating uobjects too

fossil spoke
#

lol

hollow eagle
#

call one function to add an object instead of having to manually write every object? yes pls

fathom aspen
#

Oh yeah, and you can get pretty much far with it

fossil spoke
#

Is that the AddReplicatedSubObject thing? Ive seen that somewhere recently.

hollow eagle
#

yeah

fathom aspen
#

By the way, can you use both systems at the same time?

hollow eagle
#

Unfortunately I don't think so. You can support both at the same time, but only one will be active per actor iirc

#

you can mix them across different actors

fathom aspen
#

Makes a lot of sense, I see

fossil spoke
#

Simplified delegate binding.

#

Heh

hollow eagle
#

oh yeah, the new thing also allows using a COND_ for replicated subobjects

fossil spoke
#

Thats cool

fathom aspen
#

Totally

quasi tide
#

I still can't wait for the first actual working example of Iris. See what it's all about and all.

fathom aspen
#

Much better than doing that the dirty way inside ReplicateSubobjects

quasi tide
#

The description for it has been awfully vague

fossil spoke
#

I can imagine Iris wont terribly change a lot of the code you write.

fathom aspen
#

I doubt anyone is using it in production

fossil spoke
#

FN might be?

fathom aspen
#

Hobbyist projects at best

hollow eagle
#

The lower level stuff is entirely different but yeah, the UObject level of things doesn't change much unless you want it to.

fathom aspen
fossil spoke
#

Im still stuck in 4.27 so I have to hear it from others as to the cool new things that are coming.

quasi tide
# fossil spoke FN might be?

I doubt it. They only just recently started using Nanite and Lumen, and they were actually pushing those two things quite hard.

hollow eagle
#

I believe they've explicitly said they're not using it yet

#

at least as of a few months ago

fossil spoke
#

You can at least expect FN will be using it first

#

Seems FN is their test bed for everything

#

Finally, be sure to call RemoveReplicatedSubObject whenever you modify or delete a subobject.

hollow eagle
#

it's too new and as of 5.1 was still missing a ton of features. Async asset loading was a big one that just got fixed, another is that push model was basically useless with it despite iris being entirely based on something similar.

fossil spoke
#

That cant be right?

quasi tide
#

Available in 5.1 is the new, experimental replication system named โ€œIris,โ€ which seeks to improve the performance, scalability, and maintainability of the engineโ€™s current replication system.
Like - this is the typical explanation for it wherever you see it. But...what are the stats? How is it supposed to be better in all these regards?

fossil spoke
#

Call RemoveReplicatedSubObject when you modify it?

hollow eagle
#

I think that's a typo

fathom aspen
fossil spoke
#

Yeah but modify?

hollow eagle
#

No, it's a typo. Or they mean if you want to stop its replication.

fossil spoke
#

Has to be a typo

hollow eagle
#

I've used the new system in a few places, you don't call that when you change the object lol

fathom aspen
#

Indeed

fossil spoke
hollow eagle
# quasi tide > Available in 5.1 is the new, experimental replication system named โ€œIris,โ€ whi...

one big part is that the entire thing is push-based. I'm probably getting some stuff wrong but last time I looked into what they're doing they have the concept of "fragments" and you mark individual fragments for modification at which point they replicate. That's the low level system though - UObjects still support checking for changes each network tick but under the hood it's implemented by marking fragments as being modified.
Problem is, I think right now every object gets a single fragment which means the old push model is almost useless since it marks the entire object for modification...

fathom aspen
#

I'm only sad about the ReplicationGraph that is going to be replaced by it, before I got even to touch it

quasi tide
#

I'm more sad about more stuff being slapped on but things aren't being removed

hollow eagle
#

Oh also, a big part of iris is that I believe you can programmatically control relevancy and such much more granularly. I'm guessing per-fragment, but I haven't actually looked into it.

fossil spoke
fossil spoke
quasi tide
quasi tide
fossil spoke
fathom aspen
quasi tide
#

It's not virtual anymore

#

Not in Iris

fathom aspen
#

๐Ÿ˜

quasi tide
#

They're working on removing a lot of the virtual stuff

hollow eagle
#

Well, it is

#

for backwards compat

#

but you can implement a much better version of it without that

quasi tide
#

And I saw that relevancy was one of 'em

fossil spoke
#

But why not just make all functions virtual ๐Ÿ™‚

hollow eagle
quasi tide
#

The "Replication Control" section

fathom aspen
#

Oh right prioritization...

quasi tide
#

sNetRelevantFor() is now managed by Irisโ€™ Filtering API. In an actorโ€™s BeginReplication() function, flags such as bAlwaysRelevant, bNetUseOwnerRelevancy, and bOnlyRelevantToOwner are used to set up these filters. For more information, you can check out NetObjectFilter.h, as well as NetObjectGridFilter.h/.cpp for an example of a more advanced filter.
This section specifically

fathom aspen
#

Seems to me like Adaptive Network Frequency but much more involved

fossil spoke
#

That makes more sense

#

I wonder how much of the work being done on Iris will be relied on by Mass and its potential replication.

#

I havent heard much about Mass and replication recently.

#

Though it is being worked on AFAIK

quasi tide
#

I haven't heard much from MieszkoZ lately to be honest

fossil spoke
quasi tide
#

As do I

#

His participation has noticeably dropped ๐Ÿ˜… (not that I'm complaining or anything)

fossil spoke
#

Guess he is hard at work on Mass Replication ๐Ÿ˜›

fathom aspen
#

If that is the case then I take back my ๐Ÿ˜” face

quasi tide
#

Dunno - his last post in #mass was in Feb

round acorn
#

Anyone know possible reasons why a single array set to replicate could totally disable the replication of the character movement component? When I turn replication off on this array my movement works like normal again.

#

even more weird, when I disconnect this pin the whole thing works again even with that array set to replicate

#

so I added a delay of 3s and the moment that RESIZE node hits? all movement replication is dead

short arrow
#

Thats lot of cpu time

round acorn
storm zinc
#

Question: When I run the game in 'standalone' instead of client/server mode, it runs a server but it automatically connects to the server. How do I prevent that so I could actually 'test it' without having to build the server/clients themselves every time.

#

is it some sort of default map setting where I have to set it to the 'login' map?

#

It is getting very tiresome to have to build both versions and run them everytime I make a change ;s

#

It's like the client/server version doesn't abide by the override array of map -> game modes list you set in the project settings.

short arrow
storm zinc
#

sec

#

project settings:

#

And if I choose standalone it does this:

#

so it's launching a dedicated server

#

but then the editor connects to it on the "login map"

short arrow
#

Are you talking about standalone mode or standalone game?

storm zinc
#

netmode standalone

short arrow
#

Because standalone game will bring up that CLI but it doesn't mean it's the server

#

It will also do that

#

You gotta select standalone mode

#

Idk if that makes sense

storm zinc
#

I did but

#

if I play as client, it tries to auto-connect to the server it launches

#

Then I get cool stuff like this:

#

cause the model isn't attached to a controller LOL

#

If I try to use the menu (which works) to login to the system, it authenticates and everything but doesn't load any further for whatever reason.

#

I am assuming that the 'server' is loaded into the login map and not the normal map at that point

#

and doesn't know how to handle the login request because it's a different gamemode

short arrow
#

Yeah you'll have to connect first and then send the login information to the server

storm zinc
#

ya that doesn't work

short arrow
#

What kind of login is it? Do you have some database or what?

storm zinc
#

ya, so right now I have a login map, and a widget that does uname/pwd. And it goes to an API to authenticate. Returns a session token.

fossil spoke
#

Did you disable Run under one process?

#

Oh wait, you want to use Standalone.

storm zinc
#

well, just to test things but

#

cause I need to test these C++ things

#

but I am having to rebuild client/server everytime I make a change in Visual Studio, and then again in the Engine.

#

it's just taking forever

fossil spoke
#

You shouldnt need to rebuild the engine...

storm zinc
#

no just the developer client/server/editor

#

it takes like 2min to do that

fossil spoke
#

What are you trying to test again?

storm zinc
#

but the constant editor packaging is what i'm trying to avoid

#

I need to be able to see a variable on the player

#

and I can only do that in the editor

#

I want to see what my player state is assigning (if anything)

short arrow
#

what's the API for?

#

we're sort of trying to piece together what you have, and what you're trying to do. It's a little unclear

storm zinc
#

ok so

icy jetty
storm zinc
#

This is the structure that is "Supposed" to be converted from a database back into unreal engine's language:

#

and I need to see what this value is. It is being set on the player controller in the OnPostLogin

#

it's a structure

icy jetty
#

Ah

short arrow
#

naaaah

storm zinc
#

so the only way I can see what is being returned is to do it in the editor

short arrow
#

that stuff is coming in from an API?

storm zinc
#

ya, my own

#

it's a base64 encoded string of the actual structure

#

that I decode on the engine's end when it comes back

short arrow
#

Are you doing this for a learning experience? I don't know everything, but I feel like that's over designed

#

why not make a save file that remembers all of this stuff, and create an API to tell the character what they have locked and unlocked

storm zinc
#

well, the items are from a character customizer

short arrow
#

I don't think it's a good idea to deal with object references this way

storm zinc
#

I could deal with row number (integers) but

#

Ok so...

short arrow
#

xd

storm zinc
#

it's a project for crypto that has 10,000 'dolls' that are wardrobes right

#

depending on what you purchased, you can select from those items on the doll

#

so I have two datatables

#

each one references a particular skeletal mesh, another material

fossil spoke
#

You are sending this as a string in the Options during connection for the Client right?

storm zinc
#

no but the token you send is a reference point to your character's entry in the database, which will return the structure (json object) of all the items.

#

there are \ // ' and such

#

so I had to base64 it

#

it was breaking sql

fossil spoke
#

So the Server receives the token, decodes it into a JSON blob and then does what with it?

#

Why not just print the JSON blob, it is just a string after all.

#

Or you are trying to debug that your lookup is working?

storm zinc
#

ya it's fine to do that, but every time I make a change I have to recompile the editor/client/server in visual studio for the project, then go into unreal engine and package a client/server

fossil spoke
#

Not really sure which part here that you are trying to debug

#

Why do you have to package everytime?

storm zinc
#

because if I run it in a netmode 'play as client' the editor automatically tries to connect to the 'server' it starts

#

it's not running in one process. I looked

fossil spoke
#

You are using Dedicated Servers yes?

storm zinc
#

yes

fossil spoke
#

And you have a Dedicated Server exe?

storm zinc
#

if I compile it in vs yes

fossil spoke
#

You can open a Dedicated Server instance and have the Editor join that

#

At any time