#multiplayer

1 messages · Page 698 of 1

thin stratus
#

Sorry to hear that, I don't want to demoralize you. If at all I would want you to extend your skillset and learn C++ first.
It would just be very sad to see someone burn out on an idea they can't reach right now.

#

Actually, doesn't need to be client authoritive, but would make things easier.

mellow solstice
#

yeah, I am aiming for physics a bit similar to rocket league I guess. Vehicles are made out of destructable voxels. There should be no input lag heh

nimble trellis
#

@thin stratus the funny thing is.. ive burnt out on this dream idea of mine before. it was incredibly fun in playtests (its a smash bros style FPS game). problem was, back then i couldnt model or rig/animate at all. now i can. and the last hurdle at this point really was just the netcode. and i wanted to tackle it again, id stay up 20+ hours straight reading doccumentation on netcode/rollback netcode, network fundamentals. have been the last 2 weeks or so (which is roughly how long it took me to learn to animate/rig skeles to the level that i wanted to do. and then.. reality set in, and netcode turned out to be infinitely harder

#

ironically the last thing i had yet to be able to tackle, is the most important in a multiplayer game lol. the world has a sick taste of irony like that lol

thin stratus
#

Yeah, NetCode is quite tricky.

nimble trellis
#

yeah its pretty brutal. but i guess its better that i realize it was a dead end now, then spend another 2 weeks trying to figure out how to pull it off in BP

peak sentinel
#

Can someone explain the magic behind the bAllowAutomaticWeaponCatchup in ShooterGame?

#

I just implemented it to my own custom weapon system and it solved the sync issue between server and client

#

From what I can see if current fire time - last fire time is higher than time between shots it fires the weapon instantly 🤔

#

Damn its clever

thin stratus
#

I assume it's basically so that you don't have to time the press as a player that much?

#

Haven't looked at it though

peak sentinel
#

I guess it lets you fire the weapon instantly if you are still shooting the weapon but lagging behind the owner controller's burst counter so you catchup to its counter

#

Like this

#

In the end, both authority and autonomous proxy fired same amount of bullets

#

Sometimes when releasing the trigger server goes out of sync and fire an additional bullet that autonomous proxy didnt, but I dont know how to solve that yet

trim kindle
#

Will be CDO object pointer properly resolved if replicated?

chrome bay
#

Should do since it's stably named

trim kindle
#

nice, thanks!

#

makes sense

nimble trellis
#

@thin stratus sorry for the dumb question, but are there any particular ue4/ue5 c++ courses/resources you think would be particularly useful for this whole ordeal for me that i could go check out? im not ready to give up quite yet . ill humor my attempt at this lol

uneven flicker
#

can anyone explain me why this isn't working?
When a client shoots, the server and the rest hears it, but when the server shoots, only the server hears it

fathom tinsel
uneven flicker
uneven flicker
thin stratus
peak sentinel
#

When ping is higher than fire rate of the weapon, server always goes out of sync and fires additional bullets which makes ammo different in client and server

slow wing
#

Can someone shed some light on how root motion sources work when networked. I know the saved move system exists, am I correct in assuming the server doesn't extrapolate in normal motion but will only ever move based on received moves from the client? Is this also the case with a root motion source, or does the server actually "simulate" the root motion source?

Say a client has really high packet loss but manages to initiate a root motion source, will the server actually simulate out this source or only update the pawn if it receives new moves from the client?

grand mica
#

any tuts for networking with c++

#

someone would like to recommend?

lost inlet
#

the pins

#

more specifically the compendium which is the 3rd pin

grand mica
light iron
#

Exi, before you said you use an invincible tag for ignoring damage like iframes for a dodge. Does this just entail every Gameplay effect checking if player has tag or not in the damage calculation?

static lynx
#

I have an actor that rotates at a slow rate. Because it's slow, the client rotation updates seem "jerky", as opposed to other actors that don't rotate slowly. Singleplayer doesn't have this problem.

#

Is this some sort of bandwidth saving mechanism that limits the frequency of movement updates?

#

If so, what is the best way to solve it? Should I lower the sensitivity somehow, or should I replicate the new rotation to all clients, and lerp it over the delta?

ashen stone
#

on ReplicationGraph at RouteAddNetworkActorToNodes is it normal for ActorInfo.Actor->GetNetConnection() to return nullptr for Player Pawn and Controller?

fathom tinsel
thin stratus
mint nymph
#

hey guys i am trying to spawn a dice on a player pawn it was working fine but now it just stopped working idk what i did

mint nymph
#

ok just started to bug test more the spawner only works on standalone and not client, assuming the pawn isnt replicated for its location anyone know how to do that

thin stratus
#

GetPlayerPawn(0) will get you a specific pawn, probably the Servers only

#

If you need this to spawn on each player, then you need to make sure you also reference each player

marble gazelle
#

I think it depends where this code runs.
On the server I think its the order of players joind, but not sure if the order is preserved.
On clients I think that GetPlayerPawn(0) should give you the local player, but I'm not 100% sure, there just something in the back of my head telling me that ^^'

stark tree
#

Hi, I'm making a basic Unreal multiplayer game.

  1. Check if any session is found, if not create a new one.
  2. If any is found, join it.

First player starts the game and a new session is created. Second player joins it.

Problem is, this works totally randomly- sometimes the second player finds the existing session and joins it, sometimes it doesn't find it and creates its own making both players in different sessions of their own.

Surprisingly I fixed this problem temporarily by switching to a different WiFi on both devices. It worked twice. Then I switched back to my original WiFi and it worked again. But then the next time it didn't. And now it doesn't work on the second wifi either. It's very confusing. Any idea whats going on?

warped berry
#

I have the client call a server RPC through player controller, and inside that server RPC I'm calling a multicast RPC but it doesn't get called on all clients? I think I'm missing something trivial

marble gazelle
warped berry
marble gazelle
warped berry
#

and the server RPC as well, right?

marble gazelle
#

depends >.>

warped berry
#

it basically triggers a celebration animation which I want all players to see the scoring character playing that animation

#

the server RPC is to inform the server which animation the player chose and then the server sends to all players

marble gazelle
#

then the RPC To client should be on the system that is responsible for the your reward system.
Then this system should trigger the client feedback on the character^^

#

but actually it doesn't matter which system sends the RPC to the server, but it sound's like a PlayerController job

warped berry
#

I'll think about it, thanks mate xD

marble gazelle
#

^^ any time

marble gazelle
stark tree
warped berry
#

are you using UE sessions interface?

stark tree
stark tree
#

Is there any way to upload blueprints somewhere without having to take 10 screenshots of it?

warped berry
stark tree
#

Sorry never used it

#

Figured it out

#

Thanks

#

Forgive the mess.

warped berry
#

no problem, so you're using a plugin and I don't know if there's something needed for it, but I can give you a link that will give you an idea of the whole thing

#

it's in c++

thin stratus
#

Hm, it seems like enabling Ragdoll Physics while running doesn't carry over the momentum to the Ragdoll Mesh on Simulated Clients.

#

So I basicaly fall just downwards instead of foward in running direction

split sentinel
#

Hello, i have a problem where i can equip (spawn) a gun with "UPROPERTY(ReplicatedUsing=OnChangeWeapon)" (and it works perfectly fine on all clients), but when i try to destroy the gun, it only get's destroyed on the local client.
How can i make it that it get's destroyed on all the clients? Here is my code:

thin stratus
split sentinel
#

still doesn't work

thin stratus
#

Then you are relying on the OnRep for the Server

#

Which is wrong

#

At least by default

#

OnRep does not call for the Server

#

You have to do that manually

#

In line 98 basically, after you set the enum value

split sentinel
#

oh. how do i do that?

thin stratus
#

Just call it manually

#

OnChangeWeapon

#

Furthermore, why are you spawning the Weapon in the OnRep?

#

The Weapon itself is replicated or? Then it should also only be spawned on the Server.

#

If you want to use the OnRep to attach it, make the Gun variable replicated with an OnRep

split sentinel
thin stratus
#

Yeah but that's bascially wrong

#

YOu should only spawn it on the SErver

split sentinel
#

i'll try to code it and come back to you later

thin stratus
#
// Header
UPROPERTY(ReplicatedUsing=OnRep_Gun)
AGun* Gun;

UFUNCTION()
void OnRep_Gun();

// Cpp
void ACPlayer::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);

    DOREPLIFETIME(ACPlayer, Gun);
}

void ACPlayer::OnRep_Gun()
{
    if (IsValid(Gun))
    {
        if (IsLocallyControlled())
        {
            Gun->AttachToComponent(FPSMesh, FAttachmentTransformRules::KeepRelativeTransform, TEXT("SOCKET_Weapon"));
        }
        else
        {
            Gun->AttachToComponent(GetMesh(), FAttachmentTransformRules::KeepRelativeTransform, TEXT("SOCKET_Weapon"));
        }
        FPSMesh->SetAnimInstanceClass(Gun->AnimClass);
    }
}

void ACPlayer::Equip_Implementation()
{
    if (static_cast<int>(currenGunEnum) + 1 >= GunClass.Num())
        currenGunEnum = EGuns::None;
 
    currenGunEnum = static_cast<EGuns>(static_cast<int>(currenGunEnum) + 1);

    if (IsValid(Gun))
    {
        Gun->Destroy();
        Gun = nullptr;
    }

    Gun = GetWorld()->SpawnActor<AGun>(GunClass[static_cast<int>(currenGunEnum)]);
    Gun->SetOwner(this);
}
#

Something like this

#

You can still replicated the enum normally if you need it for UI, but I would probably also handle that all through the Gun that is spawned and replicated

split sentinel
#

The spawning works with your code, but the Gun doesn't get destroyed

thin stratus
#

Then debug it a bit more please. It should hbe fine destorying it on the Server

#

Given it's marked as Replicated

split sentinel
#

alright

#

Thank you!

#

IT WORKS!!!!

plucky prawn
#

so im trying to replicate my spectator pawns but im unable to control my spectator pawn at all. in PIE it spawns 2 pawns and i dont control either of them. it does the same behavior in packaged but i cant see whats being spawned. in the logs on the client i get [2022.03.07-13.54.26:490][151]LogPlayerController: Verbose: NULL GameState when trying to spawn spectator! ... [2022.03.07-13.54.26:492][151]LogPlayerController: Verbose: Spawned spectator SpectatorPawn_2147482378 [server:0] after joining my server, and the server says ```
[2022.03.07-13.54.26:393][431]LogPlayerController: Verbose: Spawned spectator SpectatorPawn_2147482471 [server:1]

here is a link to my `PlayerController::SpawnSpectatorPawn` which removes the `IsLocalController` check to try and get the pawn to spawn on the server too. https://gist.github.com/GamerGambit/c8b97ac851e18cf0f89e6d7216546b00
thin stratus
#

Just in case someone else has issues with this in the future

thin stratus
#

Because iirc it's supposed to be local only

plucky prawn
#

specifically, if a spectator is.. spectating another player instead of free-roaming

thin stratus
#

You don't have to use Epic's Spectator logic

#

You could basically make your own system

pallid mesa
# thin stratus

ah this is so your ragdolls are similar on every client end, right?

thin stratus
#

So when you run and then die, the SimulatedProxies just fell to the floor, without any forward momentum

pallid mesa
#

oh, didn't know that

#

thought for some reason momentum was preserved

thin stratus
#

It is for the Autonomous one apparently

#

Not even the Server carries it over properly

#

Probably some super annyoing line somewhere in the CMC :P

pallid mesa
#

😩 hahaha

past seal
#

has any1 here had problems with "Set view target with blend" in multiplayer. If someone joins the session after i have set view target, the camera offsets a little bit.

peak sentinel
#

If this is the case I'm wondering how competitive games handle this situation?

waxen pivot
#

Hello, I need to replicate the array of vectors TArray<FVector_NetQuantize> but I often get the stack overflow error (or others). How to do it properly? I tried to do serialization but nothing happened, there is very little information about this on the Internet. Thank you in advance.

mint nymph
#

Anyone know how to get player pawns if there are mutliple of them

pseudo merlin
#

hi all, I took an insights profile of 2 locally simulated players in a co-op level, I'm not sure how to interpret the values. I'm assuming I need to optimize my replication but I'm not sure how bad this is or what my goal should be

#

I'd appreciate any comments on the profile! thanks

pallid mesa
#

this is a wide topic by itself, just be sure you know the features you can visualize with networking insights

#

such as RPCs, properties and such

#

once you know what insights can offer is just a matter of empirical observation and analysis

#

say, you notice you have some properties that replicate very often that add a minimal tail latency that you could simplify

#

ie velocity, acceleration...

#

you'd say - hey, this is constantly replicating thus adding n bits constantly to my bandwidth

#

you could simplify this by applying aggresive optimisation techniques such as converting these values onto simpler data types that can me mapped in the clients to the target values. But this adds obfuscation onto the source code, so apply wisely.

#

or batching rpc's or applying more aggresive relevancy techniques

#

But optimisation is an art...

#

the important thing here is that you understand what every field if insight means

summer tide
#

Let's say you have an actor with a component. When a player overlaps with that actor, you display a widget. Could it be possible without adding anything to the player BP? I only want to use the component.

rotund onyx
#

Can clients set non replicated variables regardless of ownership? If not how can I allow them to do so?

sinful tree
rotund onyx
#

I am trying to set material instance values on client side. In this case I dont want to replicate

graceful flame
#

Say you're making a game like counter-strike with two rounds during a match. Would the gamemode contain logic that handles the round timer or would that be part of gamestate? I'm trying to have a synced round timer show up on the HUD for all connected clients in the session.

sinful tree
graceful flame
#

thanks

rotund onyx
sinful tree
#

It depends on where you're calling it from.
Eg: Any player input (like keyboard or mouse buttons) are all executing from the client already - you wouldn't need to do an "Executes on Client" event for this.
If there's something being run on the server, and you then want the client to do it, then you'd do an "Executes on Client" event.

rotund onyx
somber glade
#

Just to make sure i'm on the right page:

Actor A is in the scene with an oncomponent begin overlap, with a switch has authority->remote because I want to display a visual change to a client.

That remote will actually run on any client that is connected right because they are all remote? so if I only want to display that visual change to the client I should either further filter that pawn by 'is locally controlled' or go to that pawn and run on owning client?

fathom tinsel
somber glade
#

Good point. And can I make an RPC from there if I need to get some info from the server? or will an RPC only work on the player controller/pawn?

sinful tree
somber glade
#

Yeah the only thing we need the server to do is provide a string from an array it's keep track of. So I'll just go back to the pawn itself and get it there since that is where we're going to use it.

plush otter
#

Usually how do mmo implement pre-computed movement replication? Like during a short period of time the exact delta location of each tick is pre defined?

#

I tried to force set actor location inside of onMovementUpdate. Works fine on autonomous proxy, but on simulated proxy, as long as the period is finished, it tries to smooth out the location with last sever update info, causing a replay.

stark tree
#

Guys, do I need the Oculus build of Unreal Engine to use Oculus Multiplayer features or is it not essential?

true grotto
#

Hi there! I created a timeline to change the progress bar in the HUD, but the timeline should change on the server, and the HUD only on the client. How can I replicate the timeline for playback position selection? (my method doesn't work)

.h

UFUNCTION(NetMulticast, Reliable)
    void TimerTimeLineFloatReturn(float Value);

UPROPERTY(Replicated)
    UTimelineComponent* BoosterIndicateTimeLine;

FOnTimelineFloat BoosterIndicateInterpFunction{};

UPROPERTY(EditAnywhere, Replicated, Category = "Curve")
    UCurveFloat* BoosterIndicateCurveFloat;

.cpp

AKT_BaseLyingObject::AKT_BaseLyingObject()
{
    BoosterIndicateTimeLine = CreateDefaultSubobject<UTimelineComponent>(TEXT("TimerTimeline"));

    BoosterIndicateInterpFunction.BindUFunction(this, FName("TimerTimeLineFloatReturn"));

    bReplicates = true;
}

void AKT_BaseLyingObject::BeginPlay()
{
    Super::BeginPlay();

    if (IsValid(BoosterIndicateCurveFloat))
    {
        BoosterIndicateTimeLine->AddInterpFloat(BoosterIndicateCurveFloat, BoosterIndicateInterpFunction, FName("Alpha"));
        BoosterIndicateTimeLine->SetLooping(false);
    }
}

void AKT_BaseLyingObject::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);

    DOREPLIFETIME(AKT_BaseLyingObject, TimelineTime);
    DOREPLIFETIME(AKT_BaseLyingObject, BoosterIndicateCurveFloat);
    DOREPLIFETIME(AKT_BaseLyingObject, BoosterIndicateTimeLine);
}

void AKT_BaseLyingObject::TimerTimeLineFloatReturn_Implementation(float Value)
{
    if (!IsValid(PlayerCharacter)) return;

    if (!HasAuthority())
    {
        PlayerCharacter->OnBoosterTimeIsUpdate.Broadcast(BoosterIndicateTimeLine->GetPlaybackPosition());
    }
}
fathom tinsel
true grotto
#

but in this way the client can receive inaccurate data

fathom tinsel
true grotto
#

Hmm, perhaps you are right, but I'm still wondering how I can replicate the timeline, for example, for cases where the function should only be processed on the server. Unfortunately, there is no example in the documentation

fathom tinsel
true grotto
#

I meant values

fathom tinsel
true grotto
#

Yes I am looking for this in C++

thin stratus
#

I think Timlines had terrible replication features

#

Whenever I have to deal with this I simply use a Struct with some information and interpolate the value on tick.

true grotto
#

I think tick is not the best way to change something

#

Better timer

fathom tinsel
true grotto
#

ok i am trying to use this

#

Thanks

fathom tinsel
# true grotto I meant values

If this doesn't work you can just directly set a replicated variable value on server in timeline and that would replicate just fine.

true grotto
pallid mesa
#

uh.. so you want to smoothly set a value in the server, or you want to smoothly interpolate the value delta in the client?

#

because if its the later.. don't replicate the timeline, you just don't need that

upbeat basin
#

Is there an event that triggers when PlayerArray or its count is changed? I tried to check array num on GameMode::LogOut event to see if there is no more players to close the game server. But apparently disconnected player is removed from the array after the GameMode::OnLogout call

#

So what I do right now is is waiting for a frame after OnLogout is called to check if I can close the game server

#

It doesn't feel right

winged badger
#

there are add/remove player functions in GameState that can be overriden to add it

#

but note that player array in gamestate is not an ideal way to track num players for the game mode itself

upbeat basin
#

Is there a better way than doing it manually (adding controllers to another array on GameMode and removing upon disconnection)?

true grotto
pallid mesa
#

Right then since you only want that for visuals then forget about replicating the timeline and fire it locally wherever you find a delta change (onrep)

winged badger
winged badger
pallid mesa
#

yes its just - don't x'D

true grotto
#

Ok, thanks for help

pallid mesa
#

btw just in case (probably you know this already). In onreps you can pass in a parameter of type which gives you the old value

#

with that you have A and B for interpolation

#

the interpolation method is up to you

true grotto
#

I didn't quite understand about the old value, do you mean that if I replicate the variable, the server might pass a non-actual value to the client?

pallid mesa
#

nono when you implement an onrep for a replicated variable

#

you can do

#

OnRep_Blah(mytype oldvalue)

#

and automatically unreal will provide you the oldvalue that said property had before updating in the client

#

so you have both your updated value, and the old value provided by the function

#

it's a pretty nice feature of onreps

true grotto
pallid mesa
#

no the parameter passes the old value

true grotto
#

no, i messed up everything, maybe you are really right

pallid mesa
#

and then the priperty you have is the updated one

#

haha

#

unless i had a very big brainfart, but I'm pretty sure about this

true grotto
#

sorry i was thinking of something else

split sentinel
#

Hello, i have a question. How should i do shooting (with linetrace / raycast) on multiplayer? Should i do it in a Mutlicast RPC? or should i do it with property replication or something like this

pallid mesa
#

you can shoot in the client and send the shooting information to the server to later verify it and do the damage

split sentinel
#

so the linetrace stuff on client?

waxen pivot
split sentinel
#

alright, but where do i spawn the particle systems? Like muzzle flash and impact effect

waxen pivot
#

on client ofc. You can do multicast event from server after hit

split sentinel
#

oh right, thank you

left flicker
#

I'm working on an app game that involves players playing in an 'event' at the same time, but they aren't all playing on the same level per-se. I mean there is really only the one level in the game, but the players aren't interacting at all with one another.

What I am sort of looking to do is have the server start the game, and then periodically send out one piece of data every few seconds or so to all of the players. The players do their thing, but not sending any information back to the server until they meet a certain condition and then send a piece of data back to the server.

So I'm working through a server tutorial right now that is like a standard ue4 tutorial about a shooter game using replication to determine whether things are shown between players. But is there a better way to go about what I described? Or is basically having it send all that data with every player at the same spot but nothing being replicated to the server, the only way to do this?

plucky prawn
#

if so, then yes its 100% possible

#

i cant help you with any implementation though since im still learning the networking stuff myself

left flicker
#

If that makes sense

plucky prawn
#

ye makes sense. definitely doable but like i said i unfortunately cannot help with any implementation

left flicker
#

All good. I still appreciate the input

winged badger
#

well, if nothing on the level is replicated, except GameState and PlayerStates, and you do not have a listen server host

#

it should pretty much work out of the box, with exception of being very susceptible to various cheats

#

extra work if you're using any AIControllers, as those would have to run locally as well

tender acorn
#

hi all, guys

#

I wanna ask you, how i have to replicate my widgets? It seems like they don`t have any of replication options

pure vigil
waxen pivot
# tender acorn I wanna ask you, how i have to replicate my widgets? It seems like they don`t ha...

UI is not repliced because UI exist only in client... because there no need for that, What UI does (should?) it only displays state of gameplay data, that data is only thing that needs to be replicated and UI that display that state will change accordingly without need of replication there. So you should keep data sepretly from UI and replicate only gameplay data, if you make UI display it and edit it, it will just work.

In Slate/UMG you can directly bind widget content to varable somewhere else which can be replicable, so make textbox edit varable that you replicate.

tender acorn
#

okay, i got you bro 🙂

#

thanks in advance

rotund onyx
#

I am still having trouble with getting my variables set client side. Basically I've got a material instance that needs variables set, but I don't want them replicated so the clients each set them when they join a server. For some reason that doesn't seem to be working at all.

pallid mesa
#

Is there any straight away manner to skip the owner replication for a replicated actor?

#

IsNetRelevantFor will do I guess

eternal canyon
#

Tho I’m not home so can’t rly verify

pallid mesa
#

Had a quick look, couldn't find anything - I'm in a component so the concept of ownership is not so obvious. Although couldn't find anything either for actors xD

chrome bay
#

COND_SkipOwner?

#

Otherwise it's IsNetRelevantFor

pallid mesa
#

uh, don't think actors have that, although it would be convenient

#

I'm implementing some sort of projectile prediction

#

Actually Jambax, I think you smashed your head a bit with that topic, right? 😄

quasi tide
pallid mesa
#

what's the property name?

torpid mantle
#

hello, is there a step 1 to folder design / project design for multiplayer?

#

ive been in single player land for a while, so doing a quick check as I setup a new project

chrome bay
#

COND_SkipOwner is a per-property rep condition

pallid mesa
#

yeap

chrome bay
#

If it's the entire actor that shouldn't be relevant then yeah IsNetRelevantFor is the only option

pallid mesa
#

yes that's what I believe I want

#

but I'm mostly researching different ways I'd have to implement projectile prediction, so maybe this isn't the way

pure vigil
#

I need some help thinking through some logic. Player uses a container (actor), container has an inventory (array of structs). Player gets widget displaying contents. But then the inventory contents change. I could replicateusing/onrep the container actor's inventory.. but where to go from there?

I could have the container actor track all the players that have the inventory open and when the contents changes it could force them all to rebuild their widgets. But for some reason that feels messy to me.

sinful tree
pure vigil
kindred widget
grand mica
#

I have a pickup item and when the player overlaps the box component, it displays a HUD for picking up the item.
So in my multiplayer project, I need to replicate the item so once it's picked up. It gets multicasted to different clients as well but i dont want the widget to be displayed on different clients. I am using c++ for it. How am i supposed to hide the widget?

kindred widget
#

You had a delegate. I bound to it, you sent out the message.

pure vigil
#

Hmmmmmm I see.

grand mica
#

this widget is a component in PickupItem

tender acorn
#

guys, could anyone help me with animations? even give a suggestion would be great: how some animations work in multiplayer?

twin juniper
grand mica
#

any idea why user widget is getting replicated on different clients?

lost inlet
#

well a user widget wouldn't be replicated to begin with

grand mica
#

@lost inlet

#

i can see this on the client

lost inlet
#

?

grand mica
#

i guess this means it is getting replicated?

lost inlet
#

this is not enough context and user widgets are not replicated

grand mica
#

if a player overlaps the item's box comp then a user widget pops up to pick up the item but I can see the pop up on different clients as well

#

@lost inlet

lost inlet
#

can you not @ me for every message, thanks

#

and this is nothing to do with replication, you're probably using a widget component on each pawn for some reason

grand mica
#

on each item

#

not pawn

lost inlet
#

why would you do that either

#

but oh well

#

it'll be how the overlap is handled

grand mica
#

I have done UFUNCTION(client, reliable) for overlap

supple aurora
#

Working on my first multiplayer project and doing everything in blueprints. I am building doors that open when interacted with a line trace and close when stepping out of the box collision. I've set it up so the door will rattle when its closed as a player passes by and through the same trigger that closes the door if the door is open. However, the door will only rattle once and then I can't get it to trigger again. Anyone have a possible idea what I might be missing?

grand mica
#

also, when I pick up the items from the client. It disables the visibility but the box component is still active. This doesn't happen in the server side

twin juniper
lyric skiff
#

Any ideas why this isn't running? the first is a widget button and it calls the function on the pawn associated with the widget

#

the second function doesn't seem to get called at all

#

added a print string in the first pic to make sure the button was getting clicked and it is

fluid iron
pure vigil
pure vigil
#

Having an issue refreshing a player's inventory widget on changes. I have a drag and drop operation implemented. When the player starts to drag a widget, the original item is set to not render with a flag and only the widget representing the drag is shown. When the item is dropped, the flag is cleared then the inventory is updated and refreshed.

The end result is the item shows at its original spot for a small duration before the server updates the data. It looks .. super messy. Was hoping someone might have a cleaner way to handle this

hollow sky
lost inlet
#

and I'll x-post my reply, never use this node in MP

#

use something else, I'm assuming the weapon has an owner property

hollow sky
#

that is a ref to the player bp

lost inlet
#

so why not use that instead

hollow sky
#

gonna try

#

crashed unreal by remove node line but ye lol

hollow sky
lost inlet
#

then show more of what you're doing

#

and usually recoil like this is pretty clientside

hollow sky
lost inlet
#

what's before this big comment block

#

what's the chain from mouse press to this

hollow sky
lost inlet
#

yeah so show that

hollow sky
#

and this is before the block, the other pin form the seq goes to the fx

#

this is the bath, first one is in player bp, second one in weapon bp

#

and the shoot func in the weapon bp calls the Shot Fired(EBarrel)

#

@lost inletany idea?

lost inlet
#

Shoot -> Shot Fired

#

what happens there

#

not like I really like network things happening BP at the best of times

hollow sky
# lost inlet Shoot -> Shot Fired

its a function from the Easy Ballisics plugin. It gets the EBarrel (from the plugin) and does the fireing, cant open the function so i dont know whats exactly happening

#

the plugin is saying its multiplayer setup

#

when it fires at basicly spawn a projectile at the barrel and does the ballistics things

lost inlet
#

shot fired sounds like it probably arrives on the client as a multicast then

#

though I would only bother with applying recoil on the client and if it's the owning client of the weapon

hollow sky
#

i see

#

oh oh i kinda fixed it

#

ive put the recoil code behind the fire_weapon piece and now its only for the client, but now its only playing once what is logic since its only called when i click

#

pohhhhhhh

#

i think i found it

#

no ok that didnt work

#

@lost inletso i found this in the barrel settings, if i turn it of it does get called but nothing happens

fluid iron
eternal canyon
plucky prawn
#

is there a function thats called when an actor is replicated? im trying to check when AGameState is replicated to the client

torpid mantle
#

anyone here use steamwerks sdk?

plucky prawn
#

ask your question

torpid mantle
#

Thats fair. I'm starting a multi player game, pretty decent with single player and the game will be on steam at some point. Does it make sense or hurt to go ahead and use the sdk now for foundation of auth, lobbies, etc.. or is there a basic way of doing it to 'fake' things during development until I need to bring it in. (i.e.) how hard to add later on. My first mp game so I'm trying to think about how to start. Game is 2d async strategy. So I need a server.. but clients aren't really connected in real time.

#

there might be like 2 solid q's in that puking of words

plucky prawn
#

really depends on what platforms you want to support. if you are 100% sure you are only going to use steam then it doesnt really make sense to worry about other platforms so id suggest to just lock in steamworks. however, if you plan on supporting other platforms like EOS or whatever, there exists in unreal OnlineSubsystems (like steam and EOS) which abstract functionality into a nicer API which will allow you to basically swap these subsystems in and out. of course, these abstractions will not contain all features from every sdk/subsystem (as an extreme example, steamworks allows you to join steam groups and message other steam users, the generic abstracted OSS API will probably not support this since other OSS's probably dont have steam integration)

torpid mantle
#

Could you build to the OnlineSubsystem api to get the game up and working then add steam later?

plucky prawn
#

yep. thats literally the point

torpid mantle
#

In order to distribute through steam you need the steamwerks stuff?

#

big q as my single player game will go there as well

plucky prawn
#

afaik you dont actually need steamworks to distribute your game on steam (see factorio in the very early days). you only need steamworks if you want steam integration. with steamworks you can make sure that there is a logged in steam user running your game, and that they actually own your game on steam (eg to prevent piracy)

torpid mantle
#

ah k that makes sense

#

any clue the $$ per app?

#

i guess i'll go find that out

#

where are the EOS Online subsystem docs?

#

..

plucky prawn
torpid mantle
#

just reading this stuff

#

that doesn't really.. say

plucky prawn
#

the last sentence isnt entire true. you can use steamworks with the 480 (Space War) steam app id and it will work fine, but for multiplayer sessions it will pick up literally every server running this app id

#

afaik the fee is negotiated between you and valve

torpid mantle
#

ohrly

sinful tree
#

Whether you are completing the Steam Direct signup process or are already an established Steamworks developer, you can now simply pay a $100 USD (or equivalent) fee for each new app you wish to distribute on Steam.

plucky prawn
#

someone who has actually released a game on steam might have more details about this

#

ah ez

#

looks like they didnt change it from greenlight

torpid mantle
#

ha top line

#

thx

#

k let me see about those subsystems first

#

this other stuff seems like a lot my lawyer will want a peek at

fluid summit
#

Hi everybody! i'm having a trouble with something and i was hoping someone could give me some pointers on where to search for a solution.

Currently i'm gathering some data on the server with Json calls, this is triggered and handled with events (exclusibly)

The problems is that the events don't wait until the previous one is finished, and since i require some Api calls to be finished before execution the next one, it's generating a mess with the load of the overall data.

I was thinking on the following solutions:

  1. Create some variable bool Replicated and change the state of it after LoadPart1 is finished, and trigger LoadPart2 on the OnRep of that variable.
  2. Using Tasks, but i'm not sure if this is ideal on MP, i'm open to suggestions.

The problem with the first one is that i need as many variables as steps on the process, sounds stupid.

Thanks in advance

lost inlet
#

so you don't have to pay the $100 per title every time unless you're just constantly uploading shovelware

plucky prawn
plucky prawn
#

Is there a way to do per-connection replication? I've seen IsNetRelevantFor, is this the correct way?

marble gazelle
# fluid summit Hi everybody! i'm having a trouble with something and i was hoping someone could...

Who sends these events? are the events in the correct order? If so: Create a queue and process them one after another as I assume you do some rest calls these give you a "done" callback and if one request was done you can continue with the rest.
Not sure if this is the case, but if your requests have some specific requests to send, maybe put all this logic in one request, so you can execute any request at any tíme and the backend ensures everything is executed correctly and if needed calls some other stuff.
But maybe I don't get your architecture right^^

kindred widget
# plucky prawn Is there a way to do per-connection replication? I've seen `IsNetRelevantFor`, i...

That is one way to do it. Useful if you need only a select few people to know about an object. Like a "TeamState" maybe. Realistically if you're only trying to talk to one client, it can be easier to drop an actor component on the controllers to route data through. Both work. Technically using an actor is cheaper net wise I think but requires a little additional setup. Depends on your use case or preference.

grand mica
#

Hello guys, I really need some input from the experts over here. I am pretty new with both Unreal and networking and there are a few missing links in my understanding.

Here are my multiplayer setting. I assume with this setting there won't be a player playing as server. So most of the events that happen, I need to pass them from client to the other client. I read somewhere that you first need to send things to the server first and then to the other clients. I am doing things with c++. So i have tried a few things which causes error. For eg.

To pickup an item I am first made a function binded to an action key

here it is

UFUNCTION(NetMulticast, reliable)
    void InteractWithItem();

void Aaissgnment51FarmCharacter::InteractWithItem_Implementation()
{
    if (currentIteminRange)
    {
        currentIteminRange->PerformActionInitial();
        if (!currentIteminRange->isDamageable)
        {
            if (currentOwnedItem != nullptr)
            {
                currentOwnedItem->positionWhenDropped = GetActorLocation();
                currentOwnedItem->PerformActionInitial();
            }
            currentOwnedItem = currentIteminRange;
            auto temp = InventoryHUD->GetUserWidgetObject();
            UinGameInventory* infoWid = Cast<UinGameInventory>(temp);
            infoWid->SetCurrentItemInInventoryInformation(currentOwnedItem->itemType);
            currentIteminRange = nullptr;
        }
    }


}```
#
void APickableItem::PerformActionInitial()
{
    if (HasAuthority())
    {
        PerformAction();
    }

    else
    {
        switch (currentState)
        {
        case ItemState::LAYINGONGROUND:
            if (isDamageable)
            {

                FVector explosionLoc = GetActorLocation();
                UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), DamageEffect, explosionLoc);
                currentState = ItemState::BROKEN;
                SetLifeSpan(1.0);
            }
            else
            {
                currentState = ItemState::PICKEDUP;
                PickUpMeshComp->SetVisibility(false);
                SetActorEnableCollision(false);
            }
            break;

        case ItemState::PICKEDUP:
        {
            currentState = ItemState::LAYINGONGROUND;
            PickUpMeshComp->SetVisibility(true);
            SetActorLocation(positionWhenDropped);
        }

        default:
            break;
        }
    }
}```
#

I can pick up the item through the client but the box collider doesn't get disabled for the pickup item

#

and the widget attached to the item gets displayed to all the clients

grand mica
#

also, the multicast function is being called only once 😦

thin stratus
#

Multicast is Server Only

#

So you need an Server RPC first

#

Also a lot of this stuff doesn't need a Multicast

#

The Server should be fine handling 90% of this on their own

#

The only thing you need to tell the clients is if the picking up actually worked

#

And that depends on how you manage picking up stuff.

#

Or rather, what it means to pick things up

#

E.g. destroying the Pickup when it's picked up

#

And then there is 2 things that can happen:

  1. One Time Actions
  2. State Changes

One Time Actions would be playing a Pickup Animation, spawning a Particle, etc., which can be done via a Multicast. E.g. on the Pickup itself.

State Changes, if you don't destroy the Pickup, need to be handled via RepNotify variables, because hot joining players or players that are out of relevancy range, won't get the Multicast and will not see the changed State.
An example for a State Change is visibility or collision.

#

@grand mica

winged badger
#

@grand mica you have a few structural problems there that will bite you in the arse later on

grand mica
winged badger
#

never manipulate UI directly from game code, UI gets changed 10 times during development of the game, you don't want to have to change the game code every time that happens

thin stratus
winged badger
#

also, for things like interaction, its better to make a more generic interface, so that you can pick up an item, fire a cannon or open a door with same set of RPCs

thin stratus
#

So either way you have a Server

grand mica
grand mica
#

you are right

winged badger
grand mica
#

it gets altered many time during development stage. Actually it's an asssignment stuck up on my ass. So I thought of doing something simle

winged badger
#

UI can manage itself from that point, c++ just needs to fire an occasional MC delegate to notify it to update

grand mica
winged badger
#

one thing i really don't miss is std 😄

grand mica
#

cos according to the assignment the dedicated server is easy to set up lol

winged badger
#

that kinda depends on your hardware spec

grand mica
grand mica
winged badger
#

you need to download and compile the source engine

#

while a newer high end CPU can do that in 20 or so minutes

#

you really don't want to be doing it on i3 mobile

grand mica
grand mica
winged badger
#

not with binary launcher

grand mica
#

so i have to link up the source code now

winged badger
#

you literally have to download the UE source from epic github

rigid flare
winged badger
#

then build that

rigid flare
#

so that's a bad way to get multiplayer working

winged badger
#

then you get this

rigid flare
#

correct me if I'm wrong tho

winged badger
#

also, after you download UE source

grand mica
winged badger
#

build UE and not the entire solution

grand mica
#

this one is tougher to build and setup

winged badger
#

you'll need about 150GB

grand mica
grand mica
grand mica
thin stratus
#

This is not for actually distributing the game

#

You can test Dedicated Servers in the Editor with Play As Client in the Dropdown

#

Or on Older UE Versions it was something something Dedicated Server

#

But if you actually want to build a standalone DedicatedServer, you need to download the Source code of UE, compile it and then you get the option to actually build a standalone Dedicated Server

grand mica
thin stratus
#

Which you then have to host somewhere so that others can reach it (aka cloud servers that cost money)

#

Or you provide the players with the DedicatedServers if cheating is not a topic for you

grand mica
thin stratus
#

Yeah the point is, the Editor stuff is only for testing

#

You won't get around the source code part

#

Eventually you need to actually build and ship a the DedicatedServer

#

Which is not possible with UE downloaded from the Launcher (Or Epic Games Store or whatever they call it by now)

grand mica
#

I have downloaded the source code as well but I doubt the requirements. They just want me to test it on editor

thin stratus
#

Right, if you just need to do something for some test, then it's probably not needed to do the Source Code part

#

I don't know why you are doing what you are doing, so I expect this to be a project that is supposed to be released in the future

winged badger
grand mica
#

they know I dont have any professional experience with unreal.So, I really doubt setting up dedicated servers is a requirement

winged badger
#

it only worked when play option dropdown was expanded

#

it caused a few wtf moments

grand mica
#

@thin stratus just a small doubt. If I am playing with one of the clients and I call a function which is tagged as UFUNCTION(server, reliable), it never goes inside that function. How can i even multicast if it never enters the server RPCs?

thin stratus
#

You can only perform ServerRPCs in Actors that are owned by the Client executing it

#

E.g. PlayerCharacter (Possessed), PlayerController, PlayerState, Components that are replicated on those Actors, or other Actors that the Server spawned and have the Owner property set when spawning to something that is already owned by that player

#

Otherwise it will drop the call

#

So an Item in your level can't have a ServerRPC

#

Or at least it won't work

grand mica
#

@thin stratus so if I set the owner before calling this function in PickUp, I guess it should work?

thin stratus
#

Has to be set on Server side

grand mica
#

yeah, through the character

thin stratus
#

Yeah, but at that point you are already on the SErver

#

Which makes it redudant to change the owner on the pickup

#

Cause then you don't need the RPC anymore to begin with

#

For Interactions Systems you usually RPC in the Character or whatever components on the Character handles this

#

+- some differences that others might now point out, but Character is a good start for an interaction system

#

So the Key Press for Interaction would already peform the ServerRPC

#

And the Server would then handle the Interaction

grand mica
#

I see, thanks for it. I'll try a few things out and see how things need to work. Thanks for the help

sinful tree
#

Your interaction needs to be replicated before passing to the trap. So right after your linetrace, you can check if the actor implements the ObjectInteraction interface, and if it does, RPC to the server there. Once running on server you can pass the actor reference to the interface. You may want to check on the server if the player is actually close enough to perform the interaction as well prior to disarming the trap.

Also, you do not need the Get All Actors of Class or the second interface call - your logic that is in the TrapDisarm interface should be what is contained on the ObjectInteraction interface call.

ruby tundra
#

Hi everyone hope every one is good. Well I have a question I have a multiplayer Hud which displays the health of both players. But I cannot find a way to display real time health of both the player. I would appreciate any help.

clear turret
clear turret
# clear turret Thanks for your reply. To RPC I should create a custom event that runs on server...

I'm just re-sending the message, as I've deleted by mistaken 😅

Hello everyone! I'm stuck with something with Replication and seeking for some help - most likely newbie's mistake 😅

I have a game trap (BP_Trap) in the world, and it can be disabled by a lever (BP_Lever). The lever is activated via Interface from a Linetrace that comes from PlayerController - and it requests the trap disarm through interface as well.

My problem is, if it's the client that disables the trap, the variable is not modified on the server. How can I fix this? I've tried changing image 3 to CustomEvent RunOnServer, but then the client can't disarm the trap.

I'm uploading these images:
(1) LineTrace on BP_PlayerController
(2) BP_Lever casting Traps to disarm
(3) BP_Trap checking and disarming itself

sinful tree
#

So if the actor you're interacting with is a BP_Trap, then it would disarm it.

clear turret
#

Thanks, @sinful tree! 🙇‍♂️ Following your tip I was able to do that first interaction. 🙌

clear turret
sinful tree
#

Ah ok, that is a bit different then. I suppose you could still work with what you have for the interface then.

clear turret
#

Yeah, I'd love to find another alternative for that cast, but couldn't think of a way 😅 And since this is the prototype, it will work for now.

If you have other suggestions, please point the way so I can research for the future 🙏

#

Right now, what I was thinking was to use Tag instead of a variable, so I'd "Get All Actors with Tag", which I think could reduce the amount of actors request

fluid iron
fluid summit
livid holly
#

if I'm replicating a UStruct and I change only one property in the server, does the entire struct replicates? Or only the changed property?

peak sentinel
#

Changed property

grand mica
#

Hello, So the pick up of item worked well on all clients. I made a server call on the character and through that call I called a multicast function on the item.
Right, there's only one issue which is left. It's the user widget. I read user widget don't replicate at all but there are two things which are happening atm.

  1. the inventory widget which I have added to the view don't update the item's text into it.
  2. when the overlap event triggers, the items switches on a hud. For eg. "Press F to pick up Statue" but this gets replicated on all the clients. I don't even know why. I have made these calls as client only but it still happens. Here is my code:-

    UFUNCTION(client, reliable)
    void InteractAtm();

void Aaissgnment51FarmCharacter::InteractAtm_Implementation()
{
    
        if (currentIteminRange)
        {
            InteractWithItem(this);
        }
    
}```
#

    UFUNCTION(server, reliable)
    void InteractWithItem(Aaissgnment51FarmCharacter* pawn);```
#
void Aaissgnment51FarmCharacter::InteractWithItem_Implementation(Aaissgnment51FarmCharacter* pawn)
{
    if (pawn->currentIteminRange)
    {
        pawn->currentIteminRange->PerformAction();
        if (!pawn->currentIteminRange->isDamageable)
        {
            if (pawn->currentOwnedItem != nullptr)
            {
                pawn->currentOwnedItem->positionWhenDropped = GetActorLocation();
                pawn->currentOwnedItem->PerformAction();
            }
            pawn->currentOwnedItem = currentIteminRange;
            ChangeInventoryText(this);
        }
    }
}```
#

    UFUNCTION(NetMulticast,Reliable)
    void ChangeInventoryText(Aaissgnment51FarmCharacter* pawn);

void Aaissgnment51FarmCharacter::ChangeInventoryText_Implementation(Aaissgnment51FarmCharacter* pawn)
{
    if (currentOwnedItem!= nullptr)
    {
        auto temp = InventoryHUD->GetUserWidgetObject();
        UinGameInventory* infoWid = Cast<UinGameInventory>(temp);
        infoWid->SetCurrentItemInInventoryInformation(currentOwnedItem->itemType);
    }
}```
#
UFUNCTION()
    void OnOverlapWithItems(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
    UFUNCTION()
    void OnOverlapEndWithItems(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
void Aaissgnment51FarmCharacter::OnOverlapWithItems(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    auto InteractableItem = Cast<APickableItem>(OtherActor);
    if (InteractableItem != nullptr)
    {
        currentIteminRange = InteractableItem;
        InteractableItem->ShowHUD(true);
    }
}

void Aaissgnment51FarmCharacter::OnOverlapEndWithItems(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
    if (currentIteminRange != nullptr)
    {
        currentIteminRange->ShowHUD(false);
    }
}```
#

sorry for bothering you guys

sinful tree
# grand mica ```c UFUNCTION() void OnOverlapWithItems(class UPrimitiveComponent* Overlapp...

For #2: Not 100% sure, but if OnOverlapWithItems is being detected when a player's character is overlapping with an item, then all clients could also see that overlap happening, which means "InteractableItem->ShowHUD(true)" would trigger on all clients. This could potentially be fixed by adding a "if (IsLocallyControlled())". You'd probably want a similar check on the OnOverlapEndWithItems check too, otherwise the UI element may disappear when you don't want it to when another player leaves.

grand mica
#

any idea why my widget isn't getting updated?

sinful tree
#

My guess would be that currentOwnedItem isn't replicated. Updating the inventory display shouldn't even need to be handled as an RPC, let alone a multicast. If currentOwnedItem was set up as an OnRep variable, then with the OnRep function you could again do a IsLocallyControlled check, and update the inventory from there.

grand mica
sinful tree
#

If you're setting a variable on the server, and you intend for the client to use that variable in some way (including for displaying information) then it needs to be replicated.

grand mica
#

is there a way to set a variable on the client itself?

sinful tree
#

By setting the variable while running on the client.

#

But by doing so, no one else knows thats what the client has.

fluid summit
grand mica
fluid summit
sinful tree
# grand mica why does it need to be replicated. It's a class member, it should be a separate ...

Each copy of the character will have its own value set. Replicating is meant in terms of copying the value that the server has of this specific instance of the object and letting clients know that the value for that particular instance of the object has that value.

So you have a character, I have a character. We both have our own currentOwnedItem variable.
You (through a server RPC) let the server know that you want to pick up the stone sitting on the ground. It sets your currentOwnedItem to stone. If it was marked to replicate, then your client would then know that your currentOwnedItem is stone, and my client would know that your currentOwnedItem is stone.
I still haven't picked up anything on my character, so my currentOwnedItem is still nullptr.

grand mica
sinful tree
# fluid summit Is there another term for "quehe"? cause i can't find anything about them

In a very basic sense, your queue could just be an array of "requests" that you want to make.
When you want to make a request, you add it to the array, and check if a "request processing" boolean is true.
--> If so, don't do anything further for now
--> If not, set your "request processing" boolean to true, get the request data at array 0 and submit the request with that data.
When you receive the response back, remove the item at index 0 of that array.
Check the size of the array is > 0.
--> If so, make an event that triggers the same "get the request at array 0 and submit the request", basically looping it.
--> If not, set your "request processing" boolean to false and no further action required.

fluid summit
#

That one did the trick and it was really simple, thanks!

pure vigil
#

Having a listenserver issue. In my playerstate, I have an RPC to update a variable. This variable is set to replicate with ReplicateUsing= (repnotify). Works fine for clients but this function doesn't get called serverside when the listen server is running it.

I could manually call the replicateusing function which DOES cause it to execute on the server .. but it also executes TWICE on the clients now.

Any good way around this?

kindred widget
#

You should have an updating function or binding to call. Call that from the OnRep, and call it after setting the new variable. Clients run it from the OnRep, server runs it right after variable set.

pure vigil
#

The problem is determining if this is the server updating a value for itself or the server updating the value for a client

kindred widget
#

How so? The OnRep is for the client. The Set function is for the server.

pure vigil
#

Ohhhh ok, I think I see. Let me give that a shot.

kindred widget
#

Basically you should have....

void SetSomeProperty(ValueType NewValue)
{
  SomeProperty = NewValue;
  DoUpdateStuff();
}

void OnRep_SomeProperty()
{
  DoUpdateStuff();
}

void DoUpdateStuff()
{
  //Called from OnRep on client.
  //Called directly after variable set on server.
}
pure vigil
#

Gotcha. Turns out I was doing something like that already .. but with an extra step that called a Client function which then called DoUpdateStuff. So even when I called it directly on the server, it then ran it on the client again. It needs some cleanup.

neon ether
#

So im spawning a vfx on a server and client through a multicast rpc thats being called from the locally controlled player. The spawning of everything works just fine. But how would I go about being able to deactivate that same vfx so that it deactivates on the server and client?

kindred widget
#

That sounds very state based, good case for a simple replicated boolean or something.

#

Alternatively, could change the multicast to have a boolean.

#

Depends on the case and how long this vfx is. If it should turn itself off don't worry about turning it off. If it lasts for a few seconds, maybe change the multicast parameters to be able to call it with a "Turn on/TurnOff" state. Else I'd probably do a replicated property to keep track of it if it lasts for some time. Newly joined, or newly relevant clients can be updated this way.

neon ether
# kindred widget Depends on the case and how long this vfx is. If it should turn itself off don't...

So the vfx is a flamethrower and it just needs to be turned off when the player lets go of the fire button. Which all that architecture is in place for that to be able to happen I just need to vfx to turn off for the server and client. The vfx component that gets spawned in is itself replicated. The basic flow is Weapon Actor Wants to fire -> vfx gets spawned on server and client through a multicast called from a server rpc -> that multicast spawns and sets the replicated vfx variable which should get replicated down to the local/client machine (which it seems to not do). Then for turning it off there is a multicast function that uses that same vfx component spawned and set from the previous multicast and dactivating that. The issue seems to be that when that multicast runs on the client it has no reference to that vfx component spawned originally

kindred widget
#

Not sure I'd even despawn it personally. I'd just make it a part of the weapon. Enable it or disable it based on the fire state. Reliable RPC the firestate from the owning client to the server. You can possibly let firestate be set on the owning client locally along with the RPC to server and firestate can replicate to non owning clients and enable disable the effect on any non owning machine that way.

neon ether
# kindred widget Not sure I'd even despawn it personally. I'd just make it a part of the weapon. ...

That previous message probably didnt make much sense, so I'll try and do a better job of explaining with pictures and whatnot. The first image shows the replicated vfx that I mentioned. The second is how the multicast gets started when the player fires. The third image shows the actual multicast function that ends up getting called where the vfx gets spawned and that replicated variable gets set. I think my issue here is that this will only ever let me have reference to one of the vfx that end up getting spawned and not the client and servers.

So okay i think i see what your saying conceptually. But I also dont think i see how you do that. Since from what I understand to be done correctly a vfx needs to spawned in a multicast to show up on the client and server.

kindred widget
# neon ether That previous message probably didnt make much sense, so I'll try and do a bette...

This is a specific implementation. I'd probably run this through some base classes. But the basic straight forward idea is this.

.h
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
UNiagaraComponent* FlameThrowerEffect = nullptr;

UPROPERTY(BlueprintReadOnly, ReplicatedUsing=OnRep_FireState)
bool FireState = true;

UFUNCTION()
void OnRep_FireState();
void UpdateFiringState();
    
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
    
UFUNCTION(Server, Reliable)
void ServerSetFireState(bool NewFireState);

void StartFiring();
void StopFiring();


.cpp
void AMechBase::OnRep_FireState()
{
    UpdateFiringState();
}

void AMechBase::UpdateFiringState()
{
    if (FireState)
    {
        FlameThrowerEffect->Activate();
    }
    else
    {
        FlameThrowerEffect->Deactivate();
    }
}

void AMechBase::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);

    DOREPLIFETIME_CONDITION(AMechBase, FireState, COND_SkipOwner);
}

void AMechBase::ServerSetFireState_Implementation(bool NewFireState)
{
    FireState = NewFireState;
    
    if (GetNetMode() != NM_DedicatedServer)
    {
        UpdateFiringState();
    }
}

void AMechBase::StartFiring()
{
    //Call this on owning client to start shooting
    ServerSetFireState(true);
    FireState = true;
    UpdateFiringState();
}

void AMechBase::StopFiring()
{
    //Call this on owning client to stop shooting
    ServerSetFireState(false);
    FireState = false;
    UpdateFiringState();
}
neon ether
#

To sum up; when I do the spawning of the vfx this way and I go to deactivate the vfx through a multicast like shown in the image then it only turns off the vfx on the server side and doesnt ever on the client because the client only ever has a NULL reference for its "ProjectileVfxNiagaraComponent"

#

oh wow okay I'll definitelly pick apart that file and see whats different than what im doing

kindred widget
#

Have a property. Let it replicate to anyone but the owning player. Use that to enable to disable a default system on the weapon. Set this locally on the owning client when telling server to change. Tell server to set it and also to update it's state. Everyone gets updated, it's stateful for newly relevant clients. And it should feel reactive for the owning player.

#

Mostly sure I got all of that correct. Not in a networked project at the moment. 😄

neon ether
#

So in this case is the FlameThrowerEffect being initialized in the constructor..?

kindred widget
#

Yeah, Default component on the flamethrower. You can set the particle emitter it uses from BP.

#

No point continually destroying and respawning an emitter that is consistently reused.

neon ether
#

So youd be setting that component in the constructor with the usual spawnDefaultSubObject method to give it that component?

kindred widget
#

Yeah

neon ether
#

and then set the emitter in that created blueprint in there.

#

okay that makes more sense now

kindred widget
#

Like I said, I'd probably do half of this in a base weapon class like the start and stop firing, and the firestate, etc. mark them virtual. Might not even make a flamethrower C++ base since the UpdateFiringState can just be a BluepintImplementableEvent to start and stop the emitter.

#

Depends what else you need I guess.

neon ether
#

Yeah it definitely does, I appreciate all the input though, I'll adjust our imlemimentation of how the "on/off" logic to match your example since it makes much more sense to do it that way since even spawning it over and over doesnt make much sense to begin with

neon ether
kindred widget
#

Your component doesn't actually exist at that time. That call is more of a registration to create a component.

#

It does, but doesn't, so to speak.

#

If you want to disable it early, consider PostComponentInit or OnConstruction

neon ether
#

Thank you! I wasnt actually aware of PostComponentInit

neon ether
kindred widget
#

On/Off, yeah. Cause server won't fire the OnRep

charred crane
#

In my game mode OnPostLogin, I'm spawning a player and possessing it. Then I'm getting all my Player Controllers and telling each of them to update their hud with the new pawn that I spawned via client RPC. Clients are getting an invalid object. Do I need to have the game mode get the PlayerStates and tell them to update? How do I get the new pawn ref to them?

charred crane
timid moss
#

Feel really stupid for asking this, but why is it that we don't use a ROLE_Authority guard when we call CreateDefaultSubobject in the constructor.

#

People always teach that you always only spawn stuff on the server and have it replicate down (unless prediction), so why is is different in this case?

charred crane
#

In my Event OnPossess inside my PlayerController, I have a value that is RepNotify. On the RepNotify I'm getting my GameState, but it's invalid. How could a client's GameState be invalid?

sharp kestrel
#

I'm not sure if this helps at all but my guess here is that the GameState is invalid because the local PlayerController doesn't actually have one to speak of.

#

Does the Host player also return invalid?

charred crane
#

GameState is how a client interacts with a game mode. Any info that needs to be accessible to clients about the overarching rules are supposed to be here. If I throw in a delay, it works. But the game state should exist/replicate before a random value I set inside the onpossess of my player controller replicates.

sharp kestrel
#

Right. Wasn't sure if you were just accessing it in a weird way or something.

#

If a delay makes it work then my best guess here is that you have some order-of-operation issues.

#

Like trying to access it before it is actually created, which would naturally make it invalid.

charred crane
#

How can a PC exist and replicate to a client before the game state does though?

sharp kestrel
#

Though I'm pretty sure stuff relating to players should be made afterwards anyways.

#

I mean that's what I thought but if a delay makes it work?

#

Although

#

From what I was asking in #blueprint it does seem like the host player is made before any OnBeginPlay triggers in gamemode/gamestate stuff.

#

So... depends largely on what you're doing.

sinful tree
#

I believe it's because the player controller needs to exist before the client "joins" the game. Once it joins, then the gamestate can replicate to the client.

#

I could be wrong tho 😛

charred crane
#

I'm testing with a client joining through steam. so the host player already exists, the controller has to exist for it to possess something.

#

My logic to get game state is triggered on that repnotify

sharp kestrel
#

I think Datura might have the answer there. Host' controller is constructed resulting in its pawn being constructed and possessed which would trigger the OnPossess event before the GameState is constructed?

charred crane
#

So we've already possessed a pawn. and our game state still isn't valid yet?

sharp kestrel
#

Possibly.

#

I'm going to test something real quick

charred crane
#

This feels stupid, but maybe I should just make a rep notify bool or something inside gamestate and on that notify then do my game state check/logic that i want to do.

sharp kestrel
#

Okay test failed, I can't print from a construct. I wanted to see what triggered first, a host OnPostLogin or the GameMode constructor. I know the OnBeginPlay starts after PostLogin

#

Oh wait

#

Are you working with GameMode or GameState here?

sinful tree
#

"Play as Client"
Player controller exists before Gamestate.

LogBlueprintUserMessages: [BP_MyPlayerController_C_0] Client 1: Client Playercontroller
LogBlueprintUserMessages: [BP_Gamestate_C_0] Client 1: Client Gamestate

"Listen Server"
Gamestate exists before Playercontroller

LogBlueprintUserMessages: [BP_Gamestate_C_0] Server: Authority Gamestate
LogBlueprintUserMessages: [BP_MyPlayerController_C_0] Server: Authority Playercontroller
charred crane
#

GameState, because GameMode isn't valid to clients

sharp kestrel
#

Host PostLogin
GameState OnBegin
Other players PostLogin

charred crane
#

That GameState is for the host though right? Don't they have both?

#

I'm running a listen server with a host player and joining that server through player input. That should mean gamestate exists before right @sinful tree ?

sharp kestrel
#

I'd go with what Datura is suggesting honestly. You might want to test this with an actual build as sometimes the engine can be a bit funky with this stuff.

charred crane
#

I'm testing with packaged game

sharp kestrel
#

Aah okay

sinful tree
#

And player controller exists before gamestate on clients.

charred crane
#

Are there like...async tasks that can loop until my gamestate is valid? or do i need to write that myself?

#

or a not crappy way to wait until my game state's valid

sinful tree
#

So here's the thing that I'm not entirely sure about....
When you normally possess a pawn, the player controller already knows the pawn they are possessing. This can be accessed easily at any time by doing GetControlledPawn. It may not be the type, but it's not something that you would need to replicate from the server.

sharp kestrel
#

Out of curiosity

sinful tree
#

So that OnRep of the pawn isn't really necessary as the playercontroller will already have easy access to the object it is possessing.
What is it in the gamestate that you're trying to do when the client joins?

sharp kestrel
#

Would the Delayed Start thing help here?

#

I don't know if Delayed Start prevents players from possessing their pawns

#

But it might be worth giving that a shot?

charred crane
#

Yeah the OnRep of the pawn was just a trigger to let me know that the client side possession has finished and that I can attempt my game state stuff

#

since we've established that the gamestate won't be valid yet, i reverted it

sinful tree
#

Ok, so the thing is, you shouldn't have to care about the client receiving the replication for things to proceed really. Your gamestate should do as it needs on the server without input from the client.

#

Unless of course, you're wanting client input for something 😛

charred crane
#

What I'm trying to do is get the player pawns of each other character in the game. To do that I need to get the game state and get everyones controllers(through player states) and then their pawns. Which requires the gamestate to be valid.

sinful tree
#

To do that I need to get the game state and get everyones controllers and then their pawns.
This would not be possible on clients as player controller only exists on owning client and the server. So this sounds like it would be a server-side operation, no?

charred crane
#

I edited my comment, I'm getting everyones player state, then their pawns through that.

sinful tree
#

You still say controllers though

charred crane
#

I'm not getting controllers

sharp kestrel
#

Okay so to repeat my question since it was ignored in Blueprints.
Is there a way to delay a host player's OnPostLogin to only fire after GameState has done its OnBeginPlay stuff?

#

Each player (human or AI) has a faction associated with it and I want all the AI ones (determined by the map selected) to be loaded into the list before players.

#

Human players are added on PostLogin which means host always goes to top of the list 😦

charred crane
#

Is reordering the list a possibility? Or is there some other functionality that is required?

sharp kestrel
#

I could maybe do a reorder. Its a list of structs so I can just add in a "is human player" boolean I guess

charred crane
#

Set Array Elem should work pretty well for it

sinful tree
charred crane
#

Yeah I guess I'm not sure why I decided to do this inside my player controller

sharp kestrel
#

Welp, tried adding the player factions to the end and

#

Tbf I was doing it through one of the Match Start or something like that funcitons

sinful tree
sharp kestrel
#

Yeah that's probably a better way to do it

#

So far so good, will need to do more thorough stress testing later to see how consistent it is over a network though.

charred crane
rich sinew
#

Has anyone tried something like Networked Object Pool? Any idea about that?

charred crane
#

Somehow..my player controller's Event On Possess is no longer firing for clients, but they're able to possess the pawn and control it...

meager spade
#

missing super call somewhere in your c++?

charred crane
meager spade
#

wrong controller bp?

charred crane
#

Nope. I've been working in the same file. basically just changing what happens after my authority switch..and suddenly it stopped working

neon ether
# kindred widget On/Off, yeah. Cause server won't fire the OnRep

You're probably no longer around now, but I was able to implement the design idea you laid out earlier with how turning it off and one for the server and client worked and it worked flawlessly, so thankyou very much for that knowledge. My only other question is that that lets say the client picks up the flamethrower and that player has the appropriate reference to that flamethrower it picked up. The vfx still spawns at the origin when its fired and i've been struggling to figure out how to tell that vfx move to the player's who picked it up muzzle location and show up there for the local machine and the other player. I've been playing around with the attachToComponent for the niagara component and I've only been able to get it to show up in the correct spot on the local machine while the other player always sees it at the origin.

plucky prawn
#

Are input events replicated at all?

dawn ledge
#

No input is on the client side

somber glade
#

I'm convinced unreal hates me. So we've packaged our dedicated server and quest client numerous times. We've been doing it for two weeks without issue. After setting up a video chat plugin that has nothing to do with the server, we can no longer join the server. We just join the server with an IP connection. This has worked flawlessly well over a hundred times. Now when I go to join I get "no game present to join for session" and it immediately crashes the app.

#

Server log just says join request, no game present, join succeeded, then closing open connection and disconnects

kindred widget
somber glade
#

Sorry for the crap no discord on this machine.

thin stratus
#

@somber glade if you only use IP connection, then the session stuff should be unimportant

#

Also the client log would be important

somber glade
#

So any idea what's going on here? I haven't messed with anything related to the connection.

#

Client is a quest

#

Let me see if I can find a lot

#

Log

thin stratus
#

Need the log, otherwise I can only use my crystal ball

somber glade
thin stratus
#

Nope

somber glade
#

Found it I think. Let me see if I can get it off this machine

thin stratus
#

I will have a look at it once I'm in the office. Just woke up and only on the phone

#

Maybe you can see something in it yourself already

somber glade
#

Yeah I've got a bunch of exceptions about binaural spatialization not found

thin stratus
#

Yeah not sure what that is hehe but glad you found a starting point

somber glade
#

After about 10 of those it starts throwing the no game present error

#

We went back to an older version for now. And still same game session

thin stratus
#

If you aren't using sessions then just ignore it

somber glade
#

But it works.

thin stratus
#

IP connections dont need those

somber glade
#

So it must be the audio crash

thin stratus
#

Yeah it is

winged wave
#

how would you go about adding features to the example ue4 shooter game? I mean, let's say you add something "simple" like wall jumps or jetpack movement, how do you make sure it's handled correctly multiplayer-wise and especially in case of network lag?

fathom tinsel
# winged wave how would you go about adding features to the example ue4 shooter game? I mean, ...

I don't think it is related to shooter game at all except for understanding how it works before adding your own implementations over it. It is more related to how things are actually done in multiplayer and that you will eventually learn by practicing. For efficiency you will have to follow best practices like minimum data transfer over the network and less use of multicasts by more focusing on replicated state for various events. You will eventually learn on the way so just start playing with various things and see how it works.

winged wave
#

Thank you, I've never done anything multiplayer and I was trying to figure out "quickly" what are the key parts you have to add to "normal" code to make it multiplayer, I read a bit of the basics about replication, but still I have to understand if ue4 handles automatically errors at least for movement, or if you have to do your custom checks for everything

fathom tinsel
fathom tinsel
fathom tinsel
winged wave
#

@fathom tinsel Thank you, I am trying get up to speed as fast as I can, I got this task for an interview so I have not much room to learn at a normal pace. And they specifically asked to handle server-reconciliation cases, that's why I was asking about any particular pitfalls on the topic

slate basin
#

hey, does anyone know how to get the MaxNumber of players when you play in editor when you play as listen server/client with more than 1 player?
I tried checking the AGameModeBase::InitGame options param but that's empty

chrome bay
#

There isn't one in Editor

#

Can try AGameSession::MaxPlayers but it'll just be whatever the config default is I imagine, and probably won't even be respected.

slate basin
#

I guess I'll just wait a few seconds before changing the match state if it's play in editor then

umbral horizon
#

Are 20 replicated variables (replicating to all) bad for a game which wants to have 60-80 in game players?

How many replicating variables(without replifetime condition) should make me worry about it?

bitter oriole
umbral horizon
umbral horizon
bitter oriole
#

There isn't one

#

And generally speaking if you need them, you need them

#

Don't replicate anything the clients can compute themselves and you'll be fine

umbral horizon
#

Hmm you are right. And setting up a replication graph can further help right if there are a lot of variables?

bitter oriole
#

Helps with server CPU time, IIRC

umbral horizon
#

Thanks

grand mica
#

Hey,
Something weird is going on. My character's basic movements have stopped replicating on other clients. What could be the issue?
I think the basic movements are replicated by default. Here are the properties

grand mica
#

weird, when i run the game through "Debug Editor" mode, it works different from running it from the editor. I have compiled the latest code in editor as well. This is weird

slate basin
#

if you made any changes, I think you need to compile Development Editor | win64

grand mica
#

debug editor directly from VS

#

and one from the launcher

#

I have compiled it, yes

slate basin
#

I think the launcher one or uproject runs Developement editor

grand mica
#

but things are running differently

slate basin
#

change the build configuration to Development Editor in VS and run debug from there? see if you get the same issue as you when you run from launcher maybe

grand mica
#

let me try

#

this one runs exactly like the one I was running from VS

#

so I can assume this is the right version of my work?

slate basin
#

try running the one from the launcher again

grand mica
#

ah they are working in the same way

#

and the basic movement of the character is not replicating 😦

slate basin
grand mica
slate basin
#

did you override anything in your movement component class?

grand mica
#

yeah i put a bad check in begin play()

#

got my issue 😛

grand mica
slate basin
#

does anyone know a good tutorial/blog/wiki that explains Beacons and sessions and how to use them together. I want to create a party system and lobby system, multiple parties (i.e. a party of 5, a party of 3, and a party of 2) can join the same lobby (if it was a 5v5)

sinful tree
slate basin
ancient badge
#

Hello,
https://blueprintue.com/blueprint/gacuue7p/
I have this blueprint for an actor with 4 triggerbox, the code itself works fine.
For each triggerbox (down, up, left, right) i have the same code. For all 4 they work on the server and client,when only one is triggerd, but when two triggerbox are triggerd, for example up and down then only one works on the client, on the server both work. Someone an idea why on the client only one?

elfin copper
#

Hi Guys, I have multiple "Player Start" set in my topdown level. But only the server spawns with the camera facing the correct orientation, all the clients spawn in the correct location but facing directly towards their fronts. How to fix it?

livid holly
#

Hey folks. When using Fast TArray Replication (with NetDeltaSerialize), it's possible to override methods for client side notification of changes (PreReplicateRemove, PostReplicatedAdd, PostReplicatedChange). However these methods are part of the struct itself (the one derived from FFastArraySerializerItem). If an Actor class implements a fast array serializer, can the actor class be notified of these changes? Since the struct has no concept of owner, it doesn't know who the owning actor is, but I need the client side rep notifications to be accessed by the actor

rapid rampart
#

Hello there, could anyone please help me. I'm developing a dedicated server using third person template, but every time when the second player joins the server, it sees 2 characters overlapped for all the other previously joined players like the screenshot. Could anyone help or point me some documents about this issue please?

kindred widget
#

Alternatively, I'm semi sure you can add delegates to structs that the actor could bind events to.

livid holly
#

do you mean just adding a UObject* property and manually assigning it to the owner?

kindred widget
#

UObject*, AActor*, whatever you need.

charred crane
pallid mesa
#

How accurate is the ExactPing from the playerstate for prediction calculations?

bitter oriole
pallid mesa
#

oh! I was thinking about sending the timestamp every time, but if this inaccuracy is somewhat acceptable... I can simply use it, or would you recommend something else?

bitter oriole
#

It varies a lot

#

ExactPing is thus good enough

pallid mesa
#

Oh the variable is called ExactPing but I haven't seen how it is calculated

#

i know for a fact that this ExactPing replaced an old variable called ExactPingV2

#

so I believe the algorithm underneath has evolved quite I bit

#

Oh I see, you mean CompressedPing vs ExactPing, right? 😄

bitter oriole
#

I mean ExactPing in PlayerState is good enough and there's no need to go into more details

pallid mesa
#

right I got a bit confused by the statement of "Ping isn't accurate" 😄

#

thank you Stranger!

bitter oriole
#

Ping is not an accurate physical value

#

It's a variable that fluctuates permanently and is the sum of multiple values

#

Both your client and server performance have a large and direct impact on ping for example

pallid mesa
#

right, that I understand, thus asking if the UE implementation for pin was sufficient enough

bitter oriole
#

it is good enough, just remember to divide ExactPing by 4 for the correct value

pallid mesa
#

won't need to in this case, using directly ExactPing instead of CompressedPing

#

but good having it in mind! Thank you a lot Stranger

#

it's already dividing by 4 in the early calculation as far as I could see

#

I'm on UE5 BTW

elfin copper
#

I have multiple "Player Start" set in my top down level. But only the server spawns with the camera facing the correct orientation, all the clients spawn in the correct location but facing directly towards their fronts. Anyone knows a solution? I've tried several different approaches like possesion, forcing camera view, etc and nothing seems to work

slate basin
pseudo merlin
#

hi all, lets say my rounds have a time limit. Is it ok to always replicate a float which represents time left in round? or is that a waste of bandwidth?

lost inlet
#

it's generally a bit better to use a time value of when the round time will expire

#

the game state replicates a server time value to clients by default

pseudo merlin
#

thanks 👍

#

generally should I avoid replication of floats set per tick?

lost inlet
#

like everything: it depends™

#

but if there's a more efficient way of doing it then I would say avoid, like in that example

pseudo merlin
#

makes sense thanks

dull tinsel
#

Whats the trick to getting the game mode to interact with clients properly?
I have my game mode handling team assignments and a lockdown event system.
I've basically set everything I can find to replicate everywhere, but I'm still not getting the same results on the client side as the server

dark edge
kindred widget
#

GameMode doesn't really interact with clients at all. If it has necessary things to display, it'll replicate them through GameState or other managers.

dull tinsel
#

When each player joins it registers itself in an array in the game mode. Odd numbers are team one, even team two

#

Or vice versa

#

It's not really displaying so much as telling server owned actors to do stuff, but it isn't replicated on the client consistently.
Like one is a wall of cubes being scaled with the music spectrum frequencies. That replicates, but it doesn't replicate when the cubes are supposed to stop

elfin copper
low helm
low helm
#

But you don't know how to send messages down to clients otherwise

#

Creating replicated actors is probably the easiest "replication" setup there is, but other types of messages will require a more elaborate understanding of Unreal's framework

dull tinsel
#

Ok, so move everything to the game state instead?
And correct. I have a fuzzy understanding of how replication in unreal is handled

low helm
#

the spawning of actors can stay on Game Mode

#

that will work anywehere the server calls it

#

Sending information to those actors should occur on the actors themselves, or you could use GameState as a decent alternate

#

Clients would (generally) get those updates (Multicast events I presume), though replicated variables tend to be a better way to send messages when possible

dull tinsel
#

My issue is I have several things that need to sync up for the lockdowns and I needed a manager to do that.
But I'll try game state instead and I'll make sure the events are multicast and the variables themselves set to replicate

mint drift
#

Hey guys. On a multiplayer game how to a get the player? instead of it

this is just a checker to see if it is the a player.

sinful tree
mint drift
#

if pawn == overlap actor do>

sinful tree
#

Do you want to check if it is a specific player, or any player?

mint drift
#

any player

#

any player but not NPC

sinful tree
#

So then you can check if it is a player by getting the "Other Actor" on the overlap, casting to pawn, and checking if player controlled.

dark edge
mint drift
kindred widget
sinful tree
kindred widget
#

Also worse in regards to the reason for avoiding casting. 😄 Cause now instead of just Pawn, you have Pawn, PlayerState an GameState involved.

mint drift
next pollen
#

Can anyone give me some insight as to why I don’t see this object on my clients?

#

It’s a skysphere, and I’m trying to spawn it from my level blueprint

kindred widget
#

Try using AlwaysRelevent.

#

Components may for some reason not allow it to be relevant by normal functions. Skysphere sounds like it'll always be relevant though.

next pollen
#

I’m seeing it on the clients now! Thanks for the tip

graceful flame
#

When using Seamless travel, should the Transition Map be a completely blank level? What happens if you place a static mesh or actor to indicate loading? Would that be better as a widget instead?

fluid iron
#

im trying to make multiplayer game and this is the code for joining a session
i tried open level and execute console command and both of them are not working
idk what im doing wrong, in the tutorials they said to append "Open" and the "IP" in execute console command
or just open level and put the IP as the level name

graceful flame
fluid iron
#

so do i open IP and than open the level that the host is in?

#

@graceful flame

graceful flame
#

Like this, I think.

#

you can also use Listen for the options if its not a dedicated server

fluid iron
graceful flame
#

What are you trying to make happen?

fluid iron
#

joining a session?

graceful flame
#

Dedicated or listen?

fluid iron
#

uhhhh, a session that someone created? ¯_(ツ)_/¯

graceful flame
#

So if there's already someone else creating a session, you can search for available sessions then pass that session into a Join Session node.

#

Are you using the Advanced Sessions plugin? https://forums.unrealengine.com/t/advanced-sessions-plugin/30020

fluid iron
#

like this?

graceful flame
#

It gives more options, but it isn't necessary.

fluid iron
#

it still does nothing

graceful flame
#

There's no incoming pin connecting to the Find Sessions so it won't ever start.

fluid iron
#

i connected it xd

#

and it doesnt print any string

#

idk how

graceful flame
#

Which online subsystem are you using? By default you can't host a session over the internet without one.

fluid iron
#

nvm it worked

#

thanks

fluid iron
#

and why isnt it working

graceful flame
#

I'm not familiar with that method, I'm using the advanced sessions plugin with the Steam subsystem.

toxic lion
#

I have a function that (when called in a BP) is only returning the expected value when called in a RPC

    UFUNCTION(BlueprintCallable)
    FORCEINLINE AEquippable* GetEquippedItem() const {return EquippedItem;}
#

🤦‍♂️ no reference to var in GetLifetimeReplicatedProps

slate basin
#

Hey, anyone what the best way to get th number of connecting players to the server?

fathom aspen
stark tree
#

Player 1 (host) can move but player 2 (client) can't - Hi, I'm creating a session with player 1, and player 2 joins that session. But upon joining session player 2 is unable to move or look around at all. It is not getting the pawn I believe

dark edge
stark tree
#

Should I change anything?

#

The host is VRPawn

#

But I think the client doesn't become VRPawn

thin stratus
#

@drifting trellis Please use the Job Board for things like this. See #instructions on how to post there.

still coral
#

Hello I have a question:
If I change the CharacterMovement's MaxWalkSpeed at runtime, does that mess with client prediction? Because that's what I'm doing, and client prediction should be smooth, but it's not 😅

still coral
# dark edge Yes

Ok, so I should probably create another variable that's used for the same behavior instead right?

#

Thanks btw ❤️

dark edge
#

A long term change in max speed will be fine. A sprint won't.

still coral
#

I'm trying to get my character to start running at a certain speed and then gradually accelerate until it reaches a top speed

dark edge
#

I'd just tune the acceleration

#

Or you can do this, which is way more involved

https://youtu.be/RtQRMcupJs0

Support the channel through donations. Crypto accepted!
PayPal: https://paypal.me/reidschannel?locale.x=en_US
Patreon: https://www.patreon.com/reidschannel
Bitcoin: 1JFwWHr4X6uAeoZadukzqKjzFBj3Qjy7Sk
Ethereum: 0x2B2Bc108F1Cc0fF899959dEF3226637787d8C3dE
Dogecoin: DNQ33YnhpWoTBokBNVkZP5ub8KTLkpyjpv

Join our community discord!
Discord: https://dis...

▶ Play video
still coral
still coral
dark edge
#

No because it's the same everywhere.

#

Basically if you're trying to change movement stats at runtime that CHANGE has to be predicted

still coral
#

Hmm ok 🤔

dense mason
#

Is there a way to replicate this?

thin stratus
#

@dark edge @still coral I actually wondered how one does networked "Idle to Walk" transitions, that are sort of RootMotion.
Because actual RootMotion wasn't supported unless it's a Montage, or? Maybe they are using Curves in the Animation to adjust the MovementSpeed, which could be synced, but not really predicted.

thin stratus
# dense mason

Yeah, by making that Struct RepNotify and setting it on the Server and then setting the skeletalmesh in the OnRep

dense mason
random nymph
#

I have a replicated struct in my playerstate. Any idea why the struct isn't replicated to client when changed on server? The struct has one string field and many arrays of enums

#
    UE_LOG(LogTemp, Warning, TEXT("Server switch trait"));

    FString enumString = GET_ENUM_STRING("ERuneTreeTraitType", traitType);

    FRuneLoadout newLoadout = OwnerHero->KingshuntPlayerState->SelectedRuneLoadout;

    for (auto& trait : newLoadout.BrutalityTraits)
    {
        FString traitString = GET_ENUM_STRING("ERuneTreeTraitType", trait);
        UE_LOG(LogTemp, Warning, TEXT("Trait before %s"), *traitString);
    }

    switch (category)
    {
    case ERuneType::Brutality:
        UE_LOG(LogTemp, Warning, TEXT("Server switch trait brutality to %s"), *enumString);
        newLoadout.BrutalityTraits[index] = traitType;
        break;
    case ERuneType::Willpower:
        newLoadout.WillpowerTraits[index] = traitType;
        break;
    case ERuneType::Survivability:
        newLoadout.SurvivabilityTraits[index] = traitType;
        break;
    default:
        break;
    }

    OwnerHero->KingshuntPlayerState->SelectedRuneLoadout = newLoadout;

    for (auto& trait : newLoadout.BrutalityTraits)
    {
        FString traitString = GET_ENUM_STRING("ERuneTreeTraitType", trait);
        UE_LOG(LogTemp, Warning, TEXT("Trait after %s"), *traitString);
    }

    OwnerHero->KingshuntPlayerState->OnRuneLoadoutReplicatedDelegate.Broadcast();```
#

The prints tell the trait switch is made but setting the SelectedRuneLoadout to newLoadout has no effect

#

Found the problem...

#

The struct was COND_AutonomousOnly

#

Which is strange that the first time setting it doesn't have any problems

thin stratus
somber glade
#

Does the blueprint node "is dedicated server" actually work when you have a dedicate server and how does it know that you are running on one?

somber glade
#

is that something that gets set automatically when you create a dedicate server or do we need to set that somewhere? We have a source engine that we're building a dedicate server on , but I think it's returning false on the server

winged badger
#

its read from the NetDriver

#

i think

#

anyhow, engine will set it correctly

somber glade
#

so it should be automatic, not something we need to worry about?

marble gazelle
#

It's automatic and works on my project fine.

somber glade
#

okay. weird.

marble gazelle
#

How do you start the server

winged badger
#

yeah, you can check for Client (beats Authority checks when client spawns stuff locally), Standalone, ListenServer or DedicatedServer

somber glade
#

We get a server crash if the server tries to start the agora plugin and we were getting a crash on that. So I assumed the 'is deidcated server' node wasn't properly returning true on it.

#

maybe something else.

somber glade
marble gazelle
#

well if the plugin can't be loaded on servers, you might need to exclude it from servers

somber glade
#

batch file with that in it

#

As long as the server doesn't try to create the object associated with it (which clients do, its' for voice/video chat) then it has been fine.

#

but I found out that 'is server' returns true on the client in some situations .

#

so I switched the check to 'is dedicated server'

winged badger
#

so goto c++ and use a preprocessor macro

#

if you suspect the check is failing

#

#if !UE_SERVER #endif i think

somber glade
#

Thanks, if this doesn't work I'll try that

winged badger
#

then the code inside won't even get compiled into server binaries

marble gazelle
#
#if WITH_EDITOR
#define YGG_IS_SERVER() (IsRunningDedicatedServer())
#else
#define YGG_IS_SERVER()
#endif

#if WITH_EDITOR
#define YGG_IF_ON_SERVER if (YGG_IS_SERVER())
#else
#if PLATFORM_COMPILER_HAS_IF_CONSTEXPR
#define YGG_IF_ON_SERVER if constexpr(YGG_WITH_SERVER == 1)
#else
#define YGG_IF_ON_SERVER if (YGG_WITH_SERVER == 1)
#endif
#endif

#if WITH_EDITOR
#define YGG_IF_ON_CLIENT if (!YGG_IS_SERVER())
#else
#if PLATFORM_COMPILER_HAS_IF_CONSTEXPR
#define YGG_IF_ON_CLIENT if constexpr(YGG_WITH_CLIENT == 1)
#else
#define YGG_IF_ON_CLIENT if (YGG_WITH_CLIENT == 1)
#endif
#endif

We basically use this. IsRunningDedicatedServer is Unreal API and it works perfectly fine.

winged badger
#

yeah, that code does not depend on NetDriver being instantiated yet

#

IsDedicatedServer() does

marble gazelle
#

so the issue could be related to the init order

winged badger
#

if the plugin starts up when modules are still loaded

#

yes

somber glade
#

well this is clear as mud... ```[2022.03.11-12.21.24:498][388]LogNet: Welcomed by server (Level: /Game/ProjectContent_Topos_Gallery/Level/CustomLevel/LV_Fair_Square/LV_Gallery_FairSquare_ActorType, Game: /Game/ProjectContent_Topos_Gallery/Blueprint/Core/GM_Topos_Gallery.GM_Topos_Gallery_C)
[2022.03.11-12.21.24:521][388]LogHMD: FSplash::DoShow
[2022.03.11-12.21.24:521][388]LogLoad: LoadMap: 172.30.1.34/Game/ProjectContent_Topos_Gallery/Level/CustomLevel/LV_Fair_Square/LV_Gallery_FairSquare_ActorType?game=/Game/ProjectContent_Topos_Gallery/Blueprint/Core/GM_Topos_Gallery.GM_Topos_Gallery_C
[2022.03.11-12.21.24:521][388]LogWorld: BeginTearingDown for /Game/Levels/AvatarSelection
[2022.03.11-12.21.24:524][388]LogWorld: UWorld::CleanupWorld for AvatarSelection, bSessionEnded=true, bCleanupResources=true
[2022.03.11-12.21.24:525][388]LogSlate: InvalidateAllWidgets triggered. All widgets were invalidated
[2022.03.11-12.21.24:559][388]LogAudio: Display: Audio Device unregistered from world 'None'.
[2022.03.11-12.21.24:564][388]LogOutputDevice: Warning:

Script Stack (0 frames):

soft trout
#

Hey, I am trying to setup a VOIP in my multiplayer project. (Steam works fine and all, players can join etc.) and it does not work at all. The debug texts shows that noone is talking, no mic is turned on and that it doesn't even work. In reality everyone can hear the host but the host is deaf and clients can't hear each other, furthermore this broken voice chat works in the lobby which is a separate map with a separate player controller and the voip gets initialized after joining the main map inside the player character blueprint. The VOIP is not even directional sound as all the clients hear the host regardless of distance always from behind. (I have attenuation setup and VOIP settings set.) I have been grinding the forums for 3 days now and nothing works. Does anyone has any idea how it is supposed to work? (UE4.26, AdvancedSessions plugin)

thin stratus
#

@soft trout as much as I can understand the feeling when you can't find out about a feature or a bug, please don't crosspost in 2+ channels.

soft trout
#

sry I wasn't sure where to post

#

deleted the other

timber anchor
#

Hello guys, I currently have an event that create a widget to every client if the server is actually executing it. Even if i set the event as Run On Owning Client this will be in any case replicated on Server+ All connected clients. Is there a reason for that?

dark edge
#

Keep things stateful. What is this widget and why does it appear?

timber anchor
#

Ill show you the logic i currently have

#

This event is executed everytime my interaction system, overlap with the Desk.
So you press E, and you actually sit on the chair.
If i try to spawn the widget ad the end of the Multicast event IN Run on owning client, this will spawn the widget everywhere, ignoring the Run on owning client

spark owl
#

What is the default dedicated server tick rate, and what is a good tick rate to set them to for the most smooth and stable experience?

timber anchor
#

^
Found a solution for what i was actually doing wrong.
Spawning the widget inside the player character was a stupid idea, since I was taking every Instance of the Character and spawning it.
This got solved by telling the controller with a cast to spawn it once i was seated, just with an event dispatcher

gritty pelican
#

Hi all. When the client connects to the server, Actor calls Begin Play for the client, but the replicated values are not ready yet. Where is a safe place to get the replicated values?

#

for example

void AXFoliageActor::BeginPlay()
{
    Super::BeginPlay();
    for (int32 i = 0; i < InstancesDeleted.Num(); i++)
    {
      UE_LOG(LogTemp, Warning, TEXT("i = %d, instance index = %d"), i, InstancesDeleted[i]);
    }
}
#

but at this time client don't have this variables

#

For example, can I do it in AActor::PostNetInit?

fathom aspen
gritty pelican
#

@fathom aspen Yes, I'm using that now, I was just wondering if there was another way

fathom aspen
gritty pelican
#

PostNetInit does not seem to work for replicated properties. So I will use RepNotify

void AXFoliageActor::OnRep_InstancesDeleted_Implementation()
{
    if (!bInstancesLoaded)
    {
        HideDeletedInstances();
        bInstancesLoaded = true;
    }
}
timber anchor
#

Hey guys, any reason why a replicated component (Decal) Won't show in the client side?

charred crane
#

Could a widget reference exist on a player state?

dark edge
#

Why would a PlayerState care about a widget?

#

What exactly are you trying to do

charred crane
#

What I'm trying to do is on P1 post login, send a message to all other players to create a health widget on their UI for this new player's character

#

What I tried was on post login ->game mode get all player controllers and client rpc(to player controllers) pass the new character but the character was invalid on clients

#

sorry not on post login, on possession. but i dont think that's much different

dark edge
charred crane
#

i don't think that the value isn't there yet, I think it's not valid ever

dark edge
#

What value? Every players pawn is certainly replicated. That's what you want to keep an eye on

#

Gamestate has a Player array (array of PlayerStates), and each PlayerState has a ref to their Pawn

charred crane
#

This image is from my player controller. If I repnotify Player Pawn, that will let Player 1 know that their pawn is replicated, but how would Player 2 know that Player 1's pawn has been replicated to them?

dark edge
#

Controllers are not on other clients

#

Client A doesn't see client B's controller

charred crane
#

oh right, so that won't work at all

dark edge
#

only the host sees all

charred crane
#

yeah I'm just not clear on how Player 2 will know when Player 1's pawn has replicated to Player 2

dark edge
#

Begin play on pawn -> Get local playercontroller or HUD -> register pawn? Not sure it's the cleanest but it'd work

#

I'm sure theres some onrep you can hook into that's cleaner

charred crane
#

what is register pawn? is that a node?

dark edge
#

That's what you'd make.

#

"Hey HUD, I'm here, show my HP to the local player plz"

#

"Hey HUD, I died, delete my HP bar plz"

#

not clean but it'll work

charred crane
#

how can i get the local player controller? just get player controller 0?

#

This is what I'm looking at. (on begin play of my pawn)

dark edge
#

Why not just get HUD and do it

#

depending on if you need references to allies anywhere else

pearl fog
#

Hello, I have a question, for restricting chat messages to specific players should I implement a Client RPC inside the PlayerController or there is a way to provide a filter/mask to a NetMulticast ?

charred crane
#

HUD is created and set earlier in this flow

#

I'm not clear on what you mean by get hud and do it. thats what im doing

dark edge
#

are you using AHUD at all or just handling widgets in your PlayerController?

charred crane
#

Oh, yeha I'm not using the default hud, I'm using widgets that I spawn

dark edge
charred crane
#

player controller is spawning it and holding it but it also gives the ref to the pawn

slate basin
#

hey, do you have to call BeginSpectatingState on both the server and the client or am I doing something wrong?

charred crane
dark edge
#

Just have the pawn call RegisterMe on local PlayerController at BeginPlay and DeregisterMe at its EndPlay. PlayerController can handle it from there. It's prolly better to use HUD but PlayerController is fine.

#

There's no reason for a pawn to know about the HUD or even what a widget is really

#

just needs to tell the widget manager that it exists or is about to not exist

#

In you widget manager, you'd add the pawn to MyAllies when its registered, then call UpdateUI

#

which would read MyAllies and add/remove widgets corrospondingly

charred crane
#

So the image before the one i just posted work work?

dark edge
#

I mean it might but it's gross

#

Whatever manages the widgets, let it manage them. Just give it the bare info it needs to work

charred crane
#

i'm not really concerned with its grossness lol. I can clean that up

dark edge
#

that bare info being notifying it when pawns are created and destroyed

dark edge
# charred crane

Why is anything HUD related even being passed over the network

charred crane
#

Oh do you mean it being an RPC?

dark edge
#

You can just do this in PlayerController
Begin Play -> Is Local? -> Make HUD

#

Or do it state driven like I do in my projects.
OnRep HUDState -> Shuffle HUD around

#

Depends on if server should have any authority over the HUD or not

#

works GREAT for menus etc too. It's just a state machine.
Pressed Esc Button -> Select HUDState based on current HUDState -> Update HUD

#

that way Esc can close the open menu and open the main menu depending on if a menu is up or not

#

Update HUD just switches on HUDState and does its thing opening and closing widgets etc

charred crane
#

that would all be dope to discuss about 16 months ago

fathom aspen
dark edge
minor nova
#

I'd like to tear off an actor on the server and then immediately destroy it on the server. But when I destroy immediately, client's don't receive the TornOff call, i'm assuming because the actor is no longer around for the net update. Is there any way to respond to some post net update event inside of an actor on the server?

#

I see all the pre net update functions, but I don't see any post net update ones

fathom aspen
#

RepNotify?

timber anchor
minor nova
#

repnotifies won't be called after tearoff

fathom aspen
#

Yeah you're right. You probably need to use RPCs. Check this: https://forums.unrealengine.com/t/onrepnotify-doesnt-work/356329

dark edge
dark edge
#

@timber anchor so what exactly are you trying to do? What are you trying to replicate?

timber anchor
#

Decals of the mouth i sent before, that was attached as a component to a skeletal mesh (Replicated component)

#

But that's fixed as well! Thanks a lot man 😄

royal vault
#

How do i replicate Hierarcy instanced static mesh components?

#

for instance

#

i run this event from the server and it runs to all clients

#

this works perfectly fine on server,

#

however the client cant see the changes

#

the server however can see any of the clients run placed blocks

#

even if you dont use instanced static mesh components any general ideas on how this could be solved are welcome

#

the actor running these rpcs are owned btw

fathom aspen
#

Make sure the target actor replicates

ashen stone
#

Hey guys, for a albion kind of mmorpg is there anything on unreal for hosting and traveling between many maps?

sinful tree
#

As far as UE goes, you just need to be able to launch a server build on a server somewhere and let it register itself with whatever system you intend on using.

ashen stone
#

Just return the ip from this service and use LoadLevel?

sinful tree
#

Effectively, yes.

ashen stone
#

Ty

dark edge
#

Make something small and fun, not something big, not even 1% done, and unplayable.