#multiplayer

1 messages Β· Page 692 of 1

thin stratus
#

This is also a thing, James

#

I will just unhook the PoseTick stuff from the CMC again

#

.............

#

That highly depends on your loading screen. I can't answer that

shy hill
#

its just a ui screen

thin stratus
#

Yeah but where do you add and remove it?

shy hill
#

I add it before the servertravel (see screenshot), and it get automatically removed when the new map opens

thin stratus
#

What callback do you use for the "When map opens"?

shy hill
#

Not sure I have any callback (or I misunderstand?) , after I travel from lobby to gameplay_map, anything related to the gameplay_map is initiated in the gameplay_gamemode or the player_controllers

thin stratus
#

Hm, this looks really messy tbh

#

Hard to say what's going on and why it's not working

#

Could come down to a faulty setup overall

#

Interface for something that doesn't need one.
A delay, which is always bad for networking

#

CharacterInfo, if you are moving with Seamless ServerTravel, doesn't need to be send like this at all

#

YOu can store that in your PlayerController or PlayerState on the Server and move it over via CopyProperties (PlayerState) or OnSwapPlayerControllers (GameMode)

#

So yeha, idk, lots of things that seem out of place

shy hill
thin stratus
#

Can't comment on tutorials :P Never watched those

#

I know Unreal's own Lobby Tutorial is garbage

#

Like, really garbage

#

So if that tutorial is based on that, then good lord

shy hill
#

:d

#

so I have a more basic question, can lag sometimes mess with the order in which functions are supposed to trigger ?
Let's say I have a loop that triggers function A for the loop body and trigger function B when the loop is completed. Can function A triggers after function B because of lag ?

thin stratus
#

No

#

But RPCs can

shy hill
#

ok, good to know

#

ty

shy hill
#

If I'm traveling from lobby to gameplay, does it have to be active on both lobbygamemode and gameplaygamemode ? It's currently only active on lobby-gamemode

thin stratus
#

It doesn't have to, but you should have it active on all gameplay ones anyway

#

WE usually have an overall GM class

#

Which has a MainMenu and a Game one as a child

#

And the Game one that further splits into Lobby and Gameplay

#

And Gameplay then has custom things (e.g. TeamDeathmatch)

#

And the Game one has SeamlessTravel on

#

I honestly don't really understand the issue

#

--
Is there some sort of cookbook for simple prediction? Not even movement.

#

E.g. "Do your action locally, send all info to the Server, if something is wrong, send correction." But with like a minimal setup that is generic?

#

Multiplayer often needs even the simplest of stuff to be predicted if it's player input caused.

#

An example is: Character has Energy (float). Player presses Key. If enough Energy, player turns into Stone. Energy drains. If Energy low or player releases Key, player returns to normal.

#

Predicting this with setting an OnRep boolean on the Client before sending the RPC is simple. But the float is not really

#

It gets drained over time, so on tick. Means if it's replicated it would constantly get overridden by the server. If not replicated it could go out of sync.
Send energy float to server? Send corrections back? Save "moves" on Client?

#

The Prediction Plugin would be handy if it was ready. Never looked at it. Not sure how far it is for UE5

verbal tendon
#

Have you checked the logs on the clients where it doesn't work?

verbal tendon
# thin stratus But RPCs can

@shy hill this holds true for all RPCs, not even lag related. Order of execution for reliable RPCs is guaranteed within the same actor for the same connection, but that's about it. For every other scenario there is no guarantee on order of execution

#

Also I seriously recommend reading up on EOS, it has so many benefits over Steam for development, but it does take a while to configure properly

dense sundial
#

Does anyone know if dedicated servers have a game instance, my guess is no / they only are given to player driven connections?

bitter oriole
#

GameInstance is unique and essentially represents the Unreal instance

dense sundial
#

I think that is IsRunningClientOnly()

#

Thanks for your help!

cosmic plank
#

I am trying to get an actor to NOT replicate. I've turned it off everywhere I can find in BP, as well as set it in the constructor. But I get the character on both client and dedicated server and BeginPlay is, of course, called on both server and client.
Anyone know why my character is replicating from my dedicated server when I explicitly told it not to replicate?
Can supply code and screenshots on demand.

#

I want the character to only exist on the dedicated server

violet sentinel
#

most likely start with custom game mode and controller that spawns pawn only on server. but what will be on clients?

#

a bit weird use case imo

cosmic plank
#

I have a class that spawns the server character. This class is created in and lives only in the gamemode. To be sure I use "HasAuthority" in the spawning code (even though it should only exist on server, just to be sure). I also only get 1 log entry regarding spawning, so it should have only happened once (on server).
The playercontroller calls that function from the class in the game mode (on the server).
My use case is some custom networked movement with client side prediction, server reconciliation, and lag compensation. I'm mostly doing it as a practice so don't bother giving alternative approaches πŸ™‚
No matter the use case - the ServerCharacter is replicated, somehow. No idea how as it's spawned only once on a server only class (existing on the gamemode).

#

I've turned off everything replication in the blueprint of the character and i've set bReplicates to false in the servercharacter construcotr

jolly crag
#

Youll need custom code, server spawned actors will replicate thier spawning to clients regardless of whether their variables are replicated in their actor

#

Meaning just turning off replicates is just making the variables not replicate to the server/clients... The movement component if it has one will still replicate and it's spawning will still replicate.

cosmic plank
#

Is there a way to disable replication when spawned?

jolly crag
#

I haven't personally tried it as I've not had a need, but I think you can spawn an actor on a client and have it not show up on the server... Using the authority check... But not the other way around...

#

Not without custom code particularly your own version of the spawn actor

cosmic plank
#

hm that is odd that that's not an option. How would you then have a separate server and client character and only adjust movement/other stuff when you want to?

jolly crag
#

You mean LAN? As in one of the players is hosting a game and friends can join? Or do you mean a character no one can see except the server?

cosmic plank
#

Right now the plan was to have a ServerCharacter, with a ServerAIController, and then separately a ClientCharacter with a ClientAIController.

#

yeah a character noone but the server can see was the idea

#

to have my "server truth" and then the clients would adjust whenever I request them to

#

I can show you, I actually made a diagram

jolly crag
#

Yeah that will require your own version of spawn actor of class. Unless you just hide it visually with "only owner see" bool

cosmic plank
#

Maybe I should just hide it and turn collision off... might be the way to go

jolly crag
#

There's booleans on actor class to set whether something's going to be rendered... The character will still however exist

cosmic plank
#

so interesting that it's not even an option.

jolly crag
#

If the server is going to have some kind of influence over the characters that the clients are playing then they probably need to exist on the clients as well anyway

#

Otherwise you're just asking for a headache

#

Like a DM character that secretly runs the dungeon while the players are running through it

cosmic plank
#

I like headaches πŸ˜‰ I'm wanting to implement client side prediction, sever reconciliation and lag compensation on my own basically

jolly crag
#

Nice... I see you're diving head first into all of the advanced categories of networking

#

You forgot to add replicated chaos physics

cosmic plank
#

πŸ˜„

jolly crag
#

πŸ˜‚

cosmic plank
#

I guess it doens't matter if the owning client also has the servercharacter initial state if we just don't render it

jolly crag
#

As long as the client's characters have no influence over the server's character and they don't see him

#

I've seen some people's iterations of dedicated server that has like a observer class actor

#

And they just hide him under the map

cosmic plank
#

lmao that's smart

jolly crag
#

And honestly it really does make sense why it's like that... This whole engine is catered to an online third person shooter game

cosmic plank
#

so. If i want to completely hide and disable collision, all I have to do is set a boolean?

jolly crag
#

Spawn it only on the server with an authority check... In the owner pin get a reference to the server... And then set the boolean for "only owner see" to true and no one else will see him

#

To disable the collisions you would just do it the same way as always just make sure to set the character to flying movement mode

cosmic plank
#

I'm not doing BP i'm doing C++, but i'm guessing it's called... let's see... bOnlyOwnerSee ? πŸ˜›

jolly crag
#

Otherwise they will fall clean through the map...

#

Only owner see yeah

#

As long as the owner is set to the server authoritative character controller... Only they'll be able to see it

cosmic plank
#

ah so I can't find that boolean on the character. .. it's on the mesh?

jolly crag
#

It's on anything that's rendered so if you have a mesh yes it'll be the mesh if you have some particle effect it will be the particle effect

cosmic plank
#

alright

jolly crag
#

If you have multiple things that are actually rendered... Particle ...mesh.. whatever each of those need to be set to only owner see

cosmic plank
#

alright, i'll see what I can do, thanks

jolly crag
#

Glad I can at least give some pointers

cosmic plank
#

Setting the fly mode would be on the movementcomponent "Can Fly" right?

jolly crag
#

Its the movement mode enumerator

#

Mode "flying"

#

Can fly needs to be true but im pretty sure the enum just over rides it...can fly just determines if it can enter that mode

cosmic plank
#

alright

shy hill
#

@verbal tendon @thin stratus Re - Clients not travelling to the next map. I think I found the cause and what seems to a fix.
I disabled the loading widget and noticed that the client was travelling to the map, but for some reason the player-controller didn't swap properly (from lobbyPC to gameplayBP )

OnSwapPlayerControllers was supposed to fire before the delay of 0.4, but it sometimes trigger after, so the cast to BP_gameplayPC (which initiate all the player controller stuff) doesnt go through.

I increased the delay from 0.4 to 3sec and it seems to fix it (I guess that's a dirty fix, and having the function triggering on OnSwapPlayersControllers would make more sense ?)

thin stratus
#

Delays are always shit

verbal tendon
thin stratus
#

Like literally shit if you fix multiplayer issues with them

#

One Ms longer load time and it's broken again

verbal tendon
#

If you think you found a fix, and your solution involves a delay, you're most likely not understanding what the problem is/was. So it's prone to just breaking again, or not working on all clients

thin stratus
#

You need to get a handle on the framework of ue4

#

What classes exist when

#

What do they call when

#

Etc

#

The more you follow the existing stuff from UE, the easier it gets

shy hill
#

but but... why are there delays in every tutorial I watch ? πŸ˜… Jk! I'll try to get rid of them

blazing spruce
verbal tendon
#

Every tutorial is to be taken with a grain of salt, it's giving you ideas and inspiration. It's not supposed to be something you copy paste 1:1 in most cases

#

As you learn more this becomes more self explanatory, but I know it's hard at the beginning, because you have no other frame of reference, so the tutorial you see has a lot of situational value to you. Knowing 1 proven way of doing it is ifinitely better than 0 ways of knowing how to do it.

However once you've seen this being done 5,10,20, 100 times. Not only will you know how to do it, but you can also spot pitfalls, painful mistakes that you've experienced. Things become clearer as you amass more knowledge and experience.

verbal tendon
# blazing spruce I assume this is the same for retriggerable delays too? is the best way around u...

(Retriggerable) Delays, Timers, Timed Events, the problem is not what you use, but the common denominator: time

If you are using time to solve a problem, you most likely don't understand the problem. A better solution is figuring out things along the lines of "Oh this isn't working, because I'm calling an RPC before the actor has replicated to the client." or "Oh this doesn't work because my objects have gone out of existence when switching maps"

Figuring out the problem, understanding the root cause, and then working a solution from that is infinitely better than slapping in a delay and then saying "But it works on my machine!" πŸ˜„

shy hill
#

Up until now, I sometimes assumed that delays were the most efficient solution to certain problems, understanding it's never the case is good to know πŸ™‚ thanks for clarifying !

verbal tendon
#

I have a relevant example just to be clear. I've recently had to fix something using time. It was along the lines of: MaxAttempts = 10, try this until MaxAttempts are up then abort, sleep 100ms during the loop

blazing spruce
verbal tendon
#

However this was because (1) this is an editor tool, not anywhere in game logic (2) I understood why there was an issue. A spawned process that was executing a source control command was acquring a OS file lock that wasn't being released by the OS instantly after the command finished executing. So I needed to wait for the file lock to be released to schedule the execution of the next command that needed write access to said file

#

So that's interfacing with third party applications. If I had access to the source code and all of this was happening inside of the project's logic - there would be no delay&retry. I'll stop here before I go too deep into the rabbit's hole, I hope that's clear enough

verbal tendon
blazing spruce
verbal tendon
#

I mean it's a very general rule of thumb in programming. You absolutely need to understand the problem you're solving. You need to understand what's causing the issue, and why your change is solving it. Otherwise you're just playing russian roulette with your codebase if you're working alone. If you're working as part of the team, that will just not fly.

thin stratus
#

That's the shitty thing

#

But peeps propbably already told you that

#

I can say that I haven't had to do any polling or delay in any of my multiplayer projects in the recent months/years

#

Sometimes it might be a bit tricky to know when to access a specific pointer

#

But often it's relatively straight forward if you follow along with what UE wants from you

dark edge
dark edge
thin stratus
#

But the most general pattern I know is to ask each other

#

Once

#

E.g. Let's assume you have Customization Data for your Character on your PlayerState

#

Which is a reasonable thing

#

Now when this all replicates for the first time, it can be that the PlayerState or the Character are first on the Client

#

When the Character is first, it will ask the PlayerState, which is not there, so nothing happens.
Once the PlayerState replicates, it will tell the Character.

#

And other way round, if the PlayerState comes first, it will try to tell the Character, which isn't there.
when the Character replicates it asks the PlayerState.

#

So they cover each other

#

If the object itself is there, but no data yet, you can use a combination of bool + callback

#

E.g.

void ASomeCharacter::Init() {
    if (GetPlayerState()) {
        if (GetPlayerState()->bDataReady) {
            ApplyData(GetPlayerState()->GetData());
        } else {
            GetPlayerState()->OnDataReady().AddDynamic(this, &ThisClass::ApplyData);
        }
    }
}

void ASomePlayerState::DataReady() {
    bDataReady = true;
    OnDataReady.Broadcast(Data);
}
dark edge
#

Ok so another approach might be that an early object has a registration function and when someone shows up, they register and trigger a check. Last one to the party starts the show.

thin stratus
#

Yeah

#

In C++ you can also try to make this work with a shared Onrep function

#

But again, depends on A,B,C

#

In C++ multiple properties can use the same OnRep functions

#

So you could put all 3 onto the same, and when OnRep calls you can check if they are all ready

#

Epic does something like this in UT

verbal tendon
#

Well something along those lines, you get the idea, the rest is just an implementation detail

knotty relic
#

Can you use Dev Auth Tool to login with two accounts on the same pc for testing multiplayer?

winged badger
#

2 standalones used to work - .uproject, launch game

winged badger
knotty relic
verbal tendon
#

You can test your MP locally with two accounts on a packaged build

knotty relic
oblique prism
#

If you load a character from not relevant to relevant, it essentially loads it like it was just spawned on that client right? Meaning, through construction and begin play?

low helm
#

That depends on how smooth you want the game to be. Typically, ultrarealism games fire bullets from the muzzle but most other game dont because it’s too clunky

dark edge
#

I say spawn at muzzle always.

low helm
#

Firing projectiles from the muzzle also has some unusual implications for how your reticle needs to work

#

If I was in that position, I would have my reticle be a three-dimensional object moved around the world through line traces from the muzzle

sinful tree
foggy idol
#

why is the projectile movement comp deemed bad in multiplayer games?

hollow eagle
#

I don't think it's bad, but it's probably not sufficient on its own.

#

It doesn't handle anything about replication itself so clients desyncing due to lag or otherwise are going to see the projectiles rubberband all over the place.

foggy idol
#

or performance wise ?

hollow eagle
#

Prediction.

#

If you have thousands of simulated projectiles you're going to have perf issues but not because of this component specifically.

peak sentinel
#

I still couldnt solve what that Interp thing does in projectile movement comp

#

I always make it lerp by myself to prevent rubberbanding

foggy idol
hollow eagle
#

yes

foggy idol
#

if so then could not replicating movement and doing it all locally work ?

hollow eagle
#

sure, until a client desyncs because the simulation isn't deterministic

#

for something purely visual and only lasting a brief period that'd be fine

foggy idol
#

if I use my own custom and simple logic it could though ?

hollow eagle
#

desync between client and server is a fact of life, you're not going to logic your way out of it.

foggy idol
#

as I dont think anything moving that fast needs to be accurate

foggy idol
hollow eagle
#

as I said, for something purely visual and only lasting a brief period of time it'd be fine

foggy idol
#

but I can use latency or the gamestate's time to start projectiles from different points in time

snow thorn
#

wait so if u dont use projectile motion what do u use

peak sentinel
# foggy idol thanks

If you want to smooth the location store the client transform on OnRep_ReplicatedMovement and lerp to actual transform on tick

#

For grenades or slow moving things you might need to smooth it

foggy idol
hollow eagle
peak sentinel
#

Eh.. I wouldnt

foggy idol
#

or anything I dont expect to move at infinity mph

hollow eagle
#

Again, you can use projectile movement just fine. But you need your own logic to resolve differences from the server.

peak sentinel
#

PMC is great if it's a server auth logic

#

Custom solutions are great if its purely visual thing or if you are having perf issues

foggy idol
peak sentinel
#

Smooth sync should left the chat πŸ˜„

foggy idol
peak sentinel
#

Ah, gotcha

foggy idol
#

nah

#

I plan to use custom , deterministic , simplistic stuff

peak sentinel
foggy idol
#

if velocity, actor move

peak sentinel
#

0.05s?

foggy idol
tawny nova
#

sorry, i have an event dispatcher in a controller class, and i'm trying to bind to it in a level class, but i get Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor...

#

what actor? it throws that just trying to print a string, but isn't that sort of the standard way to do a RPC?

#

is it because i put the event dispatcher in the controller and not the character?

dark edge
dark edge
#

Spawn projectile = add struct to array in a subsystem for me

#

PMC is ok but idk why the hell they don't have an option to use line traces instead of shape sweeping for pointlike projectiles.

#

Also I'm pretty sure they use Euler integration so ew

#

if you want the most predictable projectiles for sync reasons you'll want to use Verlet but if you have any drag simulation you'll still desync a bit the longer the flight times are. If you have no drag and just constant gravity, Verlet is perfect.

knotty relic
sinful tree
tawny nova
#

i guess the thing i don't understand.. i'm not trying to call an RPC on another actor, but on the server?

#

like i have this procedural generation, and it works great if i hook it up to begin play on the level's event graph

#

i just want to, in dev, trigger that from a client

sinful tree
#

What actor are you running the "Run On Server" event that allows the client to trigger it?

tawny nova
#

i've got an event dispatcher in the controller class

sinful tree
#

An event dispatcher is something completely different. That's something that allows a blueprint to send out a message to other blueprints that bind to that event dispatcher.
If you're trying to trigger something from the client on the server, you need an Event (not an Event Dispatcher) that is set to "Run On Server".

tawny nova
#

oh gotcha, the event is in the level blueprint

sinful tree
#

Ok, so if it is, the player doesn't own the level blueprint.

tawny nova
#

right

sinful tree
#

You'd have to do it from the player controller, their character or player state. Player controller probably makes the most sense.

tawny nova
#

the thing is.. you get what i'm saying, i just want to manually set off a server event

#

it feels super weird to do procedural level generation in a player class ?

sinful tree
#

It's not about doing the generation in the player class.... It's a matter of you are wanting to send a message to the server, you need to do it through an actor owned by the client.

#

The generation can take place anywhere once you're on the server.

tawny nova
#

the tutorial i was following used the event dispatcher to do that

#

the server catches the event, it just refuses to actually run it

#

with the No owning connection for actor... message

#

sorry, thank you for chatting about it

sinful tree
#

Any input from a player is always on the local machine. When you do a keypress of any kind, it's 100% of the time running on the client.
The only way you send a message to the server, is through one of the events that I posted above - one that says "Runs On Server". however, it will not execute on the server unless that event is being called on an actor that is owned by the client. The level blueprint is not owned by the client, so if you're calling a "Run On Server" event on the level blueprint, it will never work.

What you can do is put the "Run On Server" event on the player controller - an actor that would be owned by the client. What you'll have trouble with is getting that signal back to the level blueprint. This is where you could potentially use an event dispatcher to communicate to it, however, your level needs to be able to bind to the event in the player controller instead.

Event dispatchers do nothing in terms of networking. All they do is trigger a signal from one class to any others that are bound to it. If you trigger an event dispatcher on the client, it'll only ever trigger what happens next on the client's version of the actors. If you trigger it on the server, it'll only ever pass the message along to any of the server's actors that are bound to it.

tawny nova
#

you're just repeating yourself, i understand this

#

" your level needs to be able to bind to the event in the player controller instead."

#

how do i do this

#

i understand, how the heck do i bind to an event that comes from a player

sinful tree
#

Well, since you're trying to use the level blueprint, the dirty way would be to do a delay of a couple seconds on the level blueprint's begin play (time to allow the player controller to exist) and then again dirty way is get player controller 0, cast to your player controller class, and bind to the dispatcher on it.

tawny nova
#

that's what i did, it does not work

#

it gives the error message

#

the warning, i should say

sinful tree
#

Post your code.

tawny nova
#

the delay doesn't seem to actually impact anything that I can tell

#

i get that it's something about binding to the event here instead of the controller

#

but i don't get how i can bind to the event in the controller and get to the level

#

i guess

sinful tree
#

Player Controller:

#

Level Blueprint:

tawny nova
#

right dude

#

you added the fucking delay

#

i know i get it

sinful tree
#

You don't.

#

It's not about the dleay.

tawny nova
#

i am saying, i added the delay it didn't do anything

#

what is the difference

sinful tree
#

It's about where the event is.

#

I press button on my player controller. My player controller reports to server. Server passes along event dispatcher message to level blueprint.

#

Yours is currently (probably):
Press button on player controller > sends along event dispatcher to level blueprint which receives message and attempts to report to server, but it cannot because the client cannot RPC through the level blueprint > attempting to do the thing but it cant

tawny nova
#

does the thing you pasted actually work

sinful tree
#

Yes

tawny nova
#

i will study it.. i do not see the difference

#

your level blueprint and mine are the same except for the delay, and your event dispatcher being on a character instead of a controller

sinful tree
#

They are different.

#

My level blueprint does NOTHING with networking.

#

Yours does.

tawny nova
#

how?

sinful tree
tawny nova
#

fuck dude can you just show me instead of making me squint

#

that's what you have?

#

you bind to the event

#

bind event -> event

#

the target is my controller class, yours is a character class

sinful tree
#

That's not the issue. Do you not see how yours says "Executes On Server" and mine does not?

#

My "Executes On Server" event is happening on my other class that my client owns.

#

Yours is happening on the level blueprint which your client does not own.

tawny nova
#

you have it labelled "Level Blueprint"

#

this is my controller

#

this is a joke, nevermind

sinful tree
#

Yes, that was my level blueprint. On my level blueprint, the event dispatcher is NOT calling an event that says "Executes On Server".
We're communicating about these two events. They are not similar.

tawny nova
#

is your event actually running on the server?

sinful tree
#

Yes

tawny nova
#

so to get it to run on the server, after all that, you're telling me that I need to specifically uncheck the box on the event that says "run on server"

sinful tree
#

That is part of it yes. The other part is you need to call a "Run On Server" event on your character that triggers your event dispatcher.

tawny nova
#

dude.. i have been trying to explain to you, that that works, it frigging WORKS

#

that is not what i'm frigging asking

#

what is this community

sinful tree
#

I'm sorry that you are failing to understand.

tawny nova
#

so how do i replicate this event to clients now that i have turned off replication to get it to work

#

i seriously give up, never mind

#

i am walking away from the computer

#

this is insane

sinful tree
thin stratus
chrome zealot
#

how might one achieve a fog of war

#

like moba style

#

could i just erase something depending on a collison sphere, then unrender anything with specific tags not under that?

#

is there a better way of doing it?

raw quarry
#

if a replicated property is exposed on spawn and set when spawning the actor, is it a guarantee that the value will be included on the client when they run BeginPlay? (i.e. is there a chance BeginPlay runs before the property has replicated and has the default value instead)

winged badger
verbal tendon
winged badger
#

guarantee as far as one can possibly make it

raw quarry
#

ok cool thanks

winged badger
#

we had an engine bug that had replication part of that not run once

raw quarry
#

interesting

#

I'm getting some occasional strange bugs when someone joins a server that already has a bunch of people in it

#

trying to figure out if there's some sort of replication race condition

winged badger
#

on release day, on an actor that is responsible from keeping map in sync...

raw quarry
#

welp that's unlucky

winged badger
#

and only if the host changed any map settings before client joined the lobby, otherwise worked fine

#

but yeah

#

you have to take it as a guarantee

#

as there are so few of those around

#

other one is GameState having fully replicated before any Actor calls BeginPlay on clients

raw quarry
winged badger
#

yes

#

world doesn't call BeginPlay before GameState tells it to

raw quarry
#

I saw this comment from some guy on youtube that has me slightly worried:

"The problem is that everything seems to be replicated pretty chaotic from the server to the client. Something can be replicated before something else it depends on. Even the NetDriver can be nullptr on the world object in a replication notification. I used World->GetNetMode don't referencing it from the world works, you can't expect the world to be initialized on replication. You even can't expect BeginPlay was called on an actor before it's properties notifications are replicated. It gets very messy to fix this all. Basically you need checks everywhere if stuff you need is already initialized and if not save it for later."

winged badger
#

he is wrong

verbal tendon
#

Uhm, yeah XD

winged badger
#

server doesn't replicate to clients before they have a valid world

verbal tendon
#

Because actors live in a world

#

Understanding the bascics of UE4 is kinda important

#

before doing Multiplayer

#

Otherwise it's easy to fall for the messages of doom from false prophets

raw quarry
#

yeah he's saying it was causing crashes when people joined a server sometimes

verbal tendon
#

πŸ˜„

winged badger
#

do note that any component member replication is not covered with the above guarantees

raw quarry
#

I guess he just misunderstood the bug and accidentally fixed it in a way that he also didn't understand

#

XD

winged badger
#

even though they use same ActorChannel to replicate

raw quarry
#

right

winged badger
#

you do have more problematic setups

#

where while your pointer to say, PlayerState will get replicated before your Pawn's BEginPlay

#

the PlayerState Actor itself will not

#

so you have a valid NetGUID, but it can't be resolved

raw quarry
#

yeah I think I've seen several similar sorts of things

winged badger
#

OnRep will fire when it is resolved though

#

above example is pretty much guaranteed if your level is not empty

#

Pawn's NetPriority is 3 by default, PS has 1

#

Pawns will come first

#

although i do recommend raising PS NetPriority, makes initialization run smoother most of the time

shrewd violet
#

NetMode: Play as Client
Quantity: 2

This works as expected
prints out Client 1 and Client 2

#

But this one is baffling me
prints out Client 2 (where is Client 1?)

verbal tendon
#

You're most likely calling the RPC on an actor on client2 that is not client-owned, so it executes locally only

shrewd violet
#

it comes from a State in a State Machine from Logic Driver plugin where all settings for the SM is set to Server only

verbal tendon
#

That's very vague, again, wherever it's being called from most likely lives on client2, and it's not client owned

#

so the RPC is executed locally and then that's that

#

Without more concrete information the diagnosis doesn't change

#

Also I haven't used that plugin before

shrewd violet
#

ah lemme get the actual bp, i made those smaller screenshots so its easier to post a shorter question but i think i may have introduced other issues

#

GetDJCharacter -> gets Client 2's character BP
StartPerforming -> sends RPC to owning client (Client 2) to do DJ stuff
StartObserving -> sends RPC to everyone, so that they get the DJ's actions

#

The issue arise here, where i actually get Client 2 only with this BP
(if i remove LocalPlayer it has printouts, but thats not what im expecting, i'm expecting Client 1's PC to print out a statement because he would be a local player on that PC)

jade drift
#

Is it possible to use the Steam OSS with a dedicated server and client running locally? I can test it fine using NULL OSS, but with Steam it fails to connect. I'm not using Sessions or Lobbies

verbal tendon
#

Is it a chain of events that's called at BeginPlay or later during play?

shrewd violet
#

Later during play.
It is called when it enters Performing state in the State Machine.
And it enters Performing state after a series of events

  1. character opens Sign Up UI to enter a queue
  2. character Registers as DJ
  3. server state machine recognizes that player array is not empty and moves from Idle to Waiting to Performing states

also note i edited my previous post after running more tests (from NOT printing at all, to only printing Client 2)

verbal tendon
shrewd violet
past seal
#

how would you replicate UI animations to all clients?

#

through playerstate, playercontroller, interface, gamemode?

hollow jay
#

I use c++ but I think you need to use the normal replication function client-server in bp

verbal tendon
#

Or whatever client-owning actor you want to have the RPC logic on

#

Being mindful that PlayerController only exists on the local client and for all on the server, so you can place the RunOnServer RPC there but need the Multicast RPC somewhere else that exists for everyone

plucky prawn
#

so i have a TArray<UJob*> where UJob is a UObject. i want to replicate it but i just found out it crashes and i cant really find any helpful stuff where its crashing since its crashing inside of unreal PackageMapClient.cpp:2601 with Exception thrown: read access violation. Object->**** was 0xFFFFFFFFFFFFFE2F. heres the call stack https://pastebin.com/9Hm5RvsP and heres the calling code. ive marked where its crashing with >>> ```cpp
void ASBPlayerController::ServerInitPreference_Implementation(FPlayerPreferences preferences)
{
UE_LOG(LogPlayerController, Verbose, TEXT("Recieved preferences from client"));
/// TODO validate and probably dont send the entire preferences, maybe make a new struct with the essentials.
PlayerPreferences = preferences;

const TArray<UJob*>& jobs = GetGameInstance()->GetSubsystem<UJobGameInstanceSubsystem>()->GetJobs();
UE_LOG(LogPlayerController, Verbose, TEXT("Sending jobs to client (%s)"), *FString::FromInt(jobs.Num()));

ClientInitJobs(jobs);
}

void ASBPlayerController::ClientInitJobs_Implementation(const TArray<UJob*>& jobs)
{
UE_LOG(LogPlayerController, Verbose, TEXT("Received jobs from server (%s)"), FString::FromInt(jobs.Num()));
K2_ClientInitJobs(jobs);
}and heres where its crashing in the generated code
static FName NAME_ASBPlayerController_ClientInitJobs = FName(TEXT("ClientInitJobs"));
void ASBPlayerController::ClientInitJobs(TArray<UJob
> const& jobs)
{
SBPlayerController_eventClientInitJobs_Parms Parms;
Parms.jobs=jobs;

ProcessEvent(FindFunctionChecked(NAME_ASBPlayerController_ClientInitJobs),&Parms);
}``` anyone know whats going on with this?
upbeat basin
#

Is it something specific to the Pawn for OnRep_PlayerState to run on client only and not Server? I believe if I define a variable with UPROPERTY(ReplicatedUsing = "OnRep_FunctionName") the OnRep_FunctionName would be called on server, simulated proxy and autonomous proxy of the actor, right?

chrome bay
#

They only ever run on the Client

#

OnRep callbacks never run server-side, apart from in Blueprint because Blueprint is stupid

#

And they aren't really OnRep callbacks (in BP)

past seal
plucky prawn
# plucky prawn so i have a `TArray<UJob*>` where `UJob` is a `UObject`. i want to replicate it ...

so i think there is several problems with my code and none of is it what i actually posted. nothing in UJob is marked as replicated and it does not have a GetLifetimeReplicatedProps override. ive added both of these, but now i have the problem where no actor owns these jobs as they are created for, and owned by, a subsystem. am i able to replicate these at all? or should i just set them on the PlayerController the replicate them that way?

chrome bay
#

TL;DR, the UObjects have to be replicated as a sub-object of an actor

#

Or network-addressable

plucky prawn
#

subsystems dont replicate by themselves right?

#

ill read through the link you sent

chrome bay
#

No, subsystems can't replicate anything

plucky prawn
#

ye big sad

chrome bay
#

So it's common to spawn a proxy actor to handle that

upbeat basin
# chrome bay They only ever run on the Client
// AMyCharacter.h
UPROPERTY(ReplicatedUsing = "OnRep_TestNotify")
int32 TestVariable;

UFUNCTION()
void OnRep_TestNotify();


// AMyCharacter.cpp
void AMyCharacter::BeginPlay()
{
    // Call the base class  
    Super::BeginPlay();
    if (GetLocalRole() == ENetRole::ROLE_Authority)
    {
        TestVariable = 69;
    }
}

void AMyCharacter::OnRep_TestNotify()
{
    ENetRole role = GetLocalRole();
    if (role == ENetRole::ROLE_Authority)
    {
        UE_LOG(LogTemp, Log, TEXT("Server notified"));
    }

    else if (role == ENetRole::ROLE_AutonomousProxy)
    {
        UE_LOG(LogTemp, Log, TEXT("Client notified"));
    }

    else if (role == ENetRole::ROLE_SimulatedProxy)
    {
        UE_LOG(LogTemp, Log, TEXT("Proxy notified"));
    }
}

I'm able to see both Server notified and Client notified on the output log when I test this. Is there something I'm getting wrong? When I use the same Logs on overridden OnRep_PlayerState I can only see the Client notified

chrome bay
#

Yeah something is off there

#

A more definitive test might be to use GetWorld->IsServer() instead of Role == Authority

twin juniper
#

Using Steam Advanced Sessions plugin - Specifically Advanced Voice.

What is the difference between a Remote talker and a Local talker?

rocky kestrel
#

What is easiest way to get reference to self after anydamage?

#

like it takes server

upbeat basin
thin stratus
#

Where in the CMC could I reliably reduce and increase a float variable so it stays in sync?

#

PerformMovement or so?

#

Will try PerformMovement

chrome bay
upbeat basin
#

Wait, if I run 2 PIE sessions I also do get Server log for PlayerState with GetLocalRole() == ENetRole::Authority check, not with a single PIE

#

I'm honestly lost here, I was just trying to learn GAS and on a tutorial I heard ".. OnRep_PlayerState() runs on clients only.. " and wanted to see how they do the logic since to my knowledge OnRep functions should run on every device that have the actor

chrome bay
#

No the way it works is that OnReps only ever execute on a network client

#

Because they are called from the replication system when a property is received.

#

And never at any other time

#

Which is why it's sometimes common to call an OnRep function manually after setting a value on the Server

#

Blueprint confuses this because it calls the "RepNotify" function whenever a variable is changed - it's not even a replication callback, it's just a "fire this function whenever this value changes" callback.

#

Why Epic felt the need to handle it differently in BP I'll never understand

eternal canyon
#

Like you want them to be calculated separately without syncing between client and server?

tight oar
#

Can someone point me to some relevant documentation/tutorials/whatever on this? Basically I can find/filter/join my steam dedis as an individual client just fine, but now I'm a little lost on how to implement a party system so multiple players can queue up together and join as a team.

#

Would the party interface be relevant to this?

virtual IOnlinePartyPtr GetPartyInterface() const
chrome bay
#

You have unwittingly stepped into a minefield

#

For the record, there is no default implementation for the party interface for any OSS.

#

Some people have done parties with beacons, but the long and short of it is you need to do the whole implementation yourself and there's a plethora of ways of doing it that are all game specific

#

Maybe EOS has something, but I've no idea

tight oar
#

Yeah I figured as much, I had to implement a lot myself just to spin up and manage the dedi instances. Finding documentation past this point has been frustrating though

chrome bay
#

Yeah, frankly there isn't any

tight oar
#

Well, at least in some way that's relieving to know. I guess I'm on my own here. I'll look into beacons

verbal tendon
#

CDO - class default object lets you access the default values for properties that are assigned via editor/c++

#

Otherwise if it's specific values for an instance of a spawned class, then it needs to exist for you to be able to access them

#

You can always expose access to that data in other ways

#

Really depends on what the problem is that you need to solve

knotty relic
# verbal tendon what do you mean by distinguish?

So right now if I start up multiple games eosplus is being found and then logs in to steam on the first instance. But, the second starts up as null system. My goal is to be able to test inviting friends, EOS voice chat, multiplayer sessions that requires two computers and two accounts.

rocky kestrel
#

How to make this work? I want spawn chest when player dies and use player inventory. In any damage event that "DeathLoot" is from server and not from player who recently died. How to fix that.

#

So player who died have proper have "DeathLoot" variable but server didn't die and it takes that variable from server? If I print that variable in loot actor its empty but if I put print it in "SetDeathLoot" it prints correct.

sinful tree
# rocky kestrel How to make this work? I want spawn chest when player dies and use player invent...

When dealing with multiplayer, the instance of the object you're working with usually both exists on server and client. Depending on whether your code is being run on the server or run on the client is what determines who's (servers or clients) instance you're manipulating.

Currently, you're running Any Damage which is a server event and that calls the "Set Death Loot" event which runs on the client. When that event is fired, the client will proceed to set their death loot array -- the server doesn't know what that value is since it's running on the client, so when you do your spawn of the "Player Loot" actor, that "Death Loot" array likely doesn't contain anything.

To correct this issue you need to set the "Death Loot" variable on the server itself but that may not be all. I'm not 100% sure, but I think you may require a rework of your inventory if you never set up replication and have been handling everything client side instead of having the server manage it - and I think this is the case as you're using a Map type variable which are not replicated.

rocky kestrel
#

@sinful treeSo is there any way to take "self" reference in server event that is not server but damaged client?

sinful tree
# rocky kestrel <@!218956378654507008>So is there any way to take "self" reference in server eve...

When you have a replicated actor in multiplayer, the server and the client have an instance of that actor. It is not about a "damaged client" it is a "damaged actor". A reference to "self" only means the instance of this particular object.
Take the following example. I press a button, sending a reference of myself to the server. It then checks if my value I passed along == "self". In this instance, it will always return true.

#

When discussing Server / Client in multiplayer it's more about where the data is being executed; whether it is being done on the side of someone playing the game, or on the hosts' side. So again, a replicated actor will exist on both the client and server, they both have a copy of the same thing. If you're wanting others to get a copy of the inventory the character had, then the inventory should be getting managed on the server's side.

rocky kestrel
#

okay thank you

rocky kestrel
#

I'm thinking how hard it would receive also that damaged actor pin to anydamage. In c++?

sinful tree
#

Any Damage is executing on the actor that is being damaged.

tawny nova
#

when you create those actors, you could add your parameters to the actor class as a variable

#

and then you'd have a handle to get at them whenever

#

oh maybe i misunderstand, if the challenge is getting to those parameters at all

#

you know.. I too have been grappling with level files

#

is there a hard reason to not replicate those actors to clients?

#

i'm kind of in a similar jam anyhow, i am not sure

quasi tide
flint star
#

Hey, how can I prevent bot AIControllers to be seamless traveled?
This part of seamless travel handler is the problem

#

It just checkes whether a AController (can be AI) has a PlayerState and Bots have PlayerState

#

but I don't want them to travel

#

as far as I can find, there's no way to mark "Don't Travel" or a pre-travel Filter method to use to remove unwanted actors

foggy idol
torpid nymph
#

any tips on how to set the GameNetworkManager that is being used?

#

I don't know where this is being setup if I want to change it to something else

solar stirrup
#

Is there a way to sync two movement components together? Probably not, but I figured I'd ask.

It'd be a pawn movement component (a ship) and a character movement component (a player walking inside the ship).
Reason why I'm asking is that the depending on the manoeuvres the ship takes, it could move/throw the player around. Of course, both would need to be in sync so that the saved moves finish with the same results at the end.

sinful tree
#

But yeah I'm not sure how well that will work with the CMC either ._.

solar stirrup
#

Yeah attachment works

#

But it's mostly the velocity/acceleration/Gs I need to also be synced

#

Which won't be just by simple attachment, clients are always gonna be a little behind

rocky kestrel
#

Is it normal Cast to "gamemode" fails always when playing dedicated server instead listen server? Wanting to do respawn.

#

event called from third person run on server event

sinful tree
rocky kestrel
#

Okay ty! made it work that way.

plush otter
#

Is a reason why in the build version on server, this find always returns -1. No problem with PIE.
Inventory is an array of INV_SlotStructure. Initialized all to empty slot structure.

bitter comet
#

Hey all, what is the best way to get the current session settings (host name, max player count, etc) from a C++ GameInstance class to a BP so that we can update a UMG widget? I tried making a BlueprintCallable function that returns an FOnlineSessionSettings pointer but the code doesn't compile, with error Unrecognized type 'FOnlineSessionSettings' - type must be a UCLASS, USTRUCT, or UENUM. Removing the BlueprintCallable tag allows this code to compile no problem

vague fractal
#

Is there something like Launch Character which is multiplayer lag friendly* by itself ?
Like something where i don't need to build around the client prediciton

fading birch
fading birch
#

<@&213101288538374145>

#

they posted in a few other channels too

low obsidian
#

Hey Guys, I made a change breaking my dedicated server, but I am only getting an error code 3 in visual studio when I try to run the dedicated server. Running it stand alone, I am running it with -server -log but it just closes right away. Do you have any suggestions to find out what is causing this?

bitter comet
fading birch
#

You'll need to make a custom struct then.

bitter comet
#

That would work

fading birch
low obsidian
#

My dedicated server isn't started since I moved from EOS to EOSPlus. My client builds fine though and I have no issues... Has anyone run into a similar issue? I'll post the stack trace below:

#

I'm not sure why the dedicated server is starting up and trying to initialize the user interface since there isn't a user involved... hmm

mighty garnet
#

Hello, I'm running multiple client windows in editor -- it seems like they all share the same game instance object, can someone confirm that's true?

#

If so, does anyone know some way for each window to have its own game instance?

plucky prawn
#

What are the rules if I want to send a TArray<UObject*> through RPC? Do I need the GetLifetimeReplicatedProps override and properties with replicated specifiers? Or will it just send the whole thing as-is?

#

By UObject* I mean a class I made that derives UObect and the array is of this type so if needed I can add whatever is needed to replicate it.

mighty garnet
#

I think just mark it as a UPROPERTY()

#

you shouldn't need to replicate to explicitly send it through rpc

dark edge
#

Best would be to testing on multiple computers but also try just launching instead of PIE.

mighty garnet
vague fractal
mighty garnet
#

for testing my code once Im done I build dedicated server and client packages, then connect through IP

#

but as Im deving I find it fastest just to use PIE

dark edge
#

You can just launch a dedicated server too. That's what I'm getting at. No build

#

Sync, launch, done

#

5 seconds

mighty garnet
#

oh interesting, how do I do that?

#

say I want a server and two clients using my current code

harsh lintel
#

I don't get it, I'm saving a pointer to the player character on the server, I'm using GetPlayerState but it's null

#

the player state is

kind ember
harsh lintel
kind ember
harsh lintel
#

yeah

plucky prawn
harsh lintel
#

this link helped me with replicated uobjects

kind ember
harsh lintel
#

when the player dies

kind ember
harsh lintel
#

but this is all done on the server

#

shouldn't it be valid?

kind ember
#

Or maybe character is unposessed.
Unposessed character have no playerstate.

harsh lintel
#

let me check

harsh lintel
#

it only took a few hours

kind ember
vague fractal
#

Are root motion animations safe when it comes to lags ?

kind ember
vague fractal
#

Not finding anything with that name in my CMC.
Also kinda feel like it can't be that simple to fix since i already had to override the CMC with the client side prediction in C++ πŸ˜…

kind ember
barren dock
#

Hi
I am using world composition with sublevels, but if server player is too far from client, client falling down through the ground.
Can anyone help?

raw quarry
#

Am I correct in thinking that if two repnotify properties are updated on the server on the same frame, I can't assume that the client has already received both updates in either onRep()?

#

I.e. if I want to do something onRep that depends on another replicated property being sent at the same time, I should implement something like a semaphore such that I do the action from one onRep if the other has also marked itself as having completed

#

Or, of course, combine/serialize the properties together

short arrow
# harsh lintel it only took a few hours

Hey long time old friend. I literally just found this out today wondering why the playerbame wouldn't show up on the dead body πŸ˜‚. Wish I had gotten to you first

dire cradle
#

Hello, above I'm trying to enable input on the character when the game starts. But only the server receives input. Clients' input stays disabled.

#

I've tried to pass the player controller with the event with no change

#

Can anyone help me here?

#

Ok false alarm, my bad. Client just wasn't updating the mouse sensitivity correctly and was returning 0

pallid mesa
raw quarry
#

ok makes sense, thanks!

pure mango
#

It's like similar to lazy initialization in software dev

rustic kraken
#

guys i am getting this error while tring to join a game through lan

#

LogNet: TravelFailure: LoadMapFailure, Reason for Failure: 'Failed to load package '/Game/FirstPerson/Maps/UEDPIE_0_FinalLevel''

#

i am playing this on the editor

#

on 2 devices

#

both devices run this game on the editor

verbal tendon
#

PIE is a second class citizen

rustic kraken
#

ok

harsh lintel
#

is there a way I could see the callstack when a server shuts down?

#

like what is causing the server to stop running

silent valley
vague fractal
#

Alright, so i faced pretty hardcore network corrections(on high ping) on the client when moving and i found out that this will only happen when the CapsuleComponent of the character is replicated.

Now i wonder if i should just not replicate it

harsh lintel
#

LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = UIpNetConnection::HandleSocketSendResult: Socket->SendTo failed with error 21 (SE_EADDRNOTAVAIL). [UNetConnection] RemoteAddr: 127.0.0.1:17777, Name: IpConnection_0, Driver: PendingNetDriver IpNetDriver_1, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID Connec I'm trying to play as client but I'm getting this log

#

it sends me to the default client map instead of the map I have open and I want to PIE

harsh lintel
#

first time the issue happens

vague fractal
#

What's exactly the problem with this mode on the AnimInstance_BP ?

#

Even with lags it seems to work okayish enough

#

(Tested with 750 ping on server + client. I also still don't know if i should really do that on both here)

verbal tendon
dark edge
#

We test multiplayer with launching but do no traveling at all so havn't had to mess with it

thin stratus
#

Is anyone actually using the NetworkPrediction Plugin already? I haven't heard much about it anymore. I love the Insights that they have a video of on the readme (I could have used that ages ago when debugging the CMC)

vague fractal
thin stratus
grand kestrel
#

That's... concerning

thin stratus
grand kestrel
#

"Well, we don't need it for Fortnite..."

supple vapor
#

I'm trying to do a seamless travel with ClientTravel (travel type relative and bSeamless turned on) from MAP_Server1 to MAP_Server2 but the client gets stuck and tries to load MAP_Server1 again

#

MAP_Server1 running on port 7777 and MAP_Server2 on port 7778

#

any clue on why it fails?

thin stratus
#

I can't recall ClientTravel being a Seamless operation

#

Only ServerTravel

#

After all you are connecting to a new server, which has to go through the whole login process

supple vapor
chrome bay
#

Doesn't seem to have been touched for a good 18 months now

eternal canyon
#

isnt rly ready for anything other than testing i woukd say

thin stratus
#

Sad

#

Most interesting for me is the insights and the possibility of linking multiple things together

#

But well, guess we wait a few more years

#

Or I code it myself

eternal canyon
#

main thing im looking forward to is the integration with GAS

grand kestrel
#

It was the main thing I was looking forward to

#

Don't care about lumen or nanite, mass sure, but this more than anything

#

Feels moderately tone deaf if I'm honest

pallid mesa
#

wow that caught me off guard

#

all best for Dave, he gave us soooo much. Thank you Dave <3

grand kestrel
#

It always seems the ones who do stuff like this are the ones who leave

#

Same thing with the ART creator, can't even remember his name

gleaming vector
#

aw, bummer

peak sentinel
knotty relic
#

Im having some trouble figuring out how to have have spawn locations to be relative to the player. Similar to apex or fortnite lobby where your player is always in the middle.

harsh lintel
#

<@&213101288538374145>

#

hmm let me erase the link from that image

plucky prawn
#

so whats the point of a subsystem if it cant be replicated? or anything that it owns (is the outer of) also can not be replicated?

peak sentinel
#

Subsystem = modern singleton

#

I heard it can be replicated but causes weird side effects

plucky prawn
#

i see

peak sentinel
#

Point of subsystems are they are accessible from everywhere very easily and you dont have to manage their lifetime

plucky prawn
#

ok so.. i have a subsystem which is supposed to be server only (its not right now but thats not really the point), and it owns some UObject types. im trying to send the TArray<Ubject*> over RPC to a player controller but its crashing. i tried following Jambax's guide for replicated UObject but its still crashing, and i think its because the subsystem owns it and not an AActor

#

i could try to shoehorn in some kind of ownership of the subsystem but it doesnt really make sense. i just want to send some stuff over rpc :(

sly parcel
#

hi. whats the difference between steam subsystem and advanced sessions? are they the same? I am still confused in setting up different of ways to connect to steam. thank you

plucky prawn
#

advanced sessions is just normal sessions with.. advanced options? it exposes more of the C++ api to blueprints so you have more control over how your session is created

#

steam subsystem afaik exposes steam api for your sessions so you can use it for multiplayer

#

someone else might have some more details on the difference but i think thats the gist of it

sly parcel
plucky prawn
sly parcel
sinful tree
# knotty relic Im having some trouble figuring out how to have have spawn locations to be relat...

One way I can think of is by having the the local client spawn in characters instead of relying on the server to spawn in characters for each player. This also has the benefit of not having possessed characters. Then it's just a matter of doing management of each character on the local client. Any data that needs to be replicated about the character (such as the appearance or name) should be replicated through the player state using OnReps and then locally you can manage which playerstate belongs to which character and update anything about the character required.

#

I'm fairly certain you can use "begin play > has authority > local >" on playerstate to know when a player has joined the lobby. To have only your player spawn in a certain position means you do a check for if the owner is valid on the playerstate - if it is valid, then that's your player state and you can spawn the character at the "center" spawn point you want to use, if not, it's not your playerstate and it should spawn in the first open "other" spawn point.

peak sentinel
#

lmao chill 😹

#

πŸ’€

knotty relic
rose egret
#

when actor relevancy is updated ? is there any interval ?

verbal tendon
#

Tank spotted in the wild

chrome bay
#

I do something similar for my command system. There's a command manager world subsystem, and it has a data actor which handles data replication.

plucky prawn
#

Oh I see

chrome bay
#

Depends what it is I guess, but there's nothing wrong with having the subsystem-actor combo

plucky prawn
#

So the subsystem spawns in its own proxy actor which owns all the replicated objects?

chrome bay
#

yeah

plucky prawn
#

Very nice

#

I'll definitely give that a go, thanks

chrome bay
#

In my case I have an actor per-connection, but only because I want per-connection specific data from it too.

#

The gamemode notifies it when players login to create the replication proxies

plucky prawn
#

Ah I see

#

I think I might have needed something like that originally since I wanted to replicate to specific players on login, but I've reviewed my situation and decided that it doesn't matter since my jobs don't change at runtime so why not replicate them normally

chrome bay
#

You can ofc always just use an actor as the "job" object instead and spawn those

plucky prawn
#

Ye true. I figured actors had additional overhead and they really don't need to be spawned into the game so I figured UObject would work better

#

But I'm starting to think I have no business using UObject and I should use AActor for everything and disable tick

chrome bay
#

They have a little, but the advantage of this method first and foremost is you only need to consider one of those jobs for replication if it changes.

#

If you replicate them as subobjects, every single one has to be checked each time

#
  • you can disable replicated properties you'll never use
plucky prawn
#

Oh very nice

plucky prawn
chrome bay
#

You have more finely-grained control this way

#

Yeah

#

Using an actor just means you can get fine-grained control over the replication of each one. Whereas if every job is a sub-object, they are all locked to the replication properties of the owning actor.

#

Similar to how components are

plucky prawn
#

Oh

#

I probably would have made them subobjects of my actor proxy :l

chrome bay
#

yeah they would have to be

#

otherwise they won't resolve properly, or at the very least, they would have the wrong outer on clients. Client-side they will always use the actor as the outer.

plucky prawn
#

I see

#

This is way more confusing than I anticipated

#

I mean not now, you have cleared it up very nicely thanks

#

I'm pretty much coming from garrys mod where I could network whatever, whenever.

chrome bay
#

yeah UE's quite different no doubt, but for good reason a lot of the time

plucky prawn
#

Ye fair enough

kind star
#

So I've been using UE4 for like 4 years now, and I still don't know what BP 'Component Replication' actually does. According to docs, it replicates the BP component, but through all of my testing it doesn't replicate anything more or less or have any effect. E.g. what effect does this have on the Character Movement Component (CMC), as it replicates automatically?

kindred widget
#

Actor Components can replicate properties and call RPCs just like an Actor can. The component itself needs to be set to replicate, and it's owning actor needs to also be able to replicate. It's restrictions and use identically follow it's owning actor's rules.

vague fractal
#

Uh, any idea why a root motion animation would play super fast on the client when lag is on ?
All the other animations from the AnimBP are still normal even with high lag

thin stratus
#

@kind star the thing with the CMC is that it's using the character for the rpcs and has no variables it replicates

kind star
grand kestrel
kindred widget
#

Easiest way to consider it is that ActorComponents are just an extension of Actors. If your actor isn't replicating, the component won't either regardless of how it's set up. If the actor cannot RPC to server, then neither can it's components. If the component or it's actor isn't replicating, the component won't received replicated properties even if set from the server, etc.

verbal tendon
#

that smol meow is u πŸ˜›

#

with a sniper rifle

#

that meow was my profile pic for the longest time, whilst noscoping people with the AWS in CS 1.6

snow thorn
#

im really confused on how making a float such as mana get set by the server for the client

#

cpp or bp im just like lost

latent heart
#

You make it replicated

#

And then the server tells the client what the value is

snow thorn
#

so uproperrty(replicated)

#

and thats it??

#

or do i have to make a function that tells it too

latent heart
#

That's all you have to do .

#

There's various things you can do to change the details and events, but that's the basics.

snow thorn
#

wait thats all. i just make var replicated. thats simple

hollow eagle
#

GetLifetimeReplicatedProps too

#

(but yes, that's it)

snow thorn
# hollow eagle GetLifetimeReplicatedProps too

LNK2001: unresolved external symbol "public: virtual void __cdecl Ucppcharhelper::GetLifetimeReplicatedProps(class TArray<class FLifetimeProperty,class TSizedDefaultAllocator<32> > &)const " (?GetLifetimeReplicatedProps@Ucppcharhelper@@UEBAXAEAV?$TArray@VFLifetimeProperty@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)

#

im assuming thats what u mean

hollow eagle
#

read the link

#

yep

snow thorn
#

ok so i need to use bReplicates=true

hollow eagle
#

that too

snow thorn
#

does that work in a character component or is it finnicky like a timer

verbal tendon
#

There's no need to be ashamed! It's not the size that matters, it's how you use it

#

πŸ˜„

latent heart
#

It' s almost like there's a manual, siliex.

verbal tendon
# snow thorn thats what she said

And then you laughed and linked this? πŸ˜„

https://www.youtube.com/watch?v=f488uJAQgmw&ab_channel=KollektivetTV2

Music composition and production/lyrics/performance:
Fridtjof StensÆth Josefsen
Jakob SchØyen Andersen

Mix:
Rudi Simmons

Directing/Editing
Mikael Samuelsen

Online/Visuals
BjØrn Amundlien

Managing Editor
Marit StØre Valeur

Se Kollektivet hver fredag kl. 17:55 pΓ₯ TV 2!
Programmet ser du ogsΓ₯ gratis pΓ₯ TV 2 SUMO: http://webtv.tv2.no/webtv/sum...

β–Ά Play video
snow thorn
#

according to this doc all i needa do is this

#

but then i get something about dll linkage

#

LNK2001: unresolved external symbol "public: virtual void __cdecl Ucppcharhelper::GetLifetimeReplicatedProps(class TArray<class FLifetimeProperty,class TSizedDefaultAllocator<32> > &)const " (?GetLifetimeReplicatedProps@Ucppcharhelper@@UEBAXAEAV?$TArray@VFLifetimeProperty@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)

hollow eagle
#

Read the first link I posted.

#

You still haven't defined that function.

snow thorn
#

would I do UCppchrhelper * Owner

hollow eagle
#

No.

#

That's an example of the property you want to replicate.

snow thorn
#

so i wanna replicate a float

#

do i do Floatname* Owner?

hollow eagle
#

It doesn't need to be called owner

#

that's just an example of something being replicated

snow thorn
#

ok so whats before the *

lost inlet
#

?

snow thorn
#

is that what i want to replicate

hollow eagle
#

AActor* Owner is just an example of a replicated property

snow thorn
#

and then what goes after just a reference?

hollow eagle
#

you don't want it at all

#

you have a property float SomeProp

snow thorn
hollow eagle
#

AActor* Owner is just an example on that page of a property that is replicated

#

apply what they did to that property to yours.

#

it's marked with UPROPERTY(Replicated) so do that to your property

#

they added a function named GetLifetimeReplicatedProps and put some code related to the property in it, do the same with yours

snow thorn
lost inlet
#

is this just an intellisense thing or actual build error

snow thorn
lost inlet
#

where are you getting this Owner thing from

snow thorn
#

is that what ur tryna say?

lost inlet
#

this is quite the level of Not Getting It

snow thorn
lost inlet
#

?

hollow eagle
#

No, the docs do not say anything about that.

lost inlet
#

it doesn't say ANYTHING in the docs about this, AActor* Owner is a property

#

float Mana is a property

snow thorn
#

o

#

ok this makes more sense

#

ahhhhhhh now i got it

#

im sorry bout that. that was dunmb

snow thorn
lost inlet
#

what is that anything to do with anything we've discussed here

snow thorn
snow thorn
lost inlet
#

stop tagging me

#

also look at your C++ constructor

#

you're probably doing something dumb in it

hollow eagle
# snow thorn

I mean, the bit you posted before here isn't right either

#

SetIsReplicated isn't static

snow thorn
outer radish
#

Is it possible to replicate an RVT, or perhaps the drawing of an RVT? I need all players to have the same RVT texture data

#

Actually it appears to work just fine as is, sweet
edit: nevermind, with more than one client it doesn't work, hmm

rotund topaz
#

anyone in here have any experience with overriding the base character movement component to be smooth over time instead of instant in multiplayer? Trying to figure the easiest/best way to do this that isn't super ugly

terse prawn
#

If I set an audio component to replicate (the component specifically with the actor also set to replicate) and a new player joins as the audio component is playing, will the new client update the audio component on their end to match the current audio's position of everyone else?
Edit: or is that redundant?

lost inlet
#

this is not something you'd ever need to replicate

#

I wouldn't be surprised if audio components are not even spawned on dedicated servers

kind spear
#

any reason why client health is now showing grey but server health is fine ? the health variable is replicated.

torn geode
#

Hey guys! Do any of you know how to setup a basic advanced sessions system? Or have a template I can use for my game?

leaden scaffold
torn geode
#

There’s a plug-in called AdvancedSessions

#

I need a basic system for creating and finding servers

leaden scaffold
#

I see

#

What version of Unreal

torn geode
#

4.72

leaden scaffold
#

It’s wayyyy simpler in 5

torn geode
#

I don’t know if I should switch to 5

#

4.72 is working fine for me rn

leaden scaffold
#

Don’t switch for sure

#

Have you done session in UE4

leaden scaffold
#

Basically this is the same nodes

torn geode
#

I’m gonna watch all the videos I can ig then xd

#

Since idk how to do sessions

leaden scaffold
#

It’s not video level complicated IMO

#

Three nodes you must know

torn geode
#

I’m still at beginner stages

leaden scaffold
#

CreateSession JoinSession FindSessions

torn geode
#

Wait it’s that simple?

#

Bruh

#

I’ve been tryna do 50nin tutorials

leaden scaffold
#

It’s that simple

#

All these OnlineSubsystem plugins do is change the transport layer from steam to oculus or Nintendo or LAN

#

The API is the same

torn geode
#

Ah

#

Wel uh

leaden scaffold
torn geode
#

i could litteraly do this in 15min at my skill level and I’ve been watching long multiparty tutorials .-.

lost inlet
torn geode
#

Is there a way to make it so it’s 8 players connecting to a session and no host that can play?

leaden scaffold
#

Shameless self promotion I’m available for coaching if you’re wasting time with videos DM me

#

You want dedicated for that

torn geode
#

Alr

#

I will tomorrow since it’s 11pm for me rn

torn geode
leaden scaffold
#

Not significantly more complicated but does require more thought

torn geode
#

Fair

#

Hopefully after that all I gotta do is fix the actual pvp and make teams and ranked modes etc

#

I got alot to do .-. I should make a trelli

lost inlet
#

well you're talking about a lot of things there, since with ranked modes you'll probably need some backend infrastructure to track that

torn geode
#

True

#

That’ll prob be after a full release and a couple updates after

kind spear
#

seriously scratching my head i cannot figure out why this has stopped working

torn geode
kind spear
#

i know its likely some really simple and right in front of me but i just cant see it

lost inlet
#

well without context, it's impossible to know what I'm looking at

torn geode
#

The health

lost inlet
#

well that's like 5% of the overall context

#

how is the health managed? how is the UI updated?

leaden scaffold
#

Yeah this could be 90 things

kind spear
#

my apologies yes it is the health variable it is replicated and was working but after tinkering with the round timer it no longer seems to show on client

lost inlet
#

oh damn, BP. but why are you using this in a multiplayer context?

kind spear
#

i worked before so i didnt see an issue what would be a better way ?

lost inlet
#

well this will just get the first character in the world, regardless of if it's actually you or not

#

at least UMG widgets have this

kind spear
#

i just tried switching out the get player character for the get owning player pawn but didnt make a difference

fluid summit
#

Hi! i'm trying to test my dedi server with a friend with hamachi/zerotier but i'm having troubles

#

does anyone know if there's a standard change required in order to connect with a vpn?

lost inlet
kind spear
#

thats true just a pain its not showing on the client.. adding the HUD to the viewport is handled in the gameplay PC so i dont understand why it is not showing correctly

lost inlet
#

well debug it, it's not even clear if it's a UI or replication issue

placid flame
lost inlet
#

RPC to spawn the HUD is a bit overkill

lusty sky
#

you can create the widget on beginplay why rpc?

kind spear
placid flame
#

does anyone can tell me if these values are fine?

fluid summit
placid flame
lost inlet
#

How is a sky heavier on replication than a character? And what’s with the ugly font rendering as if you disabled cleartype in windows

modern cipher
#

should you replicate sky in the first place?

lost inlet
#

Depends if there’s some kind of authority on time of day and weather conditions but it still seems excessive and it replicates at 60Hz

fluid summit
placid flame
#

that's why I'm asking if it's good

lost inlet
#

Yes but it’s still using an excessive amount of data and a high update frequency to do it

#

One of the pitfalls with buying marketplace stuff

placid flame
#

okay, I'll set the update frequency at 10

#

and I'll test

#

are the values fine for the character?

lost inlet
#

Probably until it isn’t, just the sky stood out like a sore thumb alongside the ugly fonts

#

That’s some Windows 95 font rendering

placid flame
#

okay, yeah

#

I think is fine now

#

there is a setting to synchronize the bp with the clients, but that didn't change the values

#

are the other things fine?

#

I also saw that I should limit the server fps, something like this: [/Script/OnlineSubsystemUtils.IpNetDriver]
MaxNetTickRate=60
NetServerMaxTickRate=60
LanServerMaxTickRate=60
NetClientTicksPerSecond=60
bClampListenServerTickRates=true
MaxClientRate=10000
MaxInternetClientRate=10000

fluid summit
#

Is okey to start optimizing while still on bp?

placid flame
fluid summit
#

oh sorry, i tought that was on bp

dark edge
torn geode
#

Can I link player data to steam id

thin stratus
#

Theoretically

#

Just depends on what data and how you are saving it

thin stratus
#

--
Has anyone lately made some sort of gametimer (ticking down) that is properly synced? I usually have a very naive version where I just sync the value every 10 seconds and otherwise let everyone count down via a looping 1 sec timer.

#

But that doesn't really take ping into account

upbeat basin
#

I just want to confirm I get the concept correctly, if I increase the NetCullDistanceSquared on my PlayerState and decrease on Character, I can get attributes on PlayerState from the defined distance while Character and visuals are not replicated/visible on my local device, right?

thin stratus
#

PlayerState should be always relevant

upbeat basin
#

Oh, yes it is by default. So I don't need to play with NetCullDistanceSquared either, I can just reduce the Character to prevent unnecessary replication over distance and still be able to check it's health, team, any attributes etc. right?

thin stratus
#

Yes

upbeat basin
#

Got it, thanks

chrome bay
#

(Or a better version of the latter)

verbal tendon
thin stratus
#

That ServerWorldTimeSeconds, in the past, have turned out to be really off

chrome bay
#

Yeah, I rolled my own timer in the end to do prediction etc, and just drive everything from that

thin stratus
#

I basically just need a straight forward setup of a timer that counts down. May it be 5 second countdown before the round starts, or 120 seconds of the whole match

chrome bay
#

I would just use the game state timer. That's what we use in HLL to sync some things and it's been fine

#

It doesn't really matter factoring in ping, because everything else that happens will also be delayed by ping

thin stratus
#

And how do you set/reset it?

#

Right now I basically have a repNotify var that overrides a local timer var

#

And that local timer var is counted down

chrome bay
#

I'd just poll it repeatedly

thin stratus
#

Every 10 seconds the Server sets that to resync

chrome bay
#

Whatever UI element is showing it can just poll the values, so it handles the timer resyncing all the time

thin stratus
#

The UI element is doing that anyway, or rather it's ints, so I can just update it every second

#

It's more about the sync between server and client

verbal tendon
#

If you want to be more exact you can give every client a local delta based on their ping

#

Not sure how much precision you want here, but that'd be one approach if you want more

thin stratus
#

I mean, let's say it's a 3-2-1 countdown. Would be nice if the game wouldn't start at -1 visually

verbal tendon
#

This also factors into account if the timer matters a lot that the local actions they do will still be picked up by the server, rather than the round timer being over when they arrive at the server

thin stratus
#

1 second delay is unrealistic, but it does feel a bit mΓ€h for the client

#

James timer in his small game looks way more synced

#

GIven that's a client?

#

It feels like it properly starts when the timer hits "0"

chrome bay
#

Can't remember if that's a client or not now

thin stratus
#

!

chrome bay
#

But if you think, the match transition is also going to be behind by the same ping factor

#

So it still feels very close to perfect even if it's not dead-on

thin stratus
#

Yeah I understand what you mean

#

I still have issues with such a timer in terms of setting/resetting. Specifically if it's driven by OnReps

#

If that OnRep is set to the same value twice it won't call

#

(which is funnily enough a bug in UT)

chrome bay
#

Ahh, I do that by integrating both the timestamp and match state together

thin stratus
#

So you send a struct when the timer is set?

chrome bay
#

Although, in theory if the timer is a timestamp, it'll always be a different value

thin stratus
#

So a future timestamp?

chrome bay
#

yeah

thin stratus
#

Current + 120sec

chrome bay
#

yeah

thin stratus
#

And Timestamp is GameServerSeconds or w/e it's called?

chrome bay
#

yeah so instead of comparing to local world time, just use the server world time from the GS

#

Because it's a fixed timestamp in the future, it sort of auto-handles that value resyncing all the time

thin stratus
#

Okay, yeah I tried to avoid that cause I have really bad experiences with that. It was way off in The Ascent for whatever reason

chrome bay
#

I think that's how I dealt with it there anyway

#

But I know in HLL, we use that timer to deal with our ability timers, like planes flying over etc.

thin stratus
#

I think I used it for a timer on the Drones, to count down how long they still have

#

But I think I used it to account for ping

#

Which might have been the bad idea

chrome bay
#

Those are synced with that timer then a little bit of interp to stop them snapping around as it updates

thin stratus
#

E.g.

float timeRemaining = (RepStruct.TimeRemaining - (ServerTimeSeconds - RepStruct.Timestamp)
#

Something something, don't know if that line of code makes sense

#

But that way probably a bad idea

chrome bay
#

yeah I see what you mean

thin stratus
#

The idea was to say "Server started 10 second timer at timestamp 2000 and we are at 2005, so the timer is only 5 sec remaining" but that broke quickly haha

chrome bay
#

Yeah mine was End Timestamp + Length

#

relative to GameState::ServerWorldTimeSeconds

#

(or some other synced timer)

thin stratus
#

That sounds relatively the same

#

Why did mine explode ;_;

verbal tendon
#

How much did it explode by?

thin stratus
#

Given the duration of a few seconds, it felt really stupid

chrome bay
#

I think the trouble is if you use the starting timestamp, if the timer is out-of-sync by some factor when you start it'll always be out of sync by that factor

#

Whereas using the end timestamp it sort of "hones in"

thin stratus
#

Cause the timer was sometimes over for a while, like 2+ seconds, or still going on and the drone died

chrome bay
#

And stays relative

#

Ahh.. the never-ending discussion of synchronised timers πŸ˜„

#

Thanks physics

thin stratus
#

What you say James is something that does and doesn't make sense, which either means I'm too stupid or that what you say shouldn't make a difference haha

chrome bay
#

πŸ˜„

thin stratus
#

If EndTimestamp = StartTimestamp + Length, it shouldn't matter what you send, or?

verbal tendon
#

What Jambax said

thin stratus
#

ignoring the overly optimized way of saving a property

chrome bay
#

It's more that the timer will keep the same desync state it had at the start for the duration

verbal tendon
#

If you have a high delay, your servertime is already behind locally

#

so the formula compounds the amount of time you're behind

#

and your 5s remaining turns into 2s remaining

thin stratus
#

But whatever the Server sends is the same or not o.o

If I send Start = 2000 and Length = 10, or if I send End = 2010, why would that be different?

chrome bay
#

Doesn't help that I can't put into words what I'm thinking πŸ˜„

#

Well because the ping + sync is changing over time as that timer continues

#

So it sort of looses sync as that changes over time, or at least looses sync with the rest of the game

thin stratus
#

Okay so your actual countdown, that produces the final number to display is:

EndTimestamp - GameServerSeconds ?

chrome bay
#

yeah

thin stratus
#

Okay, makes sense

chrome bay
#

clamped between the 0 + timers length

#

Let me check a sec, I'm doing this for my dropships and the sync on those is pretty good

#

Yeah

#

I'm using the "End" time + a length

#

And then UI shows that relative to the "actual" current server world time

#

Though that probably should factor ping in too.. IDK

thin stratus
#
struct FGameTimerData
{
  float EndTimestamp;
  float Length;
}

// Server
FGameTimerData GameTimer = { GetServerWorldTimeSeconds() + 10.f, 10.f };

// Everyone
float TimeRemaining = FMath::Clamp(GameTimer.EndTimestamp - GetServerWorldTimeSeconds, 0.f, GameTimer.Length);
#

So something like that

#

Not actual working code, just pseudo stuff

chrome bay
#

Max(0.f, NextTime - ServerTime)

#

So yeah, what you have there

#

Then ServerTime could also factor in the ping if you wanted to try and make it closer perhaps

#

Which it seems is what I'm doing

thin stratus
#

Not for now. Just wanted something that is easier to actually use.
Being able to set a Timestamp that always changes ensures that I can trigger the OnRep properly

chrome bay
#

yeah

thin stratus
#

E.g. to change visibility of a widget or so

chrome bay
#

failing that, could just force it with an embedded counter in the struct too

thin stratus
#

True

#

But right now it's mostly BP and we all know how fun it is to modify BP Structs

chrome bay
#

Oh for sure πŸ˜„

thin stratus
#

Might just move it to C++ I guess >.>

#

Thanks for the input!

chrome bay
#

But yah TL;DR, I think end timestamp + length seems to produce the most reliable timer

thin stratus
#

It makes sense atm

#

Not sure how easy it is to maybe embed a ping into this whole thing, but that's also not important atm

lusty sky
#

@eternal nacelle u about to catch a ban

#

<@&213101288538374145>

modern cipher
#

I'm so confused what is the benefit if you hack a discord account?

lusty sky
#

idk just dont click on fake discord nitro links u wont get anything

verbal tendon
thin stratus
verbal tendon
#

it's for hijacking the steam account

#

And some people's steam accounts have lots of goodies to be traded away

rotund badger
#

Reminds me of the whole streamcommuninty thing with bots a while back, where you sign in and they nick all your csgo skims

thin stratus
#

@chrome bay Do you happen to know if the WorldServerTimeSeconds reset when SeamlessTraveling?

#

Ah I see, Epic is already trying to calculate the difference in WorldTime wit hthis ServerWorldTime

#
void AGameStateBase::OnRep_ReplicatedWorldTimeSeconds()
{
    UWorld* World = GetWorld();
    if (World)
    {
        const float ServerWorldTimeDelta = ReplicatedWorldTimeSeconds - World->GetTimeSeconds();

        // Accumulate the computed server world delta
        SumServerWorldTimeSecondsDelta += ServerWorldTimeDelta;
        NumServerWorldTimeSecondsDeltas += 1.0;

        // Reset the accumulated values to ensure that we remain representative of the current delta
        if (NumServerWorldTimeSecondsDeltas > 250)
        {
            SumServerWorldTimeSecondsDelta /= NumServerWorldTimeSecondsDeltas;
            NumServerWorldTimeSecondsDeltas = 1;
        }

        double TargetWorldTimeSecondsDelta = SumServerWorldTimeSecondsDelta / NumServerWorldTimeSecondsDeltas;

        // Smoothly interpolate towards the new delta if we've already got one to avoid significant spikes
        if (ServerWorldTimeSecondsDelta == 0.0)
        {
            ServerWorldTimeSecondsDelta = TargetWorldTimeSecondsDelta;
        }
        else
        {
            ServerWorldTimeSecondsDelta += (TargetWorldTimeSecondsDelta - ServerWorldTimeSecondsDelta) * 0.5;
        }
    }
}
#

Someone reported that the ServerWorldTimeSeconds at some point were like 3-5 seconds off

#

This would kinda make sense if the average suffers from some bigger gap, but eh

winged badger
#

direct replication can get slow under load

thin stratus
#

Yeah I guess what happened was that they maybe had a new bunch of values or a reset with the > 250, and then had only one older value and the average calculation then freaks out

#

e.g. if you have timestamps 20, 50, 51, 52 and divide that by 4 you get 44

winged badger
#
#pragma region NetworkClockSync
    UFUNCTION(Server, Reliable) void ServerRequestWorldTime(float ClientTimestamp);
    UFUNCTION(Client, Reliable) void ClientUpdateWorldTime(float ClientTimestamp, float ServerTimestamp);

    float ServerWorldTimeDelta = 0.f;
    float ShortestRoundTripTime = BIG_NUMBER;

    UFUNCTION(BlueprintPure) float GetServerWorldTimeDelta() const;
    UFUNCTION(BlueprintPure) float GetServerWorldTime() const;
#pragma endregion NetworkClockSync```
#

bouncing through the PC for network sync every 10 or so seconds

thin stratus
#

So Client asks Server for WorldTime, Server sends it back, and everyone keeps ping in mind

#

But either way, the OnRep from the Engine could cause bigger gaps I guess

winged badger
#

sends it back along with client timestamp at the time request was made

#

so you can calc ping and everything

thin stratus
#

So you basically get the full ping from Server - ClientTimestamp?

winged badger
#

and you use the delta calculated from shortest round trip

#

as it will be most accurate

hybrid zodiac
#

Hi everyone, how do I use conditional replication in actor components? I tried the usual way using a DOREPLIFETIME_CONDITION with the COND_OwnerOnly condition, but it doesn't work. The client only receives the data if I use DOREPLIFETIME. Is there a limitation in conditional replication for actor components?

winged badger
#

well, no

#
void ARTS_PlayerController::ServerRequestWorldTime_Implementation(float ClientTimestamp)
{
    const float Timestamp = GetWorld()->GetTimeSeconds();
    ClientUpdateWorldTime(ClientTimestamp, Timestamp);
}
void ARTS_PlayerController::ClientUpdateWorldTime_Implementation(float ClientTimestamp, float ServerTimestamp)
{
    const float RoundTripTime = GetWorld()->GetTimeSeconds() - ClientTimestamp;
    if (RoundTripTime < ShortestRoundTripTime)
    {
        ShortestRoundTripTime = RoundTripTime;
        ServerWorldTimeDelta = ServerTimestamp - ClientTimestamp - ShortestRoundTripTime / 2.f;
    }
}
#

ping is difference between timestamp when request was sent and timestamp when reply was received

thin stratus
#

Right and ServerTimestamp is somewhere inbetween

winged badger
#

serverr doesn't track the per client ping here, it doesn't care

thin stratus
#

Why do you only care about smaller values?

winged badger
#

i care about the delta only