#multiplayer

1 messages · Page 138 of 1

sinful tree
#

So the RPC exists on the item?

#

You're calling it from the pawn.

sullen plover
#

No, the RPC is on the pawn

gloomy tiger
#

The Interactive Object is owned by nobody

#

Just to recap

sinful tree
#

It sounds like you're calling an RPC that exists on an actor that isn't client owned, which means the RPC definition isn't on the pawn (which would normally be client owned if they're possessing that pawn)

gloomy tiger
#

You spawning it on a server instance and assigning a replicated actor to be its owner - is that correct?

sullen plover
#

I'm not calling the RPC on the item actor, I'm only doing the RPCs on the player pawn

gloomy tiger
sullen plover
#

From what I can tell it might be because the item selection validation is failing on the client side

sinful tree
#

Can you provide a screenshot of your call to the RPC? If the pawn is client owned, the RPC should be working regardless of the item validation and giving you the print string.

sullen plover
#

The server take key item event just tells the item to do whatever specific business it's supposed to do before presumably destroying itself, which is currently the only thing it does

#

But the client never gets that far because the interactable selected fails to validate.

sinful tree
#

I'd make the tick part only happen on the client. The client itself can determine what it wants to interact with without having to tell the server anything, and show anything that it wants to without involvement from the server. This also saves on 60 RPCs per second since you're no longer calling them on tick.

Then your client would need to RPC to the server with a reference to the actor that they want to interact with when you want to actually interact
The server when it receives the RPC can validate if the actor is valid, is close by enough, etc. and if so, perform the interaction as needed.

sullen plover
#

Well, the tick also handles setting the physics handle target location for picking up and moving physics objects

sinful tree
#

That's information you could send through the RPC to the server when you want to begin the interaction.

sullen plover
#

It's also updated with the camera rotation and the player being able to rotate the object after picking it up, but that's something I can only deal with after getting the client to be able to interact at all

#

But anyway

#

This is the log warning I'm getting for setting the server interactable: "LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor Celestial_PC_Character_C_1. Function Server Set Interactable will not be processed."

sinful tree
#

Is that message spammed in your output log?

#

or is it only maybe a few times and stops?

sullen plover
#

It spams, presumably because of the second call that clears the reference if nothing is hit

sinful tree
#

You have more than 1 character in the scene, right?

#

Tick fires on clients and server. If you have other clients running this tick, then they too are trying to call that RPC and since they don't own that other actor, it fails.

#

Basically, you should put your "Is Locally Controlled" check at the start of the tick to ensure that only the client that should be doing the traces is doing it and calling the RPCs.

sullen plover
#

Okay, did that, and it does seem like the server RPC is calling as it should

#

But the client is still accessing none when trying to interact with anything

silent rampart
#

holla, am testing character movement
and well the server character can move around but the clients can not.
looking at the outliner I also see that only one Player controller is created and it is also named PlayerController1 not even PlayerController0

Any solution?
and yes I am using enhanced input and setting it up from Virtual void PossessedBy(AController* NewController)

sullen plover
#

WELP looks like I needed to set the specific variables to replicated to fix that

fathom aspen
sullen plover
#

Now I just need to figure out why the object physics pick-up functionality isn't working properly but that can wait until later, I need to go to bed

wary vine
#

Does anyone know if the connection travel string is encrypted? Like if I were to do:
UGameplayStatics::OpenLevel(Owner->GetWorld(), LevelName, true, "listen?Password=" + Password)
Would password be encrypted over the network?

sinful tree
hexed pewter
#

Is there any tech on the horizon (maybe something including AI 🤔 ) that would prevent cheating in FPS multiplayer games or at least prevent it more successfully than what we have right now?

sinful tree
# hexed pewter Is there any tech on the horizon (maybe something including AI 🤔 ) that would p...

Depends on what you mean by cheating.

Any data that is shared with a client means that data can be accessed at any time - so for example, "wall hacks" that allow players to see the locations of other players is something preventable by not sharing that data, but isn't always easy to implement because at some point you need to share that data when it is appropriate so the client knows the right position of that player so it can be simulated on their side without the other player just popping into existence.

Other cheats like making targets more visible by swapping textures around or adding additional light sources in the map can effectively be impossible to prevent against someone willing to fight against whatever systems you have, as again, you're running software on a client machine and that means you don't have authority of what happens on that computer and someone with knowhow can spoof whateer checks you may have. Some anti-cheats try to detect file manipulation, but if you're relying on that machine to advise whether or not the files have been manipulated, then you're out of luck as the person in control of the machine could spoof the report making it appear as if they have valid files. Even if you were to request the client to send the files to the server so the server can validate them that doesn't mean the client has to provide you with the files they're using, just the ones you're expecting to see.

Another avenue of cheats is having to accept inputs from clients, and that means you need to be strict with what you accept from clients, ensuring that what they're asking of the server is actually ok for them to be requesting which results in more processing time used up on the server validating those inputs.

So out of these, there's only 2 things that you can really control - what happens on the server, and what data you share with clients. You can't really trust clients at all.

#

If you wanted to completely stamp out cheating, then you'd need to never allow a client to directly control the computer that the client software is running on. Effectively, allowing clients to connect to something that gives them back a video signal and it accepts inputs from them and that's it. They won't render or simulate anything on their end, and all they can do is see what is being fed to them, and no "game data" is shared. Tie this together with strict server authoritative coding for their inputs, and you'll have no means for clients to be able to cheat.

hollow eagle
#

As a general answer no, there is no magical technology on the horizon that would significantly prevent cheating more than current methods. "AI" (really, statistical analysis) methods of anti-cheat have already been in use for years - you can find some vague talks from valve about what they've done in the past. But anti-cheat is always an arms race and there is no solution to it because it is both impossible and yet necessary to trust the client.

lusty sky
hexed pewter
modern cipher
#

LOL, PUBG tried every anti-cheat solution out there, but still, there are people cheating.

hollow eagle
#

Even in a game where you do not trust the client for anything - let's say chess, where every move can be perfectly server authoritative - you cannot 100% prove that the person actually inputting moves to the game is human unless you have full control over the hardware. And even then you probably can't prove that the input devices are being used by a human. And even if you can you definitely can't prove that someone didn't wire up some servos to a joystick.
Online chess, incidentally, is generally kept fair through the use of statistical analysis - you can actually find some fun bits of drama in the online chess community with explanations of how that kind of analysis works.

But it's not realistic to make even most of those guarantees. You definitely can't make guarantees about someone's PC (you can try with kernel drivers but they're never perfect). Modern consoles are much harder to do any sort of software-based cheating with, but you can't make any guarantees about the input device. Console manufacturers have at various points thought about (or tried, or will try) only allowing "approved" third party hardware but this becomes an accessibility issue and is frankly an unacceptable compromise as a result.

And for realtime games, where it is effectively impossible to be perfectly server authoritative due to latency and the necessity of client prediction, trusting the base hardware is only half the battle.

elder sable
#

And you can still have a robot playing with your mouse and keyboard

sullen plover
#

Yeah, there’s only so much you can do to stop cheating

#

Sometimes the best anti-cheat is just designing your game to be difficult to cheat at - there are games where automating stuff will only get you so far before someone with good game sense and knowledge of the mechanics makes an absolute fool of you (eg. Sniper bots in TF2, any fighting game)

#

Policing inputs is actually only a concern for a few genres, pretty much mostly just shooters off the top of my head though.

hollow eagle
#

Policing input types is primarily an issue for shooters that want to segregate matchmaking population based on input type, but policing inputs in general is in theory something ideally you'd be able to do for any game. It would make sending input from cheating software much harder. It's just basically impossible to do.

sullen plover
#

Well, I'm talking about detecting aimbots and such, but yeah

hollow eagle
#

It's the same thing.

#

In the ideal scenario anyway.

#

But that ideal doesn't exist. Hence relying on either "proving" that other software isn't messing with the game, or using statistical models to try to find inputs that obviously don't come from a real person.

whole iron
#

Hey everyone, apologies for asking yet another question.

I have it set up so players can connect to a lobby, which then the host/server can change the settings of it and then start the game (wherein they load into the map and the gameplay loop goes through before after the game ends they all go back to the lobby). My question is how would I communicate variables between levels? Like how could I have the variables set [or rather the game settings set] in the lobby, be carried over to the new level? [And potentially vice versa if I wanted to have certain stats tracked/displayed for fun in the lobby like who died first etc]

(also im using advanced sessions, using steam API for the networking socket, and CommonUI as relevant plugins... just in case lol)

uncut atlas
#

Hi, should CredentialsToken be set when logging into Steam using Online Services?

dusty void
#

How is my character being checked as locally controlled on BeginPlay() but not at any other time when I check for IsLocallyControlled?

uncut atlas
dusty void
#

Sethealth is being called on the overlap event with a DamagingSphere I have in the world

uncut atlas
dusty void
#

client on dedicated server (mb)

uncut atlas
#

I think your on overlap event is occurring on the server where your character isn't locally controlled. BeginPlay is called on the server and client.

#

Where do you bind the event?

dusty void
#

yeah i set the event to happen on the server

uncut atlas
#

that's why. your character isn't locally controlled on server

dusty void
#

ohhhhh

#

so i def missed a fundamental thing with learning about multiplayer

uncut atlas
#

yep lol. but now you know.

dusty void
#

that changes a lot for me holy

#

back to the copemendium.

uncut atlas
# dusty void back to the copemendium.

Look into RepNotifies. Your health property should be replicated and set only on the server. RepNotify is called on client's when they receive the changed value of the property from the server. Inside the RepNotify you'd want to add your functionality to update the health bar.

nova wasp
#

Just never had to bother I guess

plucky prawn
#

if i have a multicast event on an actor, is there a way to check if the client executing the multicast event is the owner of the actor?

hollow eagle
#

check if the owner is a player, check if that player is local

plucky prawn
#

im doing this in blueprint at the moment. when i have the actor from GetOwner do i use Get Local Role and switch on that?

hollow eagle
#

no

#

if the owner is intended to be a player controller then cast to controller and call IsLocalController

#

if the owner is intended to be a pawn then do the same, the function is IsLocallyControlled

plucky prawn
#

oh sweet thanks heaps

dusty void
#

usually i can accept that i had a key misunderstanding which was messing everything up but idek what could be hte problem now b

nova wasp
#

beginplay could be too early here?

#

is this a client?

dusty void
#

Yeah i was thinking beginplay was too early but wasn't sure, and yes it is a client

#

i had a similar issue with doing stuff in the constructor which was also too early so might just be another case of that

#

i really doubt it tho since there's no way it could be too early to set th evariables, unreal engine also had a follow along tutorial covering actor components where the maxHealth was put in the constructor

final holly
#

How can I access the data in another actor class from widget.cpp?

thin stratus
#

@final holly can you be more specific

#

The question is a bit vague to easily answer

final holly
#

I created a widget with user widget inheritance in C++, then connected it to a widget blueprint. I create this widget from another C++ actor class and make it appear on the screen. Everything works fine so far.But how can I access the value in the actor class in which I created the widget, from widget.cpp?

#

I simply want to display the value in an actor class via the widget.

nova wasp
#

you might have meant #cpp ?

final holly
shrewd ginkgo
#

why I cant trigger interact

#

interact message work well and I have implement interface both objects but event interact doesnt trigger

#

and does implement interface does not see the interface on the door

#

I made it correct but it doesnt work

hearty bronze
#

you also want to ignore the player character

#

you also want to make a seperate trace channel

#

and i dont think this is multiplayer related #blueprint

dark edge
#

assuming it's hitting anything

#

that's a single sphere trace so it'll only return one hit, you'll want to do a multi sphere trace and select what to hit.

gusty slate
#

Hello,
Has anyone ever encountered an issue where Linetrace by channel doesn't properly hit client side? It a trace used for hover information on objects, it works fine on host but not on client

#

even though the object has collision enabled and is blocking that channel

dark edge
#

It's very unlikely that it's not working if everything is up to snuff

dusty void
#

is it possible to set variables too early in multiplayer, like in BeginPlay?

dark edge
dusty void
# dusty void what 😭

I had this issue yesterday, it was a client on a dedicated server and it was really late at night so i just decided to sleep and continue today but i still had no idea what could be the issue

#

could the UPROPERTY macros mess with it?

#

oh sorry for not explaining, it's just trying to set the health and max health variables

#

I think i'm just gonna try making a new component and slowly working through that

buoyant scaffold
buoyant scaffold
#

If you're trying to access this on the server at begin play, yes, too early

wind summit
#

This is for sure a noob question but I'm new to replication in unreal, I've tried so many tutorials and I'm clearly just doing something wrong. My end goal is to replicate ui across clients/server and I've been trying to figure out where I can put data/functions before I go too far.

In this example I am trying to generate a random number when someone clicks a button and show the same number to everyone

In my level blueprint I have the following (screenshot #1 of blueprint):

  • make widget, add on click event to button
  • When button is clicked, generate a random number

I am replicating the variable that stores the random number (screenshot #2 of cpp)

When I have the GenRandomNumber blueprint node set to run on server, it only works when you click the button on the server. If you click on the client nothing happens

If I set it to multicast, when you click on the server the client is generating its own random for a split second before the server's value overrides it. When you click on the client then the client just goes yolo and makes its own number and is now deviated from the server (pic 3)

How am I supposed to do this? Seems like there is no combination of run on server/multicast that lets the client ask the server to generate a new number?

wind summit
#

oh it seems like the problem is related to ownership? Moving the function the player controller solved the issue... I guess this is why all demos use the player controller, but none of them talk about ownership

summer tide
#

How come I can't replicate Break Constraint? I got Set Constrained to replicate.

rose prawn
wind summit
#

Definitely agree that trying to have widgets do replication is a bad idea. Originally I was hoping to make some kind of UI subsystem but I'm not sure how subsystems work with ownership and I could just stick with having a separate menucontroller to at least get some separatation

hollow eagle
#

err, what was said isn't true. The thing calling an RPC is irrelevant.

#

You can call an RPC from literally any code, the RPC has no way to know what is calling it.

#

If an RPC fails to execute then it has nothing to do with the fact that a widget (or anything else) called it, it has to do with the fact that the RPC wasn't allowed to be called from that game instance in the first place. Moving the call to the controller (or anything else) would not change that.

hollow eagle
#

The things your client owns includes its own player controller, the controlled pawn, their own player state, and whatever other actors you have explicitly designated as owned by that player. Also replicated components (and subobjects) belonging to anything mentioned.

dusty void
summer tide
dusty void
#

Nvm I accidentally set my health values as floats 🫠

#

just gotta fix the health bar ui being weird

dusty void
# dusty void 🤔

Solved this by creating a function that would set the variables in component, and called that in my charcacter beginplay :3

dusty void
thin stratus
#

@dusty void That looks like you are calling that during the Character's Constructor?
Or are you creating the Component on BeginPlay?
Either way a strange setup

gilded thorn
#

When using seamless travel what is the best architecture for getting data to the widgets? Sometimes the game state doesnt exist yet or other components like player controller when their construct is called so i cannot even bind the delegates.

vestal shale
#

@thin stratus Thanks a lot for your Multiplayer Compendium

vestal shale
thin stratus
#

Nope, I generally don't have an overview of tutorials, especially not up to date ones, cause I barely ever look those up.

#

Different Multiplayer GameModes are usually done through a chain of inheritance

#
AMyGameMode_Base <- AMyGameMode_MainMenu
                 <- AMyGameMode_Game <- AMyGameMode_Lobby
                                     <- AMyGameMode_Gameplay <- AMyGameMode_Deathmatch
                                                             <- AMyGameMode_CaptureTheFlag
                                     
#

Stuff like that

#

I would suggest coding your GameModes to have optional Teams from the start.
You can't have multiple parents, and coding a Deathmatch and a TeamdeathMatch mode if you later have other GameModes that also have Team vs none Team versions is a pain.
It's easier to just code a Deathmatch GameMode and having the _Gameplay one already support optional Teams vs FFA.

latent heart
#

Or just put everyone on their own team

thin stratus
#

I think most implementations just have a specific team index for FFA. E.g. 255

vestal shale
thin stratus
#

Then I can't help, sorry!

gilded thorn
# thin stratus What Data to what Widgets?

So I have a map and when you click on different locations it takes you to a different game mode.

When I load into this new map they have a new GameMode class with all new components: GameState, PlayerState, playercontroller, etc

When using seamless the UserWidgets in the HUD construct before the data in the playerstate is made causing them to be empty

I got them working with tick looking for the components (playerstate etc) to be valid. But it’s horrible as you can’t seem to debug tick without freezing.

Single process doesn’t seem to work and crashes when I try to run it on 5.2 for net.AllowPIESingleProcess (spelling may be wrong)

thin stratus
#

Right, let's not call Actors Components, cause that gets pretty confusing

#

GameMode, GameState, PlayerState and PlayerController are all Actors

#

Do you use C++ or BP?

gilded thorn
#

Both

#

Very comfortable in both but not in multiplayer code just yet

thin stratus
#

In general, with Multiplayer, you need to rely a lot on OnRep functions and Delegates.
And that can sometimes also become a chain of callbacks.
If you need the PlayerState to be valid in your Widget, then you would theoritically need to listen to OnRep_PlayerState in your PlayerController (for Clients) and callback when that is valid.
And in your Widget check if the PlayerState is valid and otherwise wait for the Callback

gilded thorn
#

Ah I see let me try that out

thin stratus
#

UE has no simple "Everything is ready." event

#

The only thing you can somewhat rely on is that if BeginPlay calls in any Actor on the Client, the GameState is valid

#

But that's the extend of it. Actors otherwise can replicate in any order

gilded thorn
#

Ya I noticed I was even trying to count the number of players and their valid actors and then broadcast a build widgets event

#

Is begin plays timing the same as on construct in widgets?

thin stratus
#

No, Construct is tied to you adding the Widget to the Viewport

#

Or to an existing Widget that is already in the Viewport

gilded thorn
#

Got it so if the HUD fires add to view port early the timing could be wrong

thin stratus
#

BeginPlay is only tied to the GameState replicating the MatchState variable

#

I guess? Not sure what "early" here is, but if you PlayerController replicates before the PlayerState (which is likely), then the HUD will also exist before the PlayerState

#

If you create your Widget in the HUD BeginPlay or similar, then it might call Construct with an invalid PlayerState

gilded thorn
#

Makes sense thank you

gilded thorn
dull jasper
#

I wunna look a lil bit into this new iris thing... went over the official docs, any more good info out there?

#

about to just go over the sourcecode a bit

rancid badger
#

my game is in normal speed when i play with one game window open but 2 windows makes the game time slow
i tried different characters, levels, gamemodes
i checked every setting possible
(in every play mode - standalone, server, client)

cedar creek
#

Hi i have a widget blueprint i need it to chance a variable in game state when i change the variable on server it works fine but when i change it in client it wont work is there anyone who can help me?

#

i really need help

dusty void
#

Pretty sure I did smth wrong when i switched the value types to float cause i went back to when i had integers and it does output proper values at least for my health component 🤔

#

besides the atrocious amount of output logs

#

i think when i had all integers the only issue when i was doing integers was the percent value was being all weird but the actual health bar was still behaving like i needed it to

#

yah everything looks fine until i output what the healthbarwidget gets in values after the float casts but the health bar still behaves properly

thin stratus
#

That's a lot of mixed up random words

#

What is your client controlling? A Character or a Pawn? Or just a normal Actor?

#

If it's a Character, then by default the Client will predict, that's how the CharacterMovementComponent (CMC) works.
You can't really change that unless you actively don't possess that Character. But that might cause other issues in the future.

#

You might want to explain what the Client is fighting the Server for, why you are getting corrections etc.

quartz star
#

Im trying to rotate my character on the yaw axis.
To replicate the rotation i wrote this code:

void AOceanityPlayerController::TurnShip(const FInputActionValue& Value)
{
    constexpr float Multiplier = 0.5f;
    float InputAxisValue = Value.Get<float>() * GetWorld()->DeltaTimeSeconds * 100.f * Multiplier;
    if (AccelerateAxisValue != 0)
    {
        InputAxisValue *= AccelerateAxisValue;    
    }
    const FRotator ActorRotation(GetPawn()->GetActorRotation());
    
    const FRotator NewRotation(ActorRotation.Pitch, ActorRotation.Yaw + InputAxisValue, ActorRotation.Roll);
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Yaw: %f"), InputAxisValue));
    ReplicateShipRotation(NewRotation);
}

void AOceanityPlayerController::ReplicateShipRotation(const FRotator& NewRotation)
{
    if (GetLocalRole() != ROLE_Authority)
    {
        Server_ReplicateShipRotation(NewRotation);
    }
    GetPawn()->SetActorRotation(NewRotation);
}

void AOceanityPlayerController::Server_ReplicateShipRotation_Implementation(const FRotator& NewRotation)
{
    ReplicateShipRotation(NewRotation);
}

It works fine except that the Client rotates with half the speed than the Server does.
Can someone help me with that?

queen mortar
#

How can I make that when the game starts, every players spawns at the same time and not that host spawns first and then each client depending on how fast their computer is

thin stratus
#

The GameMode has a boolean called "bDelayedStart" iirc

#

If you set that to true, you can override the ReadyToStartMatch (or so) function in it, and if that returns true it will start

#

That starting will spawn the DefaultPawnClass

#

You could, if you know how many players you expect, simply count the PlayerControllers and compare in that Ready function

queen mortar
#

alright I didnt know that thank you

summer tide
#

How do you replicate break constraint function?

dark edge
hollow eagle
#

There's no reason to change possession, you can drive a character with navmesh while still possessed by a player controller.

#

You will probably want to block client input (both client-side to avoid mispredictions and server-side to block the client from overriding what you're doing) but this doesn't require changing out the controller.

nova wasp
#

I think Kaos's game did something similar with AI

#

where they have a dummy controller that just accepts orders directly from players

#

that's more for multiple units though

#

(rts style)

hollow eagle
#

You don't even need that for this, you can use a path following component on a player controlled character

#

The hardest part is blocking client input, and that's not hard - it's just not a simple switch.

nova wasp
#

I just showed up and didn't read any context so ignore me

hollow eagle
#

That's because you don't have a proper path following component

#

And are potentially having your server-side inputs to the character stomped by client inputs, which again is fixable.

nova wasp
#

you may find some better results tweaking a lot of the values for how rubberbanding works either globally or per instance depending on context

#

for example, how far of a discrepancy you accept etc

#

that's assuming you keep seeing rubberbanding you can't ignore though

vestal shale
#

How to use Switch HAs AUthority node

#

I am not able to understand it

nova wasp
vestal shale
#

Remote == Client, right ?

nova wasp
#

yes, but it gets a bit less clear with certain game objects

#

and if you need to support listen servers (one player is the host) or dedicates (a server with no player)

vestal shale
#

I am trying to replicate a static mesh of my character which is a suboject

#

I can change it using RPC but not normal replication

nova wasp
vestal shale
nova wasp
#

I think you could onrep swap the mesh to the one you want as in this article

#

I'm repping you here vori lol

vestal shale
#
void ALearningCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);

    DOREPLIFETIME(ALearningCharacter, CurrentHealth);
    DOREPLIFETIME(ALearningCharacter, HatMesh);
}
void ALearningCharacter::ChangeHatMesh()
{
    if (GetLocalRole() == ROLE_Authority)
        if (HatMeshTwo)
        HatMesh->SetStaticMesh(HatMeshTwo);
}```
#
UPROPERTY(EditAnywhere, BlueprintReadOnly, ReplicatedUsing = OnRep_HatObject, Category = "Custom Actors", meta = (AllowPrivateAccess = "true"))
TObjectPtr<UStaticMeshComponent> HatMesh;
nova wasp
#

OnRep_HatObject will fire whenever a client receives a replicated value for that thing

#

there are some caveats I need to make clear though

#

they differ in C++ and BP in behaviour

#

also, your code is replicated to a specific INSTANCE of a static mesh component

#

so like, which hat mesh INSTANCE is the hat

#

if you want to swap the TYPE(asset santa hat/elf hat etc) of mesh you may want to send a static mesh asset instead

#

UStaticMeshComponent's works like this:

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=StaticMesh, ReplicatedUsing=OnRep_StaticMesh, meta=(AllowPrivateAccess="true"))
    TObjectPtr<class UStaticMesh> StaticMesh;
#

there's nothing stopping you from just having a replicated soft ptr on your own actor though and just passing the change over to the child component

nova wasp
#

yeah, but the component can just be a local thing attached to the head and which mesh it uses can be sent over the network

vestal shale
#

HatMeshTwo is the UStaticMesh that I am trying to switch to

nova wasp
#

so it is swapping betweem two different actor components?

#

or different mesh assets

vestal shale
nova wasp
#

in that case ignore what I said earlier, I was making an assumption about what you want

#

so I'm a bit less clear on this part of it but afaik you could do this a number of ways

#

if the two different actor component ptrs are network addressable (which they are by default iirc? I need to check) sending the ptr to them from the server should make it over?

#

SavedMoves might be sitting around...

#

the CMC works with a sort of buffer of input state

#

I'm not sure how it handles swapping over between owning clients

vestal shale
#

So I did a quick check for authority

#

Although I set in PIE as dedicated server

nova wasp
#

remember: only the server can change replicated values! if it needs to change from the client you may need an RPC from the playercontroller etc

vestal shale
#

The Authority is Local

#

Always printing Local even in a Dedicated server

#

Is it normal ?

nova wasp
#
FORCEINLINE_DEBUGGABLE bool AActor::HasAuthority() const
{
    return (GetLocalRole() == ROLE_Authority);
}
#

who takes the input?

#

does the dedicated server take input from the local player? here I think no

#

I think it's running the keypress on only the playing client

#

I actually don't know 100% if the "global" input events like that route to dedicates in PIE but I'm 70% sure no

#

to be frank, this is going to be a bit of a rabbithole

#

making the CMC do what you want specifically is quite hard without messing with it... it's the single most complicated game actor by my guessing

#

I'm hoping you can just temporrally turn off local corrections

#

if it helps they are replacing it in the coming year(s)

#

to make it less wacky

#

"Mover 2.0" on the roadmap

vestal shale
#

I am trying to replicate this Mesh change from last 3 hrs. Still got no success with using RPC

nova wasp
#

hmm... I wonder if this bad boy is running when you don't want it to on the server when in-between controllers?

        // Perform input-driven move for any locally-controlled character, and also
        // allow animation root motion or physics to move characters even if they have no controller
#

sorry for the big pasta

#

UCharacterMovementComponent::TickComponent

nova wasp
nova wasp
vestal shale
nova wasp
#

here's a weird one... try making both of the hat meshes Component->SetNetAddressable();

#

but this is kind of wacky internal stuff and you are probably better off with your own simple made mapping?

#

my suggestion: instead of needing to send component addresses over the network

#

make a simple name or number represent the different hat "slots"

#

for example: the RPC sends "int32 HatID = 0" and it swaps to the first slot

#

the local client knows which slot 0 corresponds to and sets the simulated proxy to use that

#

etc etc

nova wasp
#

remember that RPCs from the client to the server must be from an actor the client OWNS

#

your homework is the answer which actor that is for the client 😄

vestal shale
nova wasp
#

it is predicted, just not perfectly and doing it "the right way" is extremely annoying

#

for example, if the client sets maxspeed without it being accounted for in the same savedmove on the server: rubberbanding time

vestal shale
nova wasp
#

the answer: your custom APlayerController can send the rpc

(to be more accurate, anything your client owns)

#

a "server" rpc is called on client and does the _Implementation on the server

#

then you have the server do stuff... and send it back however

#

(or not at all)

vestal shale
#

I already succeded in changing that mesh by using RPC

#

Now, when I am trying to do it without the RPC

#

I am not able to do so

#

Btw, I tried the Boolean method

#

Not working

nova wasp
#

the client can only send rpcs

#

clients can not change replicated values and have them propogate

#

replication is ONLY from server to clients

#

rpcs can be either way

#

yeah this is more about the local role

vestal shale
nova wasp
#
FORCEINLINE_DEBUGGABLE bool AActor::HasAuthority() const
{
    return (GetLocalRole() == ROLE_Authority);
}
``` which might not always be what you expect
#

no, they are the same

#

it could be an actor spawned by the client and only on the client

#

the netdriver's netmode is more specific I guess

#

what even is remoterole on local spawned things? none?

#

lol I'm amazed my guess worked

#

careful though as clearing it out may cause other things ot get out of wack I'm not aware of

#

one thing that could help is having a really nice visual logger history

#

where you see what the server and client expected at each point

#

and where things diverge

#

LogTemp, Warning TEXT("yo my shit broke")

#

p.shownetcorrections

#

but that's not much context

#

two capsules so not much info, yeah

#

apologies, it's p.NetShowCorrections

#

it's very vague on WHY the correction happened though

#

it's just showing when it does

#

and where

#

unless there's some secondary one I dunno

summer tide
nova wasp
#

you might want to check the advanced editor->play settings

#

you can set if it's just on server or client

#

or both

#

and even packet variance

#

a bit faster than typing it out, it's the same thing though iirc

#

it's a good idea to check how things feel on "average" connection quality

#

"bad" is horribly overkill but you can tweak them

#

it's intended to see if things like break down etc with missing packets etc

vestal shale
#

@nova wasp Is a server function and an RPC the same ?
I am confused. Because their declaration looks same

vestal shale
#

I am not seeking anyone's attention. If asking you was a seek of approval in your view. Then I am sorry. I won't ask you anytime again.
It's just that I was not able to understand somethings.

#

I did took a look on that. I wonder if Server RPC is the only way to change a variable on the server side so it gets replicated to all the clients.

burnt hinge
#

For some reason my variables are not replicating properly but they are only inside the animbp. i'm getting the reference and setting them.

hollow eagle
#

animbps do not replicate

burnt hinge
#

wut

hollow eagle
#

exactly what I said, AnimBPs do not replicate.

burnt hinge
#

how is stuff like this replicating then?

hollow eagle
#

those variables aren't on the animBP

#

velocity is a member of the "character movement", which I assume is a character movement component

#

which does replicate

burnt hinge
#

this is not replicating for me

hollow eagle
#

control rotation is not accessible to other clients.

burnt hinge
#

ah okay

#

ill set it and get it before hand then. how would i even know this

vestal shale
#

So updates like movement and location use Server RPC ?

burnt hinge
#

got it working. sent it through the character

dark parcel
#

When a variable is marked as replicate. Server will always try to replicate the value to client.

So if client need to inform others of their change, let's say their character height
Client -> server rpc, set height (setting height in server). The server will then replicate the height variable to all client on next net update

#

But if you are already the server, no rpc needed. Just change the variable value it will replicate to clients on the next update

nova wasp
#

deafening sound of 100 anim instances sending 2d sounds to client

#

PLONKPLONKPLONKPLONKPLONKPLONK

#

yeah we all start somewhere

#

I want to dig up my old projects to show them in here lol, I have some funny lines

#

I struggle with that ideal a lot

#

"never let anim state influence gameplay state"

#

okay, animations which create/are hitboxes are animations

#

the more direct meaning would be "always be able to get a similar animation state with the same input"

#

and have the game tell animations what to do almost entirely... for anything remotely important

#

which feels crazy but I'm kind of liking it

nova wasp
#

I mean even for like locomotion animation here to a certain extent

grand kestrel
#

@burnt hinge

#

Its pretty heavily compressed, down to a byte IIRC, I added some interpolation to smooth it out for sim proxy only

vestal shale
dark parcel
#

Server have authority for everything in the world. The only thing it doesn't have authority over is entities that is spawned by the client which in this case won't exist on the server.

Prob should read the compendium, it goes over ownership and rpcs

#

In general you as a client only own the controller and the pawn. You can set ownership on certain actor to the client (done on server) but use it with caution as it allow cheating

ruby parrot
#

Is there no BLUEPRINT way to show the steamID of a player? Im at the point where it all seems to work...hosting,connecting,steam overlay with Spacewar as game etc. but i cant figure out how to get that ID XD

vestal shale
dark parcel
#

Well doubt anyone can explain better than the compendium, perhaps you just need to do the practical part on your end

dark parcel
#

That's what I used to get the players steam avatar

#

Not sure if it's the steam I'd but you can test it

ruby parrot
fair latch
#

Then feeding the unique net id

ruby parrot
vestal shale
dark parcel
#

Rpc calls by client on actors they don't own will get dropped

vestal shale
outer sail
#

Hey, is there any way to call server RPCs from non-player owned objects? like a random replicated ball's script calling a server RPC on itself. (in Blueprints.)

#

I've just been directing all my server RPCs through the player controller

fathom aspen
#

By making the player own them, so no, either own it, or keep doing what you're doing

burnt hinge
fathom aspen
#

It's not just about cost, but it's not really accessible on simulated proxies, so its irrelevant

burnt hinge
#

if i replicate it it's available for everyone

fathom aspen
#

Sure, but why bother if it's already replicated

burnt hinge
#

doesn't seem like it's exactly the same. the values are completely different and control rotation seems to be more accurate

fathom aspen
#

Makes sense, because the other rotation is quantized/compressed

#

And if it is, then it is for a reason

burnt hinge
#

i guess ill stick with aim rotation. i just want the characters head movement to be replicated so everyone sees where you are actually looking but it doesn't have to be super accurate

fathom aspen
#

Yeah I remember that it used to not to be accurate on one of the axises, but then living with it as I didn't need it to be super accurate either

burnt hinge
#

yaw seems to act slightly different

fathom aspen
#

Yeah indeed that was it most prolly

tardy fossil
#

Personally I just replicate a single uint8 for proxies up down looking angle, and have the clients smooth it out

buoyant scaffold
outer sail
buoyant scaffold
#

I've lost a few toes to stray rpc mines myself over the years

outer sail
#

oh damn i've never thought about that in the 7 months i've been working on this game

#

hopefully i don't cross any landmines just yet haha

burnt hinge
#

How can i replicate a child actor component?

#

So what options do i have? i basically recreated the matrix demo audio logic. It's all on a child actor component. But their system is obv singleplayer

#

just plop the whole logic on the actor itself or use actor component?

peak lintel
#

Hi. I have a flying pawn and I'm still trying to figure out what's wrong with my code. The other client is very laggy when it's moving/rotating. I've tried all kind of changes and still the same. I also, left it without any RPC because I though addmovementinput it's already replicated. I do have replicate movement active and everything, but it's still lagging. Does anyone knows what's the problem?
Thank you!

#

`void ADragon::Move(const FInputActionValue& Value)
{
float const MoveValue = Value.Get<float>();
if(Controller && (MoveValue != 0.0f))
{
FVector const Direction = GetActorForwardVector();
SetMove(Direction, MoveValue);
}
}

void ADragon::SetMove(FVector DirectionF, float MoveValueF)
{
if(GetLocalRole() < ROLE_Authority)
{
S_Move(DirectionF, MoveValueF);
}
AddMovementInput(DirectionF, MoveValueF);
}

void ADragon::S_Move_Implementation(FVector DirectionF, float MoveValueF)
{
SetMove(DirectionF, MoveValueF);
}`

rancid badger
vestal shale
#

Have a look

fiery crow
#

Hey all, I'm wondering if there are any devs out there who have encountered this issue in the past, and might have a solution or better approach? I'm replicating some interpolated character movement currently (see attached video, first play is standalone, second is two clients) and I'm having trouble with managing server events on tick, while cleanly replicating the movement for the client.
I'm pulling animation curve data and determining offset so dodges and foot planting maintain world position regardless of framerate, and then adding a server actor offset, and attempting to duplicate it on the client to maintain a smooth, framerate consistent translation. Only issue is I'm having trouble figuring out how exactly to compensate for latency on the client, because I unfortunately can't just NetMulticast or run the same function on a Client replicated or non-replicated function. Here's a video to help demonstrate some of the visual bugs this is creating:

#

If anyone wants a couple of code snippets to help clarify my approach, just let me know. Luckily, it's all C++. Thanks to anyone who might be able to help!

burnt hinge
vestal shale
burnt hinge
burnt hinge
vestal shale
#

Attenuation= The volume and pitch of audio change according to distance

burnt hinge
#

ah yea, well if i play as client i have audio now. before i didn't so it should be working

uncut atlas
#

Hi, I'm using UE 5.3 and there isn't a Online Subsystem Steam equivalent for Online Services. Will Online Subsystem Steam still work in UE 5.3? The docs say anything past 5.1 to use Online Services.

vestal shale
shrewd ginkgo
#

whats wrong about it

#

yesterday it was working when I did it, today I tried to close and open the programme because the clients could not open the door and now the server cannot open it either.

#

and for clients this has also stopped working

#

I'm about to lose my mind, things I've done are broken for no reason, help me please ;-;

fiery wadi
#

Hi, Can anyone explain to me why when I click in "server" click to move in the top down template controller works as expected (Click somewhere and run there) but in a Client window it does NOT i have to hold the mouse button to move around please?

#

When the level starts I have this in the Level Blueprint to enable Input Modes again after coming from the menu

#

I was assuming that Get Player Controller would be the controller assigned to the Client already, so I didnt think I would have to do a check if it,s a local controller or not.

vestal shale
#

How do I respawn a player properly in multiplayer ?

dark edge
#

assuming respawn means getting a new fresh pawn

#

what respawning means depends on your game's architecture

vestal shale
#

It binds event OnDestroy actor -> Spawns it in world and Posesses it

#

That works properly for Single player

#

But Not in multiplayer

#

What would be the equivalent for Multiplayer

dark edge
#

don't do that tho

#

use the gamemode functions

vestal shale
dark edge
#

then you probably aren't possessing it with the right controller

#

as in multiplayer there are multiple player controllers

vestal shale
#

This is the current flow

dark edge
#

anything with get player 0 in multiplayer is smelly

#

player 0 is the host or first player to join if it's dedicated server

#

player 1 is the next one

#

player 2 is the next

vestal shale
#

How to I get the proper index of the player which died

dark edge
#

no index involved

dark edge
vestal shale
#

The pawn gets destroy with projectile damage

dark edge
#

and lose your multicasts, you don't need them

vestal shale
dark edge
#

so then why are you getting player character all over the place, this IS a player's character

#

You can just do:
Begin Play -> bind event to ondeath (target is self)

#

etc

#

but you don't need to bind, just add to the ondeath event

#

an EXTERNAL class would do binding, that's for if the gamemode wanted to know when someone died (which would be the more correct way to do it)

vestal shale
#

Alright

#

Let me try that

dark edge
#

I would suggest using RestartPlayer though, as that''ll make every spawn the same as the first

fiery wadi
#

Not sure why the Client has to double click and hold to move to a location but the server can click once to move to a location still.

#

Im using the TopDown Player Controller Template in both Client and Server.

dark edge
#

don't do that

#

and yes, gamemode is on server only

fiery wadi
#

Ahh ok how would you do this please?

dark edge
fiery crow
obtuse field
#

I wonder if there are any plans for replicating TMaps?

#

Anyway, why isn't it already a thing?

thin stratus
#

Pretty sure we had that topic a few times already

#

You might be able to find that answer with the search

#

Not sure if they will add replication to it (and other types like TSet), but given it hasn't happened yet, my gut says they won't

obtuse field
#

Just wondering why. What is preventing them from adding it?

sinful tree
#

If it was simple and made sense to do, then epic would've likely done it already.
My guess is that there's no accurate way to keep track of what index has what and it becomes inefficient if you were needing to replicate the entire TMap every time there is some change.
You're probably better off using a FFastArraySerializer using an array of a struct that contains your key/value pairs and using it to keep a local TMap updated as you get pre/post change functions.

thin stratus
#

Yup most of the time falling back to an array is simpler and cheaper

mystic estuary
# obtuse field I wonder if there are any plans for replicating TMaps?

I know that this is not the answer, but it's just a C++ work around
https://www.youtube.com/watch?v=4US1mHsGcs4

TMaps and TSets cannot be replicated uproperties in unreal.
However, they have some convenient methods to convert to an array, which we can use for replication.
That being said, this needs to be used carefully. As frequently converting your set or map data structures to an array could be a performance issue.
An alternative, is if the logic neede...

▶ Play video
obtuse field
#

Thanks anyway

harsh mango
#

When i join a session, the On Success execution fires, but the client doesn't join the session. Is there a fix to this?\

gloomy tiger
#

A Value of a SubObject of my UActorComponent attached to a ACharacter seems that's not replicating properly. Here's the code:

// MyActor.h
UCLASS()
class UMyActorComponent : public UActorComponent
{
    // ...

    UMyActorComponent();
    virtual void BeginPlay() override;
    virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;

    UPROPERTY(Replicated)
    UMySubObject* SubObject;
};

// MyActor.cpp
UMyActorComponent::UMyActorComponent()
{
    SetIsReplicated(true);
    bReplicateUsingRegisteredSubObjectList = true;
}

UMyActorComponent::BeginPlay()
{
    MySubObject = NewObject<UMySubObject>(GetOwner());
    GetOwner()->AddReplicatedSubObject(MySubObject);
}

// MySubObject.h
UCLASS()
class UMySubObject : public UObject
{
    virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
    virtual bool IsSupportedForNetworking() const override;
    
public:
    UPROPERTY(Replicated)
    float Value = 0;
}

// MySubObject.cpp
UMySubObject::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    DOREPLIFETIME(UMySubObject, Value);
}

bool UMySubObject::IsSupportedForNetworking() const
{
    return true;
}
  • No crashes, no console errors, etc.
  • I am testing with two instances; one (remote) client and one server. Server calls a function that changes Value and it sees the changed value on his instance, but when (remote) client calls a function to read Value, it seems unchanged (0).

The above said, what am I missing? 🤔 Pretty much am following the approach proposed by https://docs.unrealengine.com/5.2/en-US/replicated-subobjects-in-unreal-engine/ but can't see what's wrong with the code above.

Learn how to replicate any UObject-derived class and the replicated properties they contain.

uneven lion
#

This only works on the client with authority, but I want it to work for anyone locally (each player sees a different mesh). Any way to stop this from replicating?

late stratus
#

Hi everyone. If I'm making a multiplayer game where citizens engage in dialogue, and I want all clients to hear the dialogue, should I execute the dialogue using GAS, playing the voice animation as a montage, or would I bet better with an RPC?

nova wasp
# vestal shale Thats where I learned from

I recently told you to use a player controller for client->server rpcs but that was a bit misleading, technically anything replicated and OWNED by the client can send a client->server rpc to be more clear

#

edited my comment to make it a bit more specific

summer tide
#

Anybody knows how to replicate BreakConstraint function?

nova wasp
#

you could just make your own rpc that sends over the call to BreakConstraint?

summer tide
thin stratus
mystic estuary
latent heart
#

And if it's a uobject it always has, why not a default subobject?

earnest ocean
#

Hey, I'm fairly new with Multiplayer and I don't get my damaging other players straight.

My PrimaryFire method on the Character determines if you hit something, if you do it calls the ServerTakenDamage(Server, Reliable, WithValidation) method:

...
if (IsLocallyControlled())
{
    HitCharacter->ServerTakenDamage(10.0f, FDamageEvent(), GetController(), nullptr);
}```

This than calls the overriden TakeDamage function of that player with the provided arguments and returns

In that TakenDamage Method I simply do `CurrentHealth - DamageAmount`, invoke a respawn in the gamemode and set the killfeed in the UI.

My Health is:

```UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Health and Stamina", ReplicatedUsing=OnRep_CurrentHealth)
float CurrentHealth;

UFUNCTION()
void OnRep_CurrentHealth();```

And the On_Rep Method just refreshes the UI through the GUI.

My problem now is, when I set my Editor to "Play as Listen Server", the server client can shoot the connected client as expected everything works as intendet, but when I try to shoot as Client to the Server, or play as 2 clients shooting at each other I receive `"No owning connection for actor BP_ThirdPersonNewCharacter_C_1. Function ServerTakenDamage will not be processed`

I guess thats because the HitCharacter is not owned by the client - but I did not found a way to work around that. I tried implementing the DealDamage entirely in the gamemode but with the same result and I guess that might be a massive networked overhead.
short sparrow
#

did not we have lyria channel?

#

i want to ask if we can make the game played between me and my friends for free online with out paying for servers and with out installing the engine source code

#

is this possible?

earnest ocean
short sparrow
#

i just want to play with my homies

earnest ocean
# short sparrow i read in the forums they cant do this unless i have the source

Hmmm I think and as far as my testing with this goes (only on my local machine though) the EOS Plugin mainly works, when it comes to dedicated servers though you need to have the engine compiled from source (but its free you could do that it just takes a huge amount of storage)

In my test setup (followed from here: https://www.youtube.com/watch?v=bvvzXbgeexQ&list=PLnL7VgJvoJuc6JqDSzua1Tv-iud0_1kUY&ab_channel=Gamewizard) for the Lobbies, Session creation and joining you don't need the compiled unreal engine from source

oblique arrow
#

Guys im trying to get unique ID from every player

void ASentinelPlayerState::Multi_GetUserID_Implementation()
{
    const IOnlineSubsystem* OSS = IOnlineSubsystem::Get();
    FString UserID = OSS->GetIdentityInterface()->GetUniquePlayerId(0)->ToString();
    PlayerSessionID = UserID;
}

in postlogin in lobbygame mode i calling the getuser id where im adding userid to array
SentinelState->GetUserID();
IDLIST.Add(SentinelState->PlayerSessionID);

When i save my game im printing

void UBaseGameInstance::SaveDataToPlayerFolder()
{
    ALobbyGameMode* LobbyMode = Cast<ALobbyGameMode>(GetWorld()->GetAuthGameMode());
    for (APlayerController* PlayerController : LobbyMode->PlayerControllerList)
    {
            ASentinelPlayerState* SentinelState = Cast<ASentinelPlayerState>(PlayerController->PlayerState);
            UE_LOG(LogTemp, Warning, TEXT("Player Controllers: %i"), LobbyMode->PlayerControllerList.Num());
            UE_LOG(LogTemp, Warning, TEXT("Player ID: %s"), *SentinelState->PlayerSessionID);
            UE_LOG(LogTemp, Warning, TEXT("Player ID: %i"), PlayerController->GetPlatformUserId());
    }

    for (FString PlayerID : LobbyMode->IDLIST)
    {
        UE_LOG(LogTemp, Warning, TEXT("Lobby ID: %s"), *PlayerID);
    }
}

But what im getting is only my ID even when another player is connected to session via steam

tranquil yoke
#

Anyone can give me an idea how would i even know, If client is connected with Server, I have this case where user can pause the app, and sometimes they get disconnected, I can see it from StatelessConnectHandlerComponent, which checks a handshake.
Is it possible i can access it somehow ?

queen mortar
#

Hey I have a question. If I want to program Ai behaviror tree, how is it different on multiplayer game from singleplayer?

thin stratus
thin stratus
thin stratus
shrewd ginkgo
#

I made a replicated door like this, but the clients still can't open the door. it seems to open on its own, but it can't pass through the door due to colision and remains closed in others.

thin stratus
tranquil yoke
#

But is it going to change the NetMode, because i was connected when i paused the game and server session is destroyed, before this client even knows about the session dying, so who would change the NetMode and Who is handling StatelessConnectHandlerComponent ?
@thin stratus

shrewd ginkgo
#

Every time I close and open the programme, it breaks here, which is a completely unrelated part. When I delete the Open/Closed variable and add it again, it gets better. what is the problem please help.

thin stratus
#

Also the Multicast in the OnRep makes no sense

oblique arrow
thin stratus
#

And I'm not sure if an OnRep function that seemingly looks renamed still works. They usually share the name with the variable

#

At least in BP

thin stratus
#

GetUniqueNetId

#

Or something like that

oblique arrow
#

Its provided from player state?

thin stratus
thin stratus
tranquil yoke
# thin stratus You asked how to know if a client is connected

I am sorry if i have not explained it properly, issue is Client is connected to server and then Client are pausing the App, now when Client comes back from paused state, Session might be destroyed, so how would client knows if it is still connected with server ?

oblique arrow
thin stratus
#

Which usually gets communicated with the GameInstance in BP or similar even Event NetworkFailure

thin stratus
#

Without the net apparently

oblique arrow
thin stratus
#

Terrible naming

#

Cause the thing returned is the NET Id

#

But well

oblique arrow
thin stratus
#

Right, cause it returns the Repl version that can be exposed to BPs

#

Apparently in at least 5.3 there is a BP version of that function finally

oblique arrow
#

or it is changing every time player joins new session

tranquil yoke
# thin stratus Shouldn't the destroyed Session follow that the Server fully shut down so the Cl...

oh yes event Networkfailure will happen when StateLessConnectHandlerComponent will be done with its HandShakeProcess and time limit exceeds, then it sends that event, but i want to detect, even the handshake process is in progress, Maybe i should decrease the time to less than 5 seconds to make it send the event sooner,

My current time for that check is 60 seconds, I had made it so maybe sometimes when you have bad connection it will not get disconnected that much.

thin stratus
shrewd ginkgo
#

How can I turn it to replicated door pls help me

oblique arrow
thin stratus
#

Relatively sure you don't need to do GetUniqueNetId on it

#

The FUniqueNetIdRepl already has a ToString method

oblique arrow
#

Dont know why but my id is empty

thin stratus
#

Try testing it in standalone when you have steam enabled

oblique arrow
#

i tried it in packaged game when i had steam api running

#

same thing

oblique arrow
#

I found out that its a problem with the controller
when i iterate thorugh player states it works

gloomy tiger
#

Thank you kind sir!

final holly
#

Should I use repnotify for Setactivated and Deactivated actor component

#

coz deactivated dosent work

graceful flame
#

So for a door you can have a repnotify boolean for example bDoorOpen

vestal shale
#

I am trying to rerspawn my pawn from the gamemode. But its not working

#

in multiplayer

stuck grotto
#

When I build my game and play on my computer it looks fine, but on another computer with almost same stats certain textures are blurry any idea why?

short sparrow
#

lyra when playing as listen server it does not move the other player

#

they are not connected, why?

graceful flame
# stuck grotto When I build my game and play on my computer it looks fine, but on another compu...

Blurry textures usually means there were more textures waiting to be loaded but the limit was too low and/or the GPU was out of vram. You can solve this by following this guide: https://youtu.be/uk3W8Zhahdg

This time on Unreal Tips & Tricks, we look at how to manage the Texture Streaming Pool size to take advantage of more video memory, or VRAM. By doing this, we can avoid going over our allocated VRAM budget for streamed textures and MIP maps. We'll also take a brief look at how to modify multiple textures at the same time.

For more details, plea...

▶ Play video
latent sapphire
#

so i have this car and its fine on the server but on the client its bad

#

it starts off fine

#

but after driving for a second it starts freaking out on the other clients

dark edge
#

What's the overall structure of your replication setup?

#

HOW does the car drive on multiple computers?

latent heart
dark edge
#

I mean technically, how does it work?

#

You press the go button. How does the car go on other peoples computers?

plucky prawn
#

do RPCs on the gamestate work? afaik no player owns the gamestate so probably not right

thin stratus
alpine wave
#

Hello
I would like to know how to handle player disconnection and exactly how to distinguish between player leaving the game by choice or due to network connection lost

brisk willow
#

Anyone knows how to properly use replicated variable in a material instance via material parameter collection. My skybox actor calculates time of day and replicates it to the clients. I'm seeing the correct value both of the variable and in the MPS where I pass it on all the clients, but it's not affecting the material instance on the clients.

alpine wave
brisk willow
#

HasAuthority part

dark parcel
#

Pointer to material can be replicated?

brisk willow
#

Remote part

#

Material

#

Actor is replicated, mesh replicated, variable timeOfDay01 replicated

dark parcel
#

U just need to replicate the time of day float

#

Everyone can run their own sky

alpine wave
#

if it's in property It would seem like it's replicating the property, as far I could think at the moment you may want to add OnRep function and adjust materiel accordingly I think values inside that certain materials would not be replicated so you may want either have certain preset mat or change accorinding to other factors
Note: I'm not familiar with Unreal engine much or materiels

brisk willow
dark parcel
brisk willow
dark parcel
#

U just set the time of day in server , then server will replicate that value to clients

brisk willow
#

It does replicate it succesfully, but the material won't consider this change

dark parcel
#

It should , provided that you do the set mpc in client too

#

I will suggest to do repnotify

#

And on rep function, set the scalar parametre value of the pmc

brisk willow
#

that's what's happening

#

sun moves on the host (left), but stays still on the client (right) at the default value of 0.5

#

Oh I think I need to set direction light to be replicated as well. Cause I'm seeing skybox colors update correctly but not the sun position

#

On sec, I test it

#

Oh, light settings don't have 'replicated' variable, so I just need to update sun position on the clients, I guess

burnt wadi
#

Hey guys, I want to spawn custom player pawn choosen in runtime by players when they join first time. I was wondering which function of gamemode to override where I can get hold of controller and can run possess on it? I can't seem to find any c++ function for it

brisk willow
#

Thanks guys, I solved the issue but updating the sun rotation on the clients (material was updating correctly, so my bad)

#

perfecto

short sparrow
#

advanced session plugin works fine in same pc in 2 instanecs/players but when play between 2 pcs ( in same house same network ) it does not show the servers list

#

any idea why?

latent sapphire
mystic estuary
# alpine wave Hello I would like to know how to handle player disconnection and exactly how t...

GameInstance has a few methods for that:

/** Opportunity for blueprints to handle network errors. */
UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName = "NetworkError"))
ENGINE_API void HandleNetworkError(ENetworkFailure::Type FailureType, bool bIsServer);

/** Opportunity for blueprints to handle travel errors. */
UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName = "TravelError"))
ENGINE_API void HandleTravelError(ETravelFailure::Type FailureType);
rapid vigil
#

When you spawn two clients using PIE, what exactly differentiates them? Because when I'm checking player controller it seems that only one exists despite there's two clients/windows. I have a kind of a weird setup where one client is the "server"/viewer, while the other client is the control panel that fires events that executes on the server (entirely local, no actual networking other than local)

They're still operating independently, so there must be some controller or otherwise that identifies which is which

mystic estuary
rapid vigil
#

To explain a bit further. I have a project where one client is supposed to be the environment that is seen, whereas the other client is a control panel (that moves the camera, fires events on the former). When setup, the main screen is displayed on a separate TV, whereas the control panel (client #2) is moved to another display (all of this on the same computer).

any tips on how it would make most sense to differentiate between these two? to separate what is shown/executed on each. I'm planning to run it similarly to how the PIE 2 clients executes.

#

(for example, should I perhaps spawn two pawns and use that?)

#

i have fairly decent experience with UE, but nothing on networking. Just looking for a pointer in the right direction and I'll do the research necessary

vivid pollen
#

If there a multiplayer stealth style game template to help me get started on a new game?

#

Inventory, equip slots, AI, basic movements... so I can focus on the envirnment and game, story and game play aspects.

dark edge
#

How does your input get turned into forces on the car

fervent jay
#

just because its MS, does not mean it won't go anywhere.....

wispy socket
#

I'm trying to keep score per hit, but the not owner check keeps failing because owner isn't setting for some reason
To spawn and set owner I'm doing this

{
    if (!ensure(ProjectileRoot)) { return; }

    // Spawn the projectile at the specified location and rotation
    auto Projectile = GetWorld()->SpawnActor<AProjectile>(ProjectileActor, ProjectileRoot->GetSocketLocation(FName("Projectile")), ProjectileRoot->GetSocketRotation(FName("Projectile")));
    
    if (Projectile)
    {
        // Set the projectile's owner to be this vehicle character
        Projectile->SetOwner(this);

And to check the hit wasn't the owner before incrementing the score I'm doing this

                {
                    if (AMyPlayerState* PS = ShootingVehicle->GetPlayerState<AMyPlayerState>())
                    {
                        PS->PlayerHit();
                        if (OtherVehicle)
                        {
                            
                            OtherVehicle->Die();

Anyone see what I'm doing wrong?

latent sapphire
#

and a bunch of math

hot edge
#

Can anyone help me?
Im trying to destroy an item on pickup from both client and server, but it can only be destroyed if the server picks it up and then it still only gets destroyed on the server
On pickup im calling DestroyActor Server which then should call On Rep Actor To Destroy
I also tried multicasting after running from server but with no luck.
The actor that im trying to destroy + the character im destroying it from both has Replication enabled.
Can anyone see what im doing wrong?

mystic estuary
hot edge
mystic estuary
hot edge
#

Could it be because the BP's i wanna destroy gets loaded in from map load? and not spawned from server?

mystic estuary
#

Could it be because the BP's i wanna destroy gets loaded in from map load
What do you mean by that?

and not spawned from server?
It means that you're doing something wrong. If you have a replicated actor, it must be present server-side, otherwise there's no reason to make it replicated.

hot edge
#

The BP is just on the map, do i need to spawn it using Spawn Actor from class?

#

But if i destroy it server side would i need a w/ notify?

mystic estuary
mystic estuary
hot edge
#

So just this?

mystic estuary
#

This is a server RPC. It can be called only server-side or owning-client-side. For the latter it's related to things like PlayerController, PlayerState, Character and such, but a regular actor spawned server-side, and replicated back to clients this is not the case, so calling this RPC client-side would do nothing.

#

If you want to destroy an actor that is owned by the server you need to use a server RPC on an actor that is owned by the client. For instance, you can use a PlayerController.

#

Also there's no reason to use HasAuthority in a server RPC because nothing but server can execute that

hot edge
#

So i would need a Player Controller for this to work?

#

And the call destroy from that?

mystic estuary
#

You would need to use PlayerController to call a server RPC with the actor you want to destroy. And yeah, you would need to create that RPC

mystic estuary
hot edge
#

Alright thanks, i'll try that a little later, i'll let you know if i get it to work 🙂

boreal scarab
#

Got it, thank you!!

#

Is the Wizard Cell one good info as well?

hot edge
mystic estuary
mystic estuary
hot edge
#

The thing is i have another BP that when i click that it actually gets destroyed

mystic estuary
#

The issue is where the cast is, as it's saying that it cannot read its result. That's weird though, since only the first exec pin is connected. Can you move the nodes around so that's clear what is connected to what?

hot edge
#

But not the BP i want to destroy, it doesnt work with that one

mystic estuary
#

Also you don't need to have a separate event to call a server RPC. You're able to call an RPC using the controller itself

hot edge
#

This method gets called using left click, when i left click on the BP BP_VicNormalDoor the door gets destroyed, but when i do it to BP_Banana it does nothing

mystic estuary
#

Can you put a breakpoint on the cast, and see whether it works fine when you try to destroy the banana? It should work fine, but the error says otherwise, maybe I'm getting it wrong or something

mystic estuary
#

What about the error though? What node does it happen on?

hot edge
#

Destroy actor

mystic estuary
#

Yours one?

hot edge
#

it must be a setting on the banana right?

mystic estuary
#

wdym?

hot edge
#

since it works on the door but not the banana

#

wouldnt that mean the error is on the banana?

mystic estuary
hot edge
#

no the unreal destroy actor

mystic estuary
#

If it fails server-side, it means that the banana does not exist server side. If so, how do you create it?

hot edge
#

i can see the banana from my server client, but its just in the level

mystic estuary
#

Still, how do you create it?

#

Oh, do you mean it's there prior to play time?

hot edge
#

yeah

mystic estuary
#

Is it replicated?

#

If no, server-side and client-side bananas are technically different bananas

hot edge
#

i checked the "replicates" checkbox

mystic estuary
#

Just now? So it wasn't before?

hot edge
#

no, it was there before

mystic estuary
#

Uh, it should work. Can you double check that you're actually passing a banana to the server? Try to put a breakpoint before the RPC call and inside it, and see whether you pass not a None, and whether it gets the same thing or not

hot edge
#

i tried checking "Always relevant" do you think that would do anything?

#

Looks like it gets passed as None to the server

mystic estuary
#

It won't do anything unless you changed anything relevancy related prior to that

mystic estuary
hot edge
#

Should i try spawning the Banana in when i generate my dungeon instead?

#

that way it will be generated from the server

cinder goblet
#

I have a UI that's supposed to default to a value of 100 for player and opponent, and increment by 6 every five seconds. It also updates whenever you spend money. This update pulls the player's cash value from their player state. The problems:

  1. When you spend, it doesn't update your cash value on the opponent's screen until the 5 second update
  2. Player 1 (Server)'s Opponent value lags behind one tick. It starts at 100, goes to 0, then up to 106 and increases as expected.
  3. On Client, own cash sometimes visually misses an increment tick, although the cash is spendable.
mystic estuary
hot edge
#

You can see here it recieves None but sends the banana

#

although it is the Client banana, dont know if that does anything

mystic estuary
#

Yeah, that's weird, especially since the actor is replicated. Again, you spawn it prior to play time that's fine

mystic estuary
hot edge
#

ignore that, its just the replicated client banana

mystic estuary
#

Again, is it spawned prior to play time? You just placed it into the level manually

hot edge
#

yeah i did

dark edge
#

Is it spawned at runtime or just placed in the level?

mystic estuary
#

They pass it using a server RPC using PC after firing a trace client-side. The banana is spawned prior to play time

#

And it's marked as replicated

hot edge
hot edge
#

Just not with the banana that is placed in the level pre start

mystic estuary
#

I have no clue why it wouldn't work when it's placed prior to play time. If it's just an actor with the replication enabled it should not be None when passed to the server via a server RPC. If spawning it on runtime works fine for you, I guess do that, but the issue is weird 😔

dark edge
#

Line trace -> tell server to destroy the actor

hot edge
#

Same error

#

wait i did something wrong, one sec

dark edge
#

Is it actually an error or are you trusting the BP debugger too much

hot edge
#

its the same error

#

but its something with the mesh then?

dark edge
#

What is the actual data type of the parameter to the run on server event?

#

just actor reference right?

hot edge
#

yeah

#

It works with other blueprints, just not the Banana

#

but the other ones i spawn in at runtime

dark edge
#

Then your Banana isn't replicated

hot edge
dark edge
#

Make a new actor with just a cube and set replicates and test with that

#

something's goofy with that actor if the cube actor works

hot edge
#

Same error

#

But i would need to spawn in all the BP's anyway cause it needs to be random so im just gonna do that

dark edge
#

yeah somethings fucky with your setup if actors placed in the level aren't replicating

#

You doing anything weird like level streaming or sublevels etc?

hot edge
#

i do level stream

#

but im levelstreaming my doors and they work

dark edge
hot edge
#

yeah, but i found a way to fix it, i basically just place a spawner BP which i replace at runtime, thats what i wanted in the end anyway, so im just doing that now

#

"fix"

latent sapphire
#

still trying to figure this out

dark edge
#

You still haven't told anyone how your button presses get to the server and are reflected in the application of forces on the vehicle server and clientside

#

Or your physics replication settings if you're using that

latent sapphire
#

oh you wanted to know how the button presses work

dark edge
#

I want to know how your system works in general

#

You press forward button, what happens?

latent sapphire
latent sapphire
dark edge
#

Show the code

latent sapphire
#

thats where it adds force for the wheels

#

wait

#

lemmie try something

dark edge
#

I don't see any replication here

#

how does the server know you pressed the button

latent sapphire
dark edge
#

noooooooooooo don't pass deltatime from server

latent sapphire
dark edge
#

Do this

#

Input -> run on server event passing Throttle over
Run on server event -> set ReplicatedThrottle

Tick -> use ReplicatedThrottle in your normal update stuff

#

then go loosen up your physics replication settings, they are way too strict by default

latent sapphire
#

ok

dark edge
#

make the settings less strict

#

but first check that it works with them as default

#

it'll drive but be very jittery

latent sapphire
#

its driving

#

but after doing so turns and stuff the car stats floating

#

nvm it is jittery

#

but still floating

plucky prawn
#

whats the correct way of getting the local player controller inside game state? i want this client side so do i just check authority and use Get Player Controller 0?

dark edge
latent sapphire
#

it does

dark edge
#

then make sure all the control variables (steering, throttle, etc) are replicated like I said

#

Input -> send to server

Server recieves -> sets replicated variables.

Tick -> use replicated variables to do physcis

#

There's ways to make it slicker but do that for now

latent sapphire
#

ok

#

like this?

ripe ravine
#

Im new to multiplayer so if the answer is obvious thats probably why

dark edge
ripe ravine
#

Im not sure why this isnt replicated

dark edge
#

no multicasts

latent sapphire
#

ok

#

what enstead

dark edge
#
  1. Send your input floats to the server (throttle, brake, steer, etc)
  2. Server sets some replicated variables
  3. Tick uses those replicated variables to do the physics.
#

The only RPC should be the client sending the inputs to server

#

for now

latent sapphire
#

i guess im having a hard time understanding

#

wait

#

maybe i get it now

#

like this for the turning?

dark edge
latent sapphire
#

what do you mean by replicated variables

#

how do i do that

#

is the a blueprint im missing

dark edge
latent sapphire
#

ok

dark edge
#

You're missing the entire way the engine multiplayer works

latent sapphire
#

ok

#

oh i see

#

does that look better

latent sapphire
#

ok i figured it out

soft notch
#

Hi, I'm spawning item on the server and trying to pass it to the client, but client gets a null reference. How can I fix this?

dark edge
soft notch
mystic marsh
frank pecan
#

I'm trying to use replicated physics in 5.3. But when I get a spam of warnings in the logs like:

LogPlayerController: Warning: ClientInput buffer overflow. MyPlayerController [Player]. RecvFrame: 8291. LastProcessInputFrame: 8275.
#

Also this one appears some times too:

LogPhysics: Warning: [Remote.Input] in fault. Reusing Inputcmd. (Client) Input: 8619. (Server) Local Frame: 1051
#

these start printing right when the player joins the game

silent valley
#

We are getting reports of some clients speedhacking in our dedicated server game. Does anyone know if there's a known exploit in CMC for this?
I would have hoped the cmc would prevent this...

#

We control the server so it's definitely a client side hack.

#

Does anyone know a good resource for common Unreal multiplayer cheats? So I can stop them of course! Not really found anything via search (not surprising I suppose).

oblique arrow
#

Guys i have array of structs

UPROPERTY(Replicated)
TArray<struct FSlotData> SlotArray;

Im calling my add item locally

void UCharacterInventoryComponent::AddItem()
{
    if (ItemDataTable)
    {
        FItemData* InteractData = FindItemByID(CurrentInteractable->ID);
        if (InteractData && CurrentInteractable)
        {
            bool CanStack = InteractData->ItemNumericData.bIsStackable;
            int MaxStackSize = InteractData->ItemNumericData.MaxStackSize;

            for (int SlotIndex = 0; SlotIndex < SlotArray.Num(); SlotIndex++)
            {
                if (CanStack && SlotArray[SlotIndex].ID == InteractData->TextData.ItemID)
                {
                    SlotArray[SlotIndex].Quanity += InteractData->ItemNumericData.Quanity;
                    ItemSlotArray[SlotIndex]->ThisSlotData.Quanity = SlotArray[SlotIndex].Quanity;
                    ItemSlotArray[SlotIndex]->UpdateWidget();

                    RefreshInventoryForPlayerState();
                    return;
                }
            }

            if (MaxSlots >= CountFreeSlots())
            {
                int FreeSlot = FindFreeSlot();
                SlotArray[FreeSlot].ID = InteractData->TextData.ItemID;
                SlotArray[FreeSlot].Quanity = InteractData->ItemNumericData.Quanity;
                ItemSlotArray[FreeSlot]->ThisSlotData = SlotArray[FreeSlot];
                ItemSlotArray[FreeSlot]->UpdateWidget();

                RefreshInventoryForPlayerState();
            }
        }
    }
}

What i can do to change this value as well on the server, of course i placed this array in GetLifeTimeReplicatedProps

#
USTRUCT(BlueprintType)
struct FSlotData
{
    GENERATED_BODY()

    UPROPERTY()
    FName ID = "Empty";

    UPROPERTY()
    int Quanity = 0;
};

struct look like this

latent heart
#

Are you calling it on the server or the client?

#

On the client I see.

#

Stuff doesn't replicate from the client to the server.

oblique arrow
#

Yes i want add item locally

latent heart
#

If you want to do it "properly", the client asks the server for the change, the server makes the change and updates the client.

#

You can add whatever prediction you like around that.

#

And of course if the server rejects teh change, it should inform the client.

oblique arrow
#

So i should call add item from server?

latent heart
#

👍

nova wasp
#

replication of properties is only from server to clients

#

RPCs can be either way

latent heart
#

And RPCs are filtered based on owning actor.

oblique arrow
#

Im little confused here so if you have for example Server prefix for UFUNCTION this function will call on server but executes only on client or the both?

latent heart
#

You mean the Server specifier? (not a prefix - changing the function name does nothing)

#

That will make the function execute on the server, if it's called from a client-owned actor.

oblique arrow
#

So what i want to do here then is to add Client in ufunction?

latent heart
#

That would cause the server to tell a client to execute a function.

#

Your problem is the client is already doing it and it doesn't work.

hot edge
silent valley
thin stratus
#

I heard some regular ( @chrome bay ? ) complain about that several times.

#

But not sure if it's the boolean you mentioned

#

It does sound like it could address it though, because the Cheating you encounter is probably caused by then sending updates with faked timestamps or something like that

silent valley
#

Would love to find a whistleblower from the hacking community to hire as a consultant 😄

hot edge
#

@silent valley What is your game called?

silent valley
hot edge
silent valley
#

ok feel free to DM me 👍
but I think the CMC booleans will address the speedhack, just makes the experience worse for high latency/high packetloss players

grand kestrel
#

Didn't test the speedhack detection but I did see it there

silent valley
twin juniper
#

Hello does anyone know if there's a way to export the map collisions?

ripe ravine
frozen wraith
#

So I've been testing to see if I could get Steam sessions working using AdvancedSteamSessions, I can find the sessions on my own PC, I can find it using 2 different machines on 2 different accounts (even with different download regions, country wise), however my 2 friends in the UK can not find any session when they create one and try to join. I suspect I'm still running it via LAN somehow but I'm not sure where or what I could be doing wrong. Using steams test AppID 480.

twin juniper
#

I am creating a physics based pawn actor and was searching about to handle the replication, client-side prediction and stuff for it, I just found out that unreal has something named NetworkedPrediction plugin which could help out in my case, I'm a bit new to engine right now, so don't really know how to search for eacmple/Documentation for this, Can someone point to some resources

Or if you know a better way to handle physics based networked movement please share

eternal canyon
#

to actually use it

#

u have to use it for everything

frank pecan
dark edge
#

What's your setup, what are you actually doing?

dark edge
#

Generalized physics movement with prediction is a very hard problem, you probably won't find a turnkey solution for that right now.

twin juniper
#

Yeah but for a character controller we would need prediction right?

dark edge
#

Why aren't you just using the usual Unreal Character?

twin juniper
#

My character is more of a floating character which can interact with other physics objects (for gameplay purposes), the default controller just doesn't work with that kind of setting

dark edge
#

Call it a movement component, controllers are a totally different thing in Unreal

#

How does it move, really gently or very twitchy?

#

You could probably get away with not using prediction if it's really floaty anyway.

sour geyser
#
PlayerState->SetIsSpectator(true);
ChangeState(NAME_Spectating);
bPlayerIsWaiting = true;
ClientGotoState(NAME_Spectating);```

I am using this code by WizardCell to spectate in my game. but for some reason, i cant destroy my player after doing so. or well, i can, but when i do, it works fine on the listen server/client, but not on the client. on the client it removes the player, but then i cant move my spectator pawn anymore. idk why
twin juniper
#

It feels pretty tight even after being a physics based character

dark edge
#

Yeah predicting that will be tough

#

Predicting it alone isn't the problem, you can do that easily

#

it's reconciliation, like when 2 characters are both pushing on something, where does it go?

#

Thats why vehicles in games can feel great, until they collide with another vehicle and then it turns into a jittery mess

twin juniper
#

Yeah, I honestly don't know how anyone solved it

dark edge
#

If everyone is locally predicting, they can't both be right if they disagree on some shared thing like a box they're pushing. That's why I'm totally NOT doing prediction for my game, but it also helps that mine's a vehicle building game so prediction is very hard, and not really necessary. 30ms lag for turning a tank is just fine.

twin juniper
#

Yeah

worn steppe
#

I have a net multicast function invoked from a UFUNCTION(Server) that modifies a REPNOTIFY variable, but when it it runs, the REPNOTIFY function for that modified variable does not appear to run. I have called GetLifetimeReplicatedProps() and DOREPLIFETIME for the class/variable (it's a component attached to a blueprint object in the editor). Any advice on debugging this?

#

OK, I have no idea how REPNOTIFY variables work apparently

worn steppe
#

i'm coming to the conlusion they just don't work

latent nest
#

Can I use playfab within ue4, and if so is there a tutorial or documentation I can follow to learn? Or anybody willing to atleast show me the basics?

hot edge
#

Hi, im calling a Server method from my widget but i cant seem to get it to work? how would i go about doing that?
It doesnt execute from either Client or server

#

im dumb, ignore me

thin stratus
#

Just asking cause sending that to the Server might not work

thin stratus
hot edge
thin stratus
#

But it calls?

hot edge
thin stratus
#

A multicast to change such a variable makes no sense

thin stratus
#

In BPs you can't replicate plain objects

hot edge
#

how would i go about replicating it through BPs? or is it easy to do from c++?

#

Switch to actor?

thin stratus
#

You can't replicate it through BPs. You can only send Actors (that are replicated and spawned by the server) or Structs

#

And since that Payload is probably local only, you would need a struct

hot edge
#

Is it easy to make it replicate through c++? or is it easier to switch it to actor?

worn steppe
thin stratus
#

C++ would only allow you to replicate the Object via an existing Actor. Similar to how Components replicate.

I don't think that helps you here.

And an Actor would only work if the server spawns it, so that also doesn't work. You'll need to switch to a Struct

thin stratus
#

In case you were expecting that

worn steppe
#

It should call on the clients though, correct?

hot edge
thin stratus
past flicker
thin stratus
#

Which I doubt makes sense for a drag and drop payload

worn steppe
worn steppe
#

or, as it turns out, it is. idk, maybe it's something wonky because it's a component

hot edge
thin stratus
#

On the rpc atleast yeah

hot edge
#

Oh so the inventory can work the same, but before i send to the server i convert to a structure?

thin stratus
#

The payload can stay an object but you would need to manually convert its data to a struct or have the struct in then object to begin with

#

And the struct properties would of course need to not be an object ;)

hot edge
#

I'll give that a go, thanks!

worn steppe
#

Aha, it turns out it isn't finding the component, so the code that I was sure invoking all of this, in fact, is not being invoked at all. I don't know why this one in particular isn't working when the others are, but progress! Thanks for the help

past flicker
#

Does anyone have some good resources for prediction in Unreal or are we still in the "engineer it yourself" era? If so, any good nonUnreal resources?

worn steppe
#

Some unreal docs there as well, although nothing for ue5, although it's probably quite similar to ue4

hot edge
#

@thin stratus It works, thanks!

sharp plover
#

is there any way to know when a actor becomes "relevant" again once they enter the AOI? Other than just PostNetInit

#

BeginPlay doesnt seem to get retriggered

sharp plover
#

client

#

Everything seems to break once they exit the AOI and reenters

dark edge
#

I thought Begin Play got fired

sharp plover
#

I think only if the actor hasnt been in the AOI already

#

then it gets triggered

#

but if a player is infront of you, walks a mile away, and walks back

#

Doesnt seem to get triggered

#

Only PostNetInit does

#

Was hoping there would be a BP solution for this but I can always expose the function in BP I guess

rose turret
frank pecan
frank pecan
dark edge
#

What do you mean by new physics system, Chaos or something newer?

frank pecan
#

I'm wondering if there's just a setup step that i missed

dark edge
#

That's the experimental network prediction plugin, IDK the current state of it or if it works at all right now

#

there's the old built-in physics replication system that works just fine

dark edge
dark wing
#

Does unreal engine have built in events or methods to know at which state the client is now after connecting to a server? like ("connecting, connected, failedToConnect")

dark edge
#

The stock settings are really strict, you can find them in project settings

frank pecan
dark edge
#

It'll be a LOT easier without prediction and the gameplay will be the same

frank pecan
#

for the clients so it's not jittery i mean. If the player shoots the ball locally, and on the server. then wont the other players just have the position of the player who just shot be snapping around?

dark edge
#

no

#

it'll be smooth

#

you need prediction for it to be instant on client

torpid lantern
#

So I understand on a dedicated server for each player, there are two player controllers: 1 for the server and 1 for the client

Are these treated as separate objects, in the sense that if the server updates a variable on its player controller, the client would not see that variable change in the client's player controller? Or are the two objects synchronized?

dark wing
#

Two objects are synchronized

#

But when the server updates a variable on the player controller it should be an RPC call of course

#

So either the server runs RPC on client, or set the variable to be synchronized

#

And there is only one player controller for each player

#

Why would two player controllers exist?

torpid lantern
#

I was trying to better understand "switch has authority" and some of the conversation was suggesting there was a "server version" and a "client version" of the PC. But from what I understand of your answer; there is one PC object but it's shared by the server and the client.

Is that correct?

#

(and thank you btw)

hollow eagle
#

No. The client and server are (discounting play-in-editor) running in entirely different processes - they cannot physically share any objects. But they each have an instance of each replicated object that is associated with the other side's version.
So conceptually you could say that there's a single player controller, but in actuality there's two that are made equivalent to each other through replication. And you generally know which side you're on based on either HasAuthority or IsLocallyControlled (these are not the same thing, they are used in different situations).

#

The server has one instance of the player controller, the client has another. The server has authority over all replicated objects.

#

Whether you want to talk about the conceptually-singular player controller or the two separate-but-associated real objects depends on the context.

torpid lantern
#

Okay, still trying to digest that and I hope you mind won't if I ask a few follow up questions.

For "switch has authority" on the PC, Authority = (server only do this logic) & Remote = (client only do this logic) - is that correct?

#

In my setup, I am not clear on when I should use switch has auth vs. a "is local player controller" branch.

nova wasp
#

"local controller" is more about if they are actually being controlled on this machine

#

the actual player's machine in which they are pushing buttons to move stuff around have the "locally controlling" player controller

#

But authority is literally just one thing: if the local role is ROLE_Authority

hollow eagle
# torpid lantern Okay, still trying to digest that and I hope you mind won't if I ask a few follo...

Sort of... "authority" means, well, that you have authority over the object. You're allowed to do anything you want with it and everyone has to listen to you about it.
Let's say you have a standalone/offline game: you are always the authority.
Let's say you have a networked game, and you spawn a replicated actor (for example, a player controller): the server always has authority.
Let's say you have a networked game but you spawn an actor on a client (no replication): the client has authority because no one else even knows the actor exists - clients can't replicate things by themselves.

#

And even for actors that exist in a level for everyone but aren't marked as being replicated - all clients and the server have authority, because the objects aren't replicated at all.

latent heart
#

I always favoured checking netmode in c++

hollow eagle
#

The idea of authority is a sort of abstraction away from having to know whether you're the client or server. In most scenarios you don't actually care about client/server, you just want to know whether you have the ability to make certain types of changes that only the thing that spawned the actor would be able to.

torpid lantern
#

I feel like a lot of fog has been lifted with these answers. Thank you all so very much.

nova wasp
#

It's an important distinction because there are situations where you a player and also a server, like netmode NM_ListenServer

#

which would arguably be mostly the same role wise as checking on the server, it's kind of case by case

#

Also Local and Remote role are flipped on client/server and I can't believe I never realized that until just now lol

latent heart
#

Checking != NM_Client or < NM_Client is my goto.

nova wasp
#

yeah, that's by far the most common "is this NOT a server?"

latent heart
#

Well, "is this the server?" more like 😛

nova wasp
#

but the other distinctions matter if you need to distinguish your own player vs other players in the local client world

#

so it's all case by case etc

#

definitely also brush up on the rules for who's allowed to RPC to server as well, that was my biggest hangup for a while

latent heart
#

Yeah. There's a reason to use all the different tests. Sometimes there are multiple valid ones.

nova wasp
#

Sometimes I wonder how other engines deal with the idea of roles and ownership

#

I dislike not being able to make RPCs from anywhere at least

#

but there may be some massive spaghetti problem with that I'm not aware of

latent heart
#

It's probably just about the network connection.

#

Or, rather, network channel.

#

The server only accepts input from actors owned by the client. So you can only send rpcs from those actors.

#

I'm sure it'd be perfectly possible for epic to have routed all rpcs through your player controller, but eh.

nova wasp
#

I don't mean that, I mean... letting us just add new RPC ufunctions that clients can call to anything

#

I think it would be doable to cheese but you can get around the annoyance by just adding more controller/pawn owned components

#

to avoid needing the 100000 line hell class