#multiplayer

1 messages · Page 272 of 1

pliant cypress
#

is this correct?

if (SoldierCharacter->IsLocallyControlled())
{
    if (bWeaponEquipped && EquippedWeapon && EquippedWeapon->GetWeaponMesh() && SoldierCharacter->GetFPSMesh())
    {
        LeftHandTransform = EquippedWeapon->GetWeaponMesh()->GetSocketTransform(FName("LeftHandSocket"), ERelativeTransformSpace::RTS_World);
        FVector OutPosition;
        FRotator OutRotation;
        SoldierCharacter->GetFPSMesh()->TransformToBoneSpace(FName("hand_r"), LeftHandTransform.GetLocation(), FRotator::ZeroRotator, OutPosition, OutRotation);
        LeftHandTransform.SetLocation(OutPosition);
        LeftHandTransform.SetRotation(FQuat(OutRotation));
    }
}
else
{
    if (bWeaponEquipped && EquippedWeapon && EquippedWeapon->GetWeaponMesh() && SoldierCharacter->GetFPSMesh())
    {
        LeftHandTransform = EquippedWeapon->GetWeaponMesh()->GetSocketTransform(FName("LeftHandSocket"), ERelativeTransformSpace::RTS_World);
        FVector OutPosition;
        FRotator OutRotation;
        SoldierCharacter->GetFPSMesh()->TransformToBoneSpace(FName("hand_r"), LeftHandTransform.GetLocation(), FRotator::ZeroRotator, OutPosition, OutRotation);
        LeftHandTransform.SetLocation(OutPosition);
        LeftHandTransform.SetRotation(FQuat(OutRotation));
    }
}
#

it worked though

meager spade
#

im confused why you have a bool bWeaponEquipped and EquippedWeapon pointer

#

but yeah

compact flame
#

I have a power system for my game but you select your power in the main menu when your not in a server, whats a good way of relaying to the server what power you selected when you join one?

#

ive tried a lot of things

quasi tide
#

Depends on the game. But keeping the selection in like, the game instance, and then have the server request it generally works fine.

#

So the client stores the id in the game instance. On PostLogin, server version of the player controller does a client RPC to get the id of the selected power.

#

Then the client's PC does an RPC of that value. Then it updates on the server through the normal flow.

#

This process works fine in co op games or non-microtransaction type games.

#

Or simple stuff.

compact flame
#

Sorry to ask this, could you possibly take some pictures as an example? I think I did something similar but I wana see how you do it

quasi tide
#

I can't because I am not at my computer that has Unreal

compact flame
#

Ah

haughty ingot
#

Pretty much every piece of advice someone would offer is some variation of what @quasi tide said

compact flame
#

and it does not work

#

im prob missing something really important

haughty ingot
#

Okay so couple things:

Remember that a player controller generally exists for a local connection, and the server. So there will be two instances of it, both will call BeginPlay.

You have the first half right, you’re storing the information on the game state. But what needs to happen is after a client logs in, the server needs to request the information from the client. There’s some handy functions in GameMode to respond to login and ready events. So the order of events should be:

Some Post Login Function -> ClientRPC (to notify the client they need to send it to the server) -> ServerRPC (to actually send the data back to the server). -> Now the server has the data from the client.

Feel free to give it a try and just send more pictures

compact flame
#

So sould I move some events to the game mode?

quasi tide
#

Can't use Login. Need to use PostLogin. That is when it is safe to call RPCs

haughty ingot
#

I didn’t mean the function name u little pedantic bastard

quasi tide
#

Also - don't store the client's selection in the gamestate. That will get destroyed when connecting to the server.

haughty ingot
#

But yes

#

Honestly I use HandleStartingNewPlayer most of the time

quasi tide
haughty ingot
#

Depends how early the data is needed tho

compact flame
haughty ingot
#

Player state being one IIRC

compact flame
#

Sorry to be asking all these questions but its my first time trying to talk to a server without being in it at first lol, what part/ event should I be putting in the game mode and is the onpostlogin node or the handlestartingnewplayer node better

haughty ingot
#

This is a Discord to ask question, don’t apologize

compact flame
#

Yeah but it takes your time

haughty ingot
#

Look in your game mode class for a function named something akin to HandleStartingNewPlayer

compact flame
#

Yeah I got that

haughty ingot
#

IIRC it gives you the player controller, yes?

compact flame
#

Yes

haughty ingot
#

So make a new reliable client RPC in your player controller

quasi tide
#

Something to note - HandleStartingNewPlayer will be called during RestartPlayer as well (if I recall) and that can be triggered by you calling it as well.

#

It is also called after seamless traveling

#

Where as PostLogin is called only once

compact flame
#

Thats fine I dont reset them I just manually call resetting varuables as this game does not require respawning

haughty ingot
#

Both will probably work for your use case, it just depends on what you’re doing

compact flame
thin stratus
quasi tide
#

HandleStartingNewPlayer gets called after seamlesstravel

haughty ingot
#

Without getting in the weeds there’s a reliable RPC buffer, they will eventually make it through. But you can also clog it

quasi tide
#

PostLogin doesn't

thin stratus
#

Not what I meant.

quasi tide
#

RestartPlayer?

thin stratus
#

HandleStarting... is called for both PostLogin and PostSeamlessTravel.

#

And I think only for those two cases, not for RestartPlayer.

haughty ingot
#

There's some order of arrival as well, but I wanna stay on topic

quasi tide
haughty ingot
quasi tide
#

I'll double check here in a few.

#

Just in a work meeting

haughty ingot
thin stratus
#

The main benefit of that node is that it calls for PostSeamlessTravel. Most peeps do stuff on PostLogin and then, when they need to use SeamlessTravel, their code falls apart.

haughty ingot
#

That's not what we want

#

We only care to execute on the owning client

compact flame
#

It says that when I put it on mutlicast

quasi tide
#

Yeah - don't

haughty ingot
#

Right, we don't want a multicast

compact flame
#

Ah

quasi tide
#

You want to select "Client"

haughty ingot
quasi tide
compact flame
haughty ingot
#

-_-

thin stratus
#

Looked at the pictures Tommy sent before. There is a whole lot of wrong knowledge to fix. Good luck!

compact flame
#

oh boy

quasi tide
haughty ingot
thin stratus
#

Given the pictures, they have either not read the Compendium or haven't read it often enough.

compact flame
#

thats what its on

thin stratus
#

Both cases mean I already solved their problems by writing it in the first place.

haughty ingot
compact flame
#

yeah

haughty ingot
#

Take a picture

compact flame
#

oh wait

compact flame
#

run on owning client

haughty ingot
#

There ya go

compact flame
#

lol

#

Im a little slow

haughty ingot
#

That's okay

quasi tide
#

You'll fit right in. Don't worry.

compact flame
#

I saw that

haughty ingot
#

Anyway

compact flame
#

Ur website is very well made

haughty ingot
#

"Made" laughcry

#

So now you have a way to notify the client when the server wants their data.

#

So call this RPC from the game mode in the function we talked about before.

quasi tide
#

Checked - you're right @thin stratus. HandleStartingNewPlayer is what actually calls RestartPlayer. So I had it flipped.

compact flame
quasi tide
#

But PostLogin is still only called once.

haughty ingot
#

There we go

#

So go back to your "Tell Server Stuff on Multi" (it should be called something more like Client_SendXXXDataToServer or something

#

But that's besides the point

haughty ingot
#

So inside that "Tell Server Stuff on Multi", you're executing on the local player of the client that just joined. So you can now get your game instance, and grab the data you want

#

Send another picture when you get there

compact flame
haughty ingot
#

So now make another RPC in the player controller that runs on the server, and that accepts your "AbilityOne" as an input.

compact flame
#

also reliable or no

haughty ingot
#

Sure

compact flame
haughty ingot
#

So, that's pretty much it. Now you transferred data from the client to the server. Now you can send or do whatever you'd like with your RecieveAbilityDataFromClient, but that's on the server. So you could send it back to the game mode, or store it, or whatever. The main idea is now you have successfully asked your client to provide the server with some data. That's pretty much it.

#

I'm sure there's other stuff wrong with the pictures you sent, but this should get you going.

compact flame
#

Alrighty thanks a lot 🙂 I was struggling with this a for a while now now that I have most of it set I should be able to make it tie in, would casting to my character and calling another server event work? through the receive event?

#

Oh ya know what all that event does is call a blueprint interface event through the player state so I could just do that right through here

haughty ingot
#

I think now is the time to go back and really take a good read over some of the netcode documentation that's provided from Epic or third party. As @thin stratus mentioned, he has really nice compendium written up about how data moves around. I don't think me explaining it would do you any justice when these sort of resources already exist.

I think you may be confusing the context of which something is called from and then executed on. Because there are multiple instances of replicated objects, there isn't one game process that's running. Each individual connection is their own process, and the server's authoritative game is then replicated down to the clients, so the Server has an instance of a connections ACharacter, the server could also have an instance of their own ACharacter if it's running as a listen server. The point is that there is many different ways for things to get lost.

https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium/

This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.

lament flax
fallen dawn
#

is there a way to have an animation blueprint for a charater that is in first person which is a bit deformed and then since the game is multiplayer, have another animation blueprint for the other players too see the character properly?

fossil spoke
#

Yes?

#

Just have 2 Anim BPs

#

And 2 Skeletal meshes

#

One for the Third Person

#

One for First Person

#

The TP SKM would just be the Character Mesh Component native to the Character class.

#

You would have to add a second for the FP SKM

#

You would want to set their respective OwnerNoSee and OnlyOwnerSee properties as well.

#

This is a very common setup for First Person games.

fallen dawn
fossil spoke
#

Yes, its a Render setting on the SKMs

fallen dawn
#

Also, is there a way to avoid of having 2 SKM and just have a single SKM one for the player and one for all the other players?

fossil spoke
quasi tide
#

Remember to handle attachments correctly as well

fossil spoke
#

Maybe some FP games that do "True" FP

#

Might use the same SKM

#

But its far easier when you have 2 separate ones.

fallen dawn
#

The way that i was thinking is just have inside the animation blueprint a bool value that does the switching, but how do i actually know which one is the current player and which one is the other player

fallen dawn
fossil spoke
#

"Best" isn't the word I would use. Its common, it works.

fallen dawn
#

I see, thanks

obsidian ermine
#

@fallen dawn You can do a TPS setup (single SKM) and use First Person Rendering

echo pasture
#

anybody know if unreal has a timeout on the server for traveling players on a seamless travel? Or if somebody fails mid travel? Like for example, if someone is just taking forever to connect, or something happens and their game crashes during a travel, will GameMode eventually set NumTravellingPlayers to 0, or naw

karmic briar
#

Not really related to multiplayer but does anyone know if PlayerCameraManager can be used with GameplayCameraComponent?

blazing bear
#

I want a replicated array of bools, is TArray<bool> as fast as it gets?

fossil spoke
blazing bear
#

Like how fast it replicates

#

Honestly the max length the array can get is about 50

fossil spoke
#

They will be removed from the NumTravellingPlayers

fossil spoke
# verbal ice bitmask

This is better, you want to pack your bools into a bitmask, replicate the bitmask instead.

blazing bear
#

I thought of that but I couldn't mark it as a uproperty

#

oh my bad I mean I tried TBitArray

#

Okay then I'll try that, thanks!

verbal ice
#

Could also wrap a TBitArray into a USTRUCT

#

And have a custom net serializer

#

whatever works best for your solution

blazing bear
#

That sounds nice too, I'll keep that in mind

echo pasture
echo pasture
#

so in the game animation sample project, the client player controller is not valid in the Event_Possessed_Client . Anybody know what the issue could be?

pliant cypress
#
void UCombatComponent::EquipWeapon(AWeapon* WeaponToEquip)
{
    if (SoldierCharacter == nullptr || WeaponToEquip == nullptr)
    {
        return;
    }
    
    EquippedWeapon = WeaponToEquip;
    HandleEquip();
    EquippedWeapon->SetOwner(SoldierCharacter);
}

void UCombatComponent::OnRep_EquippedWeapon()
{
    HandleEquip();
}

void UCombatComponent::HandleEquip()
{
    EquippedWeapon->SetWeaponState(EWeaponState::EWS_Equipped);
    if (SoldierCharacter->IsLocallyControlled())
    {
        EquippedWeapon->GetWeaponMesh()->CastShadow = false;
        const USkeletalMeshSocket* HandSocket = SoldierCharacter->GetFPSMesh()->GetSocketByName(FName("RightHandSocket"));
        if (HandSocket)
        {
            HandSocket->AttachActor(EquippedWeapon, SoldierCharacter->GetFPSMesh());
        }
    }
    else
    {
        EquippedWeapon->GetWeaponMesh()->CastShadow = true;
        const USkeletalMeshSocket* HandSocket = SoldierCharacter->GetMesh()->GetSocketByName(FName("RightHandSocket"));
        if (HandSocket)
        {
            HandSocket->AttachActor(EquippedWeapon, SoldierCharacter->GetMesh());
        }
    }
}
#

how can i turn off shadow for local player

thin stratus
#

Is there something in the Engine that would cause runtime spawned components, that are renamed and properly link up between server and client in PIE, to not do that when running the same code in a build?

Kinda confused what the heck is causing the Component to not be net addressable outside the Editor. I can't run the project as Standalone or similar and packaging to test thing takes a long time, so I would much rather understand what the difference is. The only thing I can imagine is that "One Process" causes it to just "know" the Component magically.

sage lance
thin stratus
#

The mesh component can be accessed just fine from the Actor Pointer.

sage lance
#

More details would be cool. So you do something like begin play-> spawn component -> attach component -> set ref ?

thin stratus
#

They are pooled components. The pool is filled initially with a few of them. When a Character gets spawned a component is taken from the pool during PreInitComponents. That taken component is then renamed to a fixed name (CharacterMesh) and registered to that Character. Which in theory should mean it's stable named.

#

If it wasn't, I would have expected it to be crashing in PIE, but there the component survives the RPC.

sage lance
#

So this spawning is happening on the server? Are you replacing the default character skeletal mesh?

#

When does it crash in the standalone

thin stratus
#

So far, setting it to NetAddressable by hand seems to resolve it, which is fair and fine (although the renaming should have taken care of this).
The thing that doesn't make sense yet is why PIE doesn't have that problem.
PIE can def react to NetAddressable being wrong, as I've seen that happen countless of times with wrongly set up runtime meshes and stepping on them with the CMC.

#

When the component gets send to the server for the first time, it's not part of the ObjectToNetReferenceHandle Map yet, so it will be tested for being supported for networking.

#

And in there, it eventually lands in UObjectBaseUtility::IsDefaultSubobject ( cause everything else is false ), and further succeeds cause of ((UObject*)this)->GetArchetype() != GetClass()->GetDefaultObject(false).

The ArcheType of the Component returns the CDO of the Character, which the CDO of the class is the Component of cause. IsDefaultSubobject returns true for any object instanced using a non-CDO archetype.

So somewhere the pooling system is causing the archetype to be set to the Character CDO which is "wrong". And that seems to behave differently in packaged.

quartz star
#

Has anyone ever tried to make something like movement extensions in CMC like Fortnite?

Fortnite takes the custom NetworkMoveData approach but with a system within its CMC subclass to make it more modular: extensions can inject data into our NetworkMoveData and SavedMove subclasses. Some of the lessons have been applied in the design of Mover Plugin, i.e. composable inputs and state, but they are not available in the base CMC provided by UE.

sage lance
dark parcel
#

it doesn't know the server's or other player's controller.

thin stratus
# sage lance So you make the component on the client (from the clients pool) then send it thr...

No. The Character is spawned on the Server and replicated to the Client as normal. The Component is spawned upfront into a pool and then properly registered and assigned in PreInitComponents or whatever the function was.

I think I have it solved by now though. Not 100% sure why it's different between PIE and Build, but the Component is created with the Character's CDO's Component as a template, and that seems to cause it to resolve the Archetype, at least in PIE, the same way as the original Subobject. No clue why that fails in Builds, but we will just mark the Component as NetAddressable from now on, as the Stable Name doesn't seem to wanna work.

echo pasture
obsidian ermine
dark parcel
#

Event possesed is run on server and in your case the rpc follow. There's no guarantee if the controller already replicated to client by the time the RPC is run.,

#

AcknowldgePossession->IsLocallyControlled->Setup Input / camera, no need for RPC at all here tbh.

halcyon ore
#

Feels like i'm doing some somewhat cursed stuff, so curious if theres some weird function.

From an actor component.
Is there any functions for replication beginning/ ending.
But, they provide a controller its happening for?

Seems weird to me.
For client to RPC to the server, when a component is ready, when surely the server can know that, cuz it essentially has to tell the client?

obsidian ermine
halcyon ore
#

I don't care about "knowing"
Just, wish there was a server side version, that had a player controller of the player its being sent to.

Rather then my currently "cursed"
client gets its local PC, then I RPC through the PC, to then RPC to the origional actor component, to finally have the server do stuff.

So, I wasn't sure if a version of that existed, or not.

dark parcel
#

Server already have everyone PC, why does the client have to tell the server it's PC?

From an actor component standpoint, you can just find the PC of the owner by determining the outer.

halcyon ore
#

Cuz the actor component doesn’t have an owner.
But I need to rep only to specific clients.
So I do a cursed RPC loop.

Would just be nice to skip that first client goes back to itself step.

obsidian ermine
#

How are you determining which player?

halcyon ore
#

AC is just on any generic actor.
It’s owner has no relation to what I’m doing.

Which player is determined by getting the clients local controller.

Just wondered if some weird function existed to skip the weird.
Server replicates to a player/ controller, and then has to immediately go the opposite way.
And just server has a function of like “sent component replication to”

obsidian ermine
#

Don't know of anything like that.

#

Client proxy of X Actor or Actor component -> Server proxy of X Actor or Actor component and vice versa.

pliant cypress
#
void UCombatComponent::EquipWeapon(AWeapon* WeaponToEquip)
{
    if (SoldierCharacter == nullptr || WeaponToEquip == nullptr)
    {
        return;
    }
    
    EquippedWeapon = WeaponToEquip;
    HandleEquip();
    EquippedWeapon->SetOwner(SoldierCharacter);
}

void UCombatComponent::OnRep_EquippedWeapon()
{
    HandleEquip();
}

void UCombatComponent::HandleEquip()
{
    EquippedWeapon->SetWeaponState(EWeaponState::EWS_Equipped);
    if (SoldierCharacter->IsLocallyControlled())
    {
        EquippedWeapon->GetWeaponMesh()->CastShadow = false;
        const USkeletalMeshSocket* HandSocket = SoldierCharacter->GetFPSMesh()->GetSocketByName(FName("RightHandSocket"));
        if (HandSocket)
        {
            HandSocket->AttachActor(EquippedWeapon, SoldierCharacter->GetFPSMesh());
        }
    }
    else
    {
        EquippedWeapon->GetWeaponMesh()->CastShadow = true;
        const USkeletalMeshSocket* HandSocket = SoldierCharacter->GetMesh()->GetSocketByName(FName("RightHandSocket"));
        if (HandSocket)
        {
            HandSocket->AttachActor(EquippedWeapon, SoldierCharacter->GetMesh());
        }
    }
}
#
void AWeapon::OnRep_WeaponState()
{
    switch (WeaponState)
    {
    case EWeaponState::EWS_Equipped:
        ShowPickupWidget(false);
        WeaponMesh->SetSimulatePhysics(false);
        WeaponMesh->SetEnableGravity(false);
        AreaSphere->SetCollisionEnabled(ECollisionEnabled::NoCollision);
        WeaponMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision);
        break;
    case EWeaponState::EWS_Dropped:
        if (HasAuthority())
        {
            AreaSphere->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
        }
        WeaponMesh->SetSimulatePhysics(true);
        WeaponMesh->SetEnableGravity(true);
        WeaponMesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
        break;
    }
}

void AWeapon::SetWeaponState(EWeaponState NewState)
{
    WeaponState = NewState;
    switch (WeaponState)
    {
    case EWeaponState::EWS_Initial:
        break;
    case EWeaponState::EWS_Equipped:
        ShowPickupWidget(false);
        WeaponMesh->SetSimulatePhysics(false);
        WeaponMesh->SetEnableGravity(false);
        AreaSphere->SetCollisionEnabled(ECollisionEnabled::NoCollision);
        WeaponMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision);
        break;
    case EWeaponState::EWS_Dropped:
        if (HasAuthority())
        {
            AreaSphere->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
        }
        WeaponMesh->SetSimulatePhysics(true);
        WeaponMesh->SetEnableGravity(true);
        WeaponMesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
        break;
    case EWeaponState::EWS_MAX:
        break;
    default:
        break;
    }
}
#

void AWeapon::OnRep_AttachmentReplication()
{
    // Empty
}
#

it was working fine before, don't know where i messed up

meager spade
#

why would you drop the actual weapon

#

why is weapon dealing with pickup widgets

pliant cypress
#

Rn, that weird Simulated proxy behaviour is my worry

meager spade
#

its nothing to do with HUD class

#

its just odd way to do this, most of the time when you drop a weapon you spawn a pickup actor that represents the weapon, and it doesnt control anything with UI]

#

but you havent even stated the issue

#

video has no context, what am i looking at

#

why are you skipping attachment replication

#

the way i did FPS when i was messing around, was you spawn the thirdperson weapon just locally (never on server)

#

the first person weapon is spawned on the server

pliant cypress
pliant cypress
#

OnRep_AttachmentReplication is overrided and empty so that OnRep_EquipWeapon can EquipWeapon can manage attachment respect to locally controlled but it is not.

karmic briar
#

Showcase of modified Ability System Component switching its prediction system for Network Prediction Plugin. This doesn't change anything in the public API of GAS and its behavior. almost everything is the same with additions (Except Ability Tasks).

Another video with quick setup will be released when the code is released sometime next week if...

▶ Play video
lament flax
#

I forgot, what vars made by the user in a player state subclass are automatically copied over the new player state on travel ?

#

i assume nothing if absolute

neon stone
#

Does UE5 have built in client side prediction?

lament flax
#

for what ?

neon stone
#

For multiplayer games? I dunno what you mean for what.

lament flax
#

you implement the prediction yourself for your custom systems, UE system such as GAS, the CMC or physics already implements some prediction

haughty ingot
neon stone
#

Ok.

#

Sorry.

#

Got it.

#

Another question, for the Steam sockets plugin, do I need to enable anything else to have them work, and must I have anything disabled to ensure it works?

#

I hope I don't come off too green.

lament flax
#

im playing with physics and networking for the first time and i got some sync issues between the server and clients

#

basically im using the vehicule template, where the player character is a vehicule with simulated boxes in a "trunk"
if i move around (either on listen server or client) if i bump around the map some boxes will drop down, but this isnt synchronized between both bodies

#

i know physics replication can be really nasty to do, especially when all clients interact with the same bodies, but here only 1 player is interacting with the bodies

#

can it be that the Vehicule Movement Components dont have any movement prediction like the CMC which cause the vehicle to be at different locations/rotations on each machine, meaning the physic simulation is played differently ?

pliant cypress
dark edge
lament flax
#

yeah

dark edge
#

You probably don't have any replication on the boxes at all

lament flax
#

for example on client i push the boxes down, and on server they are still in the trunk

lament flax
#

not on character

dark edge
lament flax
#

nope, comp in character BP

dark edge
#

show the setup

lament flax
#

uh, i missed the rep bool on some boxes

#

it "works" now

#

but the boxes jitter a lot on the client

dark edge
#

If you make the boxes actors and spawn them at runtime you can make them replicate their movement smoother

#

Make a box actor and play with it, get it to move smoothly on server and client but also always respect what the server says. You can test the corrections by just applying impulses serverside.

Begin Play -> switch has authority -> delay -> some random impulse

Get that to work. For your test rig just have one up in the air in the level so it drops and bounces around

#

On server you should see a drop box, then a bit later yeet in some direction.
On the client you should see the same, but the yeet should come after the server does as a correction.
Fiddle with the physics replication coefficients to make it as loose or as tight as you want. The default settings are VERY strict.

#

And always test with network condition emulation on

lament flax
#

thanks a lot !

haughty ingot
dark edge
#

The most direct inspiration is the old WireMod and ACF servers I used to play on

#

The problem with ACF is it's not much of a "game", if you know what you're doing you can just make arbitrarily powerful vehicles and there's no structure really. It's more of a sandbox.

nova wasp
#

mostly about trying to lift and carry weird objects around

#

for example at first you have rather lightweight boxt objects that are simple to just push

#

but later on you get complex shapes that are delicate or have to be kept upright

#

for example a crate of apples that needs to arrive at the destination with all apples inside the crate

verbal dust
#

why doesnt this work on client for me?

crisp shard
#

unless that is your controller

#

it does say PC, so nvm lol

#

but you are sending a server rpc, and asking about client, so not sure what you're trying to do, but it wouldn't necessarily happen on that client, the client is just sending a server rpc, and the server will whatever that fucntion is doing

crisp shard
# verbal dust oops forgot to add,

i am a tad confused on why you are doing some things... but if you're trying to set the player location, it should work but ngl the get all actors of class, and getting at index 0 setting it , and then using it as a point to get the location / rotation seems unnecessary, but i dont think that would effect the issue

#

do you have mutliple player starts ? or just 1 ?

dark edge
#

in which case you can just call RestartPlayer and it'll do what it did the first time

verbal dust
dark edge
nova wasp
#

curious if GetOwningPlayer is resolving

#

idk if you have to do something special when adding the widget to make that always correctly resolve

dark edge
#

yeah i think its failing early

verbal dust
#

I think its all triggering correctly

#

actually

#

it might be because I've got client authority on movement

dark edge
#

yeah probably

verbal dust
#

so I need to execute on client

dark edge
#

yeah no need to do anything fancy here, just locally execute if that's the case

#

try it

verbal dust
#

yup that works 🤣

verbal dust
dark edge
#

It's just that putting a pawn at a playerstart is kinda GameMode's whole thing

verbal dust
#

yeah I've never really had any idea what its for, I didnt know there were nodes like RestartPlayer available in it

dark edge
#

gamemode is what hands you your pawn to begin with

#

its the boss

verbal dust
#

but i think i just have to destroy the ppawn and possess a new one for that

dark edge
pliant cypress
thin stratus
#

Your OnRep_ filtering for HasAuthority would only make sense if you call the OnRep by hand on the Server.
In C++, OnRep is only called by Clients.

#

Instead of duplicating your switch-case in SetWeaponState and OnRep_WeaponState, you could simply alter SetWeaponState to call OnRep_WeaponState after setting it for example.
Then the HasAuthority would make sense again.

nova wasp
#

(nothing wrong with manually calling an onrep on the server though, that's okay to do)

thin stratus
#

Or, fwiw, if you spawn the weapon locally, but I don't think you do.

thin stratus
#

Do you have the same issues on ListenServer and on Clients or only on one of them or maybe "a" problem but not the same?

#

And when do you call EquipWeapon?

pliant cypress
#

yes, in new code i've placed UE_LOG on both OnRep and Equip.
And it does print FPS MESH indicating attached to FPS MESH but visually, it doesn' instead attaches to TP Mesh

pliant cypress
thin stratus
nova wasp
#

you say you added a log and then say "it printed"

#

this is the part where you have to figure out WHICH ONES actually did WHICH PATH

thin stratus
#

Yeah, that would be helpful to add to the Logs. Also would be nice if you could actually show the logs printing etc.
It's difficult to help like this, cause we can never be certain that you are reading the log results "correctly".

nova wasp
#

it's honestly frustrating there isn't some pinned thing that describes some basic debugging stuff

thin stratus
#

tbh, the Output Log should just not print into one and the same f*cking window.

nova wasp
#

some stuff I think is kind of just "you should know what a breakpoint is" (not that it's easy to figure that out without context) but it's insane how many useful debugging watches there are epic advertises none of

thin stratus
#

Give it a tab per instance, even under "one process" and maybe even try to sync them up by some ServerTime..

nova wasp
#

what happens if its from an asset load callback?

#

this is kinda unfortunately not so simple unless you abuse GWorld like I do (and even that is REALLY really silly and only works for simple ticking things)

thin stratus
#

A tab that prints GT World related stuff should be fine?

#

That's where 99% of the gameplay logic will happen anyway.

nova wasp
#

yeah, I think there should just a a "ulog that is only from a uobject"

#

or something

#

that should be the default one

thin stratus
#

I do have a function that grabs the world out of thin air and I trace projectile stuff with that similar to how Insights traces work.

nova wasp
#

ofc we need a raw statics one as well but it does not make sense to have 0 context in a default log when the context is almost always there

thin stratus
#

Not pretty but I can easily trace data even in a random struct function that has no concept of the world.

nova wasp
#

yeah, I already mentioned GWorld

#

it's a global static

thin stratus
#

The logging can always report which thread it is on

thin stratus
nova wasp
#

I can because I only do work from tasks waited on in a tickable world subsystem

thin stratus
#

It's set during the time the world is currently being processed iirc.

nova wasp
#

it would not work for EVERYTHING

#

but it does work for my game code

#

anything on a module level ofc would not work

pliant cypress
#

i hate clyde, wouldn't let me share whole message at once

thin stratus
#

Yeah Discord sucks with code stuff somethimes.

#

Like what are they defending us from?..

pliant cypress
#
void UCombatComponent::EquipWeapon(AWeapon* WeaponToEquip)
{
    if (SoldierCharacter == nullptr || WeaponToEquip == nullptr)
    {
        return;
    }

    EquippedWeapon = WeaponToEquip;
    EquippedWeapon->SetOwner(SoldierCharacter);
    EquippedWeapon->SetWeaponState(EWeaponState::EWS_Equipped);
    if (SoldierCharacter->IsLocallyControlled())
    {
        EquippedWeapon->GetWeaponMesh()->CastShadow = false;
        const USkeletalMeshSocket* HandSocket = SoldierCharacter->GetFPSMesh()->GetSocketByName(FName("RightHandSocket"));
        if (HandSocket)
        {
            HandSocket->AttachActor(EquippedWeapon, SoldierCharacter->GetFPSMesh());
            UE_LOG(LogTemp, Warning, TEXT("DebugString: %s"), *GetDebugStringForWorld(GetWorld()));
            UE_LOG(LogTemp, Warning, TEXT("FPS Mesh"));
        }
    }
    else
    {
        EquippedWeapon->GetWeaponMesh()->CastShadow = true;
        const USkeletalMeshSocket* HandSocket = SoldierCharacter->GetMesh()->GetSocketByName(FName("RightHandSocket"));
        if (HandSocket)
        {
            HandSocket->AttachActor(EquippedWeapon, SoldierCharacter->GetMesh());

            UE_LOG(LogTemp, Warning, TEXT("DebugString: %s"), *GetDebugStringForWorld(GetWorld()));
            UE_LOG(LogTemp, Warning, TEXT("Mesh"));
        }
    }
}
#

void UCombatComponent::OnRep_EquippedWeapon()
{
    EquippedWeapon->SetWeaponState(EWeaponState::EWS_Equipped);
    if (SoldierCharacter->IsLocallyControlled())
    {
        EquippedWeapon->GetWeaponMesh()->CastShadow = false;
        const USkeletalMeshSocket* HandSocket = SoldierCharacter->GetFPSMesh()->GetSocketByName(FName("RightHandSocket"));
        if (HandSocket)
        {
            HandSocket->AttachActor(EquippedWeapon, SoldierCharacter->GetFPSMesh());
            UE_LOG(LogTemp, Warning, TEXT("ONREP FP Mesh"));
        }
    }
    else
    {
        EquippedWeapon->GetWeaponMesh()->CastShadow = true;
        const USkeletalMeshSocket* HandSocket = SoldierCharacter->GetMesh()->GetSocketByName(FName("RightHandSocket"));
        if (HandSocket)
        {
            HandSocket->AttachActor(EquippedWeapon, SoldierCharacter->GetMesh());
            UE_LOG(LogTemp, Warning, TEXT("ONREP Mesh"));
        }
    }
}
nova wasp
#

they are two separate logs so now I have to make a mental mapping between these 3 things

#

okay

thin stratus
#

Two things about the code, before we talk about the logs

pliant cypress
nova wasp
#

for starters it does not make sense to silently fail to find the socket

thin stratus
#
  1. WeaponState is replicated based on your other code, why is the Client calling SetWeaponState in the OnRep?
  2. You are still duplicating the code. Just put all code that should be called on Server and Client into the OnRep and call the OnRep by hand after setting EquippedWeapon in EquipWeapon.
nova wasp
#

unless you intend for that

thin stratus
#

The HandSocket failing silently could be a problem, yes.

#

But we would see that in a missing log atm I guess.

nova wasp
#

also I'm super confused about which component is for what

// is this the tp weapon mesh? why is this one not interested in casting shadows? how can someone reading this determine that?
        EquippedWeapon->GetWeaponMesh()->CastShadow = false;
        const USkeletalMeshSocket* HandSocket = SoldierCharacter->GetFPSMesh()->GetSocketByName(FName("RightHandSocket"));
pliant cypress
#

Attempting to move a fully simulated skeletal mesh /Game/Maps/UEDPIE_1_PrototypeLevel.PrototypeLevel:PersistentLevel.BP_Weapon_01_C_2.WeaponMesh. Please use the Teleport flag

thin stratus
#

FPSMesh and Mesh are of the Character.

#

WIth Mesh being ThirdPerson, the native one I assume

pliant cypress
#

Mesh - Full body
FPS_Mesh - arms msh

#

WeaponMesh - Single, root component of AWeapon

thin stratus
#

By using 2 properties and 2 OnReps to do similar work.

nova wasp
#

why is the skeletal mesh simulated anyways

#

and yeah onreps are going to not come in at the same time

thin stratus
#

They can drop the Actor physically to the floor I guess.

nova wasp
#

make 1 holy struct that describes the state. Do not rely on random property ordering

thin stratus
#

btw, you don't want that to be physics driven. If you want to "throw away" the weapon, try looking into the ProjectileMovementComponent.

#

It is a "PROJECTILE" MovementComponent, but you can use it for whatever you want.

#

Shitty name tbh

nova wasp
#

its not horrible to do as a starting setup imo

#

they just need to not simulate and THEN move it without forces

pliant cypress
nova wasp
#

how does cod use physics for the weapon?

#

I am confused

pliant cypress
#

dropping

thin stratus
#

You can enable MovementReplication but that might cause jitter then.

#

That's why I suggest to use the ProjectileMovementComponent a that can do the "throw away" stuff even with "bounces" and what not and has logic for interpolation.

#

Unless that does not at all work for you.

#

But that's a different topic. Was just an FYI.

pliant cypress
#

sure but rn, i gotta get fix the attachment

nova wasp
thin stratus
pliant cypress
#

yes

#

that's why i am not able to understand where the error happens

thin stratus
nova wasp
#

it's a good idea I think, just saying lol

thin stratus
#

Is it wrong in the picture as well? It does look wrong but with placeholder stuff I'm sometimes not sure .D

pliant cypress
pliant cypress
thin stratus
#

In your video from the original post, it's inverted.

pliant cypress
#

so basically, even for locally control weapon has started attaching to TP Mesh

pliant cypress
#

i did some changes

#

clean build again

#

UE_LOGs

thin stratus
#

Okay.

pliant cypress
#

remade BP_Weapon

thin stratus
#

You are restarting the editor every time you do C++ changes?

pliant cypress
#

for small update, bug fixes. i use live coding

thin stratus
#

Hm. Keep in mind that it's not about the size of the changes, but what exactly you are changing.

#

Live Coding is fine, but you can't "hot reload" header changes with it.

#

Mostly only cpp changes fwiw.

#

Do adding/removing functions and properties is usually not supported.

pliant cypress
thin stratus
#

Changing the implementation of a function is fine. Touching the constructor is probably a no-no

#

Yeah, strange. Not entirely sure what this coudl be atm.

pliant cypress
#

last time it worked when u told me to override the OnRep_AttachmentReplication

thin stratus
#

You already changed the Attachment OnRep from last time, which should remove this problem.

pliant cypress
#

then i added Sprint, Left Hand IK, Crouch

#

though it was working finely till Left Hand IK

thin stratus
#

When are you spawning the Weapon?

pliant cypress
#

go over it and pick up

thin stratus
#

You pick it up?

pliant cypress
#

yes

thin stratus
#

Are you using Source Control for your project?

pliant cypress
#

Github

nova wasp
#

you don't need to use github, you can just host a git locally

#

if that helps

thin stratus
#

Have you considered reverting some changes to see if that resolves it again?

nova wasp
#

which is kinda how it works anyways

thin stratus
#

Cause we don't know what changes you've done that could have broken it outside the code parts

pliant cypress
#

didn't fixed

#

regenerated VS files

thin stratus
#

If you are using GitHub, you are probably not Source Controlling your Assets.

#

Those are most likely the more important thing to keep revisions on cause those break a lot easier and can't simply be restored.

nova wasp
#

curious what GetFPSMesh is attaching to

#

or if something else is overwriting the attach

pliant cypress
# nova wasp curious what GetFPSMesh is attaching to
ASoldierCharacter::ASoldierCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer.SetDefaultSubobjectClass<USoldierMovementComponent>(ACharacter::CharacterMovementComponentName))
{
     // Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

    bUseControllerRotationPitch = false;
    bUseControllerRotationRoll = false;
    bUseControllerRotationYaw = true;

    GetMesh()->bOwnerNoSee = true;
    GetMesh()->bOnlyOwnerSee = false;

    SoldierMovementComponent = Cast<USoldierMovementComponent>(GetCharacterMovement());

    ViewCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("ViewCamera"));
    ViewCamera->bUsePawnControlRotation = true;
    ViewCamera->SetupAttachment(RootComponent);

    FPS_Mesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("FPS_Mesh"));
    FPS_Mesh->SetFirstPersonPrimitiveType(EFirstPersonPrimitiveType::FirstPerson);
    FPS_Mesh->bOnlyOwnerSee = true;
    FPS_Mesh->bOwnerNoSee = false;
    FPS_Mesh->CastShadow = false;
    FPS_Mesh->SetupAttachment(ViewCamera);

    Combat = CreateDefaultSubobject<UCombatComponent>(TEXT("CombatComponent"));
    Combat->SetIsReplicated(true);

    GetCharacterMovement()->MaxWalkSpeed = 250.f;

    NetUpdateFrequency = 66.f;
    MinNetUpdateFrequency = 33.f;
}
thin stratus
#

Different topic again, but you should consider using something else than GitHub, as that limits your LFS stuff to a few gigs, which means you aren't actually saving the assets I assume.

thin stratus
#

I don't really think there is anything wrong with the Attachment Code atm.

nova wasp
#

I wonder if OwnerNoSee can handle attached things changing

#

I would be curious to see what is actually being attached to what

pliant cypress
#

do i need to remake the project?

thin stratus
#

There is always a solution. Remaking the project is almost never the answer :D

nova wasp
#

debug who is attaching it

pliant cypress
nova wasp
#

a breakpoint in attachment

#

that way you can see who changes it

#

even if its not this code

thin stratus
#

We are just reaching a point where we can't help much. If I were in your position I would breakpoint the Attachment-code and step into it to see what is happening in UEs code.

nova wasp
#

just add a breakpoint in AttachActor

#

this is to see if someone else is changing the attachment

#

learning how to debug is really really important

#

this stuff sucks to do beacuse there can be some unintuitive things that can change the result but verifying your assumptions can help narrow down what happens

thin stratus
#

The logs show that the Weapon should be attaching to the right socket on the right mesh on the Client vs Server.
If it still fails, then you gotta check what is happening on Epic's end.

Also are you sure the stuff you did with the IK isn't moving the Socket or Bone or so and the Attachment is in fact working fine?

pliant cypress
nova wasp
#

not what I meant... read my message about where the breakpoint is please

#

but you are on the right track

pliant cypress
nova wasp
#

make sure you have debug symbols

pliant cypress
thin stratus
#

Are you able to breakpoint within AttachActor and does it hit the breakpoint? :D

dark parcel
#

When a client join and a dynamically spawned replicated actor is spawned on the client machine.
Is the state guaranteed on begin play?

For example, if I have a replicated boolean, bChestOpen in a replicated actor.

If the server, sets the bChestOpen to true.

Then later on a client join the game, 1 minute after.
On the replicated actor begin play will bChestOpen guaranteed to be true for client?

For context, I just want to make the chest mesh open / close depending if it's already opened in the server by the time the client join.

Asking cuz I still have to figure out how to test as late joiners in editor.

thin stratus
#

If not, then you gotta install the symbols still.

nova wasp
#

seems simple enough to just onrep it, no?

thin stratus
pliant cypress
#

just hit the breakpoint

#

on EquipWeapon, the hit was on TP_Mesh

#

OnRep it was on FPS

nova wasp
#

I have no clue if that's good or bad lol

pliant cypress
dark parcel
nova wasp
#

I mean adding it inside of attachactor, not just on that line
but it being on that line can be helpful too

dark parcel
#

thingking when I can use OnRepCondition InitialOnly

nova wasp
thin stratus
# pliant cypress just hit the breakpoint

Yeah I mean we expect that from the prints, but you are meant to step into the function or even put the breakpoint into it.
You should debug what the ENGINE code is doing.

nova wasp
#

yeah the reason we are trying to see who else is calling AttachToActor

#

just in case something else is overriding your code later

pliant cypress
nova wasp
#

prefer placing it near the first few lines if possible

#

in case it early outs

#

I might change my answer to USceneComponent::AttachToComponent

pliant cypress
#

found something

nova wasp
#

you might want to mute the breakpoint until after beginplay though as it will be called dozens of times

pliant cypress
pliant cypress
#

not hitting the breakpoint

nova wasp
#

its not active

#

idk what this warning means but I assume its not reachable/resolved

thin stratus
#

No symbols :D

#

Pretty sure you skipped installing them inside the options when you installed the engine.

#

Open your Epic Games Launcher, go to the list of installed Engines and click the dropdown next to the one you are using. Check the options and see if you downloaded the symbols.

nova wasp
#

I will see if I can make a short wtf-is-going-on for how to debug stuff some time

#

it is really dire how many people miss this stuff... it's not really their fault though becuse no unreal docs or courses will teach this

#

because they all assume you somehow learned this from... somewhere

#

not to mention the crazy unreal-specific watches and natvis

thin stratus
#

It's mostly that peeps head into coding C++ for Unreal without ever learning how to actually debug C++ code properly.

nova wasp
#

I am one of those people I guess

#

idk when I figured out what a breakpoint is lol

thin stratus
pliant cypress
#

the other multiplayer game wasn't hard when i developed

#

but wasn't that much complex though. Easy to debug even with breakpoints

pliant cypress
#

@thin stratus Debugging symbols downloaded

#

what's the next step?

#

i found something

#

i downloaded my last commit

#

and it was working fine

ocean swallow
#

I’m working on a throw/spawn mechanic in a UE5.6 multiplayer project. The setup is shown in the image: the spawned items have Replicate and Replicate Movement enabled.
The issue I’m encountering is that after throwing, only the server sees the item flying correctly. On all clients, the item appears at the spawn location and immediately falls down, regardless of which player threw it.
Additionally, small items, like flashlights, sometimes clip through geometry and end up below the floor.
Has anyone experienced this before? How can I ensure that clients see the same thrown trajectory as the server and avoid these clipping issues?
Translated from GPT

nova wasp
#

also I am not sure why you want to get component by class for the spawed actor. Is the physics primitive component not just on the blueprint?

ocean swallow
nova wasp
#

I am not sure what you are referring to about the two things I said

#

also curious to see what p.VisualizeMovement 1 shows (console command)

#

also I do not think I like searching for a random primitive component on this... just use the root static mesh component of the flashlight. Searching for this dynamically does not make sense as you will want to apply to the root component every time I think

#

I don't know exactly how the flashlight works though

#

Apologies if anything I said here is difficult to translate, if it is hard to understand I can rephrase it

ocean swallow
nova wasp
#

in that case then use the root component and cast it to a primitive

nova wasp
#

yeah, assuming it actually is a primitive component

#

which it should be imo

ocean swallow
#

Now it can only fall where it is.

nova wasp
#

Is the root component a primitive component or not?

ocean swallow
#

What's that meaning?

nova wasp
#

you might have to move it around relative to the socket now... not sure if this will change the physics replication

ocean swallow
nova wasp
ocean swallow
nova wasp
#

I think the reason why is that movement replication uses the root component

#

it might be annoying to offset the flashlight in the hand now but you should do this for most actors like this if possible.. the root should be the thing that has their collision and physics

ocean swallow
nova wasp
#

did you read my message about CCD?

ocean swallow
#

i can't find that

nova wasp
ocean swallow
#

🛐 All problems solved thanksss

nova wasp
#

CCD is not free as it will make things slightly more expensive to move but for something this important it's a good idea I think

ocean swallow
nova wasp
#

the root IS the static mesh

#

there is nothing for it to be relative to

#

because it IS the root component

#

if you attach it to something else it can be relative to that, like the character's hand

#

you could also change the origin of the static mesh itself you wanted to with the static mesh editor tools

#

you could change the root to a collision component like a capsule collision and move it relative to that if you wanted to?

ocean swallow
#

But I don't know how to do it yet

#

oh,I first create a root and then move it and delete the root

lyric heart
#

i've been doing some stuff with multiplayer and i have not find much on these connections

#

i see i can do a listen server real easy and just forward ports but i don't want users to have to forward and all that

#

so i been looking into steam

#

and it works really well

#

are there any other alternatives ?

#

i know there is also EOS that you can use through steam ?

#

what do people normally use is the question ? like whats the standard way of doing the networking ?

dark parcel
#

The standard way is to make it convinience for your target base.

#

Having the user to portforward them self will easily delete your target audience.

#

You want to handle the connection proccess, I think steam use NAT or w/e it's called.

lyric heart
dark parcel
#

but at the end of the day, the end user just need to press host. And other players can click join.

lyric heart
#

right

dark parcel
#

how it happend at the backend is up to you to implement

#

I'm a simple man, if I don't get dedicated server working, i will just use steam sessions.

#

but dedicated or not, I will still publish the game on steam.

lyric heart
#

right so i can have a dedicated server

#

where i'm the only one who has to forward the ports

#

thats not a bad option

#

i just worry about power outages, downtime with this

#

steam seems to be the best way to go tbh

lyric heart
#

i just want to use the networking stuff and not publish the game through them

dark parcel
#

there you can make a fleet of servers, or even better, instances on demand.

So you don't get charged for idle servers.

#

As for steam, you can use the default app id 480, space war to test your game.
That's what it's for.

#

The downside is you will see other people sessions as well, since there are other devs testing with it. But then you can also filter with specific param so you can display only the session from your game.

lyric heart
#

i mean i can't just have a demo that uses this 480 ?

#

like even for testing

dark parcel
#

You can but not for public.

#

"demo" in what sense? need more context here.

lyric heart
#

right so like i can send to a friend

dark parcel
#

if it's demo open for public then I believe no.

lyric heart
#

just a prototype

dark parcel
lyric heart
#

a demo for people to test yes

dark parcel
#

Don't even need to build for shipping, you can build with development target.

#

Share the executable with friends.

lyric heart
#

isn't that making it public ?

#

or what exactly is public ?

dark parcel
#

no

#

you have to pass the game to them via USB or other link.

#

Making it public means you have your own app id.

#

and people can just download the game via steam.

#

and get the update via steam.

lyric heart
#

i think i will eventually get an app id

dark parcel
#

If you don't have your own app id, you will just have to copy the game to spare laptop.

#

Yea it's like $99, I'm not that broke.

lyric heart
#

in this case it seems worth it to have the multiplayer stuff all built in like that

dark parcel
#

built in like?

lyric heart
#

where it shows teh game your playing, and you can invite and stuff

#

thats awesome

dark parcel
lyric heart
#

yes it does

#

it works

dark parcel
#

if you have your own app id, it will show your game name.

#

also you can send Beta Keys

#

so you can just deploy your game anytime you need to update.

Then your players can just update the game via steam.

#

Free version with Space war means, you will have to copy the game, everytime you did an update, no matter how small.

heavy hound
#

It seems like a super simple replicaiton issue. But I'm just not able to figure it out

#

The thing, that seems to bother me is the "Event dispatcher does not seem to work"

#

If anybody can help, that would be amazing!

thin stratus
dusk lodge
#

does anybody know if anim notify state-based triggers for gameplay stuff like combos, input buffers, melee scans etc is viable for multiplayer pvp? not sure if server corrections/desync will cause notifybegins to skip for example, hearing conflicting info

dark parcel
#

how does Event dispatcher even relate to replication.

heavy hound
dark parcel
#

the listening and broadcast happend local to the client.

#

Damn, i hate reddit

#

the first comment already speaking none sense

heavy hound
#

It works perfectly fine implementing it every other way — interfaces, replication calls and all.

dark parcel
#

You need to understand that each machine are running their own instance of the game, running their own world.
Each machine would need to bind to the dispatcher at the time the function is called.

If your client doesn't get the broadcast when they run the function (from multicast or w/e), then that specific machine never bind to the event.

#

Show the binding?

heavy hound
#

It's on the screenshot

dark parcel
#

this is the only screen shoot, it's not there.

#

oh there's 2 pages

heavy hound
#

correct

dark parcel
#

have you debug if the clients execute the binding?

#

wait this code is confusing

heavy hound
#

The binding seems to work locally. If I press 'F' on client or the server, the door rotates locally but does not replicate.

#

I literally spent $40 on a consultant and he kept yapping about unreal networking, without addressing the issue lmao.

dark parcel
#

if the door rotation needs to be in sync, then you can throw away your Multicast for a start.

#

aka if everyone needs to see the same angle, then multicast is not the way

heavy hound
#

Lets just replace the door rotation logic, with a simple print statement.

#

I'm just testing stuff with Event Dispatchers and Multiplayer. Door was just a way of experimenting.

dark parcel
#

No issue with event dispatchers at all on my end

heavy hound
#

I feel like Binding might be the issue?

lyric heart
heavy hound
#

'Replicates' set to true

lyric heart
heavy hound
#

Like I said, it works with interfaces and variable notifies, just not with event dispatchers :(

dark parcel
#

well its not like nothing actually get replicated on your end. You are just telling every client to run X function which rotate the door by 10 degree

heavy hound
dark parcel
#

what "replicates"

heavy hound
dark parcel
#

nothing really replicate?

#

There's no replication at all on your end.

#

you are just doing Remote procedural call

#

what's actually being replicated?

heavy hound
#

I just want the door to rotate on server and client

lyric heart
#

multiplayer is a whole beast of a thing, but so far everything is good, i just got this weird collision issue but it stays in sync

lyric heart
dark parcel
#

if client is allowed to change the rotation, then do a server rpc where the server set the rotation of the door.

#

If server, then just set the float right away.

heavy hound
dark parcel
#

that's not stateful.

#

it's an event

#

any dropped RPC and you get different angles between players.

#

also late joiners guaranteed to see different angle, if the function have run before they join.

heavy hound
#

I don't mind if it syncs or not syncs. I just wish to undertsand, why this setup is not working

#

Lets just forget about the door rotation altogether and replace that locgic with a print statement. I would be happy if the print gets replicated.

dark parcel
#

the entire thing is pretty confusing

heavy hound
dark parcel
#

but yeah "works"

heavy hound
#

What does this part do tho?

dark parcel
#

When the character spawn , it gets all the door in the world and pass it self to be binded.
Gonna scrap all of this

lyric heart
#

why would my gamepad not work in multiplayer on a packaged build ?

#

it works fine in standalone

heavy hound
#

Cool.
Why wasnt it working in my setup?

dark parcel
heavy hound
#

But Player 0 on both client and server would mean the local characters right?

#

Thank you so much!

obsidian ermine
heavy hound
#

Anyways, I figured out — why it was not working.

obsidian ermine
heavy hound
#

get player pawn 0 is local.

#

It referes to the local character in both server/client

#

It's not the first player to join in MP setup.

obsidian ermine
#

Multicast ( Executes on all ) Also executes on the server.
So the server is executing on the first player.

verbal ice
#

On a dedicated server 0 is just the first player to connect

thin stratus
#

@verbal ice @obsidian ermine @heavy hound there is a pinned post by me from where I looked into that. Just in case you wanna confirm stuff.

verbal ice
#

So pretty much always guaranteed to return a local player if there are any first right

craggy hazel
#

Can anyone help? I've tried literally ALL day and cannot get the Steam Overlay to open during Standalone.

I've absolutely exhausted all options

obsidian ermine
verbal ice
#

Yeah I know that heh

#

Literally what I said above

obsidian ermine
#

just noting the proxies

#

I see a lot of people using get player controller (0) in server-side logic.

#

Drives me nuts

lyric heart
#

mine doesn't show on standalone, but in the packaged build it comes up

craggy hazel
#

when i run my game from Steam (It's obv not out yet but is set up in steam) I can open the overlay

I'm trying to make steam achievements, and in every single tutorial they open steam overlay to confirm it's working. So I don't want to start making all the steam achievements if I can't even do the first step in their videos which is opening the steam Overlay to confirm it's connected properly

lyric heart
craggy hazel
#

Sorry - when in standalone, I cannot open steam overlay.

But, when I'm inside steam and click the green PLAY button, I can open the overlay when doing that

lyric heart
#

the green play button is the downloaded from your store page right ? not your updated code that your testing

#

ya i couldn't get it to come up on standalone either

#

i had to run a packaged build

exotic wasp
#

uobjects not being able to have replicated subobjects is so annoying

fossil spoke
#

Obviously the owner UObject would still need to be repped through an Actor.

exotic wasp
fossil spoke
#

Right

craggy hazel
#

I finally got Steam Overlay to work in Unreal, but after a few hours, when bringing up the Steam OVerlay the 'achievements' button is greyed, inactive, and unable to be clicked. I published the achievements to steam about an hour ago!

jovial ravine
#

I don't think achievements work in the editor. You might have to package.

meager spade
#

Steam doesn't work in editor properly at all

#

You have to always yest standalone

#

Test

limpid needle
#

Hello!! I’m working on a multiplayer MR setup in Unreal. I’m apwning grab able actor from server and saving the floor transform in the GameState so when clients join, the spawned actor align with the server’s floor, keeping the passthrough world consistent. The issue I am facing is with grabbing. Right now, when the server grabs an actor, it replicates properly. But when a client tries to grab, the actor either doesn’t stay in their hand or starts drifting away. My grab flow is: 1. client input → server RPC (validate + SetOwner to client PC) → client RPC. The actor has replication and replicate movement enabled.
p.s sorry for spaming 3 channels as its VR/MR and multiplayer issue

lyric heart
#

I'm trying to make a custom character for the player on multiplayer, but its giving me a bunch of issues

#

i'm still not understand replication and stuff

#

i tried to place the actor in the world, didn't work

#

i try spawning on begin play didn't work, i also tried rpc same thing not working

#

i'm trying to set view target with blend

#

to the new camera actor for each player

#

nothing seems to work, pain in the ass

#

everything i try it only work on server

dark parcel
#

@lyric heart it's necessary to understand server to client communication.

#

you can start from the very basic first.

#

like spawning a replicated sphere where server set the color. And that changes replicate to everyone.

lyric heart
#

and changed the material

#

with rpc

dark parcel
#

with what rpc?

lyric heart
#

server, and multicast

dark parcel
#

multicast = doing it wrong.

lyric heart
#

well actually the multicast is for the montages

#

and i also did it for health of enemy

dark parcel
#

thought we are just talking about a cube and it's color.

#

so how do you change the color?

dark parcel
#

there shouldn't even be RPC to set health.

#

server simply set replicated variable.

#

and the new value will eventually be send to client.

#

Personally I just look at the compedium dozens of times, practice, fail. Once it click, then replication is easy and in multiplayer it's actually the easy part.

#

the other challanges involving mp can be explonentially harder.

lyric heart
#

instead of the multicast

dark parcel
#

yeah but you gotta use them where they are needed.

#

I don't know what works or not on your end.

#

RPC is for a one time event.

#

Replicated variables is for state.

lyric heart
#

ok well i don't want to replicate it, i want each one to have a seperate version

#

i want them each to have a different spawned actor that they can access

#

and i can only get it working on the server idk why it's a hassle lol

#

its for a custom camera because the regular cam is bs imo

lyric heart
#

oh i see because they are not needed state

#

just one off

#

based on what i'm seeing i don't want replicates at all

#

i want this to be on each one seperately

dark parcel
#

make sure bReplicate is set to false

lyric heart
dark parcel
#

and ensure that the code that spawn is local to the machine you want to spawn it in.

lyric heart
#

yes i just did that with is locally controlled

dark parcel
#

e.g Input (inpuit is local) Pressed -> Spawn my ball.

lyric heart
#

yes the code runs to spawn, but it doesn't posses

#

it's probably the controller ?

#

i'm using get controller

dark parcel
#

can't say much unless I see some codes.

#

but I am not even sure what your goal / what the problem is.

#

if you want to spawn a local actor, then there's no need to think about it multiplayer at all.

lyric heart
#

this only works on the server for some reason ?

#

but it runs twice

dark parcel
#

don't know what runs prior to this nodes

lyric heart
#

why would that even matter ? but nothing

dark parcel
#

?

lyric heart
#

it's literally on begin play

dark parcel
#

I wouldn't know that

lyric heart
#

ok so nothing runs before it

#

some stuff after it

dark parcel
#

the important part what executes the nodes. Wether it's run from RPC, or some events like begin play.

#

those matters ofc.

haughty ingot
lyric heart
dark parcel
#

Maybe do a print string and see if the client execute the code

lyric heart
#

ok maybe it's running twice on the server ?

dark parcel
#

Begin play is normally the wrong place to do stuff. Mainly because character /pawn is not possessed yet

#

it takes time for the client to be given the pawn by the server.

#

So if your code runs in a pawn / charactert object.

lyric heart
dark parcel
#

IsLocally controlled most likely return false.

#

if done at begin play for client.

lyric heart
#

it's print string fine

#

it works fine if i don't load net stuff

lyric heart
dark parcel
#

i'm always at the bottom of the class.

#

you just gotta read the compedium, experiment, fail, then try again, until it clicks.

#

Is the pawn dynamically spawned or placed in the level?

lyric heart
#

but i tried both ways

dark parcel
#

I figured it out it seems

#

you are fighting with something

#

possibly with possession

#

Try adding delay just for sanity check, it work for me.

#

Add delay before you spawn your camera and setting the view target

#

I believe this come down to begin play being too early for this stuff..

lyric heart
#

so should i do it on possess or something ?

lyric heart
dark parcel
#

AcknowledgePossession would be my go to

#

C++ though but you can do it anyway

#

OnPossess only get called by the server

#

AcknowledgePossession is what gets called on client and at this point the pawn is already possessed in the client.

dark parcel
#

use the right event for the right job.

lyric heart
dark parcel
#

AcknowledgePossession isn't exposed to bp

lyric heart
#

fk

dark parcel
#

you can do other ways, but it's more side tracking

#

Lik OnPossess then run client RPC

#

actually Im not even sure if that's guaranteed.

#

Just make a BlueprintImplementableEvent function and call it on AcknowledgePossession.

lyric heart
#
void APlayerController::AcknowledgePossession(APawn* P)
{
    if (Cast<ULocalPlayer>(Player) != NULL)
    {
        AcknowledgedPawn = P;
        if (P != NULL)
        {
            P->RecalculateBaseEyeHeight();
        }
        ServerAcknowledgePossession(P);
    }
}
#

so this is where i would want to call the new function ?

dark parcel
#

@lyric heart You will need to create your custom controller class.

#

don't touch engine's code

lyric heart
dark parcel
#

@lyric heart are you using rider?

lyric heart
#

fk i fked it up

#

i forgot to disable live coding

harsh cloak
#

Is the project not compiling now?

lyric heart
#

i have a backup i'm trying to get to

harsh cloak
#

Delete intermediate and binaries folder then try re compiling

#

If you changed engine code that may also be an issue

#

I’ve also punked myself with live coding so I do feel for you

lyric heart
harsh cloak
#

Happens, shouldn’t really be an issue but you never know

dark parcel
lyric heart
lyric heart
#

it's firing off now atleast

#

but it's not setting the view target with blend

dark parcel
#

What's OnClientPossession?

#

post the entire function

lyric heart
#

it is running

dark parcel
#

might still be fighting with something, btw might want to do IsLocallyController check there.

lyric heart
lyric heart
#

although delay is not usually a good answer

#

i think delay until next tick is ok to use ?

lyric heart
lyric heart
dark parcel
lyric heart
#

but say guessing a time for it to delay i can see is an issue

dark parcel
#

That delay is on tick probably just address the actor not fully spawn yet.

#

delay is a hack when it's used for multiplayer.

#

but in your context, it's not an issue since the camera is spawn locally

lyric heart
#

ya it doesn't need any network stuff

high lotus
lyric heart
#

this multiplayer stuff is pretty difficult lol

exotic ledge
#

what do you think about this guys?

quasi tide
#

Uhhh - unless you need specific local spawned actors...why?

#

UE automatically replicates any spawned actors that are marked as replicated

exotic ledge
#

i try to tell the same thing, this is a bad approach and will create duplicates

#

The actors spawns with RemoteRole = None

exotic wasp
#

Just make the actor replicated

exotic wasp
#

Usually you just need to bind to the right callback

#

Or create your own

exotic ledge
exotic wasp
#

I would probably not use said plugin

lyric heart
#

i would like the best way if possible, but this seems to work every time

tropic moat
#

When I call Auth->Login it returns TOnlineAsyncOpHandle, I'd like to store it so I can call Cancel on it if necessary. The problem is that TOnlineAsyncOpHandle doesn't have any constructor I can use to make a variable. What's the intended way to cancel async online operations?

toxic cobalt
#

need emergency help: CAN PROVIDE SCREENSHOTS OR ELABORATE IF NECESSARY

in my game, there is a trace thats runs the interaction. it should be that when a player interacts wiuth another, the focused one is moved back a tiny bit. this partially works, but i find that the focused player is often scrambled. when one actor interacts with another, it might work OR it might move themself or even a completely random player. please help, i need to get this done asap or else i will be a big troublea

#

images of the code

#

please help somebody

nova wasp
# toxic cobalt

do not use GetPlayerCharacter(0) on the authority to obtain a player, you should always use a specific player from what is actually doing something on the server

#

I have no way of telling what you changed after someone else helped you

#

Or which of these functions run on which machines (client/ server/ sim proxy etc)

heavy hound
short arrow
#

No, it refers to the first controller found on whatever instance called it. So for a dedicated server (and very rarely a listen server) it'll be whichever player connected to the game first. It would be the same situation for clients if other controllers actually existed for them besides their own

nova wasp
#

you are assuming you only care about the local player in this case

#

I do not know that

heavy hound
#

So binding a dispatcher with GetPlayerPawn(0) wont replicate?

nova wasp
#

what is a dispatcher?

heavy hound
#

Event Dispatchers

nova wasp
#

what is it doing? who is calling it? what is passed into it?

heavy hound
#

I'll dm?

nova wasp
#

RPCs are not "dispatchers" afaik anyways, they are regular events (if an event dispatcher can be replicated I honestly do not know)

#

no thanks

heavy hound
nova wasp
#

did you read the message I linked?

#

when this gets the player controller by index it will get the first player controller in the list of player controllers in that local game instance, it does NOT use the local actor here you have to figure out which player is actually related to this actor

UGameplayStatics::GetPlayerController(Index)
Checks the LocalPlayers Array of the GameInstance first
Then checks the PlayerState Array of the GameStateBase
Then uses the UWorld PlayerControllerList (iterator)**
heavy hound
#

Is there a more dumb downed version of that?

nova wasp
#

there is a global list of player controllers on the authority for each client

#

using the first one for no reason with 0 context is rarely a good idea

heavy hound
#

Oh, this makes sense

nova wasp
#

it only really makes sense for local multiplayer couch-co-op games or if there is only one controller (aka you are a client connected to a server with 1 local player)

#

so in this case the server will just use... whatever the first player controller is each time which is almost certainly not intended

heavy hound
#

Thanks!

nova wasp
#

this gives examples and what to use instead

#

Why GetFirstLocalPlayerController is not exposed to BP is a mystery lol

#

it is useful because it iterates the list of player controllers to find the first one that is local (AKA if the listen server is a local player it will get that, and clients will get their own controller)

#

on dedicated servers though there is no local player

heavy hound
#

It's super hard to piece all of this together, like this 'player controller' for example. Do you know any paid consultant for Multiplayer, who can help with the best practises?

nova wasp
#

you have a giant list of links to read for best practices

#

this stuff is insanely complicated in practice depending on the game I guess

heavy hound
#

What about a game like cuff-bust? Do I need to learn networkign fundamentals and should be capable of understanding the UE Source code to work on something like that?

That's too much

nova wasp
#

I don't know anything about how cuff-bust works

heavy hound
#

Lethal company, or any other friend slop genre

nova wasp
#

you don't need to read the entire source of unreal but it's really difficult imo to make an actually complex/high-scale networked game with bp because it's just insanely limited and you can't tweak much

#

I think the fact it is a co-op game is a big point in your favor because you can for example just trust the client and not worry about client-prediction->authentication flows

heavy hound
#

Can I please DM, I just wanna send a reddit thread about Unreal Multiplayer, which I feel is a hoax and seems extremely discouraging. I just wanna confirm if thats true?

nova wasp
#

sure, whatever

pseudo wagon
chrome bay
#

load of bullshit

#
  1. The term "networking stack" means nothing, no idea what they're on about.
  2. Fortnite is made by Epic, they use the same tools/systems we do.
  3. Gaps in replication updates are expected, it's by-design and not a bug.

In summary: skill issue

#

The only thing that is perhaps worth pointing out, is that Blueprint has only a bare-minimum of multiplayer tooling/support. If you want real power, as with everything else, you do things in C++. Nothing really surprising about that though.

lost inlet
#

Isn't it great when people out of their depth blatantly lie about things they don't understand

#

Not like it's a common issue on Reddit (or YouTube)

latent heart
#

We actually have a big problem with things not replicating correctly. It's weird. You run away from an area (far away, out of relevancy range) and back again and items that should spawn in that area no longer do. They exist on the server, but not on the client. Setting them to always relevant fixes it. We haven't really looked that much into it yet.

limpid needle
crisp shard
#

https://x.com/theredpix/status/1972436890495189081

curious if anyone has a take on this? if test is legitmate, which i assume it is, then how would you accomodate / manage to make this be faster than it is now? and what would be some tips to do that ? or just any thoughts on the matter

#UnrealEngine This is some of the most relevant performance-related findings about #Performance Regression: CharacterMovementComponent performance has regressed over 2x slower from 5.0. The following captures are from when a Character is moving. 5.6 stayed most of the time at

chrome bay
#

Wihout actually profiling it, impossible to say

#

Run an insights capture, see what's slow, try to make it faster or use alternatives

crisp shard
#

and if so, what are some methods people use to optimize the base CMC ?

#

also, what alternatives exist ? i know of GMC, but i'd probably guess that'd be even slwo as a base start

glacial seal
#

Hi all, I have equipment that change animation layer upon weapon equip. It work on server side but fail on client.

When my client player equip the weapon, the animation layer did not change but player on server side is able to see the animation layer switch to pistol.

May I know how I can debug this? My pistol is spawn on both client and server.

lyric heart
#

i'm trying to fix this ui, i don't understand why it's not replicating ?

#

i've tried a bunch of stuff and it's still fkd

glacial seal
#

@nocturne quail thanks a lot it is working now 😄 Instead of link anim layer in fragment itself, i just link the layer in my equipment component, which I implement server and multicast version of the function.

#

thanks a lot for your guidance!

meager spade
#

.6? i see .06 and .17

twin vessel
#

What is the easiest way to manually serialize an array of TInstancedStruct? I cannot call NetSerialize on the FInstancedStruct since it is a private member.

I've got this, but i am still far from being able to test if it actually works.

bool FXEquipU_ActionResultPredictedVar::SerializeNetworkData_Internal(TArray<TInstancedStruct<FXEquipU_ActionResult>>& Value, FArchive& Ar, UPackageMap* PackageMap, bool& bOutSuccess)
{
    int32 Size = Value.Num();
    Ar << Size;

    if (Ar.IsLoading())
    {
        Value.Reserve(Size);
    }

    for (int32 i = 0; i < Size; ++i)
    {
        FInstancedStruct Struct;

        if (Ar.IsSaving())
        {
            Struct.InitializeAs(Value[i].GetScriptStruct(), Value[i].GetMemory());
        }
        
        if (!Struct.NetSerialize(Ar, PackageMap, bOutSuccess))
        {
            return false;
        }

        if (Ar.IsLoading())
        {
            TInstancedStruct<FXEquipU_ActionResult> Deserialized;
            Deserialized.InitializeAsScriptStruct(Struct.GetScriptStruct(), Struct.GetMemory());
            Value[i] = Deserialized;
        }
    }
    
    return true;
}
high lotus
crisp shard
lyric heart
#

the timing of things that load is a pain in the ass

#

i need to delay to get what i want and this is shitty

#

like if i delay 5 seconds, then what if it takes 10 seconds ?

#

for some reason i can't set the damn widgets to have there names without a delay

#

in game i can switch names np

#

it's the initial load, it doesn't want to change it

meager spade
#

use event driven

#

or tick or w/e

lyric heart
#

i tried event driven

#

the timing is all fucked

#

a delay works

#

multiplayer is frustrating af

#

i tried a bunch of shit and it just doesn't work without a delay

#

i'll have to check a tut

meager spade
#

its not frustrating

#

its understanding, building systems to handle edge cases, etc

late surge
#

Don't ever try to use delay or hour-glass wait for next tick. Use callbacks.

lyric heart
#

the only thing that works is a delay

#

so it's something with the timing

#

but i can't get it to work right lol

limpid needle
lyric heart
#

i see mulltiplayer requires mostly c++

#

because the timing in bp is just fkd

#

and i think c++ has events that can solve it

thin stratus
lyric heart
#

so now i need to create a new character c++ class

#

reparent (which i;ve never tried)

#

and alter the code lol

#

it's such a pain in the ass

thin stratus
#

I mean, yeah. There is a reason behind peeps saying that Blueprints have their limits and multiplayer is usually in need of C++.

#

There are only two options to this: Believing it or finding out the hard way.

grizzled stirrup
#

Is PlayerState->GetUniqueId()the best way to track a unique player that may leave and join a lobby later to see if it's the same person?

verbal ice
#

Although the way it's written makes it a lot more readable, and you can tweak a lot of settings to improve performance