#multiplayer

1 messages · Page 655 of 1

halcyon totem
#

the only way I make it stop is making the camera replicated but I never had to do this before to work

#

but then when its replicated it glitches and lags on the client

gaunt umbra
#

@empty bluff think rep notify is best for that - so server/client only send/receive its state when he's acctually near by and yea as mentioned above - for performance increase you can look at 'object pooler' at unreal marketplace for reference

grizzled flicker
#

anyone know how I can display the status of my AWS server (online/offline) on a website or discord?

fossil spoke
grizzled flicker
#

"everything about local and online multiplayer" I'm hosting my UE4 game on AWS, I'd say that qualifies as multiplayer related lol

#

so yeah was worth a try. thanks tho

#

ue4 encompasses a lot of things outside of ue4, in fact most of multiplayer relies on non-ue4 related applications.

fossil spoke
#

Sure but you are not asking a UE question, hence it does not belong in this channel.

keen ivy
#

@grizzled flicker you should be able to make an http request to your ec2 instance at a route of your choosing, perhaps an open port to your ue4 server, its basically a health check

#

also, I feel like that

#

is kind of pedantic

#

lol

#

yeah its aws but its still kind of related

#

🤷‍♂️

grizzled flicker
#

the genre is programming and the sub genre is multiplayer. it mentions ue4 0 times. It's also not possible to make a multiplayer game without using 3rd party programs/scripts... AWS, PHP, databases, Steam.... many many other things lol

fossil spoke
#

Look you can either argue with me or move on.

#

Im telling you this is offtopic.

grizzled flicker
#

ok I'll move on to the off-topic ue4 related subject

#

lol

plucky sigil
#

is it possible to store and replicate AInfo* inside the GameState ?

fossil spoke
plucky sigil
#

for some reason when i retrieve it as a client it is null
but when i call a rpc to retrieve it, its not null

fossil spoke
#

AInfo is a good "manager" base class if you need replication support.

#

Is the Actor set to Replicate?

plucky sigil
#

but non-pointer objects are replicated fine

#

AInfo is replicated by default right ?
but for the benefit of the doubt, i called SetReplicates(true) in the constructor

fossil spoke
#

Have you given it the Replicated markup in the UPROP?

#

On the GameState?

#

And then also created the DOREPLIFETIME for it?

twin juniper
#

if I do SetReplicates(false) on a player's pawn (on the server), is there a way for the local player to know that the pawn is no longer being replicated to them?

fossil spoke
#

If you look at SetReplicates you will see that it changes RemoteRole to ROLE_None when disabling Replication.

#

RemoteRole is a Replicated property.

#

If you dont want to re-enable Replication for that Actor again, you can call TearOff instead.

#

This will permanently destroy the ActorChannel though, it wont be able to Replicate again.

twin juniper
#

does the local player know the current RemoteRole after calling SetReplicates(False)

fossil spoke
#

Well the Local Player wont be Authority so if it calls SetReplicates locally, it will just fail.

#
void AActor::SetReplicates(bool bInReplicates)
{ 
    if (GetLocalRole() == ROLE_Authority)
    {
        const bool bNewlyReplicates = (bReplicates == false && bInReplicates == true);
    
        // Due to SetRemoteRoleForBackwardsCompat, it's possible that bReplicates is false, but RemoteRole is something
        // other than ROLE_None.
        // So, we'll always set RemoteRole here regardless of whether or not bReplicates would change, to fix up that
        // case.
        RemoteRole = bInReplicates ? ROLE_SimulatedProxy : ROLE_None;
        bReplicates = bInReplicates;

        // Only call into net driver if we just started replicating changed
        // This actor should already be in the Network Actors List if it was already replicating.
        if (bNewlyReplicates)
        {
            // GetWorld will return nullptr on CDO, FYI
            if (UWorld* MyWorld = GetWorld())        
            {
                MyWorld->AddNetworkActor(this);
                ForcePropertyCompare();
            }
        }

        MARK_PROPERTY_DIRTY_FROM_NAME(AActor, RemoteRole, this);
    }
    else
    {
        UE_LOG(LogActor, Warning, TEXT("SetReplicates called on actor '%s' that is not valid for having its role modified."), *GetName());
    }
}
twin juniper
#

What I mean is, if the remote role updates locally after calling SEtReplicates on the server

fossil spoke
#

Yes it will

dire cradle
#

Is it not possible to replicate render targets? I'm trying to replicate a 8x8 texture generated on the server to the client but the client reads null.
Both the actor and the render target is set to replicate

#

And are always relevant

hollow eagle
#

You can't replicate the render target itself, no. That wouldn't make sense - render targets are inherently tied to resources on the local machine.
You can take a snapshot of the render target and replicate that.

dire cradle
#

Oh that makes sense, so instad of setting the render target to replicate, if I create a variable and set its value to the render target each time it changes and replicate that would it work

#

a simple texture variable

thin stratus
#

@dire cradle I would suggest you don't do that

#

Replicate the information that is required to have a rendertarget been filled instead

#

So the location and rotation of whatever records to it

#

Sending the render target over net the whole time sounds shite

#

But in case you still want to do it, i assume you'd need to grab a frame from it, turn that into bytes, send the bytes manually and reconstruct the frame, probably all C++

dire cradle
#

It doesn't update in real time only when needed, it's a 8x8 grid that just displays which player owns which sector

#

Would it still have a large impact?

thin stratus
#

Yeah but why can't the player reconstruct that based on information of the game?

dire cradle
#

oh wait

thin stratus
#

Someone is making that image/render target already

dire cradle
#

yeah I guess that makes more sense

thin stratus
#

The others can do too

hollow eagle
#

There's no reason the server needs to generate the image for each client when they should probably have the info necessary to do it themselves anyway.

thin stratus
#

Yeah, that's more or less what I wanted to say, but I haven't had my second coffee yet.

#

Speaking of

dire cradle
#

Now I have another problem, this repnotify function runs on both server and the client without any problems

#

Update Decal is called on both successfully

#

But Update Map Target is for some reason only gets called on the server

#

Map actor exists on both the client and the server and is set to replicate

#

I tried tying it to Run on owning client/muticast events but it still only runs on the server

#

I'm out of ideas with why this isnt working

#

nvm restarting the editor solved it

dire cradle
#

is the gamemode set correctly?

#

if not the game won't know which class to spawn the player as

versed bear
#

Anyone got any ideas how to resolve this error?
NetworkFailure: NetChecksumMismatch, Error: 'GetObjectFromNetGUID: Network checksum mismatch. FullNetGUIDPath: [79]/Game/Blueprints/Player/Weapon/BP_WeaponMelee.[77]Default__BP_WeaponMelee_C, 560967494, 3906595487'
Both Server & Client are built with the same revision but it still doesn't match up for some reason.

thin stratus
#

What does that result in?

versed bear
thin stratus
#

Are both Client and Server also build with the same Engine?

versed bear
#

yes

thin stratus
#

Hm, not sure then. you could try to recook the project freshly in case you work iteratively

#

Check #packaging in case it's some standard mistake

#

Is this a GameMode or a GameModeBase?

#

Well, check the top right corner

#

Says ParentClass:

#

Hm okay, then that's fine

#

Asking cause you aren't allowed to mix up Base and non-Base of GameMode and GameState

#

Are there any errors or warnings in the log?

dire cradle
#

Might be caused by player starts or auto possesses?
I don't even use Player Starts anymore they were causing me headaches

thin stratus
#

PlayerStarts are fine. They shouldn't cause headache :P

#

Video looks like the client got spawned as a spectator

#

Check the World Outliner, do you get a different Pawn/Character?

#

Also MessageLog is not important

#

I meant the output log

#

Can it be that your Client is just too far in the floor and fails to spawn?

#

Open your Character and check for Spawn Collision Override

#

Set that to Always Spawn to check

#

If that makes them spawn then they might be too far in the floor

dire cradle
#

Just to be sure, does your level have the correct gamemode set?

#

yes

#

You need to set the level gamemode to yours

thin stratus
#

It spawned the native gamemodebase

#

And you probably have a character in your scene pre-placed that your Server grabbed?

dire cradle
thin stratus
#

Make sure you have no characters in your level that are set to auto posses

dire cradle
#

It should look something like this, set the gamemode override to your gamemode class

thin stratus
#

Okay, strange that your server got one

#

Isn#t that exactly what I meant?

#

That you have the Character in your level

dire cradle
#

That wasn't about multiplayer though, gamemodes are used regardless of it's multi or singleplayer

tender badger
#

i repped the location of the IK full-body while MultiPlayer
but now lost the Walk/Run animation from other player's view...

#

it won't automatically rep the Animation, right? then what should i do? Thanks!

chrome bay
#

Animation should all be running locally

#

You wouldn't want to replicate values for animation/IK

tender badger
#

ok, so in my situation, how should i do that

chrome bay
#

It should derive all of them itself

tender badger
#

ok, got it

#

derive?

chrome bay
#

Basically all animation should be handled locally, including IK. Shouldn't need any networking

tender badger
#

so i should rep the trigger(maye a bool) to start/stop animation

#

right?

#

ok, got it

unkempt tiger
#

Does anyone know what the atomic specifier actually does?

#

I'm noticing that UE4 is merging not-yet-sent values in my replicated property with more recent packets - aka it IS breaking up the serialization

#

even though I used Atomic, can anyone confirm if UE4 actually does this or not? And if there's a way to disable this behavior?

chrome bay
#

I'm fairly sure it does nothing at all tbh

#

If you really want atomic replication, you'd need to use NetSerialize

unkempt tiger
#

Damn, that's impossible for me to do

#

Because that would disable the delta serialization I need

chrome bay
#

If it's delta serialization I don't think it can replicate atomically by definition

unkempt tiger
#

I expected it to only send the values that changed

#

But it seems to be attaching them with previous values as well

#

Imagine a struct { int A, int B, int C } that's a replicated property

#

ugh, I don't know where I was going with that example actually

#

Wait, yes I do

chrome bay
#

The delta serialise will still send everything you write to the archive, it just means you have to track what is/isn't written yourself though

#

The engines' FFastArraySerializer for e.g. sends the whole item every time

#

It doesn't track or identify item-specific changes

unkempt tiger
#

🤔

chrome bay
#

I think Atomic only works when you're using the built-in UPROPERTY based serialization

unkempt tiger
#

I am

chrome bay
#

Or maybe it just forces the whole item to replicate as one

#

I'm not sure

unkempt tiger
#
USTRUCT(BlueprintType, Atomic)
struct MY_API FMyStruct
{
    GENERATED_BODY()

    UPROPERTY(BlueprintReadOnly, Transient)
    int A;

    UPROPERTY(BlueprintReadOnly, Transient)
    int B;

    UPROPERTY(BlueprintReadOnly, Transient)
    int C;
};
#

if FMyStruct is a replicated UPROPERTY in my replicated class

#

and I change just A and C, I expected the engine to send a packet that contains just the new A and just the new C, and the old B value remains

chrome bay
#

Ah I don't think so, if you mark it as atomic - it sends everything as one lump

unkempt tiger
#

Okay, and what if I disable the Atomic specifier

#

What happens then?

chrome bay
#

If you disable it, it'll only send changed properties

#

I.e. whatever changed at the end of the network frame

unkempt tiger
#

But that means then that A, B and C may not correlate to each other, right? If the engine sends say, A's value from some time ago but B and C values from a more recent packet?

#

for example assume my server code always makes sure that in the property, A == B == C

#

it could be that an arriving packet may have a case where A == B == C is false?

chrome bay
#

Only if that was the state of the struct at the end of a given frame

#

Here's some info from UDN:
Yes this is correct, structs and arrays are unrolled in the replayout by default. What you can do in order to treat a struct as atomic is to force it to use a custom serialzier, see FVector or FMovement for an example of how we do this.

#

So yeah, if you really want to garauntee the client will never have a state the server didn't have - it has to be replicated in one bulk atomically

unkempt tiger
#

what does 'unrolled in the replayout' mean here?

chrome bay
#

Essentially each UPROPERTY is treated as if it is a uprop of the owning object

unkempt tiger
#

Ohhhhhh

chrome bay
#

Just with an extra bit of info to identify it as belonging to that struct member

unkempt tiger
#

Got it... this makes sense, thanks a ton for the help 👍 👍

chrome bay
#

As far as I know though, actor properties are never split across multiple packets - either all changes fit into the buffer for that frame or none of them do

#

So if you change two properties within the same network frame, they should either both arrive at the same time or not at all

#

I might be wrong but I'm fairly sure that's the case.

#

Can't find any solid info though

unkempt tiger
#

Got it, I have some self exploration to do with this new info

livid sluice
#

Hi Guys, I have a weird issue. I'm new to this whole multiplayer thing but to my knowledge running on owning client should only run on the client right? But when I run this blueprint both client print the name of the object instead of the one actually overlapping it. What am I missing here?

#

Also the owning client runs twice, which does not happen in the standalone run

dire cradle
#

Begin overlap gets triggered on everyone, check if authority first

livid sluice
#

But the overlapping component is inside the ownling client only, why would everything get the trigger?

#

is it made to be like such?

dire cradle
#

Does the component get spawned client-side?

chrome bay
#

Clients can call/run "Client" functions themselves

livid sluice
#

The component is inside the player Called VisionRange. And the actors are spawned in. The items themselves are placed in the world but replicated.

dire cradle
#

Try adding has authority first before calling run on client

#

So the event only runs on the server and gets replicated to the owning client

livid sluice
#

Yea that worked, but I'm still confused why without it , it does not work

chrome bay
#

The components exist on every connection, and each client will overlap themselves individually.

dire cradle
#

^this

chrome bay
#

So each client is calling that client function, as well as the server calling it too

#

The owning client therefore gets it twice (once locally, once from RPC) - all other clients get it once (locally)

#

If a Client calls a Client function, it will just run locally

livid sluice
#

But since the overlap function called a run on owning client only, should it not only be called once?

#

Why is the RPC calling it as well

dire cradle
#

Always make sure its the server that calls the run on owning client

chrome bay
#

Because it's not run on owning client only

#

The Blueprint tooltip is lying

livid sluice
#

I see

chrome bay
#

Blueprint gets a lot of MP stuff wrong and this is just the tip of the iceberg

#

But it doesn't help itself tbh

kindred widget
#

Client 1 Pawn on Client 1 overlaps. Not server, can't RPC, plays function on client 1.
Client 1 Pawn on Client 2 overlaps, Not server, can't RPC, plays function on client 2.
Client 1 Pawn on Server overlaps, is Server, does not play the function locally, tells Client 1 to play function. Client 1 plays function again.

livid sluice
#

Oh dang. I see. I still have alot to learn I suppose. Thanks for all the help ^^

chrome bay
#

TL;DR if you call once of those "Client" functions on an actual network client, it will just execute locally.

#

If you call it from the server, it'll run on whichever network client owns it (or locally, if it's a listen server and the owner)

livid sluice
#

Thats why If calling a client function always run from the server first

#

Okay I think I get it now.

dire cradle
#

Yeah otherwise it will run twice

#

There was a great tutorial I saw on youtube about rpc functions, it's really helpful to understand ue4's replication system. It's hard to get it right by trial and error

livid sluice
#

Yea it is. Thanks again!

kindred widget
#

Is it possible to OnRep a TWeakObjectPtr? Having a bit of trouble with it.

chrome bay
#

does work yeah

kindred widget
#

Er. Forgot to specify I was trying to pass in the old value as well.

chrome bay
#

Although it is somewhat useless as it has to be a UPROP anyway

kindred widget
#

For instance, the following is causing undeclared identifier compile errors.

UPROPERTY(BlueprintReadOnly, ReplicatedUsing=OnRep_MyThing) TWeakObjectPtr<MyThingType> MyThing;
UFUNCTION() void OnRep_MyThing(TWeakObjectPtr<MyThingType> OldThing);
chrome bay
#

Could try making it const ref maybe

#

I thought I'd done it before but maybe not

kindred widget
#

Hmm. No luck.

meager spade
#

why is it a weak?

kindred widget
#

🤷‍♂️

meager spade
#

could it be made a normal pointer?

kindred widget
#

Hooked to too many things. Just went around it with an on rep hard pointer and set the weak pointer that's being used by everything else.

meager spade
#

i would have just removed the weak and updated the source code

#

it would not have broke bp's

kindred widget
#

Might try that in a bit.

stoic lake
#

why is the try get pawn owner cast failing?

chrome bay
#

The preview object isn't a pawn

#

Just a mesh

stoic lake
#

im working on a multiplayer game so getting the playercharacter wont work

#

as seen in this video this is exactly what he does

kindred widget
#

@stoic lake You don't fix it. See the dropdown box up next to the play button? Change that after opening PIE to an instance that isn't meant just for editor display.

stoic lake
#

Thanks it works! Not quite understanding why it works but it does :)

elder sable
#

Hi, are RPC the only way to have reliable replication ?

versed bear
thin stratus
#

Awesome

kindred widget
#

@stoic lake An AnimInstance is an object, like any other blueprint. But instead of being a visual one, it's attached to a SkeletalMeshComponent and has helper functions to get that SkeletalMeshComponent's Pawn like TryGetPawnOwner. In the editor you just have a display instance of this open for general purpose designing. But it has no Pawn owner to retrieve there. It would similarly fail if you use TryGetPawnOwner in an Animinstance that is on a SkeletalMeshComponent of an Actor base class instead of a Pawn/Character class.

short arrow
#

Can net cull distance squared work at the actors location, and not the camera ?

#

I believe by default net cull distance squared defaults to the camera and not the actor in the world

strong vapor
#

Ya that's right.. I don't think there's any easy way to change it.. but if you were real crazy you could change the source? Idk

livid sluice
#

Hey guys quick question. I have this capsule setup inside the player camera which inherits the player rotation. In the client the capsule rotates fine. But other clients are unable to see it, even though the replication is turned on. any reason for this?

chrome bay
#

You'll need to use GetBaseAimRotation

#

That includes the separately-replicated RemoteViewPitch

#

@short arrow You can override APlayerController::GetPlayerViewPoint() to provide a different location for relevancy.

livid sluice
elder sable
#

How do you handle a player reconnecting to a game, to synchronise all the states ?

chrome bay
#

If you set everything up properly it's done automatically

#

I.E; So long as stateful changes are replicated properties etc - join in progress should work just fine.

elder sable
#

Mhh ok but if i use properties, how can i handle the fact that notify functions are called before BeginPlay on actors ?

stoic lake
#

can someone explain to me why this code is faulty? on the right side of the screen im setting the itemheld variable to true and thats it.

#

its for equipping and unequipping your axe

chrome bay
#

It's inherently unreliable

floral crow
#

Hey guys, I want to ensure certain values get replicated with an Actor on the initial bunch. The important part is that BeginPlay or any RPCs that reach the client find the right values already set.

So far, I've used deferred spawning to set the values before calling FinishSpawning. I can't do this on pre-placed actors, so I need a different alternative. These values are not set in editor time, but rather from conditions defined on the Lobby level, so setting the values on the instance in the world hierarchy is not an option.

Is there a way to set values at run time on pre-placed actors and ensure these are part of the initial replication bunch?

lost dune
#

Hello , can someone help me for a simple issue , in #ue4-general

#

Please

round star
#

I have a capsule collision that the server uses to overlap foliage instances and replicates the results (everyone has the same instance) So I assume I don't need to replicate the location of the capsule collision, only the result of its overlap

rotund onyx
#

Multiplayer is so confusing...
How should I structure data so that I can display a list of player names and scores? I honestly have no clue how I should be passing data like scores around

shell remnant
#

PlayerState?

#

GameState

#

PlayerState holds the score, GameState holds an Array of Players. If you want to "update" to all clients, you can do it from the GameMode. GameMode holds all PlayerControllers. GameMode only exists on Server, GameState and PlayerState is replicated

rotund onyx
#

so for something more complicated like an inventory, where does that go?

shell remnant
#

Inventory for your player?

rotund onyx
#

yes

shell remnant
#

Pawn or Controller

#

Depends on your Inventory Lifecycle

#

If your pawn dies (is destroyed) does your inventory needs to be cleared aswell?

rotund onyx
#

If I needed a player to reveal their inventory to another player what then?

shell remnant
#

For my project I created an ActorComponent for the Inventory. The ActorComponent is in the PlayerCharacter itself

rotund onyx
#

how can I pass that information to another player then?

shell remnant
#

RPC

#

Remote Procedure Call

#

A server function which tells the server (GameMode or GameState) to reveal your inventory to a specific player

rotund onyx
#

sorry I'm having a hard time wrapping my head around this

#

I thought the players couldn't see each other

#

My (probably completely wrong) understanding of multiplayer was that players can only see themselves and the GM

shell remnant
#

on the client yes, but the server knows all the players (GameMode)

#

But you have an PlayerArray in your GameState

rotund onyx
#

I was under the assumption that for security I would want stuff like inventory stored in the GM so nobody can do any funny business

#

so I was trying to wrap my head around matching a player in a session to an index in my array

shell remnant
#

GM is the wrong place for an PlayerInventory

rotund onyx
#

I will be very happy if I'm doing that totally wrong

shell remnant
#

PlayerController would be the better solution

rotund onyx
#

because its hurting my head

shell remnant
#

Other players can't access your PlayerController

#

Search the internet for "UE4 Network Compendium". There is a great PDF which explains all the Game Classes for Multiplayer and how the pattern works.

rotund onyx
#

thats what my little understanding is from

#

I think its pinned in the discord somewhere too

lost inlet
#

it's pinned to this channel

shell remnant
#

Anybody here who used a datadriven approach for a multiplayer game? I'm holding my configurations for pickups, weapons etc in a PrimaryDataAsset and I'm wondering if there is a possibility for loading / unloading dataassets on server and client without having to replicate them. My DataAssets are holding data like meshes, sounds, effects etc.

round star
#

can replicated variables be passed by reference

rotund onyx
#

So the thing I'm trying to wrap my head around is like. If a player picks up a (replicated) item, I should be calling something on the server, then Multicasting to the clients. But I don't know what that actually looks like in blueprints, and I'm pretty sure its not as easy as just checking the "multicast" box

shell remnant
#

Client needs to call a Server Method. Then from the Server you're calling an multicast method

#

If you're already on the server, just call the multicast.

rotund onyx
#

what does Server Method mean in this context?

#

like cast to the GM and call off of that?

shell remnant
#

If your calling from a client (proxyclass on the local machine) you first have to call a method on the server, because only the server knows all clients and only the server can send / execute stuff on other clients.

#

Then from the server you need to call a multicast method which executes a method on all clients (or the clients you need)

rotund onyx
#

does the server event need to be in the GM or can it be anywhere?

shell remnant
#

in the class you want. The class needs to be on the server. Read the Network Compendium to see which class stands for what. This will probably solve some problems.

rotund onyx
#

How will I know if a class is "on the server"

fading birch
#

classes themselves aren't specified like that

#

you can "spawn" a class on the server only

#

that's how the gamemode is handled

shell remnant
#

Please have a look at the network compendium. Some classes are only in the Server (GameMode) some classes are only on the Server and owning client. Some classes are replicated to all clients

fading birch
#

it doesn't spawn on clients, it only exists on the server.

#

if a class is marked as replicated, say an actor, then when it's spawned on the server, it will also be spawned on all clients.

rotund onyx
shell remnant
#

if you wanna know if a method is called on the server or client, use the GetLocalRole() methods etc.

rotund onyx
#

networking concepts and actual application are different beasts

rotund onyx
hollow eagle
rotund onyx
hollow eagle
#

did you read page 62 (and subsequent pages)

#

because it answers your question

#

I don't know how much more clear I can be

shell remnant
#

Every Actor which is replicated has a client and a server version. Thats the reason it's replicated.

#

You need to check if you're currently executing code on the client or server. Then you need to call the needed methods.

rotund onyx
#

so to properly multicast an event, and pass data around properly, I should be doing something like this?

lost dune
#

Can somone show me how to execute an event ONLY server side , and another one ONLY client side

#

please

rotund onyx
hollow eagle
#

You can call a server event from a client only if the client is the owner of the actor

#

multicast events can only be called from the server

#

assuming your client owns the actor, what you posted is correct.

rotund onyx
#

awesome

hollow eagle
#

Similarly, client events can only be called from the server and only the owning client will receive them.

rotund onyx
#

is my authority switch correct, or should it be the other way around?

rotund onyx
hollow eagle
#

You could use them that way, sort of as an asynchronous return. That's not really what they are though (just one way they can be used).

rotund onyx
#

ah ok

#

I am a bit fuzzy still on how the Switch Has Authority works versus checking if a PC is local or not

#

namely I don't really understand why I need to check. wouldn't a server rpc just not work if the client didnt have authority? Why do we need to check first?

#

and when in the PC what is the difference between the two?

#

these two

lost inlet
#

if you were hosting a listen server, you would have authority AND be a local controller

rotund onyx
lost inlet
#

no

#

because on a dedicated as a client, you'd be remote and a local controller. the server wouldn't return true for is local for any PCs

#

a client doesn't know about other PCs other than their own

rotund onyx
#

when is it important to check?

lost inlet
#

depends what you're doing

rotund onyx
#

Obligatory: I don't know what I'm doing!

#

I'm not really sure of an example to give

lost inlet
#

authority is basically "am I the server?"

rotund onyx
#

and local just checks if we're two connections from the same machine as the server?

lost inlet
#

is local controller is asking if you are the controlling client of a specific player controller

rotund onyx
#

so I guess its important for casting?

lost inlet
#

?

rotund onyx
#

when would I use that?

lost inlet
#

on a dedicated server, AI controllers would return true for IsLocalController(), player controllers would return false.
on a listen server, the host's player controller and AI controllers would return true, all others would return false

rotund onyx
#

ah ok that makes sense

#

but when would I want to check?

lost inlet
#

like I said before: depends

rotund onyx
#

and how would I allow remote players to make server calls when needed?

#

or is that bad practice

lost inlet
#

remote players can always call server RPCs via their player controller

#

you can call server RPCs on any actor as long as you're the owner

rotund onyx
#

so I should use Switch Has Authority if I want to skip calling the Server RPC on a listen server?

lost inlet
#

switch has authority is pretty much pointless in a server RPC regardless of setup

rotund onyx
#

what is the intended use of the node then?

lost inlet
#

for telling you if you're the server or not outside of the context of RPCs

#

one exception might be for multicasts where you might want to skip something that's already been run on the server

#

but it's networking, it can be complicated. our source is scattered with HasAuthority() or checks against Role

rotund onyx
#

ok well I think I have enough to go and start testing things out (and converting bad blueprints to nice multiplayer ones)

#

thanks everyone for the help

lost inlet
#

I don't have as much patience for doing networking in BP, usually prefer to do it in code

rotund onyx
#

the flowcharts help me read personally

#

I also dont really understand C++ syntax so it would be another layer on someone who is already sketchy with programming, lol

lost dune
#

No one? i'm stuck.

elder sable
lost dune
#

i have also tried to replace the "is server branch" by switch has authority

#

same result

#

the Client side event is called two times

#

i want it to be called one time

strong vapor
#

Throw in a Do Once node!

lost dune
#

Good idea thanks , but i want to know how it works because in the future i don't want replicated events to be called two times

lost inlet
#

I would ask to see more, and I don’t know what context this is in. Is it an actor?

#

And is there only one instance of that actor in the world if it indeed is one

#

Is that the only reference to that function too?

#

How are you testing it? Single client in play as client mode?

upbeat marsh
#

I'm making a turned based multiplayer game. When I click on AI character units I want a way of communicating to the HUD that some are ally units and others are enemy.
GameMode has the information on the spawned units (and is all server side)
I've been banging my head against google to find a bridge between GameMode and client PlayerController. I need to somehow either give each unit a reference to the PlayerController or give a Team reference to PlayerController to compare when displaying the HUD.

#

The only standard suggestion that I've been able to find is using GameState to get access to PlayerController when in GameMode. That hasn't worked

#

Please someone put me out of my multiple hours long misery

fossil spoke
#

Why dont the AI Units themselves know what Team they belong to?

#

What is a "Team" to you?

#

For example you could simply store a Team as an ID.

#

uint8 TeamId

#

That gives you 256 Teams

upbeat marsh
#

The units know, but the PlayerController doesn't

fossil spoke
#

Well if the Unit exists, then the PlayerController can just iterate over them and find all of their Teams.

#

The Unit is an Actor, the HUD itself could find their Team.

#

By querying the Actor that is the Unit?

upbeat marsh
#

How do I give the PlayerController (which is what triggers the change in HUD from unit to unit) a Team?

#

Without a Team the PlayerController doesn't know if it is the same as any of the units

fossil spoke
#

Depends on how you have implemented your Teams.

#

If it was an ID, like i posted above. Just let the PlayerState hold onto it.

upbeat marsh
#

Team is an object that contains an array of units

#

(among other things)

#

But since the Teams are on the GameMode how can I communicate it to the client side PlayerController?

fossil spoke
#

Well for one I wouldnt let the GameMode hang onto Teams.

#

GameState or a dedicated manager Actor should deal with the Teams.

#

So that all Players have access to query them.

lost dune
#

@lost inlet These events are in the BP_inventory which is contained by the BP_character , there is only one instance of this actor ( i have verified with get all actors of class ) , yes it is the only one reference to that event i have verified , And i am testing it With separate server and run under one process with two clients.

lost inlet
#

So you gave 2 characters and wonder why it’s running twice? Hmmm

lost dune
#

No , there is only one character because i connect the first client to the Server world ( not the second) and the character is spawned at the beginplay of the gamestate

#

and i don't connect the second client online ( for testing)

upbeat marsh
# fossil spoke So that all Players have access to query them.

I can try moving that logic around in that way. The game all works as it is right now, which makes me nervous of making large changes in structure. Is the consensus that communicating from the GameMode to the client PlayerController is either not possible or too stupid?

lost inlet
fossil spoke
#

Its not impossible, but there is just a clear design issue with how you want to use your Team system and how you have implemented it.

lost inlet
#

Seems a weird technical design at any rate, how’s the game state doing all of this?

fossil spoke
#

Dont be afraid to refactor systems. Especially those that have issues.

lost dune
#

I mean gamemode sorry mistake

#

here the character is spawned and possessed

#

and in this character , the inventory is spawned server side and replicated

lost inlet
#

Uh the client is authoritative over spawning their own inventory?

lost dune
#

Someone here said me everything have to be spawned server side , and automatically replicated

fading birch
#

you can run ForceNetUpdate() to force it to replicate it

#

from the server

lost inlet
#

No idea why it isn’t just a component

fading birch
#

You only need to spawn an actor server side if you want other clients to see it.

lost dune
#

so i should spawn it at begin play , beginplay will execute on both server and client

fading birch
#

Otherwise, you can spawn it just for the owning client, from the server

#

yes, you can just check the role of the actor in begin play, and only spawn it if the actor has authority

#

if it's marked as replicated, then the clients will also get it after it's been spawned

lost dune
#

ok

#

i remove this server event

lost inlet
#

Well if it was a component you can just add as a component of your pawn class, no spawning code needed

lost dune
#

As a Object reference variable?

lost inlet
#

? I mean just as a component

#

In the pawn BP you can add a component from the top left

#

Components can also replicate

lost dune
#

The inventory is BP clASS

lost inlet
#

And?

lost dune
#

cannot add a BP object as a component , need to spawn it and promote to variable

lost inlet
#

???

lost dune
#

no?

#

You mean a child actor?

lost inlet
#

No, you can make a BP class derived off of ActorComponent and you can add that to your character BP without having to spawn a whole other actor

#

Much easier than it being a separate actor you have to manually spawn in a questionable manner

lost dune
#

Ok i try it

#

Thank you

whole urchin
#

how do i call an RPC from server for owning client only ? in C++

lost inlet
#

did you read the compendium?

whole urchin
#

no

dull lance
#

if you're already on server, just have a given object call a UFUNCTION(Client) void Function() method

#

but yeah, read the compendium thingy

whole urchin
#

does it have C++ ?

lost inlet
#

it gives you a primer on basic networking stuff in BP and C++

whole urchin
#

😮

lost inlet
#

even though it calls it "UE++" which I hate

dull lance
#

UE++

#

UE++

#

UE++

fading birch
#

still pretty accurate imo

#

UE's flavor of C++ is not normal C++

#

you don't need to worry about a lot of things you normally do

whole urchin
#

i'll read it, thank you

fading birch
#

petition to rename #cpp to #uepp

lost inlet
#

it literally is, there are definitely other projects that use macros and code generation

eternal canyon
signal lance
#

Whenever I hear UE C++ or UE++ something dies inside me

#

Only special things are macros but other projects have it as well (UE has the header tool which is the only non standard thing)
If I made my own GC system in non ue project using C++ it doesn't automatically turn it into BlueMan++, it's still plain old C++

quasi tide
#

That said, BlueMan++ when?

signal lance
lost inlet
#

but off topic

gleaming vector
#

plus the codegen is special

signal lance
# gleaming vector UE technically relies on some UB in places

True, stuff like UClass are generated with the help of the UE specific build tools, and linking properties and reflection, etc...
And things like generating stuff for blueprint functions, etc...

But that's still not something that's impossible without UBT/UHT
It would still be possible with some heavy boilerplate code so I would still consider it being plain old C++

#

With UE specific helpers

gleaming vector
#

well, also, UPROPERTY pointers can be made nullptr

#

thats very hard to do in iso cpp

fading birch
#

hey erm mods

#

gottem

signal lance
#

😅

gleaming vector
#

technically this convo is on topic for #cpp 😛

fossil spoke
#

Banned

white smelt
#

hey guys i have a problem

#

when i enter splitscreen, i dont see the other character on both screens ?

thin stratus
#

That's not Splitscreen?

#

That doesn't even look like you started it with a proper netmode

#

Select "Play as Listen Server" or "Play as Client" depending on what you want

white smelt
#

Danke ?)

#

🙂

#

thanks

#

Gracias

#

Merci haha

mellow stag
#

Hello! I am confused with how to get playercount from steam advanced sessions

#

This logic doesn’t work

kindred widget
#

@mellow stag Haven't used the plugin personally, but it looks like it should work. How are you testing?

bitter swift
#

I have 2 functions here. One is C++, the other is in Blueprints

From my experience this should be exactly the same. However, when I call them on a client they only work for blueprints.
The C++ is unable to be called and multicasted from clients.

Why is the C++ not working?

stoic lake
#

does the animation blueprint run on the client or the server?

#

Sorry didnt mean it as an answer on your question

#

just a question for myself

bitter swift
rough kestrel
#

I have a map that can be played by 2 players. How do I switch to a single player mode where the second player is a bot? I still wanna host on server for spectators.

steel fox
#

How bad is to have thousands of always relevant replicated actors in my level?

rough kestrel
chrome bay
#

Thousands of always-relevant actors will likely be unplayable. Why would you have that many in the first place though?

#

Fortnite has it, but they make heavy use of dormancy to support it.

potent cradle
#

It seems like my pawns never get destroyed when they go out of net cull distance. Is there some sort of setting I might have inadvertently changed to produce this behaviour? They stay frozen in the spot where they were last relevant.

chrome bay
#

If it's replication graph, you don't get the destroy packets until you go back into range IIRC

#

It changes the way it deals with that

potent cradle
#

Yep, repgraph

#

Hmmm 🤔

#

How do you work around that?

chrome bay
#

Seem to remember seeing something like that anyway

potent cradle
#

Yeah I'm getting a vague flashback now that you mention it.

#

Did you change something for HLL in this regard?

#

Or not a problem in your usecase?

chrome bay
#

Can't actually recall, I'll have a quick look

#

Ah it looks like we have a console var to control it, and set it a lot higher than the default to cover our entire map

#

It is configurable somewhere.. one sec

#
    float DestructInfoMaxDistanceSquared = 15000.f * 15000.f;```
#

Wouldn't be surprised if they nuked that in a more recent version of repgraph

potent cradle
#

I actually already have:

#

DestructInfoMaxDistanceSquared = abs(FVector::Distance(WorldMax, WorldMin)) * abs(FVector::Distance(WorldMax, WorldMin));

chrome bay
#

Check out UNetReplicationGraphConnection::ReplicateDestructionInfos

potent cradle
#

Hmm, but. The actors don't get destroyed on the server to begin with, so why would it send out a destruction packet?

chrome bay
#

Looks like you can set bIgnoreDistanceCulling per-actor

potent cradle
chrome bay
#

Yeah relevancy closes the actor channel, or at least it should

potent cradle
#

Hmmm

chrome bay
#

Ah wait

#

OutOfRangeDistanceCheckThresholdSquared

#

That might be the one

#

You know what, I don't remember anymore 😄

potent cradle
#

If only there were docs 🤣

#

I don't see it actually being set anywhere, so I guess it's 0.0f by default, and thus ignored

#

This OutOfRangeDistanceCheckThresholdSquared

#

Lemme attach a debugger

#

OutOfRangeDestroyedActors never seems to populate 🤔

#

Remains empty

#

Yeah relevancy closes the actor channel, or at least it should
This is something that I can't seem to find in the source, so maybe that's not happening and the mentioned destruction really is just full on destruction, not just destruction when out of range.

#

Or I'm totally missing something, also highly possible.

#

Is "dormant" the right terminology for these actors? As they go outside of relevancy range? Or does dormant only refer to actors you set as dormant?

#

Because there is this thing: CVar_RepGraph_DormantDynamicActorsDestruction

#

Nope, not it either. Turned on the debug, nothing being printed.

chrome bay
#

Yeah it's not dormancy, that's separate - dormancy does close the actor channel but doesn't destroy the actor

#

If it's any consolation, I don't seem to have this issue in another project of mine. When the actor goes out of relevancy range, it's destroyed (and it is a subclass of pawn)

potent cradle
#

Mine are defaultpawns

#

But I can't imagine that's it

#

This whole thing is getting stranger by the minute

potent cradle
chrome bay
#

Yeah, just check HLL too - both projects are using rep graph and the actor is cleaned up/destroyed when it goes out of relevancy range

potent cradle
#

Okay, that means it should be something with my configuration 🤔
Where is the point in the code where it sends that packet, that leads to your pawn being destroyed?

chrome bay
#

Oh wait

potent cradle
#

the plot thickens

chrome bay
#

It's in ServerReplicateActors

#

ConnectionActorInfo.Channel->Close(EChannelCloseReason::Relevancy);

#

Bear in mind this is 4.25

#

But in ServerReplicateActors there's a whole section under

            // Handle stale, no longer relevant, actor channels.
            // ------------------------------------------    ```
#

Actors that are NetStartup are ofc not destroyed/closed

potent cradle
#

(Net Load on client)

#

This is indeed a preplaced pawn that I am debugging

chrome bay
#

Yeah

potent cradle
#

I'm not spawning it

chrome bay
#

Preplaced won't be destroyed, that'll be the problem

potent cradle
#

The heck

#

🤔

chrome bay
#

They never are

potent cradle
#

So how do you work around that?

chrome bay
#

You never want a pre-placed map actor to be destroyed because of relevancy

#

Spawn them 😄

potent cradle
#

That means you can never have pre-placed pawns?

#

That's so strange

chrome bay
#

Yeah

#

Anything serialized into the map is presumed to be required for the map to function

#

That's both with and without rep graph

#

In-map actors are never destroyed because of relevancy

#

But in MP, you'd rarely if ever have pre-placed pawns anyway

potent cradle
#

Spawning them is a bit of a pain, but whatever

#

:\

#

Lemme retest this

chrome bay
#

If you explicitly destroy it on the server, it will destroy client-side when you come into that 'destruction infos' range

#

That's what the destruction range stuff is for, and that part IIRC is unique to rep graph

#

But yeah, pre-placed is never destroyed from relevancy

potent cradle
#

Goshdarnit, that seems to be it indeed.

#

Well, TIL I guess

#

Thanks Jambax 🎩

chrome bay
#

tbf was a helpful reminder for me anyway 😄

#

Also found that one of my net cull distances was set to 10KM instead of 1KM so wins all around

rain coral
#

Hi, we're having a mindboggling issue. After server traveling, the client sometimes end up in the new level and never receives a gamestate (it's null). Whenever that happens, the FMOD music of the level also doesn't stop when the client returns to the main menu. So this makes us consider whether somehow the old world never unloads properly in those cases, and the gamestate we're trying to get is from the old world. But we don't know how this happens, if that's what actually happens, or if it's something else.

Does anyone have any tips on what to try to debug this?

#

This happens when testing it over Steam.

chrome bay
#

Are you travelling to the same level or a different one?

#

The engine does have one bug I know of, which Epic hasn't had a fix for until UE5. If the Server travels to a level the client is already in, it get's completely confused.

#

Usually results in crashes, but might create some other obscure errors too

violet sentinel
#

does it happen if server is slower than client on executing travel / loading level?

chrome bay
#

I don't think so

violet sentinel
#

good

chrome bay
#

It's just if the client is already in a "map01", and then you server-travel to "map01", the clients seem to get very lost

#

I guess the fix is ship a game with more than two levels 😄

#

We bugged Epic about it for a while in UE4 but they couldn't come up with a fix, apparently in UE5 it's solved but I'm yet to try that out

violet sentinel
#

i'm trying to enforce lobby > game > lobby > game

chrome bay
#

yeah

violet sentinel
#

because lobby > game > game > game seems weird, if players disconnect there we do not allow reconnects

#

and every next game with less players seems menaingless

chrome bay
#

Right sure, yeah in our case it's just a never-ending cycle of maps once you join

#

But yeah gave us big headaches when we only had one/two maps, or two of the same map next to each other in rotation

violet sentinel
#

i've had too many troubles with players joining to already running match , maybe because i don't have enough experience with mp yet idk

chrome bay
#

It can be tedious but so long as you stick to the golden rule of using replicated vars for persistent state and not multicasts/RPC's it's usually ok

#

But you get all kinds of different race-conditions etc. when joining in progress sometimes 😄

violet sentinel
#

i have troubles with people wanting everything be nearly realtime on client

#

so some things spawning were made on multicasts despite it being not very good practice causing troubles

chrome bay
#

Ah yeah, that's probably it then

#

Trying to track that for join-in-progress is a pain

rain coral
#

@chrome bay Omg yes you're right, it only happens when going to the same map. Thanks!
Would you recommend traveling to a intermediate map, and then back again to the level? We need to switch the game mode, so afaik there needs to be some server travel for that

chrome bay
#

It's tricky, I know we're not using a transition map but it couldn't hurt to set one up

#

The real problem seems to be that if the server loads the "new" map before the clients have all left the "old" one, then the clients get stuck

#

And they either crash straight away, or they think they've loaded the new level when in fact they haven't - and crash at some point down the line 😄

rain coral
#

Oh no :(

chrome bay
#

But yeah it's a nasty bug, and for some reason seemingly not acknowledged anywhere public that I can find

rain coral
#

Yeah, I googled the issue and seems like no one have run into it, for some odd reason

chrome bay
#

I think the issue stems mainly from UNetDriver::IsLevelInitializedForActor

#

It checks the UWorld package name, and if that world has been initialized and matches, they think they're already in the right world.

#

Might also be worth checking for GetObjectFromNetGUID: Attempt to reassign read-only guid in the LOG when you do get the error

#

This was the issue we had:

The server travels to another map (the current match ends) while the client is still loading the previous map
The client soft-locks after finishing loading the original map```
#

IDK, there's a few age-old reports I can find but none of them seem to have a resolution

elder sable
#

What s the best way to display a replicated value on the HUD, by using the hud on the rep notification or binding a delegate then broadcast ?

chrome bay
#

Either tick the HUD, or broadcast a delegate IMO.

#

Tying them together directly makes it harder to separate/redesign later.

rain coral
#

@chrome bay Thank you, I'll look for that in the log. And it sounds scary to use a transition map too then..

elder sable
#

Tick ? Why ? It will process even when the value doesn t change then

chrome bay
#

Ticking HUD is rarely a bottleneck tbh, if at all - but it's considerably easier to deal with in MP

#

Delegates are fine too, but they have their own overhead - especially if they are dynamic.

elder sable
#

So you think tick is better than a dynamic delegate ?

chrome bay
#

But having gamecode talking directly to HUD, IMO, is bad code design

#

Definitely tbh

#

Really depends how much work you're doing

elder sable
#

Ok, i saw that in the GAS sample project

chrome bay
#

If all it's doing is updating a bit of text, it's not even worth worrying about

#

If it's rebuilding an entire panel, then probably make it event-driven instead

elder sable
#

And for a delegate, where do you bind it ? Since you have to wait the postlogin ?

chrome bay
#

Depends I guess, what I tend to do is broadcast global delegates when certain actors become available on the client - but i also have the HUD look for them it it's own initialisation.

#

That way it doesn't matter which arrives first

elder sable
#

Ok, thanks !

rain coral
chrome bay
#

IMO a great metric for how well UI code is designed is how easy it is to remove it from the game, if you can just delete the UI and don't have to touch the game-code - all is good 🙂

#

But that's just like.. my opinion man 😄

chrome bay
rain coral
#

Ah okay!

rain coral
#

@chrome bay I notice UE4 has an own setting for 'Transition map' under Maps & Modes. Is that the one that comes with the aforementioned issues where clients can get stuck?

chrome bay
#

Ah not necessarily, we're not using one.

#

It might help to circumvent the issue though, if all clients are forced to travel to a different map before the current one

rain coral
#

Ah okay, so just assigning some empty map there might not lead to the case where the server travels to the new map before all players have traveled to the transition map?

#

Will give it a try at least

chrome bay
#

Yeah I honestly don't know

rain coral
#

Looking good so far, the issue isn't appearing. But I've yet to really stress test it on lots of clients

peak star
#

I get bad rubberbanding over internet when my characterpawns have max walk speed of 4000 for the entire game. It is still there but not nearly as bad when max walk speed is 200 for the entire game.
Anyone have tips where to start troubleshooting?

peak sentinel
#

4000 is big enough to let CMC get suspicious about player is cheating

#

You move too fast and your distance between server updates is growing, and CMC thinks "hey this dude is cheatin"

#

Since client moves very ahead of server

#

Thats my idea though, not sure

#

I'm not very experienced with CMC

kindred widget
#

There are correction settings for that.

peak star
peak star
kindred widget
#

Mess with these. They should help with that if you set them much higher. More distance before harder corrections.

nimble parcelBOT
#

:no_entry_sign: Weexer#5876 was banned.

hushed mauve
#

quick question, can i call an event that has no replication flags for example in the character from an actor that has no owner?

#

i guess no, but correct me if im wrong

dire cradle
#

Depends on the use case

hushed mauve
#

so i just need to call the event, when i need some replication things eg set owner then i make a function in the character for that

#

so i just need to know if i can call the function that is not replicated from an unowned actor

dire cradle
#

You want to call a non-RPC event from an unowned actor?

hushed mauve
#

yes

dire cradle
#

As long as the actor exists on the client it should work

hushed mauve
#

ok that was my question

#

im good at replication but at some points still confused

vital karma
#

This works BP for movement for my character works fine on the client but when i try it for multiplayer, walking and jumping is fine but when i try sprint the animation starts and then stops really quickly and the character doesnt go any faster. and on other clients screens the player is just walking without the glitchy run animation. is this the wrong way to do sprinting for multiplayer?

dire cradle
#

You're setting the Max Walk Speed in the client,

#

Make sure it's the server that sets the Max Walk Speed

lost inlet
#

damn, movement in BP is brave since you can't use the CMC prediction with it

vital karma
#

does that need to be sever replicated somehow?

dire cradle
#

Yeah

vital karma
#

so, do i make speed server replicated or something else

dire cradle
#

Your client changes its max walk speed but the server is the one that manages movement, for the server the characters max walk speed didn't change

#

You need to change it on the server

#

You can create an Run On Server event called "Change Max Walk Speed" or something

#

and use that instead

kindred widget
#

It's much easier just to make a server set replicated bool or enum and change speed for all movementcomponents in the OnRep.

vital karma
#

ok i thought there was more to it since just making the variable replicated doesnt work

#

is replicated the same as static in c++? in a global context

vital karma
#

like only 1 instance of a replicated thing

kindred widget
#

Replicated means that the network will poll actors and their components set to replicate for their replicated marked properties, and if they've been changed, it will send the new value to clients.

lost inlet
#

though you have the fancy push model replication now if you want to manually tell the replication system a property has changed rather than polling each net update

#

there's a cvar to make BP properties use it

shell remnant
#

Hi there, Does anybody know, why my actors have different locations on Server & Client. I spawn a new actor, AttachToComponent and do the SetActorRelativeTransform. Actor replicates to clients but the actor is way off the location it was set

vital karma
#

hm now the other client sees the charcter running round just fine but on the running characters client it looks like the character speeds up but is still doing a jittery sprint/walk animation

shell remnant
#

@vital karma How do you let the character run? MaxWalkSpeed?

vital karma
#

its just always walking but it when sprint is pressed the character movements max walkspeed is set to a higher value

#

and the run animation is played when the players speed is above a certain thing

dire cradle
vital karma
#

ok ill check if something like that is happening

dire cradle
#

is it peer to peer or dedicated server?

vital karma
#

dedicated rn

#

if its peer to peer then the main client runs fine

dire cradle
#

Try setting the movement component replicated and when setting max walk speed set it from a Run On Server event

vital karma
#

but the connecting client runs dumb

shell remnant
#

For this I have a CharacterMovementComponent which overrides GetMaxSpeed method

#

Then I have a Property bIsRunning. If "SHIFT" is pressed I set the variable (if on client I will make a Server call)

#

the CharacterMovement Component returns another MaxSpeed if bIsRunning == true

vital karma
#

i just have this and then the event changes the max walk speed to either walk or sprint speed

#

and its a run on server event

dire cradle
#

is Character Movement Component replicated?

vital karma
#

Network Always Replicate Transform Update Timestamp?

#

or Component Replicates?

#

neither are checked btw

dire cradle
#

component replicates

shell remnant
#

is SprintSpeed and walkSpeed replicated?

mellow stag
#

Anyone here familiar with Advanced Steam sessions, I can't get the playercount to work.

vital karma
dire cradle
vital karma
#

o

dire cradle
#

Set Movement Component to component replicates and try again

vital karma
#

no work :(

#

exact same as before

vital karma
dire cradle
#

Then the max speed isn't getting set properly on the server

vital karma
#

the other client sees the player running faster with animation

#

thats how i set it

dire cradle
vital karma
#

isnt that the same but with 2 events?

dire cradle
#

Just created this to test it and it works fine on dedicated

#

Character movement is set to component replicates

#

Everything else is default

vital karma
#

ill try that one first

sinful tree
#

Ideally, you wouldn't let the client set the walk speed at all, as it opens a means for players to attempt cheating. Eg. If you let the client tell the server what the walk speed should be, then the client could potentially spoof in a value that isn't what you're expecting. So if sprint speed is supposed to be 4000 normally, a player could potentially spoof it and make it 6000, or 6000000.

dire cradle
#

You'd create an enum or bool that determines if the player is sprinting walking crouching etc

#

and the server would set the value instead

#

But if cheating isn't a concern it's still fine

vital karma
#

ive tried the second example you sent but it gives the same result, player moves faster on client but animation and movement is still jittery, for the client everything looks fine

dire cradle
#

Yeah I missed a node there

shell remnant
#

does your animation blueprint uses custom properties?

dire cradle
#

client should also set the value on its own too

vital karma
dire cradle
#

Or if the server is managing the values it would run a "Run on owning client"

vital karma
#

wait isnt the "run on server" supposed to change the server value and propagate that down to the clients?

shell remnant
#

Variables you defined in the animation blueprint or if the blueprint is using your properties from the character pawn

vital karma
#

then yes it is using those

dire cradle
#

When the variable is replicated yes but in this case it doesn't update it on clients for some reason

shell remnant
#

are these replicated?

vital karma
#

nope

dire cradle
#

yeah those don't need to be replicated

vital karma
#

o

#

also i tried the SetMax event as both run on server and owning client, the former is what ive been using before and it gives the jittery movement and the other client sees the player sprinting normally, owning client gives jittery without a speed increase movement but the other client sees the player walking not sprinting

dire cradle
#

The one Datura posted should work fine in this case though

vital karma
#

ill try that one then

dire cradle
#

it's the same only difference being the client sets the value on it's own as well

#

I was talking about something like this if you don't want to set the value locally

#

ideally client shouldn't give the values to the server

vital karma
#

i would prefer that but cheating isnt really something im worried about, im just trying to learn multiplayer ue

#

altho i would prefer to be doing things the correct way and this doesnt seem like it, it works btw thanks

sinful tree
#

One of the foundations of learning multiplayer, is never trust the client.

vital karma
#

lol ive made ch34ts before so i can understand this :D

#

how can i make sure that the owning actor of my movement component is replicating?

#

wouldnt that cause the movement component to not replicate if the owner wasnt ?

dire cradle
#

Characters replicate by default

vital karma
#

mine looks like that :)

kindred widget
#

It's also worth noting that while good net code can slow down cheating, you can't fully prevent it without client side software. Which is why things like EasyAntiCheat exist. 😄

vital karma
#

o

#

does epic own easy anti cheat?

kindred widget
#

Technically I think. Company out of Helsinki if memory serves, but I think Epic bought them out.

vital karma
#

as epic games do

#

anyways seen as i dont need anticheat or even cheat protection in anyway ill go with the method of setting max walk on client and server for now, might fix it later thanks guys :D

gleaming vector
#

it's also free

#

all you have to do is sign up for EOS and you get EAC for free

vital karma
#

wtf is a world context obj? is it just an object that is inside a world or wut

fading birch
#

it's something that exists in the world

#

ie, an actor that is spawned in

vital karma
#

used for context?

fading birch
#

correct

#

it uses the actor to get the context of the world

vital karma
#

i thought so but then the drop down had literally every object in my project so i got confused, thanks :D

fading birch
#

WorldContext basically is a pointer to GetWorld()

lean socket
#

The dedicated server crashes, with the following in the log file. I see the value to adjust that it mentions in the project settings, however, i'd like to know why this is happening. It seems to happen once I have a 5th person log in. Any ideas? Thanks

chrome bay
#

Looks like a massive leak of UObjects

#

Over 2.1 million UObjects

lean socket
#

How would I go about debugging this? What could be causing this? In short, i'm just not sure what the problem is.

lost inlet
#

would help to have symbols on your running server

#

but as long as you have symbols, look at the crash dump

#

you are likely doing something very bad if you exhaust UObjects with 5 players

lean socket
#

"Exhaust UObjects" ... does this error mean that i'm creating more than 2.1million UObjects? Sorry for silly questions.

lost inlet
lean socket
#

If I create 1 UObject on client, does this same UObject get created on server? In other words, if a hundred clients create 1 UObject each, does the server have 100?

lost inlet
#

that's not how it works

#

if your running server had the PDBs with it, you'd get a readable callstack

#

instead of just UnknownFunction

lean socket
#

Great, thanks for the info, really appreciate it.

fading birch
#

was this in a packaged build?

#

or were you running a server locally @lean socket ?

lean socket
#

This was a packaged build running on AWS. @fading birch

fading birch
#

I would pull the crash minidump, load it up in VS on the same build as that server and debug it

#

assuming you built it on your local machine, if you didn't, then you'll need to pull the server.exe and the server.pdb from your build server.

lost inlet
#

Our development servers always have the symbols since it’s easier that way

fading birch
#

agreed same

#

makes it nice for sentry too

#

I still pull crash dumps though, as sentry unfortunately does not include the callstack info and just the trace :/

lost inlet
#

We use Linux servers too so it’s even easier, not even tried debugging a Linux server crash dump. I imagine you could though through WSL

shrewd tinsel
#

can i just rpc to server on tick if its not reliable?

lost inlet
#

Yes?

shrewd tinsel
#

yes?

#

i mean is it going to break something, i know in theory i can

lost inlet
#

Completely depends on context

shrewd tinsel
#

send a bunch of variables

#

floats n enums

lost inlet
#

If just the idea of sending an RPC to the server each frame on its own probably won’t

#

But you might want to consider throttling the rate it sends

shrewd tinsel
#

aight

#

but if its unreliable, does the server choose to accept it or not?

lost inlet
#

High frame rate clients can end up saturating their available bandwidth if you do it literally every tick

shrewd tinsel
#

and it should kinda go on its own pace to not throttle or am i wrong?

lost inlet
#

Huh? “Choose” to accept?

shrewd tinsel
#

if its unreliable not every rpc gets through right

lost inlet
#

Yes but that’s usually due to something like packet loss rather than a software process of choosing

shrewd tinsel
#

i see

#

how would i go about syncing camera rotation/ animation variables from client to server (so server can replicate to other clients) ?

lost inlet
#

A client is going to have authority over their animation?

shrewd tinsel
#

yes, like is he aiming or sliding

lost inlet
#

Why would you do that on tick rather than that event happening?

shrewd tinsel
#

i need to get camera to sync as fast as possible anyways

#

so i have now an event that sets those variables on server, then they replicate

#

but thats alotta rpc

#

but i would have to rpc reliable if i want to change those vars on event

#

and that would throttle network surely?

#

if theres 10 people sliding and aiming n stuff

proud arch
mellow stag
#

Anyone having trouble getting playercounts for a session?

granite badge
#

has anyone here encountered an issue in 4.25 where sometimes when a client loses connection the server crashes?

lost inlet
#

Nope, do you have a callstack?

versed bear
fluid summit
#

Hi! If i am doing a multiplayer where only the user data interacts, is it okey to make it serverless and go with a login and a database?
Am i missing something?

proud arch
proud arch
fluid summit
proud arch
# fluid summit Not, kind of like a dedicated server. I want to make something like a gacha game...

you could made your mini network interface to communicate your game client with the database server using just web request from ue4, but maybe you could get problems with lost packages, connection errors and other things to think in the connection layer, but is possible just need some work and a very good QA.

in another hand you could use Unreal Network Interface, and host the game with p2p connection

lost inlet
#

you would only really need the p2p if there's any real time element to the game at all

#

otherwise it's just a skin around a REST API

#

which you could use the HTTP library for

fluid summit
#

Yeah, i was thinking on just go with varest for the requests

#

P2p would mean something like cs go (rooms) instead of something like a mmo (all on the same map) right? Why would I need the P2p if there's no real time interactions?

lost inlet
#

you don't

summer tide
#

If I have a variable in my component to toggle something, is it enough to have that variable replicated or does it need server RPC?

fading birch
#

it depends. Is the server the one toggling it? Then you should use an onrep. If you're toggling from a client and you want other clients to notice, you'll need an RPC.

summer tide
#

I'm not using it in toggle situation. I've some other functions that I set before and after

#

In chain of functions I enable it and in another chain of function I disable it.

kindred widget
#

That conversation was confusing.

fading birch
#

you asked if you had a variable that would toggle something @summer tide

#

if that chain of functions is triggered by the server, then what I said before applies

#

if it's not, it still applies.

summer tide
#

So I have a player that possess the second player. The second player has a component with that variable.

fading birch
#

does the variable need to be on all other clients?

summer tide
#

I fixed it by putting that variable in the second character. In the 2nd char I added if HasAuth ->Set Multicast else Set Server

thin stratus
#

Just be aware that if the Variable is supposed to be stateful, that you just introduced a bug

#

Because that Multicast won't be run by anyone hotjoining or re-entering relevancy range

#

States need to use OnReps

chrome bay
#

The Golden Rule

rough kestrel
#

So I was testing my multiplayer game on lan and it was working fine. But when I tried to runa dedicated server on my pc, only movement replicates but not any other input. Any idea why

kindred widget
#

Other input like what?

winged badger
#

its almost like no RPC you added is working

#

just the engine ones

silent valley
#

We're seeing an occasional crash in packaged game, when client comes near to an enemy. Callstack shows that network data comes in and SerializeNewActor is called. This ends up calling LoadPackage which eventually fails.
The enemy is a BP type (BP_SpiderRanged), which is derived from another BP (lets call it BP_SpiderRoot).
The failure is due to "LogStreaming: Error: Missing Dependency, request for /xxx/BP_SpiderRoot.BP_SpiderRoot_C but it hasn't been created yet".

The problem first appeared after we created the intermediate BP root base class. The game runs fine most of the time, but sometimes crashes with this error.
Do we need to somehow explicitly load the base class somewhere? Or load all the enemy types on the client in advance?

#

I think maybe @thin stratus had something similar to this a few weeks back?

thin stratus
#

I think my problem was no a crash though

#

We had AIs not visible on Clients

#

Iirc it was due to SeamlessTravel and Client/Server not keeping their GUIDs in sync.

#

So the Server thought the GUID is still valid and only send that, but the Client had no matching GUID for the Class and thus couldn't spawn anything.

#

I think I forced the Server to resend or so

silent valley
#

ah ok, quite a different issue then

thin stratus
#

Yeah, equally disgusting

silent valley
#

😄

#

Do you know if it's common practice to load expected assets in advance?

thin stratus
#

I guess so

silent valley
#

Seems like if I did that the crash would not happen

thin stratus
#

During Loading Screens for example

winged badger
#

so you can only replicate 64 tags in a FGameplayTagContainer

#

...

rough kestrel
thin stratus
#

The thing is, it shouldn't even crash because of this

#

It should load the parent class too in that scenario

#

Or at least not require it

#

idk

silent valley
#

yeah... should be a stall nothing more

#

something is going bad because of the BP root I think

thin stratus
#

Can only suggest finding a repro and getting it to crash while VS is attached

#

And then combing through the callstack and trying to figure out why the f it fails

silent valley
#

yeah that would be nice 😅

thin stratus
#

In the end I was saved by UDN thread ):

silent valley
#

so far it's only crashed in Steam version

#

but yeah I'll dig into it - thanks

winged badger
#

bonus points if it can only crash in shipping

#

but if you run the exact same build you used to deploy the game with, the data will not be entirely useless

#

when you open the crashdump

silent valley
#

that's tru in theory but currently I don't have easy access to the symbols

#

maybe I can download them again

#

often not worth the hassle without being able to view the state of variables etc

winged badger
#

we configured crash reporter to send our crash reports to our backtrace

#

we also got a symbol store more or less working on the build machine

silent valley
#

yeah - I have the first bit but not the second yet

winged badger
#

but even with that

#

still need to roll the project to the released branch, which stays like that forever

silent valley
#

do you use perforce btw?

winged badger
#

and package matching version in order to get any data

#

plastic

silent valley
#

ah ok, have you looked into source indexing at all? It embeds the souce file version into the symbols, so that when you open an old crashdump, VS can automatically grab the correct version of the file.

#

it's pretty awesome when I used it in the past

#

not sure if it's supported for Plastic tho

winged badger
#

will have to look at it

#

its not a major pain in the arse, as i keep one copy of the workspace for juggling branches, and it sits on last release branch by default

#

so VS is already there

silent valley
#

fair enough, I remember it being particularly useful during QA phase where sometimes old bugs would hang around for a while. Reduces the friction to investigate it.

#

doesn't seem to support Plastic out of the box though

#

from memory it is basically a horrendous PERL script, so good luck extending it 😂

chrome bay
#

whyyyy would they do this

winged badger
#

i don't know, i am somewhat annoyed having to rewrite those as arrays of tags

#

because when i hit UnlockAll console command

#

i have 67 tags

chrome bay
#

Huh.. looking at FGameplayTagContainer::NetSerialize

#

For some reason they have a configurable size limit, just for the "number of tags" part

#

default is 6 bits... but whyyyy

kindred widget
#

Cause Zlo doesn't have enough things to worry about with me breaking his stuff. He needs Epic to get in his way too. 😄

chrome bay
#

Love how this is just "how it is" and there's no indication about it until you're project is inexplicably broken. Classic

rough kestrel
#

Hey I need some help. I was able to run my vr game on lan without issues but when I tried connecting to a dedicated server, only the hand position, head position and thumbstick movement replicates. I am unable to replicate any grab actions. Any ideas why this couod be happening?

kindred widget
#

When you say Lan, do you mean Listenserver?

#

Cause Dedicated servers can also be ran on a LAN.

rough kestrel
kindred widget
#

Can you show one of the controls that isn't working? In general you should just be calling a ServerRPC doing stuff, and letting the new state replicate back to clients.

rough kestrel
#

ok pardon the image quality as this is my work pc

rough kestrel
#

both server and rpc call the same function

kindred widget
#

Don't do the Multicast from the input event. Only do that on the Server Event. Input should generally always be nothing more than "Gather all local variables the server needs from client for this RPC, ask server to do this through ServerRPC". This works for Listenservers as well, since the ServerRPC just gets played locally and inherently works for all clients even through Dedicated. And greatly simplifies the function lines.

#

Otherwise, like here, you'll end up with a client asking the server to do something, and then they'll run the multicast function locally as well. Instead you most likely just want the client to ask the server to do something, and then wait for server to tell them the new state through a multicast or replication.

rough kestrel
#

but how did my code work in listen server and not dedicated?

kindred widget
#

Hard to say. Nothing here should be different between the two assuming you tested on the listenserver through a client's input.

rough kestrel
#

and sadly source ue4 packaging takes longer

modern cipher
#

how do you handle displaying messages from events that end up on the server?
for example, failed to add an item because inventory was full?
if the add_item RPC is executed on the server

kindred widget
#

@modern cipherI did mine through error IDs. Server does something, can't do it. Gets the controller of the person who tried to do that action and sends a client RPC with a number. Error number is sent to the AHUD class and a small text widget is created. Widget uses error number to look up in a datatable what text to display. Error shows up temporarily and then removes itself.

#

Course most times this rarely happens. Client does it's own error display as well and stops the RPC most times before it's sent. The server rarely has a chance to send an error RPC back.

narrow skiff
#

@rough kestrel Yes, it does

rough kestrel
#

how do I replicate level based events? I have a task manager which is based on actor. This calls funtions on all the tasks. There are respective start task functions. From what I read server and other rpcs cannot be called on actors.

thin stratus
#

Multicast can

#

(on Server side)

#

Just not Client/Server RPCs

rough kestrel
#

but how do I make sure that any new user who joins has changes reflected of previously called logic?

#

I was able to get that when I was using a listen server by calling on server and multicast.

#

@thin stratus ??

thin stratus
#

That's State Changes

#

I would handle that in the specific Actor that represents your Level Event

#

That one can have a Struct or so with all Information that is needed to reproduce the current state of the Event

#

Theoretically you can keep all your Event Management ServerSide and let the Actors that represent each event handle the replication

rough kestrel
#

so basically have everything triggered by the player actors?

rough kestrel
thin stratus
#

Welcome to Multiplayer

kindred widget
#

Wait til you get to the UI part of multiplayer. Bindings are glorious.

narrow skiff
#

LMAO

rough kestrel
#

😭

#

Sad part is they pay me well

#

and any new tech for the team comes from me

fallen oracle
#

Hi. Anyone here used RootMotionSources before? It's kinda hard to get information about this topic, especially that google doesn't help. If I search for it, I always get to anim root motion, which is very different

narrow skiff
#

@rough kestrel It be like that

vital karma
#

what is the correct way of having a dedicated server with advanced steam sessions?

bitter oriole
#

Dedicated servers have nothing to do with sessions

#

Rent a server somewhere, build the dedicated server version of your game from the engine source, put it on the server

#

You can then use sessions to have players find the server

rough kestrel
#

so a dedicated server match will still run even after the players quit?

#

Just set it up for the first time today trying to figure stuff out

bitter oriole
#

A dedicated server is just an instance of your game running without a screen

#

How it works is 100% up to you

rough kestrel
#

so how could I be handling a match? reloading the level? Also what if I want to load a different map based on map choice from the main menu?

bitter oriole
#

You could have some kind of lobby level that your dedicated server boots on, have players connect, pick the map, and then you'd do a seamless travel on the server toward the level you picked

narrow skiff
#

You can easily join the level the dedicated server is on from (cmd) by pressing the Acute key and typing open 127.0.0.1:7000 or what ever IP and port it is on

bitter oriole
#

Or using sessions, since the question originally was about Steam sessions

rough kestrel
twilit radish
#

Using the console is not impossible in VR. You indeed can’t while wearing the headset, but nothing is stopping you from taking it off for a second 😉

narrow skiff
#

Im meaning just for like testing purposes not in production @rough kestrel

steady musk
#

Hi guys. Im trying to use streaming levels in multiplayer. Does level unloading/loading break actors replications?