#multiplayer

1 messages ยท Page 116 of 1

dark edge
#

Sure, it's fairly trivial.

#

I would start with just trusting the shooting client, and then once it works, add some verification if you want

#

You aren't going to get roll back and all that but you could do something really simple like this?

ivory bear
#

Thanks...I will see what I can rig up. Spent time on my asset integration and first person view, only replicated stuff is movement, aim offset, shooting and weapon pickup. I would think that item pickups and inventory could still be server authoritative, and do movement, shooting and aim offset client auth...

#

And tough trying to convince the wife to let me spend $350 on a plugin (GMC). LOL

dark edge
#

I mean it all depends. You aren't even going to do a correct sprint without C++ unless you want to do some very cheatable stuff

dark parcel
#

I think watching youtube multiplayer tutorials that does it with pure bp is already a mistake imo

#

just look at the number of "sprint in multiplayer tutorial" out there

#

literar copy paste of same trash code that doesn't actually work

#

like it looked fine bcuz they didn't emulate lag and doing it in editor with 0 ms

#

the moment latency is introduced, it's unplayable

dark edge
#

By the way, the cheatable sprint I'm talking about is basically client side authoritative Sprint. Just clamp the input size when you're not sprinting, and allow it to go to size 1 when you are.

ivory bear
ivory bear
dark edge
#

They can cheat by just not clamping it.

#

Basically, you are trusting the client to not send a full-sized movement input to the character movement component when they are not sprinting.

#

But it will work perfectly, you're basically emulating an analog stick only being pushed halfway when walking, and being pushed the entire way when sprinting

ivory bear
brazen anvil
#

If you want a good FPS multiplayer tutorial you should use Stephen Ulibarri's course. He uses C++ (because you should) and he adds server rewind, client prediction, lag compensation, and a bunch of stuff.

#

He has a 10hr section on lag compensation.

dry pebble
#

+1 on stephen's multiplayer shooter course. Anyone wanting to learn networking with ue should take that

ivory bear
brazen anvil
#

Yes

#

This course will beat any YT tutorial x100

ivory bear
#

I guess it will be trivial to make it first person as it appears to be third person?

brazen anvil
#

yeah that wont be a issue.

#

yt video for that

ivory bear
#

As it is on sale for $17 bucks (82% off) I may move on to one of my games that can be multiplay in blueprints (social hangout type stuff/not fast paced) and take that course. Kill 2 birds with one stone, make my game and finally, after coding since 1982, learn C++.

brazen anvil
#

Yeah that would be a good plan.

faint cloud
#

I've never profiled before do I use the console?

dark parcel
dark edge
brazen anvil
#

Also you can easily get access to alot of Udemy courses if you have a library that has access to Gale

mint stream
#
// Camera pitch replication
  UFUNCTION(Server, Reliable, BlueprintCallable)
  void ServerCameraPitch(double Pitch);

  UFUNCTION(NetMulticast, Unreliable, BlueprintCallable)
  void NetMulticastCameraPitch(double Pitch);

And then in the main

void Look(const FInputActionValue& Value) {
    // input is a Vector2D
    FVector2D LookAxisVector = Value.Get<FVector2D>();

    if (Controller != nullptr) {
        // add yaw and pitch input to controller
        AddControllerYawInput(LookAxisVector.X);
        AddControllerPitchInput(LookAxisVector.Y);
    FRotator Rotation = FirstPersonCameraComponent->GetComponentRotation();
    ServerCameraPitch(Rotation.Pitch);
    }
}

void ServerCameraPitch_Implementation(double Pitch) {
  NetMulticastCameraPitch(Pitch);
}


void NetMulticastCameraPitch_Implementation(double Pitch) {
  FRotator Rotation = FirstPersonCameraComponent->GetComponentRotation();
  FRotator NewRotation;
  NewRotation.Roll = Rotation.Roll;
  NewRotation.Pitch = Pitch;
  NewRotation.Yaw = Rotation.Yaw;
  FHitResult CameraHitResult;
  FirstPersonCameraComponent->K2_SetWorldRotation(NewRotation, false, CameraHitResult, false);
}

I am currently doing this to replicate camera pitch. But I noticed that the client's camera jitters when looking up/down. Any idea on how to fix that?

shadow hatch
#

when playing either coop or dedicated in pie my character rotates slowly on server and remote clients, i didnt have this issue before. what could it be caused by? i can move perfectly fine and the character rotates how it should on the local player. idk if this makes sense

#

oh found the culprit, not sure why i set it to 0.66 at some point...

dark edge
#

Get base aim rotation or something like that

mint stream
dark edge
#

I'm not sure if the entirety of control rotation is implicitly replicated, but the pitch is for sure.

mint stream
#

Ahhh Gotcha. I just swapped it and it's working A LOT better. No jitter whatsoever!

void NetMulticastCameraPitch_Implementation(double Pitch) {
  FRotator Rotation = GetBaseAimRotation();

Call:

FRotator Rotation = GetBaseAimRotation();
    ServerCameraPitch(Rotation.Pitch);
dark edge
#

Why do you need a multicast for this?

#

What exactly are you trying to do?

mint stream
#

Maybe I have a misunderstanding of Multicast or am just using it wrong. I am testing out creation of a multiplayer FPS. So I thought that I want to show the pitch to both server and client. Are you saying I should just run on server instead?

dark edge
#

Just use get base aim rotation whenever you want the pitch

mint stream
#

Sorry, I am a noob, are you saying to do this then? AddControllerPitchInput(Rotation.Pitch);

dark edge
#

Adding controller input should be done on owning client only

#

That modifies the ControlRotation, which implicitly drives the stuff that GetBadrAimRotstion uses

mint stream
#

Sorry, I am confused. Where would I use the GetBaseAimRotation()'s result?

dark edge
mint stream
muted pewter
#

I have just packaged a dedicated server but whenever i try to run it it throws a notification:

PS: I havent cooked assets for server yet
Image

latent heart
#

In shipping?

muted pewter
#

just compiled the server.target.cs file and started the .exe file upon which its giving this error

latent heart
#

Using which configuration?

muted pewter
#

Development Server

latent heart
#

Not shipping then.

#

Have you tried deleting your binaries and intermediate folders and recompiling?

#

It might just be a fubar build.

muted pewter
#

Also i have just recently converted project from binary engine to source

latent heart
#

Honestly I'm not sure if that error is created by UE or by windows because the exe is broken.

muted pewter
#

so maybe thats causing isssue

latent heart
#

That shouldn't be too much of a problem.

#

Just delete binaries/intermediate and build again.

muted pewter
#

alright

frank hearth
frank hearth
#

Wow this course is great. Exactly what I wanted

#

I guess the moral of the story is to ask the community for learning advice before embarking on studying a topic ๐Ÿ˜„

muted pewter
thin stratus
brazen anvil
#

Could I just add the stance into the FSavedMove?

thin stratus
#

At least if you want corrections to properly replay the moves between the correction and the current predicted move :P

#

Unless the "stance" can be deduced by already known things

brazen anvil
#

No it wouldnt be able to. So it would def need to be in a FSavedMove so that it knows that if it is crouched, which stance.

thin stratus
#

I'm not entirely sure about your specifications for that feature, so hard to point you anywhere.
We do have a github repo pinned on this channel that shows some examples on how to extend the CMC

#

The general idea is to send any data the server needs via the ServerMove.
Inputs can be send via the InputFlags or whatever thye were called (check the mentioned repo).
More info would need you to implement a custom ClientDataContainer or whatever they are called (has a freaking long name).

#

Anything that has to be known to replay a move that can't be deduced from other information has to be placed into a savedMove

#

And that saved move has to implement a bunch of functions to ensure that the new property is also handled correctly

#

Such as does it allow combining a move

#

And then you might also need to handle the correction itself. Similar to ClientDataContainer there is one for ServerData when a correction is send.

brazen anvil
#

FCharacterNetworkMoveDataContainer?

thin stratus
#

Optionally needed of course, depends on the feature

#

There are two, I don't have the engine open and I won't open that today anymore, it's 10 PM :P
That could be the right one yeah

#

And with all of that you'd then need to utilize the existing functions of the CMC to use those new properties and code your feature

#

Which highly depends on what that feature is

#

If it's similar to Jumping or Crouching then you can check how they use the Input Flags to start ands top crouching

#

And what they save in the SavedMove etc.

brazen anvil
#

Yeah I have looked at PredictedMovement and I have also been using Delgoodies version as well.

#

I guess the only thing the server needs to know is if it is crouched, and then what stance it is at. And then the player can change the stance while still crouched. So I would just need to keep that stance updated. I also thought about using it as indicating whether or not you are crouched. If it is 0 then that means not crouched. Then 1-5 would be the stances.

#

So if I went with that, I only need to use a single byte.

thin stratus
#

What are you trying to do anyway

#

What is "Stance" here?

brazen anvil
#

different crouch levels/stance

thin stratus
#

How are they controlled?

brazen anvil
#

mouse scroll

thin stratus
#

So first scroll is level 1, down to level 5?

brazen anvil
#

yeah

thin stratus
#

And scrolling up goes the opposite direction?

brazen anvil
#

Yes

#

+1 or -1

thin stratus
#

Does the play have to actively crouch or is that triggering the crouch?

brazen anvil
#

that triggers it. So basically if you are holding the crouch button and let go, you will crouch to the lowest by default. If you hold crouch and scroll you can go up or down depending where you are at in the crouch.

thin stratus
#

If I don't hold crouch and scroll?

brazen anvil
#

so if I held crouch and scrolled down I would go through the different crouch levels

#

nothing happens then

thin stratus
#

Okay

#

Does the Level need to be saved between 2 crouches?

#

E.g. if I crouch and go to the mid level and uncrouch

#

would i still be at the mid level next time I crouch

#

Or does it reset

brazen anvil
#

It would be nice if it did that.

thin stratus
#

So saving?

brazen anvil
#

yes

thin stratus
#

Yeah then you'd need to:

  • Send the Input for + and - to the Server via the available InputFlags that are still free
  • There should be a function that handles the Crouch Input and Crouches/Uncrouches based on that. I would try to place the logic to check for the + and - key input there and simply check if we are crouching or not.
  • Based on that you can set a CrouchLevel int then
  • You can also set a Replicated Crouch Level on the Character (CMC is not replicated by default and I would keep it that way) with an OnRep to drive animations and capsulse size for SimClients if needed
  • Save the CrouchLevel in the SavedMove, implement the required functions with that in mind
  • Send it from Server to Client on corrections to ensure any form of Correction tells the Client the correct CrouchLevel
  • You might need to override the function that replays the moves (ClientHandleCorrections or something like that) and save the current CrouchLevel before replaying
  • Not 100% sure though. Epic does that with some stuff because the SavedMoves literally change variables on the CMC and if that last change it replays is different from what is currently going on (like a key being pressed) then the client would suddenly not do what they think they do (if that makes any sense)
frank hearth
thin stratus
#

isn't that more #cpp ?

eternal canyon
#

oops

#

i thought i was in cpp mb lol

brazen anvil
#

By input flags are you talking about the compressed flags?

#

Those are used like a bool

thin stratus
#

They are a bit mask

#

0101 0101

#

Think it's a uin8 iirc

brazen anvil
#

yeah

#

4 are used by the engine

#

so you get 4

thin stratus
#

Yeah if you need more than 4 new ones then you would need to use that container I talked about and add a similar setup

#

Most people are fine with 4 though

eternal canyon
brazen anvil
#

Yeah I think I can start working on something now though with a plan. thank you for the help

eternal canyon
#

and just sending custom data in general

brazen anvil
#

I have that open in another tab lol

eternal canyon
#

lmao

brazen anvil
#

i downloaded the the smooth network plugin and then came back to it a couple days later. I was looking in it and I was so confused. then I went back to the github and seen it was a plugin for blueprints.

thin stratus
eternal canyon
thin stratus
#

If you ever find time to PR an example, that would probably be great

eternal canyon
#

if u look at the old master branch

#

theres a more easy to read example for sending custom data

thin stratus
#

It's this one

eternal canyon
#

tho note dont take that directly since its client auth, since its input data

thin stratus
#

The 4 examples are sadly very similar to each other

#

And are missing that custom data stuff

#

I think they have the ResponseData

#

But not the MoveData

brazen anvil
#

In his example he actually has a bug due to a timer.

#

I think it was the prone timer.

latent basin
#

I want to have a timer that shows how much time has been elapsed, its for a multiplayer game and it should be the same for all clients. Where would the correct palce be to handle calculating time elapsed, the game mode, game state?

thin stratus
#

This basically, but it is C++

#

Like so many things in Multiplayer

#

You can try to mimic that in BPs fwiw

latent basin
#

Hmm is there any wya to do it in bp, its just a simple timer nothing to complex

eternal canyon
#

also depends on how exact it needs to be

latent basin
#

Okay ill have a look

thin stratus
#

It's sadly not that simple

#

Cause everyone can have a different ping

latent basin
#

Damn that makes sense

thin stratus
#

The naive version would be

#
  • ReplicatedVariable in GameState
  • Set it to, I think, GetServerWorldTimeSeconds() only on the Server on Tick
#

But this does not account for the Ping to each user where it might take 100ms for one and 50ms for another

#

You can also try Epic's function with just using GetServerWorldTimeSeconds() directly (function on the GameState)

#

But it's not very nicely synced

#

Unless that changed recently

latent basin
#

Thanks alot for your help you went above and beyond for me i appreciate that

#

Im going to try run tests then with the link you gave me vs the bp server world time sec function

#

Thanks

thin stratus
#

I usually use a Timestamp

#

And then use the ClientTimestamp to calculate it

#

@grand kestrel Maybe worth improving the Prone code to not use a Timer

brazen anvil
#

He knows. its logged as a issue on his github

thin stratus
#

Ah

brazen anvil
thin stratus
#

Yeah okay, can't hurt to annoy him

brazen anvil
#

lol

#

oh now hes typing

grand kestrel
#

Yeah ๐Ÿ˜„ I have other priorities atm
Feel free to PR if you'd like, otherwise I'll get to it eventually

thin stratus
#

What, other priorities than giving your life for the UE community?

#

sigh

grand kestrel
#

That's a good point, I was going to make a game, but that's not important ๐Ÿคฃ

thin stratus
#

I can't say I have the time either. I'm only really answering between doing other stuff

grand kestrel
thin stratus
#

Don't think so. I can try to find something I did

grand kestrel
#

If I don't do it now it might get put off for quite a while lol

thin stratus
#

I have a cooldown example

#

Might not be 100% complete though

grand kestrel
#

I'll have a look, if it looks like it'll start taking time I'll do it later ๐Ÿ˜„

thin stratus
#

Ja it's quite old actually. You'd save the a float timestamp in the CMC and SavedMove.
And then use it like this:

#
bool UVRTCharacterMovementComponent::CanStartBoost() const
{
    if (!IsValid(VRTCharacterOwner))
    {
        return false;
    }
    
    if (!VRTCharacterOwner->CanStartBoost())
    {
        return false;
    }

    const bool bEnoughBoostPower = BoostFuel >= MinBoostFuelToBoost;
    const bool bIsFalling = MovementMode == MOVE_Falling;
    const bool bOnCooldown = GetRemainingBoostCooldown() > 0.f; ////////// <<<<<<<<<<<<<<<<<<<<<<<<<<<<
    const bool bHasFuelTanks = VRTCharacterOwner->GetCurrentFuelTanks() > 0;

    return bEnoughBoostPower && bIsFalling && !bOnCooldown && bHasFuelTanks;
}
#
float UVRTCharacterMovementComponent::GetRemainingBoostCooldown() const
{
    const float CurrentTimestamp = GetTimestamp();
    const float RemainingCooldown = BoostCooldown - (CurrentTimestamp - BoostCooldownTimestamp); /////// <<<<<<<<<<<<< BoostCooldownTimestamp
    return FMath::Clamp(RemainingCooldown, 0.f, BoostCooldown);
}
#
void UVRTCharacterMovementComponent::SetBoostOnCooldown(bool bNewValue)
{
    if (bNewValue)
    {
        bBoostOnCooldown = true;
        BoostCooldownTimestamp = GetTimestamp();
    }
    else
    {
        bBoostOnCooldown = false;
    }
}
#
float UVRTCharacterMovementComponent::GetTimestamp() const
{
    if( CharacterOwner->GetLocalRole() == ROLE_Authority )
    {
        if( CharacterOwner->IsLocallyControlled() )
        {
            // Server for owned Character
            return GetWorld()->GetTimeSeconds();
        }
        else
        {
            // Server for remote Character
            const FNetworkPredictionData_Server_Character* ServerData = GetPredictionData_Server_Character();
            return ServerData->CurrentClientTimeStamp;
        }
    }
    else
    {
        // Client for owned Character
        const FNetworkPredictionData_Client_Character* ClientData = GetPredictionData_Client_Character();
        return ClientData->CurrentTimeStamp;
    }
}```
#
void UVRTCharacterMovementComponent::PerformMovement(float DeltaTime)
{
    Super::PerformMovement(DeltaTime);

  // [..]

    if (bBoostOnCooldown && GetRemainingBoostCooldown() <= 0.f)
    {
        SetBoostOnCooldown(false);

        if (VRTCharacterOwner->GetCurrentFuelTanks() > 0)
        {
            ResetBoostFuel();
        }
    }
}
#

That's only a part of it

#

But should bring over the general idea of a timestamp vs a timer

grand kestrel
#

Yeah that's pretty clear, I'll work on it in a moment

thin stratus
#

bBoostOnCooldown was needed iirc, but maybe that can be removed if there is a smart idea. Without that the remaining BoostCooldown would be far below 0 and still trigger the code in the PerformMovement

#

That boolean also needed to be in the SavedMove

#

The rest is a lot of boilerplate shit for the SavedMoves and corrections

#

I also can't say if that is the best way of placing all those events. But it worked damn well for VRTribes

grand kestrel
#

I'll probably do it that way ; I might experiment more if I had an active project that needed prone ๐Ÿ˜ฆ Better than missing edge cases

thin stratus
#

Yeah it's not easy to figure this out without testing a lot. There is a lot that might just go unnoticed

#

Like the need to set stuff when combining saved moves etc

grand kestrel
thin stratus
#

No stress. I didn't even know about this until now.

#

(the bug on the repo)

grand kestrel
#

Yeah, it's not a major issue that people can't work around

#

No point doing it wrong a second time by rushing it

muted pewter
#

upon connecting my game from editor to dedicated server running on my machine game establishes a connection with server and loads the map but merely for 2 seconds and then editor crashes with this error:

#

any idea ?

woven bramble
#

Guys, I want to set the locations of all players to one location. Character_BP (RunOnServer) -> GameState (RunOnServer) -> Then using For Each Loop (get all player controllers), I cast PlayerController -> Set Player Locations (RunOwningClient) iin playercontroller.

But it's just work for Server, not working for Client. Does anyone know?

unkempt tiger
#

Anything I can call on my actor so that it replicates as soon as possible instead of waiting for the next replication cycle (which can be a way if NetUpdateFrequency is low)?

fossil spoke
unkempt tiger
dark edge
woven bramble
#

Does anyone knows why set actor rotation doesn't work? (or set actor transform not working for just rotation)

woven bramble
dark edge
woven bramble
#

I think this is because ControlRotation is not suitable to be replicated and I am starting the process by doing RunOnServer.

#

But I don't know the solution (if my inference is correct .d)

dark edge
#

Just set control rotation for the player too if that's a thing

brazen anvil
#

Ok I am confused. When extending FSavedMove_Character do I need to do anything special to add custom state data?

dark parcel
brazen anvil
#

yeah thats what I am looking at

#

but it doesn't make sense

pallid rampart
#

hey guys, any tips for predicting slide movement? Once I add in some emulation it gets really laggy, if anyone has done this type of thing before i'd love any info ๐Ÿ™‚ thanks

fossil spoke
#

Slide is just an axis limited crouch with a different animation and movement speed.

#

It shouldnt be difficult to implement when thought of in that way.

dark parcel
unborn nimbus
#

During replication, how does a client know which actor the replicated data belongs to?

dark edge
#

That's like asking how I know which email address sent me a message. It's implicit.

If you're asking about the specifics of how some ID gets resolved to an actor, that's probably going down the stable naming rabbit hole.

fading smelt
#

Hi all! Can someone suggest good course about creating and working with multiplayer in UE5, please?

dark edge
fading smelt
# dark edge Are you already comfortable in Unreal?

I have 2 years of commercial experience as Gameplay programmer. My problem is al my previous projects/prototypes was pure single player + we use GAS a for bit, but mostly for creating GE and some Temp Buffs. So i have 0 experience in multiplayer and because of that i lost most of my job opportunities

fading smelt
woven basin
# fading smelt Hi all! Can someone suggest good course about creating and working with multipla...

I can highly highly highly recommend Stephen's c++ multiplayer course: https://www.udemy.com/course/unreal-engine-5-cpp-multiplayer-shooter

If you jump on his discord - he gives out coupons almost weekly that makes the course cheap. It uses best practices that many people in here talk about, and it talks about server side predicition etc that most others dont.

He's also in the final stages of a deep (400 video+) course on GAS that is extremely amazing.

Udemy

Create a fast-paced, competitive multiplayer shooter in Unreal Engine 5 using C++!

#

By far one of the best paid resources - and its crazy cheap for the value it gives.

The GAS course is just next level though - its amazing...

fading smelt
#

ok thx

hazy silo
#

hey there, what is the best way of replicating a pawn's/character's rotation?
I can't imagine creating my own rep notify variable and updating it on tick is the way to go ๐Ÿ˜…

#

(assuming I don't want to use the player controller's control rotation)

vapid mortar
#

hi. does anyone know how to replicate 3d widget? My situation right now is when new player just joined the room while the current players in the room turned on the 3d widget(mic on), the new player cannot see the 3d widget which actually was turned on. How to solve this?
My setup right now : widget bp cast to character bp which have custom event run on server then pass to custom event run on multicast and set flip flop to set hidden the 3d widget to true or false

latent heart
dark edge
#

Mic on should probably be a bool on PlayerState

dark edge
cosmic yoke
#

hello will PlayerController->GetNetOwningPlayer()->GetUniqueID(); will contain the same unique id from the player state, which uniquely identifies that player if you are using EOS or steam?

#

because the playerstate uniqueid is a FUniqueNetIdRepl

#

so i'm assuming it's not the same

solar stirrup
#

Same underlying value afaik

cosmic yoke
#

so how do i get the actual int32 that PlayerController->GetNetOwningPlayer()->GetUniqueID(); gives to confirm?

solar stirrup
#

it's not an int32

#

Depends on the platform and implementation

#

You can use ToString() on it afaik

dire dragon
#

do i need to do 3 custom events for (for example) use? (run on server, run on client and multicast)

latent heart
#

Depends on your use case.

#

Unless you explain more then the answer is shrug

fervent leaf
#

Hi, I have a component that has a Uboxcomponent. I try to setup attachment to the owner of the component, so the boxcomponent stays on the mesh of the owner. I dont understand why this wouldnt work

dire dragon
latent heart
#

Anyone who joins after the multicast won't know about the grab.

#

Use a replicated variable.

dire dragon
latent heart
#

Add a variable to your player, "grabbed object", with an onrep. When that onrep fires, attach the object to the player. Or whatever you do.

#

Instead of attaching where you are, simply set that variable instead.

#

And wait for the onrep to do the attachment.

dire dragon
#

what if i don't want player's to join after the grab?

latent heart
#

It's still a better system.

dire dragon
#

oh wait.. my client has authority too

#

so i need only multicast?

latent heart
#

No. No multicast at all.

#

Or the client rpc.

#

Just the server rpc and the onrep.

dire dragon
#

i really don't know what u talking about, i only watched like 2 tutorials about multiplayer

latent heart
#

Then watch more.

dire dragon
#

so i removed the multicast and authority switch and now if the client grab's then the client aswell as the server see's the hand change transform but when server grab's then the server see's the hand change transform but the client doesn't

latent heart
#

That's why you need the replicated variable.

dire dragon
#

i don't know what that is....

latent heart
#

It's a extremely core part of multiplayer. You should learn!

dire dragon
#

okay i learned what replicated variable is and what rep notify is but i still don't know how to do that

muted pewter
#

I have just packaged a dedicated server on my local machine and now i want to create a session on this server upon request from a game instance running on android device. How can i configure Server for this?

#

Android Device is able to connect with the server

queen escarp
dire dragon
#

the grab one works but the drop one doesn't

cosmic yoke
#

what is the best way to prevent the destruction of the player state if a client disconnects and reassign it when it reconnects? In theory overriding CleanupPlayerState would prevent the destruction of the player state when the player controller is destroyed, and overriding InitPlayerstate would allow me to assign the existing instance, instead of creating a new one, but to get the right player state i need to use the unique id, which means i need to have to way to get the unique id on the player controller before creating the player state. Is there a way to do that?

latent heart
dire dragon
queen escarp
#

@dark edge ideas :/ ?

dark edge
queen escarp
#

collision for frame :/ ?

dark edge
#

Drag the frame mesh, and each of the door meshes into the world and show the collision view of them

queen escarp
#

yeah nothing wrong with them tbh

#

but its only showing on 1 clent its not rpcing on the others when its opening

#

id say thats the first issue

#

the gate is a npc actor wich is always the server so idnno why its not rpcing ?

sinful tree
#

Is your "Event Use" event being called on the server?

dire dragon
queen escarp
#

@sinful tree

is being called from a player character bp then to a parent class interact_BP then to the door object

#

do i need to call it from the player character via server ?

sinful tree
queen escarp
#

yeab but since im only calling a function on a npc unit on the server shouldent it be enough with just that npc from the server calling the rpcing :/

sinful tree
#

What I'm getting at, is that whatever your execution flow is, it must be running on the server for the multicast to work.

queen escarp
#

yeah but anything the "Door" dose since it only exsist on the server is always run on the server since its replicated

#

but im guessing i got that wrong :/

#

cuz i called it via server and now it rpcs as it should from the player

sinful tree
#

Example:
If you have a client pressing an input and then that eventually ends up calling "Event Use" without the server knowing about the input from the player, then it's only running on the client, so the multicast won't fire.

The correct way would be:
Client presses button > Run On Server event > Server calls "Event Use", then multicast fires correctly.

queen escarp
#

yeah exxactly

#

but i though when i call a function on a npc actor thats alwys only on server side

#

and from the npc it calls the rpc then it should work in the same way

#

not that i would have to call it from the players server side to make it rpc

#

but yeah i understand what you mean

#

its just i got it on the other foot basicly

#

but nice that works

#

however ?

#

ideas ?

sinful tree
#

The way to look at it, is that each instance of the game is its own separate thing. When you call a function when you've triggered an input on the client, it's running on the client. If something triggers on the server such as say an overlap being detected, then the server would be executing it as it knew about it. No instance knows what the other is doing unless you communicate to the other instance. There are effectively two ways of communicating between those instances:

  1. Replicated Variables
  2. RPCs

Replicated variables will only replicate if they are set on the server. Setting a replicated variable on a client only changes the value on that client. When running on the client you can change replicated variables on other actors that the client doesn't own, but it's only changing on that client's instance of the game.

RPCs are a means of sending an instruction and some data between the instances. Multicasts attempt to send the instruction to anyone who has the actor relevant, basically like an "Everyone hear this!" message, but these can only be sent by the server. "Run On Server" and "Run On Client" are very specifically tied to the "Owning" client, meaning that in order to send the instruction from the client to the server (Run On Server) the client must own that actor. Similarly if you want the server to send information to the Owning Client of the actor, then you'd use a Run On Client RPC, but again, it'll only work if there is a client that owns the actor you're attempting to call it on. No owning client, no message sent.

buoyant wedge
#

hello
any one have a GIF that explain CLIENT PREDICTION vs NO CLIENT PREDICTION?
I need it to put in a personal documentation

dire dragon
queen escarp
#

yeah datura thanks for info i kinda semi" knows all that" im still learning obviously but this is just a weird thing i encountered but this cleared it for me

#

however the collision this i dont get ./

dark edge
dark edge
#

show navmesh

queen escarp
#

i mean if im looking at it with "playercollison view mode / vision collision" etc then i cant se any collisio

dark edge
#

Yeah your 2nd video looks fine, now the problem looks like pathfinding

#

I bet your navmesh isn't updating

#

so pathfinding doesn't know it can walk through the door now

queen escarp
#

yeah that makes sense since i can test from otherside and walk

#

so how would i update that ?

dark edge
#

navmeshvolume has option to auto update or something like that

queen escarp
#

hmm

#

cant find any options like that :/

#

ill google

#

yeah so its the navmesh thats the prob atleast

buoyant wedge
#

@sinful tree thx you.but I meant a GIF of an example in a game

dire dragon
dire dragon
dark parcel
queen escarp
#

@dark parcel wassthat

dark parcel
#

look it up, maybe that's what you need

pseudo merlin
#

hi, this is kind of a multiplayer question kind of not. I'd like to setup some kind of daily challenge system, where the game fetches some global challenge on a server. I'm assuming an HTTP request is the way to do it, any advice on the simplest way to setup the backend for that?

brazen anvil
#

Purely a guess but you could maybe do something like a data table to hold all your challenge stuff in it. Title, description, requirements, rewards, time limit, etc. And in your game you can setup some button or timer that once it is triggered it does a RPC to server to get a random challenge, or however you want to get it, and then a client RPC with the challenge.

dark parcel
#

I'm pretty sure he meant literar server since he mention HTTP request

brazen anvil
#

Oh not sure what that is. I was just thinking of like a daily quest system

dark parcel
#

had a friend doing an API call for me so I can broadcast Announcement. I used HTTP request for that

brazen anvil
#

would you want the client to do the http request or would it be better if the server did the request for you?

winged crypt
#

Hey, is the print string broken in 5.3? I only see client 0 printing

rugged oasis
#

how to replicate Simple Move to Actor?

#

with Get hit Result Under cursor

thin stratus
#

@rugged oasis Any more information on what you are trying to do?

#

Is the problem that the client tries to move?

rugged oasis
#

I've already found the problem. thanks

sinful tree
pseudo merlin
#

which removes some of the magic lol

#

its currently a singleplayer game I should add

sinful tree
#

Well, then they could just cheat their way through obtaining the challenge too if they wanted ๐Ÿ˜›

#

But yea I guess if you wanted that restriction it makes sense.

pseudo merlin
#

but yeah, in theory if I could just ping some server anywhere for some daily value

dark parcel
#

doing it externally is nice too tho, you can change the challange on the fly and you wouldn't need the client to update the game

pseudo merlin
#

that could be a seed for a locally fetched challenge

remote flame
#

Anybody know/have experience with any other way of networking VR roomscale movement other than the VR expansion plugin?
To me it seems a bit weird to replicate your roomscale movement to the server to reproduce the movement, but I'm guessing that's the only way to do it with server authority?

I've briefly considered having client authoritative movement since I'm working on a co-op project. but I'm afraid stuff like enemies grabbing you will result in rollbacks.

(I have a physical character setup with roomscale movement that tries to sync your room and actor movement to keep the collision at your location)

old sky
#

Hello!

Why do I feel some jitter when moving my pawns?

When I enable Network Emulation (with the Average profile), it feels like my characters sometimes jitter a bit. They're getting corrected by the server.

Why is that? Is Unreal's CMC enough for multiplayer games or should I roll out my own networked character movement component?

#

Should these jitters be happening with the Average profile?

thin stratus
#

@old sky CMC is usually enough, but if you need any additional Network movement features you'll have to use c++ to extend it

#

The jitter is probably cause the average profile has Package Loss

old sky
dark edge
thin stratus
queen escarp
#

hm un UE4 there was an option on project setting for the Navmesh" Rebuild at Runtime" but in 5.1 there isent anyone know where it went =)?

#

or runtime generatiion "Dynamic" should be the same ?

#

yeah it worked* ๐Ÿ™‚

pallid rampart
vivid gulch
#

How do I send an RPC in an actor from the client to the server?
The actor is an interactive item in the world (like a door) that has been placed already on the map.

Can I do that without the player controller or player pawn?

#

I just can't seem to wrap my head around it ๐Ÿ˜ฉ

gusty slate
#

Hello hello everyone, Is there any way to specify this for a variable in blueprints? "REPNOTIFY_Always"

thin stratus
solar stirrup
#

Shameless plug /j

thin stratus
#

Not sure tbh, but if it's not in the settings then probably not

gusty slate
#

Yeah it isn't :/ I have an array of structs and if I modify the struct by ref (Set members) the repnotify doesn't trigger

#

Thank you cedric

vivid gulch
# thin stratus No

Thank you. On your page it says
.... we create the ServerRPC in the PlayerController and let the server call an interface function on the door (for example 'Interact').
How is this interface call on the door replicated to the client?

solar stirrup
#

The door state would be replicated

#

Not the interface call itself

#

The RPC just tells the server to interact with the door

vivid gulch
#

Ah ok, so actually the server changes a replicated property which is then automatically replicated to relevant clients.

solar stirrup
#

Yep

vivid gulch
#

Thank you a lot. I find this approach a bit inconvenient. Because this way you always have to modify the player controller for all kind of stuff.
Imagine adding a lot of other interactive actors in the world. Each time you have to modify the player controller and add new functions there.

solar stirrup
#

And using an interface for interactions means you don't have to write different code to interact with different actors

#

One component to interact with any actor that implements the interaction interface

#

Just many different implementations of the interaction interface

vivid gulch
#

I see makes sense. But still can't just copy and paste my BP_Door to another project or distribute it on the marketplace. The other one must modify their player controller.

solar stirrup
#

You can put your interaction code in a plugin

#

Component, interface, and BP_Door

#

Then they'd just have to add the component to their PC and it would "just work" with some minor tweaks

vivid gulch
#

That would work. I still wonder why there isn't just a way in the engine that allows sending clients RPCs to servers for unowned actors in the same blueprint along with the player controller initiating the request.
The server can still verify correctness etc. But everything would be in the same place ๐Ÿค”

sinful tree
vivid gulch
#

True, but just add a new replication type here that allows it ๐Ÿค”

thin stratus
#

I wouldn't waste time on arguing this

#

This will not be a thing anyway

#

This is a years old design decision and that's how all games in UE do it

vivid gulch
#

For me it is not wasting time, for me it's learning how the engine works.

thin stratus
#

?

#

You learned how it works and then argued for a new replication type :D

vivid gulch
#

I like to understand why something is how it is.

sinful tree
#

A replicated Interaction is something that involves the player controller or any other client owned actor or their components anyway.
Once you have called the RPC, you just need to call a generic interface to that actor, passing along a reference to the actor that called the interface if you need it to call back to it in any way.

#

Client Input > Server RPC w/ Actor Ref > Interface to Actor Ref, with calling actor > Server does whatever validation etc. and performs the interaction as implemented on the interactable actor

thin stratus
#

The main reason for this is that Epic devs decided that calling RPCs on non-owned Actors is more work than just limiting it. This makes sure no one can call RPCs on e.g. a Character or PlayerState of another player to adjust things they shouldn't

#

having to add all kinds of checks for this is more work

#

The interact system is probably one of the only times where this is a restriction

#

On top of that it also makes a lot more sense to call the RPC in the InteractComponent

vivid gulch
#

@thin stratus I see thanks.

dire dragon
pallid stone
#

How many bytes can be sent at once over the network in unreal?

#

For server to a connected client

fathom aspen
#

I think it was 8000 bits last I checked the profiler

glossy kettle
fathom aspen
#

In fact many things can... it's up to you to believe what's really true

glossy kettle
#

this is why myself and @pallid mesa switched to transparent ethernet cables

#

harder to get tricked when you can profile with your eye

hollow eagle
#

if the wires get red-hot then yep, shit's broken. And you might have plugged the cable into main power rather than your router.

brazen anvil
#

If I wanted to implement a leaning mechanic that allows a user to lean anywhere from like 45 degrees to the left or 45 degrees to the right, what would be the best way to handle replicating that? Like they could lean to the right 1 degree, 2 degree, 3 degree, etc.

#

I am going to guess the best way would be to add custom network data to my cmc but curious if there is a better option.

thin stratus
#

Then it would be enough to just do it quick and dirty through a PressedKey RPC, with an OnRep value (Bool if you just need to know left vs right or float if you need more control) that skips owner so you can predict it

brazen anvil
#

i feel like that could be a lot of RPC calls in a short amount of time. is that an issue?

meager spade
#

leaning we did just via the animation and keeping the lean state in sync, nothing complicated

#

but depends what "leaning" you want

brazen anvil
#

i agree

stoic lake
#

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_SurroundedCharacter_C_0. Function SE_FlashlightTrace will not be processed.

hey I got this error when trying to play in editor as listen server + a client. the server works just fine but the client cannot move.

young spoke
#

I'm getting the follow error on a mac unreal 5 when a client attempts to ClientTravel(). this works on my linux

```LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = UIpNetConnection::HandleSocketSendResult: Socket->SendTo failed with error 2 (SE_EBADF). [UNetConnection] RemoteAddr: 127.0.0.1:7777, Name: IpConnection_8, Driver: GameNetDriver IpNetDriver_6, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: NULL:Samuels-MacBook-Pro.local-D606E39F45468DD4136D96A66DA244C2 Connection will be closed during next Tick()!, Driver = GameNetDriver IpNetDriver_6````

#

any help appreciated

ruby lake
#

guys im using servertravel but it always travel to the same map, how do i fix that?

fossil spoke
ruby lake
fossil spoke
thin stratus
#

Actually seems to be generally used for SocketSubsystems

thin stratus
ruby lake
#

im new to multiplayer sry

young spoke
twin juniper
#

I'm currently using the Steam Advanced Sessions plugin and was wondering if there was a way for a host who is hosting a session with multiple clients to join a new session and carry over all the clients from their old session. I was also wondering if the host could create a new session and migrate all the clients to that new session. Finally I'm looking for a solution to if the host leaves a game one of the clients first creates a new session and has all the old clients connect to that new session. Anybody have suggestions or even better yet blueprint screenshots showing how they've implemented joining a session with a lobby as well as migrating hosts?

ivory bear
# twin juniper I'm currently using the Steam Advanced Sessions plugin and was wondering if ther...

not sure if this will help or not>>
https://www.youtube.com/watch?v=NUKTKFYbW_w

#

Ok, have a simple pawn and pitch and yaw replicate nicely when doing a listen server with 2 players.
When generating a Host and having a player connect (2 players, standalone) I get no pitch replication. Is there a reason for this? Did I miss something?

twin juniper
#

@ivory bear Thank you!

daring arch
#

Hi!

Is there any way to make a C++ event for whenever a specific variable changes?

#

Basically, I have a variable which tells me what is my current weapon index.

When it changes on the server, i want the clients to hide the old weapon and bring in the new one.

Do I have to check for this change on every tick or are there observer events I can use?

woven basin
#

You use OnRep_ functions - check out the multiplayer guide for how to use it.

daring arch
#

Is OnRep called on the server?

#

Or only on clients?

fossil spoke
#

In BP It is called on both

#

In C++ it is only called on the Client

#

You must call it manually for the Server in C++

daring arch
#

Gotcha

#

Thanks!

pseudo ermine
#

Im using a fixed size array to represent the player held weapons, but this array (even though Im using a FastArray implementation) does not replicate when I send the current Player ref to a RPC call

fossil spoke
#

Do you have code to share?

#

Its hard to pinpoint an issue with just what you have said

pseudo ermine
#

Yes I do, one question tho, Im mot adding nor removing anything the array per se, Im just canging a n index content

#

Does doing that makes marking as dirty not work

fossil spoke
#

You need to mark that element dirty if you changed it

pseudo ermine
#

So the element it self Ok Imma share the code

fossil spoke
#
    /** This must be called if you add or change an item in the array */
    void MarkItemDirty(FFastArraySerializerItem & Item)
pseudo ermine
#
StoredWeapons.Items[((int)InPickedWeapon->GetSpecification().Type) - 1].Weapon = InPickedWeapon;
    StoredWeapons.MarkItemDirty(StoredWeapons.Items[((int)InPickedWeapon->GetSpecification().Type) - 1]);
fossil spoke
#

You should be managing it inside of the FastArray Container

#

But sure

#

Thats what you need to do

pseudo ermine
#

This code is ran client side and it works

fossil spoke
#

Uhhh you shouldnt be doing that on the Client

#

How do you expect it to replicate?

#

Replication only occurs from Server to Client

#

Changes are made on the Server, the Server then replicates those changes to Clients.

pseudo ermine
#

Oh that makes sense

fossil spoke
#

How big is this array?

#

How many elements?

pseudo ermine
#

3 max

fossil spoke
#

Ok, why are you using a FastArray?

pseudo ermine
#

I thought the reason it wasn't replicating was the nature of the TArray like TMaps not replicating at all

fossil spoke
#

No

#

TMaps do not support replication at all.

#

Neither to TSets

#

TArray does

#

Infact, your usecase is better handled by just a simple TArray

#

I would not use a FastArray for replicating 3 elements which are just pointers to Actors.

#

Way overkill

#

And unnecessary.

#

And complicated for what its doing

pseudo ermine
#

Yeah doing this FastArray impl I was thinking, this is too much

fossil spoke
#

Just go back to using a TArray.

#

Especially considering it seems you misunderstood the issue

#

Which was Server to Client replication

pseudo ermine
#

Is passing a UObject* as a param on a Server RPC call viable on this scenario?

#

like It wouldnt send a GUID but the real UObject* object being the player character

fossil spoke
#

No pointer replication will EVER send the Object

#

That just doesnt make sense

#

Only static assets can be replicated by UObject*

#

AActors if set to replicate can be replicated like this

#

Since AActor supports replication out of the box

#

UObjects do not

pseudo ermine
#

I missused the naming

#

Its a ACharacter my bad

fossil spoke
#

If that ACharacter was spawned by the Server, its ACharacter* can be passed around yes.

#

Because it will exist via its NetGuid on all Clients

#

Since ACharacter is replicated by default

pseudo ermine
#

Great

fossil spoke
#

This is not true for other AActors though

#

You must enable replication on other AActors yourself

#

I think you should go through the Pinned Messages in this channel

#

And read the Multiplayer compendium

#

You are missing some fundamental knowledge.

pseudo ermine
#

Yeah I tried doing rough but Im lost lol

fossil spoke
#

Keep trying. Keep reading.

pseudo ermine
#

I was able to make it work standalone

fossil spoke
#

Standalone isnt networked.

#

So of course it would work

#

Listen and Client are the only networked setting in the PIE button

pseudo ermine
#

Gotta rewrite a lot of stuff

#

Ay THX a bunch I gotta sleep 2AM 'round here

fossil spoke
#

Good luck

pallid stone
rich dune
#

Hey,

has anyone a good tutorial for a Multiplayer Truck and Trailer system? I have Trailers working fine in singleplayer. In Multiplayer the Trailer always desyncs and the movement stutters like crazy.

The Trailer is attached via a Physic Constraint and the calls and actors are all set to replicate. Any ideas or tutorials?

woven bramble
#

Does anyone know how I can Replicate Control Rotation? it's not working. (it starts from GameState)

blissful talon
blissful talon
#

You can, but you need to replicate it from the local controller, i.e. it's the client that would tell the server its control rotation

woven bramble
#

Is GameState (RunOnServer) -> For Each Loop -> PlayerController (Multicast) wrong?

blissful talon
#

Server doesn't know the client's control rotation, so it's rather incomplete

small grail
#

PC's net owner is local.

small grail
dark edge
dark edge
blissful talon
# blissful talon You can, but you need to replicate it from the local controller, i.e. it's the c...

I do it this way:

.h
/** Replicated control rotation for animations. */
UPROPERTY(Replicated, meta=(AllowPrivateAccess))
FRotator ControlRotation = FRotator::ZeroRotator;

.cpp
void AMyPlayerState::Tick(float DeltaSeconds)
{
    Super::Tick(DeltaSeconds);

    const APlayerController* PlayerController = GetPlayerController();
    if (!IsValid(PlayerController))
    {
        return;
    }

    if (!PlayerController->IsLocalController())
    {
        return;
    }

    ControlRotation = PlayerController->GetControlRotation();
}

The reason to have it on PS is basically to allow everyone know the control rotation of a certain player.

woven bramble
# small grail What you are trying to do? I mean the feature.

The only thing I want is to gather all the users in the game around a point and make them look somewhere.
But I can gather them to one place, but I can't make them look.
Actor Rotation doesn't work, because I have control rotation on. (So it just work for Server, not working on client)

small grail
#

And you might disable input at the same time too

small grail
#

Yes, just multicast to client side for example client game state

#

And in game state you executing "Force facing" event then how it is implementing is on client side.

rich dune
dark edge
blissful talon
#

Hello, I'm trying to make a grab attack for my AI, but I have some network related problems.

The ability itself works perfectly in single player, though in multiplayer it behaves in a weird way when applied on clients, i.e. the host still can be grabbed, and the animations play correctly.

The feature is separated in 2 abilities: Grab_Attacker and Grab_Victim.

The first one is used to play replicated attacker's animation, determine the victim, setup the victim position, toggle certain components, and deal the damage.
The second one is used to play replicated victim's animation.

What works in multi player: attacker's animation, victim determination, deal the damage.

As for the victim position I set the victim in front of the attacker, so that the animations will be consistent. I use the AActor::Teleport() to define where the victim should be, but for some reason it doesn't work for clients, I've checked just in case whether the feature is even supported by the CharacterMovementComponent, and it seems to be; in fact it does override the UMovementComponent::OnTeleported() and does something.

As for the victim animation it doesn't play at all for the client, but it plays it for the server, but after 2-3 seconds since it should've started.

That's how I play the victim animation: https://pastebin.com/w7vW4Uez. The ability does activate immediately after the attacker identifies the victim, however the animation takes a few seconds to start for the server, and it never starts client-side (even though it should). The ability resides on the victim character by the way.

Here are some logs I get mid grab: https://pastebin.com/CqG4zQVu. CH_LivingMannequin is the attacker, CH_Customer is the victim. I have no clue why it tells that the attacker is stuck, and that the CreateSavedMove hits the limit of 96 saved moves.

#

Also, to avoid some issues I disable the capsule component and the character movement component on the victim for the time it's being grabbed, so that the grab animation can be played properly, allowing the attacker move the victim as they want without interfering with physics/collisions.

Does anyone have any idea what may be wrong in my approach?

woven bramble
#

It actually seems very simple and I'm probably making a small mistake.

woven bramble
dark edge
#

GetBaseAimRotation

#

that'll get you a replicated pitch

small grail
dark edge
#

there's nobody to multicast to

#

playercontrollers only exist on server and OWNING client, not on other clients

woven bramble
small grail
#

No idea why you want a loop though

woven bramble
#

like this

small grail
# woven bramble like this

But you have already multicasted to every client. And you should input this with getting local player controller

woven bramble
#

Do you mean something like this

dark edge
#

What are you ACTUALLY trying to do here? What is the game mechanic

dark edge
#

You can get playercontroller 0 if you want, there might be other ways to get all local playercontrollers (typically 1 but might be more if you have couch co-op)

#

This will work as long as you don't have multiple local playercontrollers

woven bramble
#

After pressing a key, an event runs in GameState (on the server), I want to teleport users to a point in the game and ask them to look at a point. (In order to hunt the Demon in the game, they need to go to that point and look at a point. So they will gather in a circle.) These are the code in GameState. https://blueprintue.com/blueprint/-zn8oq2r/

woven bramble
dark edge
fathom aspen
#

I like you dyed your hair

#

Nah, that can't be real

#

Are you telling me that I should go back to using Timers like a peasant now?

#

Aha, so the hype is gone pensivesmh

#

The hype is all over #verse now I get it

woven bramble
pallid stone
# fathom aspen Why would you?

I have a crowd manager that is moving actors around (instead of them using their own movement components). Sending a fvector is 12 bytes, so that limits me to 8000/12 = 666 replicated updates (under idea circumstances, nothing else being replicated to increase the sent chunk size). I want to handle numbers in the thousands, which would be sending 60000 bytes for, say, 5k controlled actors.

#

Also, on an unrelated note for a completely different issue, if you have sequencer moving around an object that replicates its movement, will that show for all connected clients?

fathom aspen
#

Which is done synchronously

#

Meaning you will 100% start getting hitches if you manage to do that

#

Anyways there is UNetConnection.MaxPacket fwiw

woven basin
#

@fathom aspen - any updated thoughts on GMC since you bought it? Any regrets or issues youโ€™ve encountered?

Iโ€™m thinking Iโ€™ll pull the trigger and buy it; just trying to make sure firstโ€ฆ

fathom aspen
#

Will look further into the CMC/GMC 's science once our game releases next month

woven basin
#

Yeah, cool. A responsive author is a very good sign.

Is there any further news on GMC v2?

fathom aspen
#

From 2 days ago:
The GMC v2 beta for everyone is drawing closer, and I'm pretty confident that I'll manage the release before the end of September. Stay tuned for more news.

woven basin
#

Oooh. Ok cool, guess that seals it then; Iโ€™ll just buy it now. Thanks.

solar stirrup
#

Apparently the v2 "supports" the GAS

#

as in some peeps in the v2 beta are using it with the GAS, but it's still not as supported as the CMC & GAS are

woven basin
#

Yeah, thatโ€™s actually what I need v2 for the most. And apparently enhanced Input as well?

solar stirrup
#

Yeah EI is supported/going to be supported in v2

half umbra
#

It doesn't matter if I trigger an interaction (server) in an Acora component owned by the player

#

because Player is owner this component

#

yes?

grave lynx
#

Hey, OnPostLogin, I'm SetControlRotation the controller. Working fine on server, not on client. Need multicast?

dire dragon
thin stratus
#

I assume cause yo uaren't replicating this stuff?

dire dragon
#

i'm using repnotify

dire dragon
#

this is how it all looks like, the top one works fine but the bottom one only does the client thing and the server see's like nothing changed

solar stirrup
#

you can call Server RPCs in any actor you have ownership of, and any components of those actors

austere halo
#

Hey everyone, I'm just wondering if the gamestate has a different way of replicating variables in c++ compared to other classes? I've put in the usual:
UPROPERTY(replicated)

void MY_Gamestate::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME( MY_Gamestate, TF_World);
}

and set bReplicates to true in the constructor, but it's just this class that is not replicating its variables. I'm wondering if it has to be done differently?

proven kayak
#

Why is your class called MY_Gamestate and not UMY_Gamestate

austere halo
#

Dw was missing #include "Net/UnrealNetwork.h" in the header ๐Ÿคฆโ€โ™‚๏ธ

proven kayak
#

Shit

#

AMY_Ganestate

austere halo
#

Yeah it does have a A prefix I just typed it differently in discord

proven kayak
#

๐Ÿ‘

austere halo
#

thanks

proven kayak
#

Did you.... type out that whole function definition instead of copying it Thonk
In any case glad you figured it out

tardy fossil
#

underscores in class names ๐Ÿคฎ

austere halo
#

haha no just changed the name cus it's called something stupid ๐Ÿ˜†

proven kayak
tardy fossil
#

this is how its done

austere halo
#

where's the dark mode

tardy fossil
#

had to disable it to see my emoji class names

austere halo
#

xD

echo epoch
#

Can anyone point me in the direction to learn about Generating Invite / Lobby codes? (Something like the code that Phasmophobia generates when you create a lobby)

ebon jacinth
#

Anyone have experience swapping from Listen Servers to Dedicated Servers? Wondering how much work it might be. A majority of the game uses GAS for abilities.

dark edge
#

If it was done correctly, it shouldn't be too hard.
If it wasn't, it might be hard.

grand kestrel
thin stratus
#

Just a bool tbh

grand kestrel
#

So using setmovefor/prepmovefor?

thin stratus
#

Yeah it was set alongside the CD timestamp

#

It was mainly so that PerformMovement ticked function wasn't calling the remaining cooldown < 0.0 part over and over

#

Maybe there is a smarter way to have that with one variable

grand kestrel
#

@thin stratus
So far it works quite well, I can't get it to desync at all
I've also just noticed I forgot to prevent jump during prone heh, so that's getting fixed here too

#

Since you're here, I have a git question, I've made these changes in my link branch which I usually just git rebase -f origin main to pull changes from main into, but this time I need to do it the other way, I don't think I really want to rebase in reverse, of course I can just cherry-pick the commit, but does that cause any issue when I rebase normally in the future (probably not?), is there a better way, such as simply committing the changes I made in link to main instead?

thin stratus
grand kestrel
thin stratus
#

More than the typical fetch pull commit push merge is nothing I can do with that

grand kestrel
#

Well that's fine, I will just commit to link and cherry-pick to main

ebon jacinth
fathom aspen
#

More or less yes. Listen server usually we are guaranteed a controller, while DC we are not

#

Also try not to use GetPC(0) if you can actually help it

ebon jacinth
fathom aspen
#

Save? Wdym by save?

ebon jacinth
dark edge
#

but why do you need to do that?

#

pawn always has a ref to its own controller

#

if it exists

ebon jacinth
# dark edge if it exists

Get get pawn uses a player index, so I would need to at least save that if I'm not assuming 0 is always local

sinful tree
#

Gamestate has a player array already which is the array of playerstates of all players. "Which player" is a bit harder to determine from that array, but it is doable, especially if you have a reference to something else about the player, like their controlled pawn or their controller, but again, if you had a reference to either of those, you could just get the playerstate from those.

ebon jacinth
sinful tree
#

But why do that? The player controller has a reference to the pawn.

#

The pawn has a reference to its controller.

#

No need to worry about indicies.

#

You technically shouldn't be trying to get reference to a specific controller/pawn/player on the gamestate unless you have some sort of information about the player to begin with.

ebon jacinth
#

But even get player controller is using an index

#

What method do you use to not use any indices?

hollow eagle
#

Pawn has its own get controller method that gives you the controller. It does not do anything by index.

#

There's zero reason to store the controller anywhere else, the pawn already knows what is controlling it.

ebon jacinth
#

But if you are on a child actor trying to get access to that controller would you then be getting the parent, and then using the parents (pawns) get controller function to get it's controller? Instead of using get pawn on that child actor.

#

Or on a UI widget on the viewport, would you be grabbing the HUD and then get owner player controller or get owning player controller etc

dark edge
ebon jacinth
#

Each pawn has 12 child actors that can fight another pawn's actors. And those go another 2 child actors deep ( so a child of a child of a child of a pawn). When I'm on the deeper children or on different widgets on the UI on the viewport I have been using the get player pawn to get the pawn and then calling functions I need from there. But those use an index. In our listen server setup get controller 0 is always the local player controller I believe so it works. But the worry is if it will still work when we go to dedicated servers or if all of those need to change.

#

I was just wondering if I should save the player index on the children at possession so I can always get whatever I need from that child actor by using the index instead of having to work my way back to the Pawn or HUD through parents etc.

hollow eagle
#

So don't use the functions that take an index...

#

All widgets have access to the player controller that owns them

#

And that player controller knows what pawn it possesses

#

You're making a problem for yourself by assuming you need indices in the first place.

left lance
#

I need to create essentially a player controllable platform for multiplayer. This platform is something players could walk on as they moved it around the world. What is the best base class to do this in? I'd love to take advantage of the Character class and it's replication, but the 'platform' won't be capsoliodal at all (though it will utilize control rig, not that those are related, but figured I'd bring it up). Would that be an issue?

#

Is there a different class that I should utilize because it would work better? E.g., a pawn?

#

The good news is the movement of the 'platform' will be relatively slow

unique basin
#

you could send movement commands to the actor or make the platform a pawn and possess the platform

left lance
#

Since it's slow enough, will those movement commands be replicated smoothly enough? I suppose I can do some client side lerping... ๐Ÿค”

dark edge
left lance
#

I doubt players will be moving themselves while moving the platform (cause it'll be hard), but I'm not preventing it/planning on preventing it. And other players can be moving on the platform while a player is changing/moving it around.

If it's not being actively changed, then the platform will be moving at a constant rate/direction

dark edge
#

Just make it an actor

left lance
#

Then move it via SetPosition/Rotation?

dark edge
#

However you want

left lance
#

From a replication stand point, what's usually best?

#

Really want to avoid jitter (so, will probably have to do some client side lerping)

dark edge
#

The most important thing is that it plays nice with characters standing in it.

left lance
#

Is there any special considerations I need to keep in mind for that?

dark edge
#

I mean just go try stuff. Get everyone to agree on the movement of the platforms then get it to play nice with the CMC

left lance
#

Ok, thanks!

woven basin
#

What else would you add here?

#

I'm thinking network lag settings....

thin stratus
#

Yeah those could also work

#

You should probably add a button to open the full project settings

#

And focus the network section

dire dragon
#

how do i fix the physical animation lag when multiplayer?

woven basin
thin stratus
#

Eh yeah editor probably

woven basin
#

gotta work out how to focus a section - i'll try to find an example

thin stratus
#

I think the advanced play settings might do that already?

#

Or do they just open the whole section?

woven basin
thin stratus
#

Hm.

woven basin
#

got it - you can select the "section name"

#

so I can do it - I'll try now

dark edge
pseudo heath
#

i'm trying to make my first multiplayer, but when i try to create the session for the listen it fails...

soft flare
#

Yo guys can i ask here for help?

#

im kinda stuck for days because i cant replicate something to other clients

#

if someone has some mins pls tell me xD

dark parcel
#

@soft flare you will have more chance getting help if you share your code/bps

#

describe what you are trying to do then specify the problem in details

soft flare
#

uhm yea i can try to explain it

dark parcel
#

Sharing some screen shoot would be a good start

soft flare
#

so i have a host and join systen, and whenever someone joins a host the client sees something else than the host. Example i equip skin 1 on host and start a server, the client joins and sees everyone with his skin but the host sees all skins corret, whenever someone joins and there was a player in the level already it doesnt replicate his stats

#

the window in the bottom right corner is the person that joined

#

you change skins in the menu before you join a lobby

dark parcel
#

How are you equipping the skin? Thru RPC?

soft flare
#

RPC?

#

there is a interface in main menu wait

dark parcel
#

๐Ÿซ 

soft flare
#

On equipment

#

then we make lobby in multiplayer

soft flare
dark parcel
#

How do you actually equip the cloths? By accessing variable from Game Instance I suppose?

#

just a heads up, I hvaen't actually tap multiplayer yet but I will see if I can work it out

soft flare
#

nah it works like this, you equip the skin and you have a "selected skin" var in the character, whenever you start a level it saves it and loads it when youre ingame

#

The problem is

#

when the new player joins

#

he sees the wrong variable on "selected skin"

#

He is allways seein his skin

dark parcel
#

can you share how you load the skins?

soft flare
#

Whenever someone joins it does a multicast on EQUIP SKIN event

dark parcel
#

ok

#

So multicast is an RPC

soft flare
#

Ohh you mean replication

dark parcel
#

Remote procedural call

soft flare
#

Oh

dark parcel
#

basically a way to run function in Multiplayer setting

#

But here is the scenario

#

You execute Multicast from the server, the function apply to all existing machine.
The problem is the player that have yet joined the game, they don't execute the RPC call

soft flare
#

wait can we go private call and i discord stream you?

dark parcel
#

No,, sorry

#

imo your option here is to do RepNotify

graceful flame
#

Use repnotify to handle state not updating scenarios for late joiners or when players re-enter into the netcull distance of a replicated actor. Multicasts only work if you're already connected to the server when it happens.

soft flare
dark parcel
#

Multiplayer is hard, replication is the easy part

soft flare
dark parcel
#

but that still took a while for me cuz I'm not bright

graceful flame
#

You just change the variable from replicated to repnotify. Then you double click on the variable's set node and its like a function.

dark parcel
#

OnRep-> Change Skeletal Mesh

soft flare
#

So thats what i do now:
you change your skin in a "rep notify" node
and you start the game, then when someone joins he sees the correct skin and i dont need to recall it? or do i need to call the even in a muticast or something?

graceful flame
#

So that function runs whenever the variable changes. If its a boolean for example like "isDoorOpen?" then you can just start with a branch. If isDoorOpen? = true, execute event to animate door. If isDoorOpen? = false, execute event to move door into closed position.

dark parcel
#

Repnotify the Skin

#

Go to the Repnotify function

#

Get Mesh -> Set Skeletal mesh to the variable

#

Done

soft flare
#

Alright i try that real fast

#

i give update in a min

dark parcel
#

and after that look at documentation and some youtube (cough) for more info

soft flare
#

Ive been lookin in the internet the whole day... xD

graceful flame
#

You just set the values as want for whatever makes sense, but then inside the repnotify you handle the switching logic.

soft flare
#

thats why i am asking here

soft flare
#

Thanks ^^

#

i try that now

#

Hm

#

still same thing

#

Thats what happens on the menu widget ui

#

thats what happens inside the rep notify

dark parcel
#

Not enough experience in mp but I don't think that's gonna work

soft flare
#

yeye nw ^^

#

still thx for trying to help

dark parcel
#

So when you change cloths are you only changing the material?

soft flare
#

No also the mesh

#

wait

dark parcel
#

Well then you want to repnotify the mesh and the material

soft flare
#

Yea wtf

#

hahaha

#

but not even the mesh is changing

#

let me throw the other part in real fast

dark parcel
#

The logic to resolve the actual material can be done somewhere else

#

the repnotify logic should just set the material/skeletal mesh

#

imo

soft flare
#

Nono it changes in skeletal asset

dark parcel
#

Resolve material -> Set material(repnotify)
OnMaterialRep-> Get skeletal Mesh -> Set Material

#

The same with the skeletal asset

#

Do the logic to get the Skeletal mesh -> Set the Skeletal Mesh (repnotify)
OnSkeletalMeshRep-> GetSkeletalMesh->SetSkeletal mesh

soft flare
#

I cant 100% follow but i try that

dark parcel
#

other machine doesn't need to know how you get the material or skeletal assets

#

They just need to know the current Repnotify variable

soft flare
#

hmm okok i try that brb xD

#

thanks for all of this โค๏ธ

#

what exactly do you mean by resolve, you mean the Run on server and multicast part?

dark parcel
#

no that shouldn't even be RPCed I think

#

the only thinng u need to RPC(Server) is the repnotify variable if you are client

#

Move this somewhere else for a start

soft flare
#

To the character?

dark parcel
#

I dunnoe, I guess

soft flare
#

now its in my thirdperson char

dark parcel
# soft flare

You are changing the materials by ID tho, that's quiet a number of variable u have to replicate

soft flare
#

the array is like a skin inventory

graceful flame
#

If you organize the blueprint nodes a bit more and use color coded comments it will make things easier for you in the future.

dark parcel
#

@graceful flame Do you know a way for the other machine to join later? other than emulating lag

#

in Pie

graceful flame
#

Start pie with one client then you minimize and look for the add client button, I think Play becomes add client or maybe its beside pause. Something like that.

#

I'm in vs building my project so i dont have ue open at the moment.

dark parcel
#

@graceful flame Thanks , I never know we can do that

graceful flame
#

Or if you're running the packaged built game client exe you can just keep opening new ones

#

but it will have the same auth (if you have any auth setup)

soft flare
#

the thing is

#

there is elements in the game, like fire ice and stuff

#

it works fine for them

#

Even late joiners see the correct element

#

its just everything else xD

dark parcel
#

are they even replicated? are they pre-placed?

#

then those stuff you see probably already exist in each client and they just play it as it is

soft flare
#

uhm

#

the way i did it was that

#

begin play calls it for me and whenever someone joins it does another beginplay for all actors

#

Let me try something real fast

#

IT WORKED

#

LOL

#

i dont even know why

#

So here is what i did

dark parcel
#

This is what I did

soft flare
#

The int gets sent with the events

dark parcel
#

You can repnotify the number if you want

soft flare
#

Idk how this is gonna fit but i think i leave it like this for now

dark parcel
#

I changed the cube color and late joiners still see the same material

soft flare
#

Ohhhh

#

ill save that pic thats actually smart aswell

dark parcel
soft flare
#

bro im almost crying jesus this is gonna speed up m

soft flare
#

You say you have no idea abt mp and still know more than me

#

But yea thanks allot my guy how you have a wonderfull weekend โค๏ธ

#

@graceful flame u aswell

#

this discord is truely amazing xD

austere halo
#

Hey everyone, I'm building a multiplayer survival game similar to valheim or ark, and am now working on the building/crafting aspect where you can place down meshes like doors, walls, etc. The straightforward way would be to just have every building piece be its own AActor with a static mesh and functionality. Considering players could build bases with 1000s of these pieces, I'm wondering if this will cause performance problems down the line, both in terms of rendering and in terms of networking?

dark edge
#

Rendering should be ok nowadays but it all depends

#

Just fire it up and spam building parts all over the place and see where the bottleneck is

austere halo
#

My plan is to be able to host listen servers with large worlds where players could be in different areas at once (minecraft-style), which is probably a lot for the server to handle and makes it a bit harder to test... Was trying to avoid building everything just to have to rebuild it all in a different way, but you're probably right

dark edge
#

I think you're insanely over-scoped but speculating without testing isn't worth much

#

If 1 actor per part is too much, consider 1 actor per part island (building, Space Engineers Grid) or even some sort of manager that handles it.

austere halo
#

Yeah its not the easiest project ๐Ÿ˜† I'm a decent programmer and have already got a procedural world that loads/unloads as you move around + a replication graph going, but even that has been a challenge so far... Yeah that was my other plan, to have one actor per 20m tile that handles everything within it

dark edge
#

Until you've tested you have no idea. Just go test (with a realistic client count)

austere halo
#

Yeah will do, thanks for the advice

ruby lake
#

guys i want to to use servertravel or seamless travel, where do i remove the current widget before the travel?

#

currently when i use servertravel the widget stays between maps, i dont know why

fathom aspen
#

Seemingly because their Outer is persistent, but the research is still on going...

#

There is a static helper function "RemoveAllWidgets" iirc

#

You could try it out on EndPlay of HUD for example, as the latter gets destroyed regardless of the travel

ruby lake
queen escarp
#

This is run on the game mode but the game mode cannot destroy actors on the server like this right :/ ?

dark edge
#

game mode is the top dog

ruby lake
#

guys shoud i use servertravel or openlevel with ?listen ?

sonic jasper
#

Is there something similar too ClientInitialize that is called on a listen server client, want the server to wait before spawning some actors but cant seem to find a central place to call the process from that works for both listen server client and clients.

spare moss
#

Hey, im trying to get a multiplayer prototype up and running. Having an issue where an actor has authority on the local client (Ownership chain traces back to the local client's player controller and Has authority is returning true), but any calls to execute on server events are getting dropped

#

Relevant BPs ^

#

I see the print string appear from the first picture, (Authority: True), but the second print string never appears on the server or client (using listen server)

edit: Realised I may be quite dumb and I think I have different versions of actors across both client and server

lavish cypress
#

After calling Tear Off on an actor is it possible to restore the actor replication?

fathom aspen
#

Nah, it's meant to be an irreversible operation

magic helm
#

If you want a reversible option, look into dormancy

pseudo ermine
#

Now my mind got puzzled hold on

#

When I call let's say a AActor.ServerRPC

#

If I change the values of the said actor (It is replicated) inside the RPC method

#

Am I changing the AActor server instance?

#

The server is a dedicated one

sinful tree
#

Yes? Values you change while running on the server would be changing the server's copy of the actor. If the properties that you are changing are marked as replicated then the value you're changing it to would also be sent to any clients that have the actor relevant.

lavish cypress
#

In the engine code, USocialParty implementation, they demonstrate beacon use to reserve slots in a server. Before travelling all clients to the map, they call DestroyBeacon(), which internally cleans up the Net Driver.

However, when I do this, the client GameNetDriver gets destroyed and the client loses connection as soon as they join the map.

#

I'm trying to figure out how to destroy the beacon net driver without kicking the client out of the game.

#

The workaround I thought of was to tear off the beacon client to make sure the beacon net driver isn't using any bandwidth while they're in the server

fossil spoke
#

The ActorChannel would need to be setup again.

#

Not sure how viable that operation is

fossil spoke
cedar tangle
#

First time looking at setting up a dedicated server got some questions:
It seems like the main idea of a dedicated build is to compile out code that shouldn't exist in a client?
Also, from what I have seen so far, the editor can not directly connect with a running dedicated server instance?

lavish cypress
#

Yeah I would have assumed it would clean up the Beacon Net Driver but for whatever reason the client loses connection shortly after arriving in the map

latent heart
#

As for the editor/dedi, not sure.

cedar tangle
latent heart
#

Not quite.

#

The dedi server removes rendering. The client version removes potentially logic, but there's also a listen server that has both.

#

You could, and should, exclude private stuff from a server build if you are never going to distribute it. Either via plugins or #if code.

#

But it's kinda irrelevant if you're going to distribute a listen server capable build.

cedar tangle
#

Ok, still compiling the source at the moment.
That is where I am confused. Has the client code got exist in the server build? (the CLI commands I have seen reflect that it has to run the same project and map).
Everything I do has to be dedicated only, because the system would have to be out of reach for users.

latent heart
#

Generally you don't want to use #if UE_SERVER do stuff #endif, but rather #if !UE_CLIENT

#

That works for listen servers implicitly. In both server and client code (!UE_SERVER for clients) . Or maybe I'm wrong about that, but I think UE_SERVER is just dedi server builds.

#

And UE_CLIENT is just client only builds.

#

It's been a while.

woven basin
cedar tangle
#

Thanks for the feedback, one moment, I will check the code that would occlude the logic form client/server build type (may be where I am getting confused).
Also that debugging method is something I would be looking at later on, but good to know log data can be relayed in that way.

cedar tangle
#

@latent heart @woven basin it was is exactly where I was getting confused, I shall explain:

The code block wrapped within the condition #if UE_SERVER *CODE #endif is compiled out of the client.
So this means the code should not exist in the client build at all (exactly what I need).

However, the development process (the UI project) would hold both client and server logic.

@latent heart #if !UE_CLIENT I guess wouldn't specifically exclude a client from being a server (maybe safer option for some projects).

So for development (not testing), then as long as the editor can run the #if UE_SERVER blocks, then a dedicated server is not needed for development.
It is needed for testing tho, to make sure one build type can not accidentally do something it should not.

I need to test out the editor with the #if UE_SERVER to make sure what I am thinking is correct.

latent heart
#

Try compiling editor code with #if UE_SERVER.

#

If that code runs, you're fine.

#

Also, a dedicated server is needed for development.

#

Because you need to test things in a live environment. Listen servers, what you'd get in the editor, are juts fundamentally different in some respects to dedicated ones.

#

In both game logic and excluded code.

#

It will, in fact, highlight where you've written bad code.

#

Or "it works on a listen server, but not in dedicated servers" code.

#

Or failures in your testing procedures because you're testing on listen servers instead of purely remote clients.

#

Especially in c++ code where onreps work differently than in BP.

#

(slightly)

#

You can pretty easily debug a dedi server by launching it directly from your ide. Just launch your client also from the ide and connect to the server. Without using the editor, if that's what you have to do. It may or may not require packaging.

cedar tangle
#

So a dedicated server is needed for development but the editor can not communicate with a dedicated server instance.
Hmmm, I am thinking maybe a project code find and replace of #if !UE_CLIENT with #if UE_SERVER to take advantage of running a listen server along side the editor for productivity reasons.
Unless is another way to go about it. Seems one would have to keep building out server stand alone builds otherwise.

glacial burrow
#

this might be the wrong place to ask, but can anyone recomemnd me a webSocket library for RPCs that can run on C# and C++ ?

cedar tangle
#

Actually, I may have worked out another way to go about doing it (I forgot how C++ build's work as I have been doing allot of BP's recently).

latent heart
steady nimbus
#

Hello! So I'm getting to a point where I'm trying to understand how to setup a dedicated server to spawn sessions dynamically as needed. A fairly typical scenario is:

  1. Select their character and get transported to the lobby map (this is probably where the initial dedicated server session would start)
  2. Once enough players queue up in the lobby map, those players that queued to go the "match"
  3. After the match is complete, going back to the initial main "hub" lobby in (1)

What i'm slightly confused about is (2), is how to have the dedicated server itself know when players are queuing to start a new session for the new map and initiate travel for those players

rugged oasis
#

how to replicate this? the clicked actor variable is not passed from the client to the server

latent heart
#

Where is that node?

#

Also never use the get player controller node that has the index option.

plucky prawn
#

Unless you don't actually care about your multiplayer stuff working properly

latent heart
#

Or potentially single player in edge cases.

#

If that is a player owned actor or widget, which is required for your rpc to even work, you can get the player controller a better way.

#

(you can't send an rpc from a widget, but it will allow you to get the correct pc)

plucky prawn
#

But widgets have their own function also

soft flare
#

Yo guys anyone can help me out? im having this problem for a really long time now.
every time i use (random int/float in range) it gives diffrent variables on every client. someone knows what to do?

latent heart
#

Yes, don't use them on different clients? Or set the seed.

#

As long as they then do the same number of randoms, they will get the same value. Of course, if anyone joins late, they will need to catch up on the random value rolls...

#

(if you set a seed value)

fierce egret
soft flare
#

I dont use set seed, i use run on server and then after the variables are set i do multicast

#

Event beeing calles

#

randomizing on server

#

Send to all clients

#

idk whats wrong it gives me totaly wrong variables now aswell

#

seems like the "randomize" part is beeing completly skipped now

soft flare
#

if found it out, the variables that are randomized and are applied have the setting (replicate) wich for some reason messed up the replication totaly, so when i put replication on variables what exactly does it do? seems like it completly messes up my multicast

soft flare
pallid mesa
#

Hey peeps... i think its about time to discuss how neat it would be to guarantee variable replication for POD types in BeginPlay the 100% of the cases in Actors, net startup or not...

#

I haven't tried Iris in this aspect, but the legacy networking system doesn't have any place in which you can guarantee variable replication and gamestate to be valid at the same time

#

it does the trick for non netstartup actors but for preplaced actors replication can absolutely happen after beginplay

#

which is a very big inconsistency if you think about it from an architectural point of view

#

makes networking harder, by default

fathom aspen
#

I do agree, makes you hate yourself for using net startup actors, which are incredibly useful when utilizing Initial dormancy

pallid mesa
#

they are needed, indeed

fathom aspen
#

The best I found to workaround that was to hack my way by marking all my replicated varaiables as rep notifies variables, and using PostRepNotifies combined with BeginPlay/GameStateEventSet(delegate)

supple vapor
#

isn't there a setting 5.0+ somewhere to delay event begin play until ready for replication?

fathom aspen
#

Yeah there is IsReadyForReplication, but I guess that was to indicate if the actor is capable of firing RPCs

#

But good point, I never dug deep into that

woven basin
# pallid mesa it does the trick for non netstartup actors but for preplaced actors replication...

just so I can follow along this topic - are you saying if I have a replicated object pre-placed in the world, the client will load the pre-placed object. But if the server has subsequently modified it before I joined, the object would do BeginPlay() on the client, and then receive some additional stuff a few frames later from the server, causing a state that might never have occured to appear on the client?

fathom aspen
#

100%

woven basin
#

so we need a flag to say "dont begin play this object until the server confirms it is ok to start"?

fathom aspen
#

The problem here is inconsistency compared to spawned from replication actors and convolution that you need to make them "consistent"

fathom aspen
woven basin
#

"PODs"?

fathom aspen
#

Literally as it's the case if GameState is valid

fathom aspen
#

Trivial data types

#

Which are guaranteed to have replicated by the time BeginPlay is called on spawned from replication actors

#

That way we have very cool guarantee of "if BeginPlay is called, we are guaranteed to have recieved all our replicated properties (mapped ones actually), along with a valid GameState"

pallid mesa
#

this would avoid having to "wait" for the gamestate in your onreps (as one of the use cases)

woven basin
#

Cant we just override AActor::PostNetInit() and where it says DispatchBeginPlay(); - do a check for Gamestate there?

If Gamestate not yet replicated, create a callback to the Gamestate rep notify to get it to beginplay this actor when it arrives?

#

so if Gamestate has not arrived, the actor wont start?

fathom aspen
#

That's the problem, PostNetInit is not called on net startup actors, but only ones spawned from replication

woven basin
#

arh...

fathom aspen
#

There is no global callback to when properties have replicated in net startup actors

pallid mesa
#

The goal is to delay the begin play, yup. I havent personally saw the CVAR @supple vapor mentioned above

woven basin
pallid mesa
#

i think the proper route would be for postnetinit to be called also on netstartup

#

and wait until then to not disptach beginplay on clients

#

but thats just my opinion, unsure if there are other better approaches

fathom aspen
#

And yeah it has something to do with calling say a client RPC on beginplay but it not reaching the client since the owning actor wasn't yet ready for replication

#

Or at least that's how I interpreted it last time