#multiplayer

1 messages Β· Page 104 of 1

winged badger
#

you'd need to RPC every single change

#

then server sets the replicated properties, and those replicate to other clients

keen hound
#

How would I detect if a player joined a server

#

I'm assuming post login

winged badger
#

HandleStartingNewPlayer is best place to put spawn logic in

cedar lagoon
#

Hum, cause I wanted the client to spawn it locally (so no lag at all) then be able to to move it as he wants while still being replicated to others but not to the player

winged badger
#

it works both for hard and seamless travel

#

you have to RPC every client local change to server if you want other clients to see it

#

there is no way around that

#

except starting from FScoket and implementing p2p

#

bypassing unreal's replication system entirely

cedar lagoon
#

Ok it's clear then I'll simply go with a replicated actor and move that actor, would be way easier, but I loose the cool thing to not have any delay while the player moves the actor, anyway thank you for your help πŸ™‚

winged badger
#

you can predict it

cedar lagoon
#

Sounds interesting

winged badger
#

you can spawn the actor locally, then have the replicated one replace it

#

when it arrives

#

as long as local PC is the owner of the Actor on server, Actor will be able to RPC its own stuff

cedar lagoon
#

Yeah thats what I tried, but I ended up having a local variable holding the local spawned actor, and another var set as replicated that hold the actor spawned on the server, but the problem is that since this actor is marked as Replicates, then the client was able to see it also

winged badger
#

you can try to cheat if you don't mind a minor performance impact

#

base that Actor on Character, use CMC with client Auth movement

winged badger
#

basically

#

you Spawn Actor A on client, RPC to Server to spawn Actor A1

#

server sets the owner of A1 to PlayerController that requested the spawn

#

when A1 calls PostNetInit ideally, BeginPlay is also kinda fine, it checks if its Owner is a PlayerController and if that PC is locally controlled

#

then it contacts the PC "hey, replicated version of me arrived", PC destroys A, replaces A references with A1 refereces and pretends its the same Actor instance

#

(doable from BP, with BeginPlay)

soft cape
#

Has anyone recently attempted to remove "lobby" widgets from clients when the host initiates a ServerTravel()? Any call to removing a lobby screen widget seems to break the clients player controllers that are attached to the in-game pawn

cedar lagoon
#

Oh yeah I got it, I'll try that, do I need to keep the actor marked as Replicates right ?

winged badger
#

A1 yes, A doesn't matter

#

you can have it as replicated by default, it won't do any harm

cedar lagoon
#

Ok, then, make sense, thank yu so much, can't wait to test it !

winged badger
#

alternatively

#

you can have A1 cache the reference to PC that requested it

#

also set the owner

#

then use OnlyOwnerSee/NoOwnerSee

#

the approach used for FPS/TPS meshes in a FPS game

#

but client will end up having 2 actors, only one will be hidden

#

i find approach #1 more elegant

winged badger
cedar lagoon
#

Yeha me too, especially for this project I think it don't requires it

#

@winged badger Thanks anyway, you are the kind of guy who really makes the unreal community greater, really appreciated.

limber gyro
#

if a have a cooldown float going down each each frame on tick, it should happen both in the server version and client version right?

winged badger
#

yes

limber gyro
#

im talking about a character

#

ok so why is it not going down tho

winged badger
#

Tick will execute on both

limber gyro
#

i have this snipet of code inside "tick"

#

but if check them inside a server RPC they are never 0

winged badger
#

ugh, those should be subobjects

limber gyro
#

doesnt run

winged badger
#

you're making a god class there

#

where is your Super call?

#

ah, this is not Tick

limber gyro
#

no no, thats just in child class

#

its a hero shooter so i have a base class for the heroes

#

and then all heroes are child classes

winged badger
#

that doesn't look like it should compile

limber gyro
#

why?

winged badger
#

server RPCs don't like non const& structs in their payloads

#

or any RPCs for that matter

limber gyro
#

doesnt complain

#

im in 4.26 if that helps

winged badger
#

odd

limber gyro
#

anyways, thats not why i am here xD

winged badger
#

and if you break that

limber gyro
#

why the heck is my server var not going down

winged badger
#

does it run?

limber gyro
#

what do u mean break?

#

put a break point on it?

winged badger
#

yes

limber gyro
#

let me check

#

runs just fine

winged badger
#

and when you break the tick after you hit the server RPC breakpoint?

limber gyro
#

you want me to put a break in the rpc and the tick?

winged badger
#

i want you to break tick

#

while stuck at RPC breakpoint

#

then continue

limber gyro
#

i just did

#

it says that the cooldown is 0

#

but the rpc says its 6

winged badger
#

note that you'll be hitting tick break on both client and server here

limber gyro
#

im hitting it only once tho

#

i think

winged badger
#

you should hit it immediately after continuing

limber gyro
#

i only see the 0 value

winged badger
#

and it should alternate between server and client

#

ok

limber gyro
#

yep thats what i was assuming too

winged badger
#

so

#

break the RPC only

#

trigger it

limber gyro
#

i was also assuming that i would see a 0 and a 6 in the values

winged badger
#

F10 your way past the line where the value is assigned in the RPC

#

verify its 6 in locals

#

then right click on the variable in locals and select Break when this value changes from the menu

#

then continue

limber gyro
#

i did all that

#

doesnt change

#

doesnt break

winged badger
#

if has to hit the data breakpoint

limber gyro
#

i dont know man, the game is jsut running normaly

#

nothing is breaking

winged badger
#

but RPC did break?

limber gyro
#

if i put the break point on it, it will break

#

i removed them to see if it would break on its own with the "break on value change" thing

#

im just trying to make a server check on the cooldowns so players dont cheat

#

NVM im a retard, i was checking the wrong variable

keen hound
#

how would I show a dedicated server in a server list?

limber gyro
#

in ur game instance for example

#

and then steam is gonna pick it up

#

if ur not using steam or a subsystem in general ur gonna have to implement ur own solution and talk with a master server somehow

winged badger
#

GI doesn't have BeginPlay

#

you need to configure the DS startup map, use GameMode BeginPlay

limber gyro
#

ye its not begin play its "Init"

soft cape
limber gyro
#

before i shoot myself in the foot

#

is it a good idea to set cooldowns both in the server and client and hope they are synced enough to not interfere with gameplay?

fossil spoke
#

Otherwise Clients could potentially just cheat it.

limber gyro
#

ye thats why im giving it authority

#

i was just wondering if it was a good thing to do

fossil spoke
#

If you arent making some hyper competitive shooter or something, desync on the Client side should be fine.

limber gyro
#

basicly i have a "callSpell" function that will set the client cooldown and call the RPC, in the RPC i check the cooldown and set the server cooldown

#

well, it is a competitive shooter....

fossil spoke
#

Then maybe you need to be concerned about it being synced.

limber gyro
#

i will see how it goes in playtest

#

and go from there

#

i didnt want to replicate cooldowns cause the var update is a bit choppy, so i would need to make dummy variables

#

so it wouldnt look bad

fossil spoke
#

If you have a synced clock you can always send the timestamp and adjust the Cooldown to account for some latency.

fossil spoke
#

If you are using GAS i believe cooldowns are pretty well managed for you.

limber gyro
#

im not using gas

#

i've been on this project for like 3 years

#

gas wasnt a thing when i started

fossil spoke
#

Pretty sure GAS is more than 3 years old at this point.

#

I could be wrong.

quasi tide
#

It is

#

It's been in since Paragon

fossil spoke
#

Yes I more meant available to the public

quasi tide
#

It has been.

fossil spoke
#

πŸ‘

quasi tide
#

It just wasn't all that well documented

limber gyro
#

well i wasnt aware of it when i started

#

i think

#

and even if i was i probably thought it would be overkill

fossil spoke
#

We picked up GAS much after it was released publically.

#

Its been very helpful.

limber gyro
#

i will 100% consider it for my next project

#

atm i just cant be arsed ahahah

quasi tide
#

Pretty sure even Valorant uses GAS

#

Could be wrong though. Don't quote me!

hollow eagle
#

iirc they don't as they started on valorant too early. They did build something similar.

#

I'd have to dig up where they said that though

rain condor
#

I can't replicate attach. SpawnActor it's replicated because if i put another location i'll see it

plucky prawn
hollow eagle
#

by knowing about that video already?

plucky prawn
#

Ah fair

#

I forgot like... A lot of stuff I watch, or if I don't forget it, I forget the video it's from

rain condor
rocky kestrel
#

How server hosting works? I have currently hosted my own dedicated server locally with port forwarding. But I would like to upload my server to some cloud service. I have zero experience of that.

elder sable
#

Hi, Any member of FFastArraySerializerItem is serialized ?

fossil spoke
#

Otherwise any UPROPERTY member will be automatically serialized.

#

If you override NetSerialize you must serialize each member you need manually.

elder sable
#

Mhh ok thanks ! Will try to understand how they did with mass

rain condor
obsidian cargo
#

Is there any sort of event or OnRep to know when a runtime spawned component has replicated to a client?

#

I'm considering adding an event to the owning actor and having runtime spawned components broadcast through that event during BeginPlay if they are on the client. This has a code smell to me though.

#

I'm using the GameFeature plugin from Lyra to runtime spawn some components, but now I client UMG widgets to initialize based on the state of the replicated component.

winged badger
whole pine
#

why isnt this replicating

chrome bay
#

Get rid of all that Multicast event. Set a replicated bool from the Server event, use an OnRep callback to set the visibility

blazing spruce
#

Hi, I'm having a slight issue with my decal spawning, it mostly works however clients don't see the decals that are spawned on walls but everything else is replicated properly.. I suspect its the rotation not replicating properly, any ideas how i can get it to replicate the rotation correctly?

chrome bay
#

Why would decals be replicated at all?

#

Decals are visual effects and should generally be spawned locally. Also on a dedicated server, particles don't exist.

solar adder
#

I spawn a replicated actor using multicast. On the creation i pass some variables to it. Why is it, that on the server these values are set correct, but on the client they have the default values, unless i turn on replication for those variables? I didnt expect that replication would be needed for those variables, since i create it on client with the same values

blazing spruce
# chrome bay Why would decals be replicated at all?

I know that usually visual stuff doesn't need to be replicated and im not even entirely sure exactly how mine are replicating cause im not doing any RPC's for the decal spawning, however regardless of them being replicated or not, clients still dont see decals spawn on walls

chrome bay
chrome bay
#

But even if you do mark them replicated, nothing about decal actors is actually replicated by default.

#

So you'll have a decal actor with a position and orientation but nothing else.

stable seal
#

1-i have random anim montages for 1 movement like slide in the video. when one of them plays anim1 other one can see anim2 sometimes. Both gets random anims

#

2- idk why they teleport sometimes

blazing spruce
# chrome bay Presumably you've marked the Blueprint as replicated - but if you haven't, then ...

Okay so maybe im doing this whole thing wrong.. if i dont have the decal actor replicated then the clients dont see them spawn at all, i imagine thats because im doing the IsServer check when getting the collision data from the particle system, however if i dont do the IsServer check then the client see's like double the amount of decals spawning compared to the server player which isn't ideal

#

How should i be setting this up so decals spawn, doesn't matter if they're in the same location for everyone, but they are able to spawn on all surfaces?

chrome bay
#

The TL;DR is none of this should be replicated or care about networking at all. That Server check shouldn't be there and it implies something else is going wrong

#

EventReceiveParticleData would only ever be called locally

#

Start by disabling replication of the decal actor completely, and removing the IsServer check. 'BloodSpurt' shouldn't be replicated either.

#

Niagara/Particle Components don't have any network functionality

blazing spruce
stable seal
solar adder
# chrome bay You shouldn't spawn a replicated actor from a multicast at all. The server shoul...

ahh i see. Could you please explain something? I saw network corrections in some tutorial: As i understand they happen when some local actor falls out of sync with the server version

  1. If i spawn a replicated actor on the server, it means that i dont have the local version on the client - only the replication, so there wont be any network corrections, right?
  2. I thought that if i multicast a replicated version, i would receive a local and server copy, and the server would apply corrections to the local if it goes out of sync.
  3. In general i am trying to figure out the best way to deal with projectiles - do i just multicast an unreplicated version. Because spawning a replicated version on the server seems to create jerky effect
chrome bay
# solar adder ahh i see. Could you please explain something? I saw network corrections in some...

If you spawn a replicated actor on the server, clients will create a copy of that actor locally when they receive it and replicated properties will be sent from the server version to the client version. If you spawn via a multicast, you will have two actors on the clients. One will be the Servers' replicated one, other other will be an extra one you spawn locally that the server has no idea about.

#

RE projectiles, hard to say. If you are spawning it as a replicated actor, with replicated movement, and the client also simulates movement locally, then most of the time it should be "fairly" smooth - but it won't be perfect.

#

The problem is that if a client spawns an actor locally, the server has no idea about it, so it can't do anything to/with it

solar adder
limber gyro
#

any 1 knows why this setup always returns 9999 ping?

chrome bay
#

If this is Steam, it's because doesn't report ping to lobby sessions.

#

At least, Epic's default implementation of it doesn't, you have to do it yourself in code.

stable grotto
#

How to test if an event is too heavy on bandwidth or CPU πŸ€”

graceful flame
rose pollen
#

jesus i just spent forever on a crazy bug, it seems that if you have a replicated actor with a child actor component and the child class is not replicated, the child blueprint will execute as both server and client and furthermore when it executes the "has authority" node will give both the server and the client authority

quasi tide
#

with a child actor component
Gross

pallid rampart
#

is it ok to check things like islocallycontrolled or has authority in beginplay or is there a better place?

obsidian cargo
#

You check where it is needed for the logic following

rain condor
#

Any idea why this not replicate attach?

#

Return true on client but false on sv

coarse gale
#

I think on rep only runs on clients, but not 100%

#

so from my understanding, you are setting the item to attach as a replicated variable, and then that is running onrep on all the clients, the server never runs the attach event. I think

rain condor
#

I tried this too

coarse gale
# rain condor

I dont really know what is required to do this as ive not tried to attach anything like this yet. But what I can say is that before you were only attaching on clients and now you are only attaching on server.

thin stratus
#

OnRep calls on everyone (that have an instance of the actor) however the attach should be replicated

#

Bigger questions are: Is that actor replicated and where is the RPC in?

rain condor
#

I found the issue

#

Player was not valid

#

Idk why

#

Because a made a initialization function who is called on bp_maincharacter beginplay

fathom aspen
fathom aspen
#

And if you're a blueprint guy, there is oncontrollerchanged i guess

nocturne quail
#

if I play the game with two clients, both are forced to look at the right or left, no one is looking straight forward.
is it possible to fix it

#

only the head is rotating by itself πŸ˜„

whole pine
#

if antoher client has a rep notified list of worn items, how do i retrieve them

whole pine
#

they are set to a structure variable

coarse gale
latent heart
#

That is correct

whole pine
#

@latent heart

whole pine
#

how do i RPC scene capture

mystic estuary
#

Hello, I'm trying to replicate my UObject, but for some reason it doesn't call the OnRep whenever I change the value server-side. I'm following this https://jambax.co.uk/replicating-uobjects/, but it still doesn't work.

My UObject that I want to replicate:
Header: https://pastebin.com/ajCvkJC8
Source: https://pastebin.com/ttULH3Qc

The actor owning the UObject is the PlayerState:
Header: https://pastebin.com/qk9nWsQKr
Source: https://pastebin.com/9PQDzwQr

I call the AMTD_PlayerState ::SetHero() client-side, and it gets there, but the OnRep is only called server-side because I do it myself to run the same logic server-side as well.

Does anyone know why it may not be replicating the object?

EDIT: AActor::ReplicateSubobjects() says the following:

/** 
* Method that allows an actor to replicate subobjects on its actor channel. 
* Must return true if any data was serialized into the bunch.
* This method is used only when bReplicateUsingRegisteredSubObjectList is false.
* Otherwise this function is not called and only the ReplicatedSubObjects list is used.
*/

Hence it requires bReplicateUsingRegisteredSubObjectList to be set to true.

grizzled stirrup
#

When you have ClientAuthorativePosition=true does anyone know which part of the character movement component actually sets the location of the simulated clients on the listen server?

whole pine
#

each player has a rep notified structure variable that contains what items they are wearing, what they equip or unequip is replicated but i need to retrieve another clients scene capture from their inventory and also replicate the equipped and unequipped items there too

latent heart
whole pine
#

or get their rep notified item array and attach it to the default scene capture every player has

#

honestly whatevers easier

latent heart
#

Why are you using a scene capture?

whole pine
#

to show equipped items when you open a players inventory

#

owning player already has it set up

#

idk how to retrieve other clients

dark wing
#

is this in kilo bits or kilo bytes?

whole pine
mystic estuary
half umbra
#

if i use this "Get Game Time Since Creation" then for multiplayer game, everyone will have same time?

#

or i need put this time to replicated float?

rain condor
#

Why player return me not valid?

sinful tree
#

The "Set" of your Player variable in "Initialization" is not the same variable as the one you're accessing in OnRepItemToAttach. Are you setting the Player variable in the blueprint that has OnRepItemToAttach?

rain condor
#

It's the same

#

The second picture

#

It's replicated because it was an attempt to make it work

bronze glade
#

Hey everyone, this might be a silly question but I am fairly new to multiplayer systems and don't know much about cheating.
If I store variables on a blueprint actor, is that something that a cheating player could access and modify the variables on their client?
Opposite to this, if I store those same variables on the server instead and call them from the bp actor, could they still modify the values?

mystic estuary
#

How OnRep is supposed to work? I'm trying to replicate a UObject, but client-side the OnRep is called twice. The first time the argument is not nullptr (it has the old object value), while the replicated object is nullptr, and the second time it's vice-versa -- the argument is nullptr, and the object is valid, and has the server value.

Should it be working this way or I'm getting it wrong?

grizzled stirrup
#

ClientNetSendMoveDeltaTime is only the tick rate for each human player in a game right? No AI characters replicating down will be affected?

real ridge
#

HEllo guys I have question I cant solve one of my problems even I am debugging It, I have function which is called when I crash or my plane is killed it is called via ma controller and then its called to my game mode , it is working perfectly always just when I die with someone else at same time just one of us is respawned, in all other cases its working good,any ideas ?

#

and its called from my pawn

obtuse field
#

What are other methods of voice chat, that work on dedicated server beside EOS?

faint parcel
#

My FFastArraySerializer subclass's void PostReplicatedAdd(const TArrayView<int32> AddedIndices, int32 FinalSize); isn't being called, I don't know where to start debugging πŸ˜›

#

An item is added to the array, MarkItemDirty is called on the item.

fossil spoke
#

@faint parcel Does your FastArray ::NetDeltaSerialize function call FFastArraySerializer::FastArrayDeltaSerialize?

obtuse field
faint parcel
obtuse field
#

Nvm. they said its deprecated

fossil spoke
#

ODIN is free I believe

#

Ive integrated it before.

#

Its pretty good.

#

Lacks some features.

#

I havent used it in a while.

#

So that might have changed.

obtuse field
#

Ty, I will take a look for sure

obtuse field
fossil spoke
#

Yeah well you are unlikely to find an entirely free VC solution that has everything you want.

hushed rain
#

Say I want to have a rank system in my Listen server hosted game but dont want people to be able to print wins, is there some way to create a "consensus" between players to validate a match's results?

#

Or does steam have a built in system for this?

quasi tide
#

No sensible way really.

#

Each instance could report the game and you could just accept the majority or w/e

#

To some backend server that is.

#

But for ranking stuff, you really should plan for dedicated servers.

#

Not a single soul likes ranking systems and it not being on a dedicated server.

hushed rain
#

Yeah that's understandable but a lot of old games without dedicated had some sort of rank system I'm wondering how that worked

quasi tide
#

Very shittily

hushed rain
#

Maybe they just said fuck it who cares if people cheat lol

fossil spoke
#

You have to remember to that older games would have had such a small percentage of people that would have even known or cared about cheating

#

Than todays games do

hushed rain
#

Yeah that's true

sinful tree
# real ridge and its called from my pawn

You don't want to have this event marked as Run On Server otherwise a client will be able to call it and feed it whatever data they want and at any time (if they're manipulating their client)
Your issue is because you're using the game mode event and a delay. When you trigger the event there is only ever 1 copy of it running, so the next time the event is called, the data from the previous one is no longer present so when the delay does finally finish, it's reading the second one's data. Perhaps it would be best to delay in the player controller before calling your respawn event in the game mode.

soft cape
#

Has anyone had issues with clients (sometimes) not connecting to host when using FindSessionById(), then calling JoinSession() after the completion delegate passes? It seems to be inconsistent where sometimes the client joins host without issue, and other times the client gets a Timed out connection error.

#

Even JoinSession() will return back true but the client will still time out. Thought this method approach would be the ideal way for clients to connect along with their host, but it seems something wrong is amidst

#

I'm on UE5.1.1 if that matters

obsidian cargo
#

Is it possible to have a component set the rep condition COND_OwnerOnly on itself? I'm using GameFeatures to spawn components on actors, and you can't set LifetimeReplicatedProps on those types of components.

hollow eagle
#

component replication isn't controlled by LifetimeReplicatedProps. At best that controls the replication of a reference to a component, but not the object itself.

#

You can either call AActor::SetReplicatedComponentCondition or override UActorComponent::GetReplicationCondition on the component itself.

obsidian cargo
#

Oh really? Wow I misunderstood how that worked. Thanks for the clarification!

obsidian cargo
hollow eagle
#

structs aren't components

#

and UObjects aren't replicated via properties referencing them, period

#

they're replicated via either the ReplicateSubobjects method on an actor or the newer replicated subobject list (also on actors).

obsidian cargo
#

Thanks for the clarification!

solar stirrup
#

Actors aren't guaranteed to replicate to all relevant connections at once right?

#

Is there a way to make sure a property gets replicated to all connections at the same time?

hollow eagle
#

there are zero guarantees possible about when something will be replicated

fossil spoke
#

There is no way to guarantee they will arrive at the same time.

hollow eagle
#

even if you managed to get unreal to send a change out at the same time you can't guarantee anything about when someone would receive it anyway

solar stirrup
#

Figured

#

Trying to think of a way to replicate something viably

#

I have states that may succeed each other

#

Or just like run super fast on the server

#

Which means with normal property replication that the client might never know about it

#

Trying to figure out a way to replicate those reliably without using RPCs

#

Because some those do need to run on the client heh

small grail
#

Open level is totally a client action, right? If it is the server, something I remember is like you need to move the whole session to a new location(level) and bring clients to it.

regal solar
#

For anyone interested in testing Gamelift Anywhere, I've created a script that automates the process of connecting a local server to AWS Fleet. You can find the script on my GitHub repository:
https://github.com/zorigoo0128/GameliftAnywhereManager.git

GitHub

GameLiftAnywhereManager is a Python script that facilitates the management of Amazon GameLift resources for game server hosting across multiple locations. It leverages the Boto3 library to interact...

sinful tree
small grail
real ridge
real ridge
sinful tree
#

Exactly. There is only one game mode and you're trying to execute a delay on it twice from the same event. You cant do that if you want a delay for each player as the delay prevents the execution of the first player spawning and then when you call that event again the data from the first player that is stored in the event is overridden by the second call of the event for the second player.

If you want to delay per player, then make the delay in their controller, and when that delay is finished you can call into your game mode if so desired to spawn them.

vivid seal
#

What kind of network emulation settings do you guys consider β€œrealistic” to test for. For example, my custom root motion stuff works great at 200ms but at 1% packet loss on top of that I will occasionally get net corrections or doubling of certain moves. Is this normal or should things still be running smoothly? At what % packet loss and how much latency should I be able to play without net corrections

small grail
#

I think it is normal

#

200ms, god...

thin stratus
#

200ms is most likely the upper limit. 100 to 150 is already enough though.

#

Everyone with that or a higher ping won't be enjoying the game anyway :D

small grail
#

They should consider change the physical server area or check their network condition.

#

I won't complain any weird things happened if I've got 200ms lag.

vivid seal
#

Yeah I figured above 200 probably wasn’t really worth designing around, but wasn’t really sure with packet loss as I don’t know how much packet loss the average player has

thin stratus
#

Noob dev. Can't even fix 500ms ping. It's just half a second bro. Ai could fix it.

vivid seal
#

ChatGPT how do I fix 500ms lag???

small grail
#

You should check how google fix it for stadia using negative latency tech

#

Which I don't understand how

thin stratus
#

I recall enough games for a while actually kicked you

#

If you had a high ping for too long

#

Wonder if that practice is still a thing

real ridge
#

i think I get your answer

#

thanks"

whole pine
#

how do i rpc a scene capture

near granite
#

log says like this when openning the packaged server. I don't understand what it means

nocturne iron
#

Is it possible to make a RPC non-sequential, or property replicate from client to server. I need to update positional information in a system where the client is trusted? (The data is positional information from an assisted outside-in tracking solution for a proprietary VR setup)

real ridge
#

@sinful tree it fixed my problem! thanks I did not realize that this is problem

solar adder
#

hi! i have another question about replication. I spawn a replicated actor on the server with replicate_movement=true. It moves based on tick. When i change the movement speed for it on the client (switch_has_authority=remote) i expected it to be laggy due to network corrections (p.NetShowCorrections 1), but in reality the server and client versions just go out of sync with no corrections.
When i try the same in clean 3rd person template for 3rd person character (changing max walk speed locally), i see the server corrections.
Do there corrections happen out of the box only for character/projectile movement components?

near granite
#

Sublevel set visible also should be done from server to multicast ?

small grail
nocturne iron
#

Not sure if this is a property of Unreliable?

whole pine
#

no one knows how to replicate a scene capture eh

chrome bay
#

Not really sure why the sequence matters, you can send Unreliables to the Server from a Client without problems. Not sure why you would want them to be called out-of-sequence...

rocky kestrel
#

This is happening in gameInstance

#

And this game mode

#

Should I put delay to beginplay so server would be created first? Or should I put create advanced session to game mode?

#

Or is this okay?

nocturne iron
upbeat basin
#

As Jambax stated, I guess making them unreliable is only optimization, with vanilla engine at least, you can have here

#

You don't make any difference on sequence part, but at least you don't need to force the packets to arrive since there will be another update sooner or later

upbeat basin
# rocky kestrel Or is this okay?

If net mode is guaranteed to set on the GameInstance::Init (I'm not sure if it is or not) I don't see any problem here unless you need to save file part to work exactly after session is creation. If you need to though, then I would put the save file part on the OnSuccess pin of CreateSession node, whether they all be on GameMode or GameInstance

rocky kestrel
torpid girder
#

i am looking at my server, i see it listening on tcp ports and udp, should i open up all these ports?

chrome bay
#

Unreliables will not be resent anyway

#

They're either received and processed or they aren't

upbeat basin
#

Also if you're not working with listen server and have a different logic for that, you don't need to check if you're on dedicated server for GameMode

#

GameMode won't exist on any other machines executables anyway

rocky kestrel
#

I am creating Rust like game so only dedicated servers

rocky kestrel
upbeat basin
#

If you mean a custom function/event by custom beginplay event, sure that would be fine as well

solar adder
# small grail Usually you don't replicate movement

i see. But what about network corrections, when does it kick it? Lets say i have an actor out of sync, can i somehow force it to be corrected? And why doesnt it happen automatically only for 3rd person character for example?

upbeat basin
pine cipher
#

does advanced sessions work rn on 5.1.1

rocky kestrel
pine cipher
rocky kestrel
#

I have working dedicated server and it works. I can even see my server on steam public server browser

rocky kestrel
#

In this quick reference guide I explain how to get Steam Dedicated Servers working with Unreal Engine 5.

Join my discord for additional support: https://discord.gg/qassP7Y

Here are the important bits you need to know that I talked about:
AdvancedSessions Plugin: https://vreue4.com/advanced-sessions-binaries
UnrealEngine Source Releases: https:...

β–Ά Play video
nocturne iron
#

Where is the correct place to populate GameState properties that resides in the GameInstance on map load?

#

It need to be replicated before client pawn spawn, and set before server pawn spawns.

#

Is InitGame too early?

chrome bay
#

Earliest possible place is AGameMode::InitGameState, or you can just override gamestates PostInit / PreInit functions

#

Zero garauntee it'll replicate before the client pawn is received

nocturne iron
#

Is InitGameState before or after InitGame?

chrome bay
#

Don't know, InitGameState is called from PreInitComponents

nocturne iron
#

Think that's before

chrome bay
#

You have no garauntee the gamestate will be valid when your pawn is received on a client though either way

#

Replication order between actors is never garaunteed

nocturne iron
#

How is default map classes replicated then?

chrome bay
#

Like any other actor

#

They arrive whenever they arrive

nocturne iron
#

Hm

#

Guess i will just have to OnRep then :)

chrome bay
#

OnRep or use callbacks if they exist

#

UWorld::OnGameStateSet for instance

nocturne iron
#

Right, but it's a property on the GameState

chrome bay
#

Unfortunately on the Server, that's before InitGameState. Utter genius design from Epic

nocturne iron
#

Then i would have to create my own callbacks

#

Hah xD

chrome bay
#

The only thing you do know for certain is that BeginPlay() isn't called until the Game State is received

#

But I don't like initialization in BeginPlay so 🀷

nocturne iron
#

Yeah, I don't ether.

#

But InitGameState + OnRep seems to solve my issue :)

#

Thanks

torpid girder
#

hello, other than opening up udp/7777 should i open the tcp port that my server seems to be listening on?

silent valley
torpid girder
#

I am using redpoints eos plugin

silent valley
#

I don't know about EOS. Maybe the docs list other ports?

torpid girder
#

oh i was just asking here as i had been reading and i saw the server listening on tcp ports

silent valley
dark wing
grizzled stirrup
#

if (GetRemoteRole() == ROLE_AutonomousProxy) Can never be anything but human players right?

#

As in can't be AI controlled characters

robust linden
#

how can I make my 1st person character have a visual representation for other players like a 3rd person character?

teal fog
#

I've got one humdinger of a replication problem here. Preface: UE 5.2 BLUEPRINT PROJECT (except for an extended character movement component). I suspect the answer will be "swap to C++", but that's no obstacle.

Players pick up and put down objects in this game, which are physics-enabled on the server (yeah I know.) The replication of object parenting and referencing works flawlessly, this is a purely visual bug.

When a client player "drops" an item (which clears its ownership and detaches it from the actor, no other network related effects) sometimes a bug will occur where, on the LOCAL CLIENT ONLY, the object snaps back to it's original position it had before being picked up. From that position any local effects will be applied to it, such as force impulses. After the client receives fresh data from the server, the item will "snap" to where it should be and play continues without issue. Note that on the server, everything looks fine - the player releases the item without issue from where they are standing.

This bug is not consistent. I can pick up-drop items for 60 seconds straight without the bug happening, and then it will occur again.

I've tried Net Relevancy, Net Dormancy, disabling Replicate Movement on the client on pickup, on drop, everything in between, and nothing will fix it. It happens on 500ms ping, 250, 50, editor-launched windows, packaged builds, everything.

Anyone have any ideas?

chrome bay
#

Sounds to me like the client is changing the attachment state locally. They then receive an interim update from the server, so it snaps back.

#

The Server is the one which should manage attachments and whether physics is enabled or not. That info will replicate to clients automatically so long as replicates movement is enabled.

teal fog
#

Interesting, I wonder why that update would cause it to snap to the position it had before being picked up?

chrome bay
#

Because the client is manipulating something locally that is server-controlled

#

They get an interim update from the Server, which breaks the client-predicted change, then a short time later it resolves

teal fog
#

The server does the item attachment as well, like I mentioned the server has the object where it "should" be the entire time

chrome bay
#

All attachment/physics should be set by server, client shouldn't do anything

#

Just attach/replicate and make sure Replicates Movement is checked on the object.

#

I can't say for certain, but it sounds to me like the client is changing it as well

#

When a client player "drops" an item (which clears its ownership and detaches it from the actor, no other network related effects) - to me this reads as the client detaching it, not the client telling the server they've dropped it, and the server detatching it

teal fog
#

It happens on both, the client runs the "drop item" for local responsiveness and the server does it when it gets the RPC

chrome bay
#

That's why it breaks

#

You drop it locally, you receive an interim packet from the server which reattaches it breifly, the server receives the RPC, sends the new update which then detaches it again

#

Higher latency will make it more noticeable

teal fog
#

So I should do the local item drop with a dummy item for responsiveness

chrome bay
#

Don't do it at all IMO

#

If anyone is playing the game with 500ms lag and complaining about responsiveness that's their problem

teal fog
#

That's somewhat my thought process as well

#

Interesting

#

I still don't get why the server's interim packet causes the item to go to the pre-pickup position, but I'll give it a shot

chrome bay
#

Why pre-pickup IDK, but it just sounds like server/client fighting over stuff overall

teal fog
#

That's what I thought it was as well

#

Am I incorrect in assuming that disabling Replicate Movement on a client tells the object to stop listening to updates from the server?

chrome bay
#

Meh.. it's complicated. Replicate Movement is itself a replicated property, so realistically it shouldn't be modified by a client. If you disable it, the client will not do anything when it receives non-attached replicated movement, but it DOES apply attachment replication.

#

Server is still sending updates regardless

#

The real problem however, is when you enable it again, the client won't update to whatever last replicated movement state was replicated, so that client will be out of sync.

#

Until it moves again on the Server, that is

#

if you were in C++ you could apply it, since you still have the data - but not in BP

teal fog
#

That makes sense. I think what tripped me up was the separation between attachment state replication and movement replication. Makes a lot more sense now, thank you

twilit radish
# grizzled stirrup As in can't be AI controlled characters

To my knowledge, and with a bit of looking around in Cedric's guide and the Unreal source I only see it being used for actual players yeah. Not AI. I also wouldn't quite see why AI needs it anyway as it can never be directly controlled by anything else than the server if we are talking replicated pawns.

#

Sure you can influence decisions it makes through RPCs but ultimately the behaviour tree and all that stuff are not available on the client πŸ˜›

twilit radish
# robust linden how can I make my 1st person character have a visual representation for other pl...

I believe the common way is to have two (skeletal) meshes. One for first person and one for third person. The ones you don't need you can just make invisible locally on a device. So for the character you're controlling you can just hide the 'third person mesh' and and for other clients you hide the 'first person' mesh. Not exactly the most clean thing but whatever I guess. You can if you're really worried about the components existing just dynamically add / remove the components as well.

#

Maybe that you can also use a single component (assuming both your first person and third person meshes are for example skeletal meshes) and just locally change the mesh on it but I'm not quite sure how well that works I'll have to say.

grizzled stirrup
robust linden
#

Tho yeah idk changing the mesh hmmm

twilit radish
# robust linden Tho yeah idk changing the mesh hmmm

The biggest problem that popped up in my head with only having a single component is when you're for example using a listen server. Maybe your game in specific requires hitboxes for your character, then you get the problem that the listen server doesn't have a 'third person' mesh any more and then things can definitely get messy.

#

Maybe that in specific doesn't matter. Not sure, but then again I don't know your game. I listed it anyway πŸ˜›

dark edge
#

swapping out meshes, making 1 mesh visible, 1 not, whatever

whole pine
#

how do i rpc a scene capture

#

no info on the internet

#

im leaning towards getting item info struct of equipped items on a player i click on

#

and showing those on the scene capture player mesh

short arrow
#

You'd RPC what it is you wanted to screen capture

whole pine
#

just replicate it in general

dark edge
#

you rpc the data required to do the scene capture

whole pine
#

ok since my equipped and unequipped items are rpc'd

dark edge
#

they should be replicated but yeah

whole pine
#

can i line trace on a client or something and get theyre equipped items?

dark edge
#

sure

whole pine
#

is that possible with one click?

dark edge
#

line trace -> hit a character? -> get their items

#

assuming their items are replicated data then sure they'll be there

whole pine
#

ok cool,

#

im pretty overwhelmed with this task cause idk to what extent it will work without a server

dark edge
#

if they're not replicated data it'd be more like:
line trace -> hit a character? -> hey mr server, i'd like to see this characters items plz (this is an rpc)
later........
OK client, here's the items you wanted to see (this is an rpc) -> ???? -> profit

#

how are you doing multiplayer without a server?

whole pine
#

just using 2 clients in editor

dark edge
#

there is a server

#

its running in the background

whole pine
#

so whatever is happening with 2 clients in editor is the equivalent to a real server?

dark edge
#

are you launching the play in editor session as multiplayer with 2 clients?

whole pine
#

yea

dark edge
#

then yeah there's a server in the background they are connecting to

whole pine
#

if i dont use run as server but i use 2 clients instead. is that still a server or no

dark edge
#

show your PIE settings

#

you're either running as multiplayer with the 2 clients connecting to a background server or you're just launching 2 instances of the game which are each effectively single player, depends on how much you fucked with the settings lol

whole pine
#

and net mode is on client

dark edge
#

yeah that's doing server, client, client

whole pine
#

phew

dark edge
#

both clients connected to server

#

i mean can you see the other character running around?

whole pine
#

yes

#

i just didnt know if that was true replication or not

dark edge
#

it is

#

basically you pretty much have 4 modes a game can be in

#

standalone (local player, not open for connections)
listen server (local player, open for connections)
dedicated server (no local player, open for connections)
client (connected to listen or dedicated)

whole pine
#

oh ok thanks

#

speaking on that line trace method mentioned above, i know this isnt the right channel to ask but im in top down game mode with one universal camera for all players and i was curious what location settings apply to that situation for the line trace

#

nevermind, i think i can just use get hit result under cursor node instead

robust linden
#

so I guess I need two meshes? But now what about animations, when I want to play a montage, do I do "if IsLocallyControlled() -> Play First Person Montage else PlayThirdPersonMontage?"

quasi tide
#

Pretty much

#

Need to play the right anim based on if it is first or third person.

twilit radish
robust linden
twilit radish
#

To my knowledge that's the most common way games do it yeah. I believe all they do is attach colliders to their characters. So if you for example want your arms to have collision you can attach a capsule collider to something that moves along with the arm, which often are the bones of a skeletal mesh so that if you have different animations they still move along with the animation.

#

This is what CS:GO for example does. And obviously it doesn't have to be as accurate as they do it here. But you get the general idea of how this can be useful.

rain condor
#

Player return invalid idk why

robust linden
twilit radish
# rain condor Player return invalid idk why

What is invalid? In general if you're asking questions on servers like these I would suggest providing more information if you have a problem. Things like errors, explaining what exactly doesn't work etc. πŸ˜‰

graceful flame
twilit radish
rain condor
twilit radish
#

Although I would find it pretty funny if that would be a thing though, Lawlster x)

graceful flame
rain condor
#

I made a function to set it and i called it on begin play main character

whole pine
# dark edge show your PIE settings

this worn items variable is replicated, if i click on another client using the get hit result under cursor node, is it able to detect the variable from that specific actor i click?

dark edge
graceful flame
whole pine
dark edge
#

Replicated just means that yhe variable on the client will be kept in sync with the servers version

dark edge
whole pine
graceful flame
robust linden
#

skeletons can just have simple collision like that? What do you mean?

#

Physics asset?

dark edge
# robust linden what

The skeleton itself can have colliders for the bones. That's what you want to hit test against , and is also what does the physics for ragdolling.

whole pine
whole pine
#

i thought it might

dark edge
#

Idk what the difference is anyway, is that node from pre-5.0?

whole pine
#

no

rain condor
#

if i continue with execution breakpoint don't call anymore

rose turret
#

does anyone have a good explainer about Iris that breaks down exactly what it is? all of the docs are like, "it's multiplayer but better" but I'd like to understand architecture/goals/etc.

graceful flame
#

You can mouse over the output pin variables to see the state as you step through (F10) the nodes one by one. Check the variable after the node was executed or while its stopped on the node not before.

rain condor
#

Yep, the problem it's i get not valid player

#

Initialization it's working

graceful flame
bright tiger
#

Is it necessary to mark input functions like MoveForward in a character as Server to better security?

rain condor
#

And it works

graceful flame
boreal wadi
#

When using the Push Model is NetUpdateFrequency taken into account at all or can I just set my NetUpdateFrequency to the lowest value and have all of my variables send updates manually.

fathom aspen
#

Yeah ofc it is taken into account. Push model only saves you the comparison done to evaluate if a property needs to replicate

#

Lowering net update frequency with ForceNetUpdate works

#

Using dormancy along with flushnetdormancy also works and is far more performant than the prevoius two

rose turret
fathom aspen
#

The only one I know of is in PushModel.h I guess?

twilit radish
#

Also an important note is that even when using push model there are still things that don't use it I'm pretty sure. Maybe that it has meanwhile become a lot better, not entirely sure. But a quick search result on Github in the 5.2 branch still shows me variables that don't support it.

clear island
fathom aspen
#

Indeed

clear island
#

oh interesting, TIL

twilit radish
#

Unreal still has a priority system to prevent overflowing the network or specific client connections. Push model doesn't change that.

obtuse field
latent heart
#

Not even the next broadcast tick. It'll only update if it's that actor's turn to replicate.

#

Or whatever the correcte phrasing it.

#

Even "Force net update" doesn't actually force a net update.

#

It just sets the last update time to zero.

dark wing
fathom aspen
#

Indeed, not next tick but next tick the actor is taken into account @clear island

#

I missread

clear island
#

yea thats what I meant

latent heart
#

I may have also misinterpetted, but I wanted to make it claer!

clear island
#

I used the wrong phrasing

fathom aspen
#

Because if not it will mean immediately

#

Immediately is always next tick xD

clear island
#

well yea, but when I said "Immediately" I was thinking in similar fashion to RPCs

#

but I guess not, it still follows the whole replicated property lifecycle

fathom aspen
#

RPCs take a different path, well at least those that are not unreliable multicasts

clear island
#

yea reliable ones

fathom aspen
#

And yeah they are indeed fast, at least from my experiments

clear island
latent heart
#

Do unreliables not get pushed out straight away as well?

#

Even if they aren't checked for delivery.

fathom aspen
#

Unreliables that are multicats are queued for the next net update

fathom aspen
latent heart
#

I see!

twilit radish
#

Honestly I don't really know if push model is even worth it. I thought I read at some point that Epic them selves said there was basically no improvement to performance with it enabled?

clear island
clear island
#

however it really does depend

#

for valorant that was like their number 2 heaviest thing server side

#

but they also wanted to host multiple games on one single core

#

so for them, it mattered alot

quasi tide
#

@fathom aspen Have you explored Iris yet?

#

Or have you not because you are "working"

clear island
#

they replaced all replicated props with RPCs, even stateful stuff

#

just to avoid the long delta times when comparing props

#

(this was before the push model existed in UE)

fathom aspen
#

Maybe in the next project I'll do πŸ˜›

twilit radish
# clear island so for them, it mattered alot

Right. But Valorant in specific is already a lot different in that regard than most games. I would imagine they have very high tick servers because of the genre of the game right? Which I would assume indeed starts adding up to constantly check all their replicated properties. But I honesltly doubt that if even Epic says it barely did anything for their own use cases that most games will gain any benefit from it.

twilit radish
quasi tide
#

Confirmed

fathom aspen
real ridge
#

it is worth to move multiplayer project from 5.0.3 to 5.2?

#

it's using eos

fathom aspen
#

Not if you don't want a more stable iris?

#

Okay that's a personal opinion

clear island
real ridge
quasi tide
#

Don't worry about iris until Fortnite is actually using it

twilit radish
clear island
#

in my experience these past few months from profiling dedis, the heaviest stuff is, in this order:
1 - animation
2- CMC
3- delta time comparisons for replicated properties

fathom aspen
clear island
fathom aspen
clear island
real ridge
#

mike CringeHarold because I used niagarra instead actors meshes to make bullets and all effects when shooting or doing anything like this in game thinking that I will make better performance

boreal wadi
fathom aspen
#

Yes

twilit radish
#

πŸ˜›

torpid girder
#

Hi, I am trying to transition out of spectating, I am using gamemode the code worked in gamemodebase so something is getting in the way

clear island
fathom aspen
real ridge
#

can you give me tip how I can spectate game or my exe version of game and find which parts of game causes FPS drops or lags or takes performance?

twilit radish
magic helm
twilit radish
#

Although without joking if you're using something like mass those material animation techniques can actually save you a TON of performance. But maybe not the best topic for #multiplayer πŸ™ƒ

clear island
fathom aspen
clear island
#

I only tick the animation poses when necessary

twilit radish
magic helm
#

For most games, the biggest CPU bottleneck is animation

clear island
#

yea it really was a pain to get right, especially with lag compensation doing the rewind back to a time where the animation wasn't ticking

#

but it was worth it

#

previously just 2 players on server caused the cpu to load at 80%

#

now its at 18% to 20%

twilit radish
#

That sounds like a rather odd jump to me for only 2 players πŸ€”
Not saying it couldn't be the case but again that sounds like a very extreme performance change for just two players.

clear island
#

the map also had alot of vehicles which are skeletal meshes and were also constantly ticking

#

I disabled the animations there too

twilit radish
#

That seems like an important detail to mention in this scenario no? 🀣

clear island
#

sure, but my point is that before, with all the vehicles + 2 players, the CPU was 80% load

#

but even on the profiling tools, the vehicle ticks didnt really show up alot tbh

#

it was mostly the players

#

because they have alot of child components attached to the skeleton bones

#

and constantly ticking that animation would update transforms on all those child components too

twilit radish
#

Do you happen to know what the load was with no players before changing all the animations?

clear island
#

that I dont know because I already had code in place that just disabled the vehicle ticking when there were no players on the server

#

all I know is from the profiling I did, with players inside the server is that the player animation ticking was always the top offender

quasi tide
#

That's probably why they're investing so much into animation performance

clear island
#

which kinda makes sense, valorant devs also reported the same issue for them

#

the heaviest thing was animation ticking

#

2nd was the replicated properties

half umbra
#

Pitch works correctly
but Yaw
not
Client doesn't see Server Yaw
on Client always is 0.0
why?
Get Base Aim Rotation is replicated

thin stratus
#

Iirc BaseAimRotation is just the Pawn's Yaw.

#

If you expect a different one it might be due to that

#

Best to check the C++ code behind it

whole pine
#

im setting the specific controller of the client i click so i can use it as object input when i cast to my pawn bp in my scene capture bp cause if i have the object input on the pawn cast as 'get player character 0' it only shows one players equipped items but i have to cast to my player controller bp to get the variable in the picture with object input as 'get player controller 0' so what should i do

dark edge
whole pine
whole pine
#

when i click on another client

dark edge
#

on a client, the only playercontroller that exists is your own

whole pine
#

oh ok

half umbra
whole pine
#

so how do i identify the player i click using get hit result under cursor

dark edge
#

What data are you wanting to get about that client?

#

PlayerState for the actual player

whole pine
#

im sending the worn items variable off the client i click to the scene capture

dark edge
#

PlayerState represents the person
Pawn represents their character/other thing in the world.

#

What actor holds Worn Items?

whole pine
#

main pawn character

dark edge
#

ok so why do you need controllers etc?

#

just get the character you just clicked

whole pine
#

idk, i was tryin dif things

dark edge
#

is WornItems a variable in your Character class?

#

and is it replicated

sinful tree
whole pine
#

yes and yes

dark edge
whole pine
#

just need a way to identify which client i click using the get hit result under cursor that casts to my character bp

dark edge
#

you clicked a thing

#

you check if it's a topdowncharacter

#

if it is, then get its WornItems

whole pine
#

in mmy scene capture bp i have to cast to my character BP

#

so im getting character 0

#

so do i promote this cast in the pic to a variable and use it as input object for the cast in the scene capture?

dark edge
#

don't get character 0 ever

#

why are you doing so much casting

#

do you know what casting means

whole pine
#

yea

dark edge
#

you sure?

whole pine
#

yea

dark edge
#

Show the part of your code that takes in a character and shows their inventory

#

I'm guessing OpenMyInventory just shows inventory for self, and OpenOtherInventory shows inventory for any TopDownCharacter, right?

whole pine
#

right

dark edge
#

so just pass the result of the cast after the hit into OpenOtherInventory

#

show the internals of OpenOtherInventory

whole pine
#

its a disaster

dark edge
#

I think you're making this way more spaghet than it needs to be

whole pine
#

i grew up on spaghet

whole pine
#

specifically

dark edge
#

I want to see what OpenOtherInventory does with the passed in character ref.

whole pine
#

cause i have rep notify's for showing items on players

dark edge
#

This is to inspect some other character right?

whole pine
#

im getting open other inventory from the character bp cast

#

its not a ref pas

#

pass

#

it just opens a widget that is different from the owning player inventory widget

sinful tree
dark edge
#

where does that code live

whole pine
#

all im trying to do right now is make the scene capture know which client i click on

#

cause im getting worn items array from the character cast off the hit result of get hit result udner cursor node

dark edge
#

that's the pawn you clicked on

#

you clicked on a thing, it was a BP TopDownCharacter

whole pine
#

i get the worn items and then send them to the scene capture

dark edge
# whole pine

You're trying to set a replicated variable clientside

#

we need to see what OpenOtherInventory and TryEquippingOtherPlayersItems do

#

but anyway, those should not be separate from your own versions, doing it on self should just be
OpenInventory(self)

#

make the function once, call it with a parameter of self for the self case

whole pine
#

self inventory and other inventory are 2 dif widgets

#

this is try equipping other players recorder items bp

#

this is scene capture bp

#

as you can see since its on player 0 it can show only one clients equipped items

#

open inventory events just create inventory widgets, thats it. the main target is just the image within the inventory widgets which is bound to the scene capture material

#

so my main problem here is just identifying which client i click on and send the scene capture that player info

#

@dark edge

whole pine
#

i put this in the scene capture BP but doesnt work

bright tiger
#

Is it necessary to mark input functions like MoveForward in a character as Server to better security?

sinful tree
#

Eg. Marking a "Defeat" function as run on server could allow a client to call that function when you don't even intend for a client to be able to make such a call.

bright tiger
# sinful tree Eg. Marking a "Defeat" function as run on server could allow a client to call th...

Then this talk of the wiki:

β€œInstead of letting a player tell the server their position explicitly, consider having the PlayerController send player commands (like move left, up, down) and simulate that state on both client and server and let the server update the player's position as a replicated property. This avoids an entire class of cheats (like speed hacks etc).”

What does it refer?

sinful tree
#

I'm talking mroe about your general question as to whether or not to mark something as Server to better security. The answer is no, that's not what it does. Marking a function as "Server" indicates you are opening a means for a client to send the server an instruction and you can pass along data in that function. If that function gets called, then the server will be executing it.

SO... If you need to have the client tell the server to do something, then you must mark the function as Server in order for the client to be able to call such a function, however, you do not need to mark a function as "Server" to have the server execute the function nor does it increase the security of it (the opposite actually) - the function can still be called at any time while you are running on the server.

In terms of what your wiki is talking about, imagine a situation where you are calling a function called "MoveForward" and you mark it as server but it has no inputs. This means you are asking the server to execute whatever "MoveServer" is but is not relying on any further input from the client. The server would end up determining what needs to happen and where to.

If you added a vector input named "DesiredLocation" to "MoveForward" and had it marked to run on server, then you're passing that DesiredLocation from the client to the server in that function call. If you set it up so the server then uses "DesiredLocation" and moves the client to that location without performing any checks, you're now trusting the value that the client sent, which may not necessarily be what should happen and could result in a player teleporting themselves anywhere on the map.

glass orchid
#

Can i call a playerstate's server RPC from a widget?

sinful tree
glass orchid
bright tiger
sinful tree
bright tiger
sinful tree
#

Correct

bright tiger
# sinful tree Correct

And my last question, does Pawn class also handle RPC for AddMovementInput and similar?

sinful tree
bright tiger
whole pine
keen hound
#

how do I create a dedicated server browser?

latent heart
#

Generally you'd add it to your main menu map somewhere.

#

Interface with steam or eos or whatever online subsystem you're using to query the available servers.

#

And display them.

keen hound
latent heart
#

The server details will be available from whatever online subsystem you are using

keen hound
#

@latent heart are query port and multihome commands in ue5?

keen hound
#

yeah I know it's spaghetti, I'll get it sorted soon lol @sinful tree

sinful tree
#

Not much you can do with maps if ya need to check if the values are there... It is what it is XD

keen hound
#

I use a shortcut

half umbra
rocky kestrel
#

I have 60 players "MMO" game and I have been using local dedicated server. Can I use playfab server just to upload my server there? Without any other integration with playfab. I would use steamcore for server browser and session.

latent heart
twilit radish
#

As a PlayFab customer, you can access our service and use a limited, free quota of multiplayer servers for product evaluation and testing.

fervent hazel
#

What am i doing wrong? why is the gamepad not controlling the second player`?

shadow hatch
#

im working on tracing / overlap detection for the purposes of dealing 'damage' in my project but somehow the tracing is not quite working when running client / dedicated as opposed to standalone or listen server

#

the trace is based on two sockets on a static mesh

#

but its meant to look more like this

#

as if the static mesh, the sword, is stuck in the air and the only reason the tracing moves at all is cause the anim montage is using root motion, driving the character forward

shadow hatch
#

after hours of digging looks like i needed to enable this on the character skeletal mesh, otherwise it seems as if the character is basically tposing as far as the server is concerned or something:

#

im guessing having this enabled the whole time might not be a good idea? would it be beneficial to have it only enabled when its needed

dark parcel
#

do PossesedBy only called on Server?

shadow hatch
#

it is yeah if memory serves

dark parcel
#

In my case, I was woundering why my anim notify never get called 😦

#

turns out when not rendered the anim bp doesn't play the montage because of the option

#

i set it to always tick then it plays

pallid mesa
#

hopefully!

shadow hatch
#

oh okay. i suppose just enabling disabling refresh bones on dedicated seems to be a decent workaround, no?

pallid mesa
#

dedi servers by default dont refresh bones

#

its a hugeeeee optimization

#

refreshing bones will add some considerable cpu time to your dedi server

shadow hatch
#

another workaround is placing collision boxes by hand inside each anim montage, i think thats how the one triple A unreal game does it, i think...

pallid mesa
#

well... there are several techniques

#

that can go from doing a sphere trace on the frame of the hit in front of the player

#

to more complicated solutions based on how arcadey your game is

shadow hatch
#

i wanted to try go for as much accuracy as possible sort of

pallid mesa
#

doing the hit on authority relying on bone positions will.... not be accurate at all

#

as soon as you have some lag, I mean

shadow hatch
#

hmm.

pallid mesa
#

you can maybe go for a client side approach that you later verify... when it reaches the server

shadow hatch
#

well the problem is

#

i was detecting hit clientside until i added ai

#

thats when i suddenly had to rethink stuff

pallid mesa
#

ah I see πŸ˜„ u want AI to be accurate

shadow hatch
#

i suppose i dont mind if the ai isnt super accurate but

#

i want to make sure i dont get my wires compeltely jumbled by having too many exceptions just cause the ai or something else

pallid mesa
#

well you can have players to do client sided hits, and let the AI do its thing on the server

shadow hatch
#

yeah, that was the plan, i will separate them again

solar stirrup
#

Does AActor::PreReplication() get called server-side as well?

pallid mesa
#

just remember to think of some verification on the server for the client side hits if you are going to do some form of pvp

shadow hatch
#

which might have pvp i guess but even coop might

solar stirrup
#

based

pallid mesa
#

πŸ‘‰ 😏 πŸ‘‰

pallid mesa
#

XD

#

(unless im not recalling it correctly now)

solar stirrup
#

iirc it gets called on the client too

#

or maybe im confused

#

anyway mostly needed it server-side so it's fine hehehe

pallid mesa
#

Called on the actor right before replication occurs. Only called on Server, and for autonomous proxies if recording a Client Replay.

#

@solar stirrup from docu

solar stirrup
#

ah

#

it's fine I have PreRepNotifies() iirc on clients

pallid mesa
#

what are you doin

#

πŸ‘€

solar stirrup
#

I'm keeping history of states on the server to ensure they all get replicated to clients

#

regardless of if they happened for a split second server-side

#

so like if a state starts and ends in between replication intervals

pallid mesa
#

ah, i see yeah

solar stirrup
#

I just wanna clean up states that are X seconds old in pre-rep

#

I really didn't wanna use RPCs for this heh

#

but this will probably work fine catJam

pallid mesa
#

!! gl erlite!

solar stirrup
#

tyty

naive wind
#

I've got this code here. MoveToCooker() runs just fine, but the server function (S_MoveToCooker) never runs. I have a feeling it has something to do with MoveToCooker() being called from a multicast delegate but im not too sure.

second image is the function bound to the delegate

#

god multiplayer is so confusing, so many different possible combinations of RPCs and owners its so hard to get it right

#

any tips or general rules of thumb for coding multiplayer would be helpful. Still a bit new to this

sinful tree
whole pine
#

how come client 2 gets correct values from worn items variable but not client 1

sinful tree
whole pine
quasi tide
royal anchor
#

Just making sure that I'm going about this in a some what correct way. When I have a listen server and I make a call from a client, like a basic attack, in real time that takes a second for the client to call that from the server and the server replicate that back to the client that it is attacking.
This feels awful as a client, especially while using less then average connections. Is it a better option to have the client play out that code while the server also does?

#

Purely cosmetic from client and actual coding, like damage etc. From server

quasi tide
#

Yeah, pretty much.

royal anchor
#

Okay so to make the client actually feel good to play is a pain in the ass lol

quasi tide
#

Also yes.

whole pine
icy jetty
#

Did you try printing the items to see what is coming up?

glossy kettle
#

WHY IS SERVER SAYING I HAVE NO COMMIT WHEN I HAD THE CONSENT OF THE QUORUM

north stone
#

<_<

real ridge
#

Hello guys I have weird problem I am trying to let my AI shoot at me but I am getting failed cast on event for damage but very strange is that on the start of event I can cast check first photo when I cast there to my plane its successful but when I am trying to give damage after linetrace hit my plane here (photo 2) it fails and I See on my monitor printed cast failed...

#

any suggestions?

#

its in same line

sinful tree
#

If this is an AI controlled actor, you shouldn't need to call Run On Server RPCs in it, and if it can be client controlled, you don't want to allow a client to tell the server how much damage to deal and who the damage causer is.

Is the idea here that as soon as the AI sesnse a PFCPawn it does that linetrace and applies damage?

real ridge
#

weird

sinful tree
#

So this bit is normally connected?

real ridge
#

it continues to line trace sorry for confusion

#

I am trying find problem why is damage not taken I have like 20 guns one AI turret in game and all works fine

#

same system here and it is not working lol

#

but on turret I am using ai perception here I am using pawn sensing

sinful tree
#

Maybe it's failing for the pawn type? It looks like you have the print here saying playerstate.

#

or am I just being somewhat dyslexic XD

real ridge
#

I am trying again , line trace works good I am getting casted print from the start

#

but this one still not workinng lol

real ridge
#

πŸ˜„

#

good point

sinful tree
#

Well, again, maybe don't mark that as a run on server event? If it's AI controlled it shouldn't need to be run on server, as it should already be running on server.

real ridge
#

omg I am putting damaged actor as owner

#

let me swap it

sinful tree
#

That'd do it.

#

lol

real ridge
#

no wtf why its printing cant cast to player I dont have anywhere this Print

#

its saying when server damage is applied

sinful tree
#

Perhaps you have some casting going on in the AnyDamage implementation in your DFCPawn class?

real ridge
#

Should take a look

#

yea bro thx found where is mistake coming from now fix it

#

D:

#

lol I did not get this idea

#

its in my plane

#

its like its getting wrong player reference

#

otherwise it would cast

#

but god why

#

bro I fixed it thx thank to you πŸ˜„

#

I was casting on any damage only to my players but damage causer was sentinel ( defense system) lol so it could not cast lol I Should refactor this

#

I Dont event cast there anywhere

#

idk why I did this

signal lance
#

@whole pineStop... there is no excuse for calling people idiots

Also @icy jetty that wasn't very nice of you either

whole pine
#

really cause people been passive aggresively doing it for a long time

#

guess thats the loop hole

signal lance
#

I will remind you of #rules
If you have an issue with someone report them

whole pine
#

i dont report, thats whats funny about this

signal lance
#

Throwing back insults at someone who insulted you instead of backing off or reporting them doesn't make you look any better than them

#

It's a childish thing to do

#

And I won't discus this any further

whole pine
#

i can argue its childish to report someone for something you do to someone else

grizzled stirrup
#

Does NumPublicConnections not include the host?

#

As in if NumPublicConnections is set to 3, it will allow for a 4 player game (the listen server host being the 4th player)?

sinful tree
grizzled stirrup
#

Thanks!

twilit radish
#

That would truly be something if you could disallow the host from "joining" because NumPublicConnections and the private one might have both been set to 0 haha.

tall mesa
#

Hey all! First time posting, I apologize if it's the wrong channel for it. Anyone have any idea how to enable the on-character gameplay tags debug visualization? I've stumbled into it by accident several times, but there's a debug option SOMEWHERE that lets you see active gameplay tags as a GUI that hovers in roughly center-mass over each character during PIE. I can't find it on purpose for the life of me, but it was super useful to have on

#

It looked roughly like this where the active tag was hovering over each player

#

Edit: nevermind. I rubber duckied my way into finding it πŸ€¦β€β™‚οΈ
If anyone's wondering, it's the console command: AbilitySystem.DebugAbilityTags

grizzled stirrup
twilit radish
#

I never really had to use it for anything so far so I'm not sure. But that would honestly be rather silly..

#

But that's many parts of Unreal in a nutshell though xD

grizzled stirrup
#

exactly πŸ˜„

#

Does anyone know why LogOnlineSession: STEAM: Updating lobby joinability to false. gets called when the first player joins a lobby even if NumPublicConnections is set to something crazy like 50?

#

The only way around it is by setting SessionSettings->bAllowJoinInProgress = false; but in this case I would like it to work without doing that (as that causes other issues)

#

Sorry for the ping, did you ever solve this? I'm running into the same issue. I'm guessing that in the Steam code, the MaxLobbyMemebers is forever at 2 for some reason

#

make skin an OnRep var

sinful tree
#

Player Wants to Change Skin > Server RPC > Server sets skin value in OnRep > OnRep function called on clients > Have whatever needs to be done with the skin value done

grizzled stirrup
#

Yes! Late joining players will automatically call the OnRep for each other player so they'll all have their correct skins

#

You can do this wherever you like

#

Generally the player state is good to hold vars becuase your character may not always be valid, so the OnRep in the player state would then call the "equip skin" func in the character

winged badger
#

a big assumption during loading in the world for the first time

grizzled stirrup
whole pine
#

if 2 clients are joining a level, why does this spawn 4 of the actor if this is coming off event begin play

#

one for each player on both clients?

winged badger
#

because whatever this is, it has 2 instances on both clients

#

always catch the BP name in the screenshot btw

#

BeginPlay runs on every instance of every Actor on every client and server

#

regardless of who the owner is

whole pine
winged badger
#

no colisions, or replicated actor lands ontop of locally spawned one

whole pine
whole pine
whole pine
#

if im playing in standalone, why are both windows seeing the same scene capture result

winged badger
#

scene capture should be done locally

whole pine
#

im trying to but idk how

#

gpt's saying set ownership off the spawn actor of class node

winged badger
#

actor doing scene capture is spawned by player controller, only if IsLocalPlayerController

#

that way each PC will spawn its own on a local machine and nowhere else

whole pine
#

this applies if im spawning it into a level?

winged badger
#

where else would you spawn it?

whole pine
#

theres no error i just didnt compile

#

idk, its still just only working for one client

soft isle
#

Hey! I'm having some trouble receiving data back through RPC calls. I'm punching way above my weight here, dabbling way beyond my skill level when coding to be honest, so hoping someone has the patience to help me understand how to work around this.

Basically what I'm trying to achieve is this: Server has a list of data related to players. On login, clients request that data, server sends it back, then the client presents some relevant info in the UI with said data. Other attempts at retrieving data has been successful (thanks to other posts in this channel I've stumbled upon), but turns out it's even more complicated when dealing with collections of sort. TSet and TMap is not supported, and TArray only works with certain setups (as far as I've understood even if it's a bit beyond my knowledge level is that it needs to be a const reference), so as a workaround for now I'm just turning the sets and maps into arrays server-side before passing it back to the client.

Code compiles, but when I hook it up to my UI the event I hook up my delegate to throws an error, twice, once for each parameter.
No value will be returned by reference.
So, blueprints can't work with const references it seems. What would be a simple but functional way to get the data I want from the server to the client?

Give me a moment and I'll fetch the code I'm using to make it easier to see where I could improve it.

#
void ABattlestruckGameState::RequestAllPlayerData(FReceivedAllPlayerData Callback)
{
    FGuid RequestID = FGuid::NewGuid();
    OnReceivedAllPlayerDataCallbacks.Add(RequestID, Callback);

    ProcessRequestAllPlayerData(RequestID);
}

void ABattlestruckGameState::ProcessRequestAllPlayerData_Implementation(FGuid RequestID)
{
    // PlayerDataList is a TMap<FName, FPlayerListEntry> housed on the server.
    TArray<FName> PlayerList;
    TArray<FPlayerListEntry> PlayerData;
    PlayerDataList.GenerateKeyArray(PlayerList);
    PlayerDataList.GenerateValueArray(PlayerData);
    ReceiveAllPlayerData(RequestID, PlayerList, PlayerData);
}

void ABattlestruckGameState::ReceiveAllPlayerData_Implementation(FGuid RequestID, const TArray<FName>& PlayerList, const TArray<FPlayerListEntry>& PlayerData)
{
    FReceivedAllPlayerData* Callback = OnReceivedAllPlayerDataCallbacks.Find(RequestID);
    Callback->ExecuteIfBound(PlayerList, PlayerData);
    OnReceivedAllPlayerDataCallbacks.Remove(RequestID);
}```
#

And even if there turns out to be a better way than to pass TArrays, I'd still like to know how to get arrays and such passed for learning purposes. Might turn out to be useful in the future.

whole pine
#

how do you make scene captures local

winged badger
#

i'd start with why would you log the player in, wait for its PlayerController/State.. .etc to replicate, then send an RPC from server to client to request the data

#

you know player just logged on, you know they will request the data, so might as well send it

#

worse yet, you can't send server or client RPCs through GameState

#

as the players don't own it

#

and what is the PlayerList for even?

#

just put your per player data as replicated data into their own PlayerStates and let it replicate on its own

sudden harbor
#

Does any replication need to be done for multiplayer levels?

jade drift
#

If I don't want players to be able to know when other players join/leave a match, would I have to disable PlayerState replication?

soft isle
#

@winged badger About to hop off the computer for now so I won't have time to test more right now, but to try and reply to some of the questions on my way out:

  • GameState and RPC... hmm, yeah, that's totally an oversight on my end.
  • As for the delegate being copied, I'll check back up with the other post here I used as a reference to see if I misunderstood them. I've used almost the exact same code other places in my project but instead of sending through a TArray/TMaps/TSet it send either simple data or structs... and those work flawlessly. If what I'm doing in regards to the delegate itself is a big no-no even if it works (in those other places) I'd like to learn why. This is unchartered territory for me.
  • In a lot of cases, even if the data changes mid-game, a client doesn't need to know about the changes. So in general for those things I try to keep it to a "only send when requested" to reduce the traffic. It may be used for other things than login, so I still need the requesting itself to work.
  • This system will probably be massively revamped at a later time, but for now I'm just trying to get this revision working so I can focus back on other places of the framework that need attention for now. Although, as said, even if it does get revamped I still don't understand how to send arrays through RPCs in general, and still hoping to understand how to achieve this in case it becomes useful for something else at a later stage.
fickle estuary
#

Having an Issue turning on the ReplicationSystemTestPlugin for Iris, getting a cannot open source file on the includes, all I'm trying to do is run the plugin, haven't modified anything on my end

naive wind
#

If I set an actor’s owner on the client and NOT the server, can I execute server RPCs on that actor from the client?

hollow eagle
#

no

winged badger
#

NetworkAutomationTest sounds like it shouldn't exist unless there is an Editor in the name

sonic obsidian
#

Hey guys i was wondering if using world partition in a multiplayer game is a good idea ive done some research but i was wondering if anyone here would know if using it is a good idea the way im going to do it is use the tool to convert my level to world partition but just curious if its a good idea

gloomy zealot
#

would it be possible to use LAN+LogMeInHamachi/Radmin instead of a online subsystem?

twilit radish
twilit radish
gloomy zealot
fervent hazel
#

Hello, can someone help me implement something in UE5.1? i Would pay for that! I need a basic system where 2 players local can play. 1 is controlled by the keyboard and mouse and 1 by controller. Someone maybe here to help me with that?

twilit radish
#

@fervent hazel If you have any specific questions you can ask them in here. If you're looking for someone to do it for you there's a job posts section. See #instructions

fervent hazel
quartz iris
#

Would anyone be able to help as i'm still stuck on this. I can't figure out how to make the gamemode play widgets on the respective winner/loser playerstate variables

rose turret
#

if I fire an RPC, does UE wait until the world is ticked before it actually sends it?