#multiplayer

1 messages · Page 433 of 1

winged badger
#

like right after spawning

jolly siren
#

Hmm I never knew that they were replicated in the same bunch

winged badger
#

95% sure it would work that way

#

if not you can OnRep_AutoEquip

#

it does make sense that the Actor would send all its replicated properties in initial bunch that spawns it

#

otherwise, you'd have chaos with what arrives when

jolly siren
#

Right, it makes sense. I'm just not sure if that is how it works

winged badger
#

i can't say i explicitly tested a scenario where i spawn something, then immediately set its variables

#

but that is probably because i never had trouble relying on it

#

as for other cases of multiple variables replicating together, they will replicate in DOREPLIFETIME order

#

that i did test

jolly siren
#

@rough iron Can you confirm that setting a replicated property directly after spawning that actor will always result in that property and actor being replicated in the same bunch?
In other words, can you rely on the values of replicated properties in BeginPlay?

wary wyvern
#

Hey guys, I'm trying to spawn replicated actor, which has a replicated child actor inside. That child actor spawns on server but does to appear on client. What my be the problem?

winged badger
#

it is easy enough to test @jolly siren

#

just set the bool to not its default value, breakpoint BeginPlay and read it from there

#

(you'll hit twice, you're interested in one with ROLE_SImulatedProxy)

jolly siren
#

Right, yeah I know. It's the intermittent issues I'm worried about. But I'll test with lag

rough iron
#

@jolly siren not 100% sure but it all depends how much you need to replicate, if the netcode decides to chop all your data in smaller parts some will comein later, I remember that exposed on spawn values are valid in BeginPlay, others I wouldn't rely on it.

winged badger
#

NetDriver shouldn't send any Actors before it evaluated the entire traffic for that frame

jolly siren
#

Hmm okay, it seems like it isn't common knowledge then if it is true.
I would think that if the bunches were chopped up, they would be reassembled before UActorChannel::ProcessBunch

winged badger
#

it is my current understanding, ExposeOnSpawn also need to be set under the hood

#

before the blueprint construction script runs

#

but i never found the time to read the entire net code

jolly siren
#

Okay, just read a long write up by an Epic dev.
Answer: They try to ensure that BeginPlay is called after replicated properties are received. But it is not guaranteed in all cases.
And we should use PostNetInit instead.

jolly siren
#

Both UT and Moss's Twin Stick Shooter example have places where Client rpcs are called immediately after spawning a replicated actor on the server

#

hmm

winged badger
#

does your FActorSpawnParameters have something related to PC as the Owner ?

jolly siren
#

No, I don't set the owner with FActorSpawnParameters. I am setting the owner to the Character within GivenTo

#

So really it looks like this

#
AGun* NewWeapon = GetWorld()->SpawnActor<AGun>(DefaultInventoryClasses[i], SpawnInfo);
NewWeapon->GivenTo(this, i == 0);

void ABaseGun::GivenTo(APortalWarsCharacter* NewOwner, bool bAutoEquip) {
    ensure(NewOwner);

    Instigator = NewOwner;
    OnRep_Instigator();
    SetOwner(NewOwner);
    MyPawn = NewOwner;
    PrimaryActorTick.AddPrerequisite(MyPawn, MyPawn->PrimaryActorTick);
    ClientGivenTo(Instigator, bAutoEquip);
}

void ABaseGun::ClientGivenTo_Implementation(APawn* NewInstigator, bool bAutoEquip) {
    Instigator = NewInstigator;
    SetOwner(Instigator);
    MyPawn = Cast<APortalWarsCharacter>(Instigator);
    PrimaryActorTick.AddPrerequisite(MyPawn, MyPawn->PrimaryActorTick);
}
thin stratus
#

As long as the Owner is set before you RPC it should be fine

jolly siren
#

So the client rpc can't beat the actor (AGun) replication?

meager spade
#

anyone know how i can make the muzzle flash more conistent looking

#

it plays on the remove client longer than it should

#

remote*

bitter oriole
#

Can't really say without knowing more

meager spade
#

so the muzzle flash is a GA cue attached to the muzzle of the gun

#

when i fire local is fine, muzzle flash plays properly, on remote the muzzle flash carries on for quite a while

#

before stopping

#

and looks really odd

#

after i stop firing*

#

think ill handle the firefx outside of GAS

#

it seems to be hit and miss on replication times

winged badger
#

@jolly siren you can't call a client RPC on it before you call the GivenTo, as it has no NetOwner at that point

jolly siren
#

@winged badger ClientGivenTo is called within GivenTo after setting the owner on the server

winged badger
#

it didn't look like that from your first snippet

#

you spawned it, then called ClientGivenTo directly there

jolly siren
#

sorry, yeah the 1st snippet was a simplification

#

The 2nd snippet was meant to show more

winged badger
#

if your RPC arrived before the Actor on the client

#

your client would DC

jolly siren
#

oh really? I didn't know that

winged badger
#

it happens every time NetGUID resolves into a null reference

#

multicasting from PC or GameMode

#

or calling a Server RPC on an object thats no longer there

#

all result in client disconnecting

jolly siren
#

The same goes for client rpc?

winged badger
#

while i never managed to make that happen by accident

#

pretty sure it does, there should be no difference from Multicast

#

(in a way the RPC is resolved, the difference is in to whom its sent)

#

i did have the situation recently with InventoryItem (ActorComponent) with no cooldown - result was if you spam fast enough when your stack is 1 server would destroy the component, and client would send another RPC before it got that information from the server

#

which would result in attempting to call a function on a component that was no longer there and client disconnecting

jolly siren
#

ahh okay, yeah I think I'm going to remove the rpc for now

twin juniper
#

Does anyone have jitter when walking on a terrain in multiplayer that they don't have when walking on flat ground?

meager spade
#

maybe you need to adjust the replication settings

#

in the CMC

#

to make it smoother

twin juniper
#

How?

meager spade
#

think there is some smoothing settings

#

or something

#

not get editor open atm

#

maybe need to increase replication frequency?

#

lots of things can cause jitter

twin juniper
#

It seems like it may have something to do with vehicles. I have AWheeledVehicle pawn, it replicates fine but it seems to get very jittery

jade gazelle
#

Is it advisable to replicate a timer from server to client or would it make more sense to just set the timer on server and then simultaneously set a timer on the client via RPC? The client timer is just for UI purposes, there’s no functionality on the clients end

#

I guess what would be the least expensive from a bandwidth perspective is my question

jolly siren
#

I have my character's mesh pose not ticking on the dedicated server. Therefore, when I drop weapons they come from the tpose location instead of where I really want to drop them from (the animated location). Is there anyway to tick the pose for a single frame before dropping the weapon on the server?

#

I thought calling RefreshBoneTransforms would work, but it's not

opaque forge
#

What can a cause of getting this error when trying to replicate functions be? 1>C:\Users\Sam54123\Documents\Unreal Projects\TVStudio\Intermediate\Build\Win64\UE4Editor\Inc\TVStudio\VideoSwitcherComponent.gen.cpp(47): error C2511: 'void UVideoSwitcherComponent::ServerSetInput(const TScriptInterface<IVideoSystemInterface> &)': overloaded member function not found in 'UVideoSwitcherComponent'

sharp pagoda
#

const TScriptInterface<IVideoSystemInterface> &input
TScriptInterface<IVideoSystemInterface> input

#

Signature mismatch

opaque forge
#

I get rid of the & and it complains about a signature mismatch though

sharp pagoda
#

const

opaque forge
#

void UVideoSwitcherComponent::ServerSetInput_Implementation(TScriptInterface<IVideoSystemInterface> input)

#

That still seems not to work

#

1>C:\Users\Sam54123\Documents\Unreal Projects\TVStudio\Intermediate\Build\Win64\UE4Editor\Inc\TVStudio\VideoSwitcherComponent.gen.cpp(40): error C2511: 'void UVideoSwitcherComponent::ClientSetInput(const TScriptInterface<IVideoSystemInterface> &)': overloaded member function not found in 'UVideoSwitcherComponent'

sharp pagoda
#

void ClientSetInput(TScriptInterface<IVideoSystemInterface> input);

#

Same issue

#

This time for the client RPC

opaque forge
#

?

#

This is my first time networking btw

#

But to my knowledge I followed the wiki exactly

#

Obviously swapping function names

sharp pagoda
#

It's just the same issue with the server rpc function, you have a signature mismatch in your client rpc

#

ClientSetInput_Implementation

#

Change the parameters of that to not be const ref

opaque forge
#

It's not

#

void UVideoSwitcherComponent::ClientSetInput_Implementation(TScriptInterface<IVideoSystemInterface> input)

#

I fixed all of them at the same time

sharp pagoda
#

"UVideoSwitcherComponent::ClientSetInput(const TScriptInterface<IVideoSystemInterface> &)" (from your error)

#

Are you sure?

sharp pagoda
#

What's the error?

#

It can't be the same thing

opaque forge
#

I may have missed someting

sharp pagoda
#

Line 38 use GetOwnerRole(), there is no Role since this is a component, not an actor

opaque forge
#

Is that the cause of the entire fault?

sharp pagoda
#

Might be, hard to tell if the other errors are false positives or not

opaque forge
#

Well, it's not compiling. Not intellesence's falt

sharp pagoda
#

New error log?

sharp pagoda
#

@jolly siren I would try TickPose() then RefreshBoneTransforms(), you shouldn't need UpdateComponentToWorld

red ledge
#

Hey guys, I was looking into the best way of replicating an inventory

#

something like the fortnite or pubg ones

#

my idea was to have a list/database of items with item ids

#

and only replicate that

#

not the struct that holds all the info

#

but what are other ways to have a proper working inventory? all tips are welcomed

#

I heard something about FastReplication as well but i have no idea what is that, can't find anything on google

jolly siren
#

@sharp pagoda I tried that too, it isn't working

#
GetMesh()->TickPose(0.f, false);
GetMesh()->RefreshBoneTransforms();
#

The location I am trying to use after doing that on the server is
Weapon->getMesh3P()->GetComponentLocation()

hasty adder
#

Not sure where to post this but anyone familiar with discord’s richpresence ? Is this at all something to use for dedicated servers so if client sees client b is on dedicated server and requests to join etc or just peers to peer stuffs

thin stratus
#

Pretty sure how you handle the join request is up to you

#

If it's done right, they send you a request with payload

#

That payload should be info about the session you want to join

#

Shouldn't matter if Listen or Dedi server

hasty adder
#

Hmm might have to review my ded server setup. It makes sessions but it’s using nulloss I always get log messages for no session to join etc even tho it works

jolly siren
#

@red ledge replicating IDs is the best way to go imo

hasty adder
#

Unless this is normal for dedicated non steam server..

thin stratus
#

You can make Sessions but with NULL OS they are only local

#

NULL OS Dedi Servers would need connection over the internet via IP

jolly siren
#

@sharp pagoda Okay so the following is partially working.

So I'm doing the following from character right before dropping the weapon

GetMesh()->TickPose(GetWorld()->GetDeltaSeconds(), false);
GetMesh()->RefreshBoneTransforms();

This seems to start off in the wrong location (tpose location) and gradually get closer and closer to the correct animated location the more I drop the weapons. Any ideas why this might be?

warm summit
#

Hi, does anybody know a good tutorial to make LAN Multiplayer? Because with Advanced Sessions, the LAN Tickbox doesn't really work; I can't join another session in my own network (except for PIE

red ledge
#

@jolly siren thanks!

jolly siren
#

np

#

@winged badger What is your understanding of how long after SpawnActor a replicated property can be set and still come over in BeginPlay(really PostNetInit)? Is it any property set within the same frame that the SpawnActor was created?

keen thorn
#

@jolly siren I think is is because the pose/animation have a transition time, so when u tick it with certain deltaseconds, it will use that to interpolate the pose to the correct one

#

@jolly siren try setting the delta seconds to something big like 1.f

#

cus then i believe its enough time for it to do instant transition to the current pose

jolly siren
#

I tried setting it to 100.f. But yeah using a 0.f delta seconds caused it to not work at all. I'll try 1.f now

keen thorn
#

or 100.f didnt work?

#

what happened on 100.f

jolly siren
#

It acted the same as with GetDeltaSeconds. I'll try again tho

keen thorn
#

worst case u gotta call it lots of time, but i believe there should be a better way, not too familiar with this functionality :/

jolly siren
#

A lot of times with different delta time each time? Yeah I was thinking of doing it in a loop and incrementing delta time

keen thorn
#

but im not sure if that may work, the pose transition may be hard bounded, gotta experiment i think

jolly siren
#

Yeah with 1.f it is still gradually getting lower

#

I'll try a really really high number

keen thorn
#

ye, i checked the source code and nothing clamping the deltaseconds

jolly siren
#

yeah even this still has the issue

#

GetMesh()->TickPose(999999.f, false);

severe nymph
#

Anyone on 4.21.1

#

?

#

using the createstaticmeshcomponent or instancedstaticmeshcomponent seems to be busted across networking

#

LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: StaticMeshComponent

#

Logging this when testing with multiple clients

#

animation blueprint wont properly replicate movement velocity when touching the mesh created with the node

#

Maybe its base movement returning null …. not sure

#

Its almost like it doesn't know how to cook these actors that call this node anymore

#

Copy of my construction if anyone wants to see if they can reproduce

hasty adder
#
Client> Saves Setup to savegame
Client> Joins Server
Server> Creates PC - Sends RPC to Client to send info back.
Client> Loads savegame data, Sends to Server Values to set on PC server side
Server> Server Sets PC -> PS character setup
Server> Spawns Character - Exposed var from PS for what body parts.```
Will the values for each part of the character be replicated correctly or will it just spawn defaults?
#

This is my workflow theory of setting up say int for what Head or arms etc should be used as a character, customizable char over multiplayer

fossil spoke
#

If the Server is setting the Meshes it should replicate fine, though typically you would want the Client to update it locally as well for instant feedback.

#

Also using a Client Side savegame to set values on the Server leaves it open to Players modifying the Save and potentially gaining access to content they shouldnt have access to.

#

Are you using BP or C++? @hasty adder

#

You should look into the ClientTravel function and the Options you can append to the connection URL that gets sent to the InitNewPlayer function on the GameMode if your using C++

hasty adder
#

Unfortunately bp so I need to call back when pc is created. Luckily latency is ok because you still have to choose team from a spec state

severe nymph
#

here is what happens when walking across meshes created with that node. To work around create the static mesh components in the actor and set them using the set static mesh node instead of using the create static mesh component node..... unfortunately this means instancing is completely broken over networking until this is fixed.

hasty adder
#

I’m gonna give it a try tonight or tomorrow depending on my wife’s schedule lol.

meager spade
#

yo

#

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_WeaponAK47_C_0. Function ServerRemoveAbilities will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_WeaponScar_C_0. Function ServerGrantAbilities will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_WeaponAK47_C_1. Function ServerRemoveAbilities will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_WeaponScar_C_1. Function ServerGrantAbilities will not be processed.

#

the weapon has an owner though

fossil spoke
#

Are you sure?

#

Does it have an Owner with a NetOwningConnection though

#

IE something connected to a PlayerController

meager spade
#

yeah the PlayerState

#

even if i set the pawn as onwe

#

owner*

#

its saying that

jagged garden
#

do IsLocallyControlled check before you call the function

#

its weird like that

meager spade
#

yeah

#

i think its running on another client

#

and thats what is throwing the error

fossil spoke
#

Make sure its not a remote clients version of the actor calling the RPC as they wont have a PC that they own to make the call for them

meager spade
#

@fossil spoke that is what my investigation through locals just confirmed

#

the pawn calling it has no Owner

#

so i need to do IsLocallyControlled before calling the Server rpc right?

jagged garden
#

yeah

meager spade
#
    {

        if (!OwningPawn->HasAuthority() && OwningPawn->IsLocallyControlled())
        {
            ServerRemoveAbilities();
            return;
        }

        UAbilitySystemComponent* ASC = GetPawnOwner() ? GetPawnOwner()->GetAbilitySystemComponent() : nullptr;

        if (ASC)
        {
            ASC->SetRemoveAbilityOnEnd(ReloadAbility);
            ASC->SetRemoveAbilityOnEnd(SecondaryAbility);
            ASC->SetRemoveAbilityOnEnd(PrimaryAbility);```
#

like that?

#

now im hitting a check if i put IsLocallyControlled

#

check(IsOwnerActorAuthoritative()); // Should be called on authority

#

oh i think i need to return out if not IsLocallyControlled

#

and screw them

#

hmm now i have no abilities at all

#

thats cause i !IsLocallyControlled is bailing the server, mmmmmm

#

so what is the best prcatices

#

for handling ListenServer and dedicated server?

#

in RPC calls?

severe nymph
#

RPC calls should always come from an actor with owner set

#

Has authority or is server branch

#

Why would a pawn calling it not have an owner?

#

If the pawn is ai it should be owned by the server ai controller

#

If it’s a player it should be owned by the player once the ak actor is equipped or gripped(vr)

#

Set owner on equip

meager spade
#

right

#

so the player switches gun, OnEquip is called

#

OnEquip calls GrantAbilities

#

but that should be server only

#

so non servers get bailed out, and it calls Server to call that function

#

fixed it

#

i was just derping a bitg

severe nymph
#

👍🏼

#

Awesome 😎

quartz heart
#

in a multiplayer scenario with a dedicated server, is there any way to use Level Streaming such that the server has all of the levels loaded in the world, and all of the actors active, but the clients only have the levels loaded they can 'see' or care about, and only tick actors and get replications for the actors in those levels?

#

last thing i read about this was from 2014 and basically was 'no if the server loads a level all the clients do it too'

#

trying to cut down on the number of actors each client has to worry about.

grand kestrel
#

If you're just worried about actors considered for replication then that's what the replication graph is for

#

Released in 4.20

fleet fiber
#

can anyone explain what im doing wrong here? I have a Pawn_blueprint. In that blueprint I have a G pressed event. When G is pressed the event calls (RunOnServer) which calls (MultiCast) which spawns actor from class. I am not running a dedicated server. Client1, the listen server, presses g and the actor spawns on all clients. Client2 presses g and the actor only spawns on his own client. Why is it not spawning on server? https://gyazo.com/1329ac8dfeb44d0c79d9fe3905ad9a3c

winged badger
#

it is spawning it

#

just not where you'd expect

fleet fiber
#

lol whut

winged badger
#

as it will spawn under hosts (listen server scenario) or first player that logged in (dedicated server) cursor

#

sorry

#

you can't use GetPlayerController[0] in this scenario

fleet fiber
#

when i call this on listen server, it is spawn on server and client, when i call it on client its only spawned on owning client

winged badger
#

your Actor should be spawned server only

#

and replicated

fleet fiber
#

yes, thats why i use ron on server on client, and then multi cast

winged badger
#

and you should send the HitResultLocation as an input parameter on the ServerRPC

#

because that will return a different location on each machine

fleet fiber
#

so I have to replicate the hitresult before sending it?

winged badger
#

as it is now

#

no, click on red event node

#

add input in details panel of type vector

#

and connect the pins

#

that way vector is sent with the RPC

#

multicasting is a terrible choice here

#

as any player outside NetRelevancy range, as well as any player that joins later won't have that Actor

fleet fiber
#

Players cant join later so that doesnt matter:P

winged badger
#

it matters for relevancy, and its really bad practice

fleet fiber
winged badger
#

not quite

#

you plug those 3 nodes into the first server RPC

#

both server and multicast should have the vector input

#

is the door replicated?

fleet fiber
#

yes

#

its stattic mech sompnonent is replicated as well

winged badger
#

that explains why it "works" when server does it

fleet fiber
#

XD

winged badger
#

so

#

your HitResultLocation is evaluated when Spawn is called

#

and each machine has a different idea of what is PlayerController[0]

fleet fiber
#

wouldnt the pawn return its own playercontroller ?

winged badger
#

so each machine takes a different location for the spawn

#

no, GetPlayerController is static

#

it doesn't use Pawn as context

#

so on your client PC 0 is its local controller

fleet fiber
#

so im basically returning the listen server playercontroller everytime?

winged badger
#

and on server its the host's controller

#

when your server spawns a door

#

it spawns it under its cursor and it replicates, so clients see it where it should be

#

clients however spawn an additional door wherever unreal figures out their own cursor is locally

#

and if you are using multi window PIE, that can result in some interesting numbers

#

bottom line

#

replicated Actor should be spawned on server ONLY

fleet fiber
#

So multicast is not needed?

winged badger
#

and you need to push the Location (because its dependent on local controller) through the ServerRPC

#

no, its not

#

server has no clue where the clients mouse cursor is

#

ever

#

or what buttons a client is pressing

#

unless you RPC the info

fleet fiber
#

so how do I get the local controller?

winged badger
#

you don't need to

#

your SpawnDoorRPC has vector input

#

when its called it will evaluate the location locally

#

and then send the result to server along with the RPC

#

basically saying "spawn door at this location" instead of 'spawn door"

fleet fiber
#

So I made a replicated vector variable, it gets the vector from the hit result, which it sends to the run on server

#

and this seems to work fine

#

@winged badger would you consider this a proper set up?

#

Also, thanks, been stuck on this for days 😛

winged badger
#

almost

#

you don't need an authority switch

#

or a variable Vector

#

otherwise, yes

fleet fiber
#

Yeah I left the switch cause im lazy :P, I thought I'd have to replicate the vector so I made a variable. Gonne try without it.

winged badger
#

it would not do anything, as client setting variable locally wouldn't replicate to others

#

and clients would overwrite whatever server sent when they press G

#

the RPC carries location with it now

fleet fiber
#

lulz, Guess I got a lot of bad info on youtube xD. Thanks a lot, now I can finally continue my project

final thicket
#

Hey guys what would you say is the best way to handle knocking back a character in a way that is server authoritative yet also without a noticeable delay?

jagged garden
#

maybe try add impulse

jolly siren
opaque forge
#

When I call a net multicast function, does it run on the server as well?

jade gazelle
#

Yes

fleet sluice
#

Interesting bug indeed

opaque forge
#

Is that intended?

#

Should I make use of it?\

jolly siren
#

yes, it is intended

chrome bay
#

I posted that issue to Answerhub too with code. Got a reply from engine team which says it is a bug, got a guy on it.

#

General limitation with how the rep layout is generated.

#

Note that if you manually create a NetSerialize() override, the previous value is correct

jolly siren
#

Ahh okay cool, yeah I came across your udn post on it

chrome bay
#

Ah cool cool. Yeah I'm surprised it hasn't been found sooner.. makes me wonder how many people are using that functionality. I find it really handy

jolly siren
#

The old value with OnRep is sort of a hidden feature

chrome bay
#

I guess the other workaround is to just store a shadow copy locally and update it in the OnRep function, but.. kinda annoying

#

Yeah for sure

jolly siren
#

I've had issues with it before too. Can't remember the specifics, but it definitely isn't rock solid

dense spindle
#

Someone encounterd FPS problems with 4.21? In our Multiplayer FirstPersonShooter you start to lag when you pass 180FPS...

chrome bay
#

Clamp to 120 :D?

#

Willing to bet the net driver is just choking on RPC's / data

dense spindle
#

Hehe, well thats our workaround for now, but we arent sure whats going on. You dont want to limit the FPS.

#

I wonder if someone else has this issue

chrome bay
#

Yeah not ideally. How are you testing it? In PIE?

dense spindle
#

The error isnt in PIE when i understood correct.

jolly siren
#

Looking through my code it looks like I was having issues with the OnRep previous value when it was a TArray. Might have been fixed by now tho

dense spindle
#

Our game can create also Listen Servers, when you play on them the problem dosnt happen. Means it only happens in Online Mode. Lan is fine. Its weird.

#

Also difficult to find out what is cuzing it...

chrome bay
#

I hope it's been fixed as I rely on that sometimes too haha

dense spindle
opaque forge
#

Do server functions have to be called by a pawn or can they be called by any replicated actor?

jolly siren
#

It depends on ownership

#

See the rpc chart on the link i provided

opaque forge
#

Is there a way to make an actor dropped into the level able to call server functions from the client?

opaque forge
#

I'm trying to make a very moddable game with replicated components that can be easily put in any actor and I don't want to custom code the player pawn to individually find all the actors that might contain a component and try to replicate them every time the function is called

chrome bay
#

A client has to be the net owner of an object to call an RPC on it. Only way

#

Whole networking system is built around that concept.

opaque forge
#

How do you recommend implementing a system where a player on a client can press a button (in vr) on an actor and it calls a server function?

#

What's the best way to pull a variable from the server into a variable in a server owned client variable without always replicating the variable?

jolly siren
#

Without always replicating it? So you want to replicate it once only or multiple times that you have control over?

opaque forge
#

Never mind

opaque forge
#

Does anyone know what to do when the compiler complains about inconsistent dll linkage when implementing GetLifetimeReplicatedProps on a compoent?

jolly siren
#

Lots of problems there

#

should be void UVideoSwitcherCompnent::GetLifetimeReplicatedProps

#

And you aren't calling Super::GetLifetimeReplicatedProps

opaque forge
#

Just following the wiki

#

So what am I doing wrong

#

Shit, I'm an idiot

#

Didn't read that I wrote UActorCompontnt::GetLifetimeReplicatedProps

jolly siren
#

yeah I just said that

opaque forge
#

I guess the wiki was confusing when it uses AActor as a placeholder for your class name

#

Now I'm getting 1>C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\CoreUObject\Public\UObject/Class.h(3032): error C2039: 'StaticClass': is not a member of 'IVideoSystemInterface', but I think it's unrelated

opaque forge
#

What are the potential causes of an property outright not being replicated? I have it marked as ReplicatedUsing=[function], it's activated at the bottom of the file, my component and actor are set to replicate, and Blueprint even says it's a replicated property, yet when I update it from the server, my function isn't called and my property isn't updated.

#

Okay, I figured it out. I forgot to put const at the end of GetLifetimeReplicatedProps, which led to it trying to define a new function.

grand kestrel
#

Has anyone ever returned false from a _Validate (RPC)? Maybe ever in the history of UE4? Genuinely wonder where you'd actually handle failed validation in that manner

sharp pagoda
#

Returning false in a validation will boot the client, so you can do so if you believe the client is attempting to cheat based on their inputs.

chrome bay
#

Yeah I've used it once or twice, but very rarely

grand kestrel
#

@sharp pagoda I mean compared to dealing with it in another manner, I know what it's for 😀

#

Any cheat detection I've put in hasn't been in the validate methods

#

But I guess I can see some edge cases that might catch an excessively blatant cheater

#

The real problem is cheaters who do minor adjustments like reducing recoil, hiding foliage, etc

chrome bay
#

I've only ever had one use case for it, but it was pretty unique... client sends through reliable RPC's with a "Handle" - and the handle is always just incremented from the last value. The handle is used to seed RNG, so if a client "knows" a particular handle that generates good RNG for them they could just repeatedly send it. The server verifies the handle first by checking its the "next" one, and kicks them straight away if not

#

But tbh.. chances of anyone figuring that out anyway are pretty much slim to none

stray patio
#

Anyone here who hase experiences with replicating things on servers with many players (e.g. 64)?

twin juniper
#

Anyone have any movement jitter when walking on hills? or on specific surfaces?

grand kestrel
#

@stray patio Yes, but I'm not gonna sign up to answer any questions, the one piece of advice I'd give is to learn the engine inside out so that you know how to replicate the least amount of information possible and don't double up on things that are already replicated out of the box (this is extremely common with newer devs)

halcyon abyss
#

how do I identify a client on the server_

#

?

#

clients can have multiple player controllers on the server

meager spade
#

no

#

clients have one controller on the server

#

and one controller local to them

#

so the server has a copy of everyones controller, and a client only their player controller

halcyon abyss
#

sorry

#

what I meant

#

is that I have local and online multiplayer mixed

#

So they have multiple local controllers

#

and I wanted to know if there was a way to tell by the player state or the player controller... What client they belong to

#

I can always of course just send the info from the client to the server so that he knows how they are grouped

#

I jsut wanted to know if there was a client ID

#

aready

lethal depot
#

I want to test my build locally between more computers

#

for some reason I can't join with 127.0.0.1

#

but using the exact ip address works

#

(local one)

#

any idea why? 🤔

halcyon abyss
#

how can you do this without having all player controller instantiated?

jagged garden
#

@lethal depot 127.0.0.1 is local machine

#

so it would only work on that computer

opaque forge
#

are non replicated actors always ROLE_Authority, even on client machines?

lean river
#

no

#

only server owned actors has role authority even if the actor is not replicated they have authority role as i remember

opaque forge
#

If a scene component is replicated, does it automatically replicate location?

opaque forge
#

If I have an actor with a static mesh as it's root that's supposed to be replicated, do I have to set the static mesh to replicate as well?

livid barn
opaque forge
#

I have a server variable that is updated a lot by the server (like every frame) but is only used by the clients once and a while. What's the best way to implement a system where the value is only sent to a client if it requests it? The client may not be the owner of the actor.

livid barn
#

@opaque forge of the top of my head, possibly instead of the client directly trying to pull down the value (since it updates so often) have a chain of RPCs or something, whereby the client requests the server to send the value.
Then the server can do a single event for that client with the variable you want updated only then and there.

opaque forge
#

What if the client isn't the owner of the actor?

#

It's for a media player synchronization across all clients.

livid barn
#

handle it the same way as you would with a widget running a function on the server or something. You need to do a chain of events that goes through the player controller, then to the server

opaque forge
#

Okay

#

Also, quick question when an rpc has a return value, what's the client's protocol for waiting for the return value to come back from the server?

livid barn
grand kestrel
#

It doesn't work that way

#

If you want it to send something back use a client RPC

opaque forge
#

Can you send a client rpc to just the client that called the rpc?

grand kestrel
#

Client RPC send to the owning client

opaque forge
#

We're not sure it's going to be the owning client though

#

The server RPC will be sent from the actor to the player controller to the server

grand kestrel
#

If there is no owning connection you can't send rpc

#

Need to use replication

opaque forge
#

'The server RPC will be sent from the actor to the player controller to the server'

grand kestrel
#

There are no player controllers on clients for simulated players

#

The server has one for every player then each player has only their own

opaque forge
#

I know

grand kestrel
#

You really should read the compendium that was linked

opaque forge
#

Each client will use their own

#

Or if there's a better way to do what I'm trying to do, I'm all ears

grand kestrel
#

The compendium will inform you how to make any solution for anything

livid barn
#

heres an example from my game. I have a widget button which spawns a NPC into the world.

  • On the Widget Blueprint when button is pressed... Talks to Player Controller Ref to run event there
  • In the player controller ref, the Event "Executes on Server", then it runs an event in the Game State
  • In the game state the event Executes On Server. and does all the required stuff to spawn the NPC

From that chain, the client sees the NPC spawn into the level

opaque forge
#

I'm trying manually request a value from the server from on the clients because the server updates it so often, it's impractical to update it on all clients every time

#

And it's more of a master value that, theoretically, the clients should be individually simulating

#

We just need to check in periodically that it's correct

#

And when a new client joins, of course

livid barn
#

do what I did above, but instead of spawning a NPC. The server just sends runs an event on the Player CHaracter that requests the value from

opaque forge
#

But how do I get a return value from that?

#

How does the rpc system deal with return values?

#

I can't find much documentation

grand kestrel
#

What documentation, you were linked the compendium, if you read it you'd know how to make it

opaque forge
#

I'm planning on it

livid barn
#

remember, the player characters LIVE on the server. The client only has a puppet that essentially controls them. Replicationwise its up to the server if it wants to send data back to the client to show the client whats really happening witht he player character

opaque forge
#

Can we do it on the player controller?

livid barn
#

so you would store a replicated variable on the player character or whatever, but its ONLY gets updated when the event on the server is trigged becuase the player requests it so

#

yeah player controller or whatever.

#

I'd suggest possibly making a widget button that maybe does something to your character which the server does. Just leaning how to request the server to do something from a non owned source will help it be a bit clearer

opaque forge
#

I get the function calls to the server

#

That makes sense

#

Just how do you handle the return value in rpcs

#

And waiting for the server to give you the return value

grand kestrel
#

Again.. you can't

livid barn
#

i think you're in the wrong mindset to what you're expecting it to to.

grand kestrel
#

You're expecting something to happen in a way that it simply doesn't

livid barn
#

think of it this way. How can the SERVER version of your character get the data you want only at certaintimes?

#

cause when that SERVER version of your character gets it. It'll propogate back down to the client

opaque forge
#

Ooooh, that makes sense

livid barn
#

yeah its one of those weird wacky things unreal does which if you've ever leanred networking programming it throws ya off a bit 😛

opaque forge
#

Will that turn into spaghetti code because of the fact that the component I'm trying to replicate has absolutely nothing to do with the player/player controller, and there might be multiple of them?

livid barn
#

first make it work, so you understand it; then make it better 😃

opaque forge
#

Will do. Also is there a printer-friendly of that compendium?

livid barn
#

the text is pretty big on those PDF pages, you couyld probably just open it up on a tablet or a phone

opaque forge
#

Okay

livid barn
#

what you'll find is that EVERYTHING lives on the server. And if you were to have your own pawn (without the unreal special Movement Controller) you'd notice that when you send control inputs to the client in a high latency environment; it will take a noticeable amount of time before the server actions it and send you the update that the client moved position

#

anything client side is essentially like "please server, can you make my character do this please?"

opaque forge
#

Yeah

#

I've done a little bit of networking

#

I'm actually trying to figure out how to replicate a media player

#

The server would keep track of the time the media is supposed to be at, but we can't constantly replicate that to the client

#

Especially since the client will theoretically keep at the same time

#

But there might be occasional buffering, etc

livid barn
#

you'd probably have a StartTime in world seconds that the media is playing at

#

so 5min video starts at 12:04:03
and if its 12:05:06 then video is at 1m 3sec into playing

opaque forge
#

Of course

#

Why didn't I think of that?

#

The server will have the option to pause it, etc, but we can always math the start time out of that.

livid barn
#

yep pretty much. Saves having to spin an update time each tick

#

the less you have on EventTick the better

opaque forge
#

That's my problem, I get single minded and try really hard to solve my problems instead of finding ways around them

livid barn
#

oh we all do. I'm STILL banging my head on this charactr position reset problem I've had for months in my game

opaque forge
#

Oof

#

It's probably an engine level bug

livid barn
opaque forge
#

I read that when you posted it earlier, and had no idea how to awnser it

livid barn
#

😭 i hope someone out there sees it and can atleast point me in the direction of a good work around concept or something 😦

grand kestrel
#

Lol that's certainly not an engine bug

opaque forge
#

btw, will using start times like that get screwed up with timezones?

livid barn
#

use UTC clock in unreal. MUCH better

#

also you can also use Server time to base the position off rather than trying to match UTC time across clients

grand kestrel
#

@livid barn that's not a bug at all, you need to integrate anything that modifies movement into the existing code so the prediction uses it

livid barn
#

so server started 1000 seconds ago, video starts at 1000 seconds... etc

grand kestrel
#

You can't do it in BP

opaque forge
#

How well are the clients synchronized if I use server time?

grand kestrel
#

You'll want to override and copy/paste then modify CalcVelocity in Character Movement component

livid barn
#

@grand kestrel i thought I had done that, as I've attempted to do it in C++ with a custom movement controller and everything. Still not change.

This issue seems to happen occasionally also. Which makes it even weirder. Like I have done frame by frame velocity checks and at some point the server just goes "nah fuck it you're slowing down for no reason at all" then after about a frame or 2 resets the position. The issue seems to happen i think just before the reset

opaque forge
#

Anyway, going to bed. Marry Christmas, if you celebrate it!

grand kestrel
#

@opaque forge if you send an rpc to the client and save the current time, then the client sends an rpc back, the current time when the rpc is received minus the time it was sent gives you the clients ping

#

And from there you can solve the time offset between server and client

severe widget
#

technically speaking (TimeRecieved - TimeSent) /2

grand kestrel
#

Yeah

#

It's hard to type on phone

severe widget
#

And just because you've got a custom movement component doesn't mean you're doing everything CMC gives you for free (as part of character movement)

#

CMC can be like 4 diff components, really

livid barn
#

yeah im reading through the source now

severe widget
#

CMC is like.

#

wut.

#

but also CMC was before components could directly RPC

#

so its not even as good as it can be

grand kestrel
#

Look at the CalcVelocity function

#

Override it

livid barn
#

but yeah i feel a bit lost from this; as Im not really seeing what BP or C++ wise Im doing wrong as it works for many many frames, and then suddenly shits it self almost randomly. And i cant seem to trace it back to what makes the server go "nah time to use different values"

grand kestrel
#

Also don't use set walk speed

severe widget
#

its not obvious.

grand kestrel
#

Override GetMaxSpeed

severe widget
#

Also yeah, don't do that.

grand kestrel
#

Crap this is a mission on a phone

livid barn
#

SetWalkSpeed is set once. Im not updating it

severe widget
#

vaei its cool I'm here :akppa

#

imma leave my emote failure.

grand kestrel
#

In that case you can just set it on the component

livid barn
#

if you get a chance have a go at the steps to reproduce the issue that i have in the link above. Like I've been hammering away at this for months trying all sorts of approaches. The symptom is not consistent, despite how I attack it.

grand kestrel
#

I've already modified CMC immensely, last time I made it use a spring algorithm for acceleration, I've also made it move naturally along a spline without setting it along the spline

#

I'll have a look when I'm home

#

In four days

#

Just @ me around then

#

Or I'll forget

livid barn
#

cheers 😄

grand kestrel
#

Found it, that's using the spring algo

livid barn
#

and thats over network?

grand kestrel
#

Yeah

#

Everything I make is network capable

#

I don't do single player systems they're a waste of time

severe nymph
#

Has anyone found a way to fix the issue with the add static mesh component node not assigning netguid to the component properly for multiplayer

#

Test with 2 clients and server doesn’t send velocity or handle client movement properly

#

(Name=0x00000112655a4bd0 "NODE_AddStaticMeshComponent-0")
This what's failing the NetGUIDLookup in PackageMapClient.cpp

but its very strange because at first this value comes across
+ NetGUID {Value=23 } FNetworkGUID

it breaks here

    if ( NetGUID.IsValid() )
    {
        return true;
    }```
result
```[16] = {0x00000112298a8800 (Name=0x0000011266e192d8 "StaticMeshComponent0"),{Value=23 }}```
#

Any insight on a fix would be awesome.... only 4.21.1 bug keeping me from migrating

grand kestrel
#

@severe widget BTW can't you see your PMs?

next falcon
#

Hey guys
so i replicate a Object inside of a Component and i replicate a string inside that replicated Object in cpp and it works fine, but if i create a String in the blueprint child of that object and replicate it, it doesn't work
is there a way how i can replicate Blueprint Vars in a replicated Object ?

bitter oriole
#

So, any reason my local (same machine) client gets 30ms ping - scaling with the server framerate, so basically two frames ?

#

I'd understand one, two seems weird

austere veldt
#

Hey, do you know if there's a possibility to decrease replication frequency and accuracy with distance? Let's say that I want other players to be in perfect sync within 50m around player, but players distanced at 200-300m aren't relevant so they can replicate even once per 5 seconds just to show their presence?

thin stratus
#

@austere veldt UE4's replication graph system would allow that

#

It's what Fortnite uses

austere veldt
#

@thin stratus thanks, that's exactly it. So I do assume that I could design dedicated nodes prioritizing different activities in the game like for example melee fights. If fight between players is detected then the actors will be routed to this dedicated node which adjust their update frequency. Am I right?

versed socket
#

I notice that when I want to have a client-triggered action to multicast to everyone in the server (e.g. swapping their current weapon), I find that after a while of doing this over and over I end up with a bunch of dummy router helper methods in my PC or in my GS that are only just passing on the word from Owning client to Server and then to Multicast.

Is this the right way to go about implementing this? It seems to work fine afaik but I still wonder if I'm doing it the "right" way.

lean river
#

yeah you doing "right", however lot of options exist for weapon change..
you dont have any other choice to start this since the beginning of this happening on client..
after you forwarded this to server you can use multicast to trigger animations or you can use replicated state enum variables etc.
but multicast is also fine.. personally im using replicated weapon state so i can fully ignore multicasts

heady scroll
#

What's the "right" way of processing input from clients?

#

For instance, when a client presses a button I want to set a variable on their controlled pawn, but I want the server to do that as well

#

Will I just need to do a multi-cast event call and have an extra event for that single set node?

thin stratus
#

Client->SetVariable
Client->ServerRPC
ServerRPC->SetVariable

#

Multicast only makes sense for fire and forget things

#

Would rather mark the Variable is Replicated

#

@austere veldt Not 100% sure how it works but the graph system puts actors into groups

#

These groups are more or less important

heady scroll
#

Wouldn't just the ServerRPC and following SetVariable be enough?

thin stratus
#

I guess you define rules on which group an actor belongs to

heady scroll
#

Because the owner would get the replicated value back anyway

thin stratus
#

@heady scroll Yes, but then the local client has to wait 2xping to get the update

heady scroll
#

Right

thin stratus
#

or 1xping? well delayed

heady scroll
#

Yeah, 1x ping

#

But the point stands, if you're playing with people in the US while you're in Europe, that sucks

thin stratus
#

You will feel it even with 30ms

#

That's why movement for example is simulated on the client

austere veldt
#

@thin stratus yeah, it's a bit complicated and based only on C++, but the idea is great. It's too bad that it isn't documented... What interests me the most is the possibility to dynamically route actors to specified nodes basing on their actions, like for example fist fights

thin stratus
#

I think there is a blog post about it

#

And that's it

#

That's all or so

#

not sure

austere veldt
#

allright, I guess it's time for experiments then

#

thank you for your help!

heady scroll
#

Also, as a primarily SP dev, thanks for the compendium @thin stratus

#

The third about GameStates and that sort of thing is making my life a lot easier in singleplayer things as well 😛

twin juniper
#
"SpawnActor","2.356 ms","100.0 %","0.049 ms","0.1 %","0.0",
#

Why does spawning an actor take 2.3 miliseconds

jade gazelle
#

Is there any built in functionality in the engine for transmitting specific data from one dedicated server to another? Like if I had players that were “grouped” and they bounced servers to another map, sending info to the new server to let it know to regroup those players?

#

Otherwise I think I have to use a database solution which I guess is fine, but not idea

#

Ideal

thin stratus
#

@twin juniper Depending on the Actor, it can be pretty heavy to spawn one :P

#

@jade gazelle Doubt, cause UE4 is build for games like UT.
While you can also use the whole Engine for tons of other games and setups, it's still limited to that base idea of having one Server and playing one match from start to finish and which then goes to the next map.

#

If you need Servers to talk to each other, you have to add your own solution

twin juniper
#

@thin stratus I am trying to spawn a new actor every 15 seconds

#

It's an AI zombie thingy

final thicket
#

Is, 'Set Ignore Look Input' server authoratative ?

#

and 'Set Ignore Move Input'

keen thorn
#

@jade gazelle theres no built in system, but there are plenty of free plugins to aid do what u need.

low gate
tropic snow
#

Anyone know why I can't reconnect to the same server after disconnecting? This is my game info instance:

hasty adder
#

@tropic snow Crazy. I bet you may have followed a tutorial for lobby? Find your network error handling

#

There might be a branch for is server

#

You do not want server to destroy its session on error. And if it’s the tutorial I’m thinking of it has a branch true or false both kills the session on error

jagged garden
#

@tropic snow look at events like on logout or something along those lines

#

if you wanted auto reconnect

twin juniper
#

Anyone here have experience with the steam inventory?

severe nymph
#

Anyone else having issues over multiplayer with the add static mesh component node?

#

21.1 regression

#

This worked fine in previous engines

opaque forge
#

Can I put ustructs in a replicated uproperty?

glossy moth
#

Hello there! So I'm having a issue with replicating the projectile to either client or server (I can see the player shooting but not someone else), I'm new so would really appreciate advice!

thin stratus
#

Why do you have two ServerRPC behind each other?

#

And what is calling "PlayerFire"

#

And where are you calling FireProjectile?

glossy moth
#

thats a very good question, i set server fire to multicast and i call the fire function in the rifleBP child blueprint

thin stratus
#

That seems rather wrong

#

The correct order is:

Input(Client/ListenServer)->ServerRPC (ServerFire)->CheckIfCanFire->Fire

#

Your base weapon should implement the FireWeapon already

glossy moth
#

okay ive put the fire proj in the master BP

#

and could you explain the input/rpc/fire a bit more for the beginner? im just very new to everything still and i know how frustrating it can be pointing out the obvious

meager spade
#

your naming is a bit odd for starters, i would get confused calling a Server RPC PlayerFire

glossy moth
#

i noticed that now, its supposed to be a normal event because its the player character that does the shooting action event "presses button" and should go > Server > Multicast IIRC?

meager spade
#

a non authority can't multicast

#

so your PlayerFire is invalid

#

PlayerFire -> ServerFire -> Multicast no need for the authority switch, only issue is your multicasting the projectile and projectile spawning

#

which is not needed

#

Server should spawn the projectile and just multicast the effects/fx

#

the projectile should be replicated and will be visible to all players when spawned on the server

glossy moth
#

So i should put multicast in between reduce ammo and play sound?

#

Aka after fire projectile

#

But still in the same exec so to say?

meager spade
#

what does CanFire do?

#

checks for ammo?

glossy moth
#

CanFire checks ammo, you spawn with 30 default

meager spade
#

so, client calls ServerFire, ServerFire checks for ammo, if true, it spawns projectile, and multicasts the sound and effects

#

ideally i would check for ammo locally

#

if you can that value locally which you should be able too

glossy moth
#

Well this is the master blueprint for weapons which is going to have child actors

meager spade
#

PlayerFire -> Check for ammo -> ServerFire -> Spawn Projectile -> Multicast

glossy moth
#

Oo I see

meager spade
#

i mean my projectiles, the server does more sanity checking before firing it

#

but start with basics first

glossy moth
#

I read your networking document @thin stratus and found that my dumbass didnt replicate the projectile itself in its own blueprint

normal hatch
#

Hey there! I'm here from a guide on how to make a dedicated server from unreal engine. I have successfully made my dedicated server! I want to host my server on Amazon GameLift. I have added the Amazon GameLift plugin. So how would I package my server so it could be hosted by Amazon GameLift? Thanks!

meager spade
#

how can i hide a spawned actor on the server that is replicated from the owner

tall maple
#

How do servers work if I wanted my games servers to purely community run kinda like how valve do it? Can I just package up a server executable and make it public? Is it safe to do that?

graceful cave
#

@tall maple yes

#

not hard to do if you dont already know how it works

#

but requires engine built from github source

#

not that you need to modify anything, visual studio just wont create a server binary otherwise

hoary lark
#

I'm trying to work on fall damage for my game... right now the server is auth over all damage (engine default), this means the client hits the ground and locally nothing happens, then they hit the ground on the server, then the server tells the client they should take damage or die. the delay is a bit jarring and I'm wondering if it might be common practice to implement clientside prediction for receiving damage (maybe only for self-inflicted damage), similar to how clientside-prediction and server-checking of movement is done? would "pro" games ever build a saved state system that could be rewound and replayed for health just like saved moves? or do they just make the client able to apply self-inflicted damage to itself and broadcast up to the server? (does that open an avenue for cheating somehow, even if I limit it to damage events only and not healing?)

calm plaza
#

Anyone have much experience with Advanced Sessions Plugin? Trying to figure out how to best utilize the Search Sessions Filters Struct. Any points are welcome.

grand kestrel
#

@hoary lark apply any effect locally, the actual damage deduction done server side

#

If you're using CMC it's predicted so the result should be nearly identical

hoary lark
#

My question comes from the fact that if only the server applies damage, death/ragdoll gets that delay

#

And the change to your health bar but that's not as important

grand kestrel
#

I guess you ultimately have two choices

#

First, process the death immediately on client, revert it if server disagrees

#

Second, process the death immediately on client, and notify the server that it received fatal fall damage and the server can just kill the player

hoary lark
#

That's not a bad idea actually

grand kestrel
#

Since you can't really cheat by falling to your own death

#

It should be ok to take the clients word for it this one time

hoary lark
#

Simplifies things and doesn't create too many nasty loopholes. I'll put that into the team for consideration. Thanks!!

grand kestrel
#

Not for fall damage, specifically only for dying from it

#

If there's a way to heal other players it could potentially cause an issue if they were healed immediately before hitting the ground but it would be rare and they'd just think they were too late. You could refund any cost of the heal with some good logic

#

Logic is basically -> client says they died -> saved by that heal on my end -> refund

hoary lark
#

Yeah it makes perfect sense. I can cope with a delay receiving some damage from falling, it's when you land and keep running and then suddenly fall dead it sucks. 😄

grand kestrel
#

Another way depending if it suits your game is to add a tiny stun from fall damage

#

Though might still not look great

hoary lark
#

It's pretty fast paced, I don't really need to handle it much otherwise... Some local fx from the impact that don't really do anything, and forcable death, will be perfect. I'll have to implement a little logic to prevent double playing fx and stuff but... Liking it more the more I think about

ocean geyser
#

question. im doing server/client travel to connect multiple instances together. i can host on one client, and join it on another by connected to my local ip address just fine. the problem is when i port forward(im 100%positive the port is good) and try to join through my external (11.111.111.111:1234) for example with clienttravel, it does not connect. is there something im missing here? or is it related to me trying to connect with it with that ip/port from a local machine?

thin stratus
#

@ocean geyser Are you trying to use your public ip on the same PC?

#

Cause I'm half sure that's not working.

#

Public IP works for connecting from outside of your LAN though

fleet sluice
#

When you try external/public connections between processes running on the same machine, you are "vulnerable" to router hairpinning. The technical explanation doesn't matter since you can't control that, but the effect is that some routers will prevent that kind of connections

#

Stick to LAN or separate WANs

meager spade
#

how can i get projectile to act smoothly on client?

meager spade
#

you can see the issue here

#

the frst non wobbly one is local only and the wobbly one is server

twin juniper
#

Is there a way to "Bake" NPCs into a map

#

so like, they spawn in groups, instead of just one SpawnActor() at a time?

thin stratus
#

Each actor has to be spawned through the SpawnActor code

#

You can preplace them

#

Or loop in one and the same frame to spawn multiple ones

twin juniper
#

Is there a way to spawn a group instead of just one? SpawnActor is a very expensive operation

thin stratus
#

Nope

#

If you have a lot of Actors that have to be spawned, you spawn them at the start and make sure to pool them

twin juniper
#

What is pooling? :o

#

How do I do that

thin stratus
#

You keep an array of your actors

#

So basically spawn 100, keep an array of the inactive ones

#

When they die, you don't destroy but mark them inactive

#

If you spawn one, you take an inactive one from the pool

twin juniper
#

I know that the engine is capable of handling 1000s of actors in multiplayer, because of what was shown in Fortnite. However, I seem to have issues just spawning a number of zombies on a timer

#

Oh so you would just spawn a few thousand of them on load, but then move them to where they would be spawned? Instead of actually spawning new ones?

thin stratus
#

Correct

twin juniper
#

I see

#

That would make much more sense actually

#

In theory, you could spawn a few thousand actors on load

#

and then move them as needed

meager spade
#

issue with 1000 actors on load is memory

twin juniper
#

Well, the issue I have is basically trying to figure out how to have different sets of actors in different locations. However, I need to have them based on the zone/city/area they are in.

#

I tried to spawn them using a timer, however, there is lag whenever that timer event goes off

meager spade
#

yeah cause your instantiating a bunch of actors same tick

twin juniper
#

Large numbers of NPCs, based on different zones, seems very complex to do. Manually placing them wouldn't work either because we need to be able to respawn them if they die

meager spade
#

so either space your spawns

#

or pool and spawn

#

you will still get a tiny hickup when spawning the actor, but if you spawn an actor every .1 second it will help reduce the amount

twin juniper
#

How do games like Fortnite spawn all of those items for example?

#

There's like 3000 items, each I assume is an actor randomly spawned, not even mentioning the chests.

meager spade
#

the map is pre-populated

#

before clients connect

#

and all chests etc are spawned during this initialization

twin juniper
#

What about Conan Exiles? They have thousands of NPCs, with unique interactions and quests!

#

and then the npc's even spawn, but no lag

#

w<

meager spade
#

they probably use pooling

twin juniper
#

or uh

#

what's that other game

meager spade
#

for the actual actor and adjust his quest

#

once unpooled

twin juniper
#

Is this a good example to look at?

#

For how to do this

meager spade
#

not really my pooling manager is better

twin juniper
#

link me

meager spade
#

and allows for pooling of any object, it is c++ only

#

o_0

#

mines not released

#

but

#

ill share it as its quite simplistic but good

#

well any actor not UObject

#

just to clarify

twin juniper
#

yay

#

@meager spade where is it? you going to dm me?

normal hatch
#

Hey there! I'm here from a guide on how to make a dedicated server from unreal engine. I have successfully made my dedicated server! I want to host my server on Amazon GameLift. I have added the Amazon GameLift plugin. So how would I package my server so it could be hosted by Amazon GameLift? Thanks!

jolly siren
#

Is PktLagVariance supposed to affect ping?

#

I'm trying to test very large lag spikes. Looks like PktLagVariance is clamped at 100

#

I'll see if I can do it with clumsy

river hazel
#

Its a percentage i believe

#

Anyone have any experience with getserverworldtimeseconds? Im seeing it not sync up properly from server/client

twin juniper
#

Does ARK use object pooling to spawn 25,000 actors within a few milliseconds?

fossil spoke
#

@twin juniper Might be better to ask that on an ARK Discord? Unless there is an ARK dev here with that knowledge its anyones best guess.

twin juniper
#

Is there anyone who has been able to have 25,000 NPCs and mass spawn them on map load?

jolly siren
#

Definitely don't spawn them all at once

flint plover
#

Quick questions. I’m working on a small multiplayer game, 6-16 players. My graphic card fried this week and I’m waiting on a replacement so I don’t have much to do on the computer so I figured I’d start a open conversation about replication graphs. Going to shoot a few questions out and see if anyone feels like answering. Would I even need one for a smaller project like mine? Would I benefit much from it? How hard would it be to implement into an existing project? And what kind of results have you had if you have used it?

#

I can tell from some of the above conversations, some devs may benefit from replication graphs when trying to spawn increasing amounts of npcs or items

trail dragon
#

Can I replicate arrays and if so is the entire array replicated upon change?

#

@flint plover Doubtful. Replication Graphs were only introduced to handle 100 players and thousands of replicated actors for Fortnite

#

It just gives you finer control than "distance" to what is relevant to your players

meager spade
#

you can replicate Array's but not TMap

#

and yes it will replicate entire array

#

if you want to be smart you can use a FFastSerializer

trail dragon
#

I should break down and read a tutorial on multiplayer inventories then instead of trying to roll my own it sounds like

meager spade
#

to only replicate what changed

trail dragon
#

Not that tutorials always follow best practices

meager spade
#

FFastArraySerializer < sorry]

trail dragon
#

Can a UObject be replicated if it is created on the server and assigned to a replicated property?

meager spade
#

a UObject would need some stuff added to it to make it suitable for replication

#

by default they wont replicate

#

UActorComponent is a good place to look for replicating UObjects as its based on UObject

#

AActor aswell is

turbid heron
#

ok question i am confuzzled

#

how do I check if the pawn that has had its variable replicated is actually being possessed by the client?

#
void Client_UpdateHealthWidget();```
#

i thought that this would only be fired on the owning client?

trail dragon
#

Aside from your actual problem, it's probably better if the player broadcasts an event when his health is changed, and the health widget is registered to that event and updates it

#

That way you can create the widget locally only for the pawn you possess and any time that pawn's health is changed the UI automatically updates without having to manage specifically telling the client to update their UI

turbid heron
#

yeah the UI is client-sided, and no I dont want to bind and poll for the health on tick, i would rather an event-driven UI

trail dragon
#

"broadcasts an event when his health is changed" = event-driven

turbid heron
#

but that's what I am already doing, except it is broadcasting on all characters whose health change

#

my original question is : how can I tell which character the listen-server/client is owning?

#

ex:

#

CharacterA (listen-server is possessing this character) damages CharacterB

#

it triggers a server RPC to change CharacterB's health

#

it then runs a client RPC to update the widget (this part needs a check if the character is the one the client/listen-server is possessing)

#

would it be just a matter of getting the character's controller, and seeing if it is the same as the first player controller?

#

that seems convoluted, there should be some flag for ownership somewhere...

#

omg

#

im stupid haha

#

i was damaging CharacterA instead of hitting CharacterB, so that was pretty awful of me

turbid heron
#

IsPlayerControlled() && IsLocallyControlled()

#

this is what should tell you if the pawn is owned by the local player authority

#

(or networked client)

severe nymph
#

Has anyone found a resolve to the 4.21.1 add static mesh node in construction script bug?

#

a commit or something?

#

Listen server wont send movement data to clients

#

Doesn't matter which template you use... its the engine itself. Something got messed up with the GUID on that node.

#

This bug is literally holding me back from migrating from 4.19.2

trail dragon
#

@severe nymph Is it because each client is creating their own uniquely named instance which aren't linked to each other so anything that tries to replicate it fails?

severe nymph
#

It’s not marked replicated

#

It’s just a net load on client in map actor with add static mesh component node

#

Works fine in 4.19.2

trail dragon
#

Right but looking at the error in the console

#

"could not resolve the new relative movement actor base, ignoring Server CorrectioN"

#

When the player walks over it, the player controller sets it as the movement base, and it doesn't exist on the server/client (as a same/linked entity)

severe nymph
#

Oh yeah it seems they are both creating their own instance

#

(Name=0x00000112655a4bd0 "NODE_AddStaticMeshComponent-0")
This what's failing the NetGUIDLookup in PackageMapClient.cpp

but its very strange because at first this value comes across
+ NetGUID {Value=23 } FNetworkGUID

it breaks here

    if ( NetGUID.IsValid() )
    {
        return true;
    }```
result
```[16] = {0x00000112298a8800 (Name=0x0000011266e192d8 "StaticMeshComponent0"),{Value=23 }}```
trail dragon
#

Maybe you can say the StaticMesh component has Replicates Component enabled? I'm not sure if that would cause them to link properly or not 🤔

severe nymph
#

So it’s two versions of the node component

#

I tried that

#

It clears the warnings but server still doesn’t send data

#

It appears something is wrong with GUID on this node

naive stump
#

Guys,
do I need to configure my router for dedicated server to work over steam?
Adding inbound and outbound rules doesn't helps

severe nymph
#

@trail dragon so I would have to now replicate any actors that use static mesh component nodes and set the components to replicate also?

#

That seems a bit strange considering that if you add a static mesh component to the actor and set the mesh with construction it behaves like it should.

#

It only has this issue when using construction scripts to add the static mesh component.

trail dragon
#

@severe nymph Is the construction script run when the map starts, I don't remember. I think it also differs in editor vs. packaged builds.

severe nymph
#

Construction scripts are ran on actor compile

#

Built before init play

bitter oriole
#

On actor creation

#

Not compile

severe nymph
#

In previous versions it cooks properly in map build

trail dragon
#

They get re-run after a compile (because they get re-created, but still 👀)

severe nymph
#

Not in 4.21.1 it seems

bitter oriole
#

Construction script is basically an extension of the C++ constructor, so it will run everytime you create an object

#

Compiling a blueprint will recreate it so yeah

trail dragon
#

There were certainly changes to networking between 4.19/4.21 because Fortnite... if the construction script is only run when editing the map (and not before Begin Play) you should see why the server/client think they have different instances?

severe nymph
#

My roads, stairs and sidewalks are all modular using this public var system to construct different types

trail dragon
#

ie: There's a "Stream Sub-Levels during Play in Editor" checkbox in the Level Editor - Play that might make a difference

severe nymph
#

If I replace the node with an actual component it works but I have to destroy components not set by vars

#

And it’s simply a ton of work to redo my entire map actors

#

Plus having actors with components just to destroy them is bass akwards

#

The add static mesh component node is practically useless in multiplayer now

trail dragon
#

Try changing that setting and/or try packaging

#

See if it works then

severe nymph
#

I’m using persistent map

#

No Sublevel

trail dragon
#

If you disable "Use Single Process"?

severe nymph
#

According to that debug editor c++ breaks I was doing the node isn’t passing the check. I’m not sure how previous versions of the engine handled the node but something tells me that it was simply overlooked

#

Primarily because if you tick component replicates on the node it clears the warnings even without actor rep ticked

#

Which does nothing if the actor isn’t replicated

trail dragon
#

Might be worth a bug report then

severe nymph
#

If I replicate the actor and the component then it seems to work

#

But I shouldn’t have to do that on a net load on client actor

#

Static mesh component at that

#

It’s like saying you have to replicate a landscape

#

Or a house floor

#

Chews up bandwidth for nothing

#

There should be no difference in behavior between a constructor static mesh component and an aactor with a child component when parsed by mapbuild.cpp

#

Packaged behavior is no different than editor

#

Dude just slides

#

Haha 😂

trail dragon
#

You've made an ice skating hugging simulator

severe nymph
#

Apparently 😂

#

My project is already heavy on bandwidth due to it being VR with transform data for IK

#

About 5kb per client not including voip

#

Aiming for 35 clients on dedicated on 100mb fiber

#

Anything I can do not to have garbage replication data the better

trail dragon
#

To be fair, they only replicate once.

severe nymph
#

I hope epic overlooked this and isn’t expecting us to rep this manually

#

Maybe they replicated it by default in previous build and ripped it out for fortnite

#

But that still doesn’t explain why placing a static mesh component in an actor that isn’t replicated yields different results

#

Vs using the constructor

#

The client should understand it’s walking on a non movable static mesh component baked into the map

#

Technically the server should understand

#

It errors for listen server client as well

#

So it’s definitely a server issue

#

Locally everything is fine the movement just doesn’t make it anywhere

trail dragon
#

The PlayerState isn't valid on the client when their Player Controller is first spawned right

#

If so, how can you tell when the Player State has been replicated and the player is ready to actually set up 😦

naive stump
#

no one?

severe nymph
#

@trail dragon you run an isvalid loop break

#

Until valid

#

Or write a c++ function to give you a playerstate valid event

#

And expose the node to bp

twin juniper
#

@jolly siren Any idea of how other games handle the saving and spawning of NPCs?

#

How do people spawn 25,000 NPCs, and then save them in the same position, with the same stats, and when the player leaves the game and comes back, the NPCs have the same stats, health, etc

#

Calling SpawnActor<>() and then setting the stats causes too much lag

bitter oriole
#

Very few people spawn 25,000 NPC @twin juniper

#

Nevermind saved NPCs

twin juniper
#

ARK does it every time you load into a single player map

#

I think Conan Exiles does it too

#

but i dont know how

jade gazelle
#

If I have a widget component nameplate attached to all players that gets updated and set via OnRep, what would be the best way to implement a client side “hide nameplates” option? If I run a function on the client to hide all nameplates that would work until a new person joins and then the function would need to be run again to remove the new persons nameplate

#

Should the OnRep function maybe check to see if the player has a bool set for nameplates on/off and then function accordingly?

twin juniper
#

Is it possible to spawn 25,000 actors in under a minute?

#

with zero lag

naive stump
#

@jade gazelle Using OnRep would hide it for sure and it would not need to be hided when a new player joins

severe nymph
#

@twin juniper batch he spawning

#

Create a spawn manager actor with a que

#

Spawn with a deviation so it happens randomly between frames. Will reduce the hit

twin juniper
#

That doesn't work, tried it

#

Calling SpawnActor()

#

is just not going to be an ok solution

severe nymph
#

I can spawn 50 per frame random delay loop over the first minute and get 10000 no issues

#

If your not delaying 10 seconds after map load it’s going to hurt

#

Spawning NPCs during map load is a bottleneck

twin juniper
#

Are these just basic actors? or are they complex?

#

I need to be able to spawn NPCs

#

which are complex

severe nymph
#

My NPCs are ai

#

3rdperson character base

#

Are you handling with a grouped controller?

#

Or are you spawning 25000 controllers also

#

Might want to modify your behavior tree to group your controllers for like NPCs

#

Cause truthfully 25000 NPCs with a controller each is 50,000 actors

#

You can use crowd manager or write your own ai controller class to control a group of NPCs either way

#

@twin juniper

#

Also if your using some plugin for sql or MySQL and not using vars then that will be much slower

twin juniper
#

Yea

#

There is no SQL

#

But it is spawning controllers.

#

@severe nymph

#

But I don't think the controllers are the issue

severe nymph
#

You’ll be surprised how much the ai controller instance slows things down

#

But delay on your spawn manager to allow map load to finish ... spawn actor in loop up to 50 then random deviation on the timer handle to recall the spawn event

#

You should see much smoother performance

#

@twin juniper

#

The actual spawn actor should have a random .2-.5 delay in front of it

#

Keeps it out of the same frame

twin juniper
#

@severe nymph Could you show me an example of how you are using a single AI Controller to control thousands of NPCs?

#

How does that work when they are all going to be moving in different locations

severe nymph
#

You get all actors of class set controller

#

The logic is handled by behavior tree

tall knot
#

Hey!
I'm making a simple multi stealth game and I'm doing the Hosting a session and Joining a session with blueprint. I have a bit of an issue, I'm using "Find Session" and it returns a blueprint session result array, which contains IPs I assume, but I want to let the guest choose from different available sessions in the Joining a session menu, but I can't figure out how to print those values in my menu so the player/guest can choose. Well I kinda did print it to screen, but either I get 0 when I fail to find a session, or 1 if I do. I got those numbers by checking the lenght of my blueprint session result array so I know there is a value there, but I can't print it to screen (with print string).

#

I'm a bit new to this, so please bear with me.

bitter oriole
#

Sessions aren't an IP address

#

They're not printable

#

Dunno how that's exposed to Blueprint, but you should be able to get something like a session name, or the names of joined players, etc

tall knot
#

How would I set the session name? When I use "Create Session" I don't have that option

severe nymph
#

@twin juniper in the controller the only difference between a single ai and multiple would be to loop through the pawns to perform the behavior tree logic

#

Move to ... attack ... whatever. The services you used in behavior tree should execute for each casted pawn object you pass in

#

Crowd manager is good for really dumb NPCs but for anything with meat to it your going to have to write a custom class

#

Also I’d recommend a c++ or nativized class as blueprints are a little slower handling this but it is better than 25,000 controller instances

tall knot
#

@bitter oriole I can get the name of the server who's hosting the game, how do you think I should do this?

twin juniper
#

@severe nymph You do know a Controller can only possess one pawn at a time right?

#

lol

bitter oriole
#

@tall knot I haven't done this, so I don't know. I use sessions for friend matchmaking, so I never list sessions in a menu.

turbid heron
#

sessions have names

twin juniper
#

@severe nymph Do you know what I mean

severe nymph
#

Yes but your misunderstanding

#

In your controller

#

Loop through the actors

#

All actors of class

#

Pass in the pawn to behavior tree

#

Do service logic

#

Technically it’s not possessing them all at the same time

#

But once they perform the action the service timer has to execute meaning the controller moves on to the next pawn

tall knot
#

@bitter oriole thank you for your help tho 😃 have good day

severe nymph
#

There are tons of examples on google and YouTube of custom group ai controller classes

#

Just study what they are doing and work out the logic on how you want to do it for your situation

naive stump
#

Guys,
do I need to configure my router for dedicated server to work over steam?
Adding inbound and outbound rules doesn't helps

severe nymph
#

I’m using a single controller for ai horde logic I loop through all the zombies pass the pawn to the blackboard run the service to move to and move on

#

Just depends on what you need. If you want them all performing complicated unique behavior then instances will probably be the only way (remember a single controller shares variables across all possessions) so most vars will need to be in your pawn in this setup

#

@twin juniper

twin juniper
#

@severe nymph yes but the pawn needs a controller to possess it

#

pawns must have controlers that possess them

#

otherwise behavior trees dont run

severe nymph
#

lol

#

I feel like your not reading what I’m saying

#

You possess them on get all actors of class -> loop -> body -> possess

#

In the controller

#

You can have a pawn in the world with no controller

#

You pass the pawn cast into the object in your behavior tree so it knows which pawn to run the service for

#

Object key

severe nymph
#

If you don’t want to worry with that then write your service to loop through the actors @twin juniper

#

Have 1 controller behave as the logic for all actors but still have an ai controller instance on each

#

Really there is so many ways to skin this cat

#

You’ll need the subclass of the controller not run the behavior tree in this situation

#

With 100- 2500 NPCs it’s fine no big deal but if your seriously trying to do 25,000 then your already pressing the cpu and memory to some extremes then throwing a behavior tree and service tick on top

#

It’s going to be costly

twin juniper
#

You know as soon as you call Possess() on another pawn, it stops the behavior tree on others right? @severe nymph

#

Like, what you are suggesting just is not possible to do

severe nymph
#

I don’t know what to tell you other than it’s how I’m setup

#

You have to be mindful of your returns service timers and loop timers

#

It’s all just timing and math

#

The using ai controller subclasses with a parent class maybe easier for you to get your head around and use as a “leader” but I can assure you that you can indeed control groups of pawns with a single ai controller by being mindful of your logic and possession/action timers

#

@twin juniper

#

Just because something isnt fitting into the way your thinking about it doesn’t mean it’s not possible. It’s just that it’s not “done for you” you have to write the logic all the way from the controller -> possession -> pawn -> service-> action return variable to control the next event call in controller

twin juniper
#

@severe nymph

#

So you are saying I should just do this manually?

graceful cave
#

is there a reason bHidden on actors is replicated?

#

seems like it should be clientside only

severe nymph
#

@twin juniper that’s a great start yes but you would need an event to call it once the previous pawn completely returns its actions

#

If you want to have a horde behavior then you’ll need to think about a parent controller with subclass for possession

#

So you can control group movement and actions all at the same time but with a single controller logic

#

Basically a “leader sensing”

twin juniper
#

@severe nymph I think ARK has a custom "SpawnActor" node as well

trail dragon
#

I highly doubt either of those games are actually spawning 25,000 NPCs

jolly siren
#

If I spawn replicated actor B from replicated actor A, is there anything in the engine that guarantees replicated actor A will be created on the client before B?
A is the owner of B

#

A is Character in this case and B is a Gun

lean river
#

in theory.. yes..
if you spawn actor a then you spawn actor b from actor a straightforward server would create a before b
but this not means actor b would be created on clients with proper owner of actor a
this is why all of the actor has onrep_owner in case if owner is not replicated at the moment when created on client

jolly siren
#

Well I'm talking about 100% guaranteed, not theory. I'm not really worried about the owner pointer itself

#

I'm worried about if actor a exists on the client when actor b hits it's PostNetInit

lean river
#

im not sure about this, but i think actor b and actor a both can be valid at same time (or actor b can spawn before actor a ), so order is not guaranteed..
owner rep is the final step in replication which happens after client spaned those actors

jolly siren
#

yeah the problem is that I need to have the values of multiple other replicated properties on spawn on the client. Which is why I am using PostNetInit because it apparently guarantees that

lean river
#

of course actor replication is modified by netfrequency or distance

jolly siren
#
    /** Always called immediately after spawning and reading in replicated properties */
    virtual void PostNetInit();
#

Set Owner should be valid in PostNetInit, however if the character that Owner points to hasn't been replicated yet then it will still be null

lean river
#

yup its weird but i run in this problem several times..
actor was replicated properly, their base properties also was replicated properly

#

but owner was not

#

seems owner is always in late and replicated after that actor is created on client

#

but sometimes owner was replicated before everything else :D
im not sure postnetinit is a safe point

jolly siren
#

Argh, I'm not sure what else to do besides packing everything into a struct

lean river
#

well for weapons im replicating weapon state
its a workaround but im using onrep function for weapon state and check for valid owner

#

if owner is invalid im skipping everything

#

also im checking state in onrepowner function if state is replicated i call what i need to call