#multiplayer

1 messages · Page 186 of 1

twin juniper
#

uhh

#

what value to the Closed?

worthy oak
#

1

#

for a postive

#

-1 for a negative

twin juniper
#

same problem as before

worthy oak
#

?

candid tinsel
#

try using a lerp on the select

twin juniper
#

depending on which side of the door

worthy oak
#

not according to this

candid tinsel
#

btw are you trying to make the door open on both direction

twin juniper
candid tinsel
#

like where the character is facing?

twin juniper
#

as well as what I got rn

worthy oak
#

ah I see

candid tinsel
#

this might help

worthy oak
#

saving this for future use XD

candid tinsel
#

yea yt helps alot

worthy oak
#

it certainly does

candid tinsel
#

but not with multiplayer as much

worthy oak
#

ive noticed XD

candid tinsel
#

ive been having trouble with ragdoll and literally ive seen nobody make a video about ragdoll and multiplayer but one person

#

and they used the most basic ragdoll like set physics and thats it

worthy oak
#

oh man hats off to you

twin juniper
#

youtube isn't really good but sure

worthy oak
#

I avoid that or try too XD

worthy oak
#

and mileage varies by who your watching

candid tinsel
#

yea with basic stuff its really helpful even with ai

worthy oak
#

def have to be...selective

#

and tbh for something like opening a door

#

thats fine...you might have to tweak it for multiplayer

#

but hey you can get a working concept to test off

candid tinsel
#

for doors just use rpc and it should work but for latency you might wanna try other stuff

dark edge
#

you can select on enum

#

drag off enum and hit select

#

then feed the output into the multiply

twin juniper
dark edge
#

Show your current code

twin juniper
#

the '1' for closed is the problem

past flicker
#

Do RPCs replicate parameters?

fossil spoke
#

An RPC is a message being passed across the network to a particular connection.

#

The Params passed with that message will be received by that connection.

#

When the message arrives.

past flicker
#

I'm using Wait Gameplay Event to call a client RPC because I want the payload client side, but it's empty.

fossil spoke
#

Did you verify the Gameplay Event contained data at all?

past flicker
#

Nevermind. I made a mistake by setting a breakpoint on the RPC instead of 1 node deeper. The data is there. Thanks!

candid tinsel
#

anyone would like to check this issue out?

dark parcel
surreal plaza
#

How are collisions handled as far as authority? I have an object placement feature that should feel responsive in terms of placing an object. If it is blocked, they cannot do it. But imagine the case of someone placing a cabin with sheep wandering around. They are in the clear on the client, when it is placed on the server, a sheep has since wandered into the area. Is the client running collisions on the server and will they know that it then isn't possible?

candid tinsel
dark parcel
candid tinsel
#

u mean the als v4 assest? problem is its for 5.0 i got 5.4

#

if its the als v4 then ill download it and look how its done

fossil spoke
#

If this is multiplayer. Then you will want the Server to do the placement anyway

#

You dont want the Client to have authority over placement.

#

If you want responsiveness, you might want the Client to predict valid placement and then get corrected by the Server if the Server rejected it (because of situations like your scenario with the sheep).

dark parcel
fossil spoke
#

The Server would tell the Client it failed and to roll back the prediction (remove whatever the Client placed in anticipation of it being successful).

candid tinsel
#

ok ill try it out

unique summit
candid tinsel
#

its already sychronized

#

i looked at the als but im not sure where they implemented the ragdoll i just seen ragdoll start in the c++ files and some in the anim blueprint i dont know how they made it work on multiplayer exactly

#

ill try making an interface for ragdoll and add it to the character and see if it works that way

vagrant grail
#

Guys what do you think about making a Dead by Daylight game as my first multiplayer game ?
What would be the difficulty of doing that type of game compared to other multiplier games?

vagrant grail
woeful ferry
#

Take like a simple arcade game and make it multiplayer

vagrant grail
woeful ferry
woeful ferry
woeful ferry
#

Then pick another game at that size, that is fun. Dead by daylight is a big scope

vagrant grail
#

to me big games = Battle Royals, MMOs, Open World, etc...

woeful ferry
#

Then you're extremely naive

vagrant grail
#

?

woeful ferry
#

Just because a game has a small loop, doesn't mean it's small. Fall guys loop is extremely small, but the game itself requires a lot of work

vagrant grail
#

there are different minigames, levels, etc...

lost inlet
#

scope != player count

vagrant grail
#

I know but I guess it requires more work in terms of optimization compared to a game with less player

woeful ferry
#

We're talking about just the amount of work you still need to do to achieve something like DBD, it'll shadow the multiplayer aspects that you actually want to learn

#

that's why you wanna keep the scope small, to just focus mainly on multiplayer

vagrant grail
#

What about a simple prop hunt game ?

dark parcel
#

Prop hunt sound reachable

maiden flame
#

Prop hunt is reasonable, but it all depends on how you approach it. You could create a Dead by Daylight game, but dumb it down to the bare essentials of gameplay, cutting all the fluff like customization/unlocks/progression and graphics, only focusing on the absolute bare minimum to make the gameplay loop work.
It's probably more complex to program, but if the idea motivates you more then that could be a good reason to try. If you fail you still learn something.

kindred widget
#

Honestly. I would focus less on making a clone of a game and focus on learning how to design portable systems that can be dropped into any game. EG a replicated inventory system, a generic AI tree with reusable behaviors, learning GAS and making some generic attribute sets, cues and ability bases, etc etc etc. These small tasks are a lot more rewarding due to their reuse and the understanding they'll give you than focusing on a specific game type. Specially since you'll be able to simply drop a lot of this in multiple projects and throw together prototypes for a lot of different game types.

magic vessel
#

I know that sounds obvious when said like that, but a lot of beginners that I know/knew would make massive interconnected spagetti that was inefficient, hard to port to other projects and impossible to change without breaking something else

fossil veldt
#

for an inventory system for example it's much easier to immediately understand where the pitfalls are if you're just copying the minecraft one

#

whereas you can overlook a lot of things if you're building it kinda detatched / sandboxed

maiden flame
#

I agree with Snaps.

#

Although I can see the benefit of both approaches. Whatever gets you to make something, you'll learn from it either way.

quick musk
#

i mean dbd was in dev in 2015 with only like 30 people, definitely way more than a solo dev obviously but still not a huge team over at bhvr

magic vessel
#

If you're trying to learn how to multiplayer though, it isn't the best option. Once you have a good foundation of knowledge and libraries, then it could be a attainable scope but not before

#

I'd stick with Prop Hunt, plenty of clones out there (even FNTASTIC made one)

wraith cargo
#

Anyone know where I can find an in-depth guide on unreal engine multiplayer with blueprints?

dark parcel
kindred widget
wraith cargo
dark parcel
#

for example, the character movement component

wraith cargo
#

Ah, so there are no work arounds?

dark parcel
#

nope

#

Say a sprint system, if you want a responsive one, you will have to go cpp

#

you cannot do it in blueprint

wraith cargo
#

Time to learn cpp ig

dark parcel
#

you can make card games or turn based game with blueprint

#

or yea learn cpp and unlock unreal features

#

going pure blueprint is just experiencing trial unreal

wraith cargo
#

Is it more difficult to make games with cpp in unreal?

dark parcel
#

learning is not my virtue, everyday is a struggle

#

but I think that goes to most people here

wraith cargo
#

Guess I should start learning now so I can start working asap

twin juniper
twin juniper
wraith cargo
#

What would be easier?

dark parcel
wraith cargo
#

in terms of making the game

maiden flame
limber gyro
#

is doing any kind of authority check in the GameMode class redundant? since it only exists in the server

neon summit
#

yes

dark parcel
maiden flame
#

That doesn't explain why. It explains how CMC works, but you have access to that in BP.
Sure, you can't modify lower level netcode, but do you need to for sprinting?

thin stratus
#

This is not about Lower Level NetCode

#

The CMC has an internal prediction system, where any kind of predicted data has to go through the ServerMove function, and a lot of stuff needs to be added to custom SavedMoves so the Client can properly replay Moves they already did when receiving a correction.

#

That is all out of range for Blueprints.

#

@maiden flame

maiden flame
#

Oh, thanks for explaining.
Does GAS handle some of this for you with flags? Or is it still too incomplete in BP to properly replay moves for custom events like sprinting?
The main problem I had with sprinting seemed to be corrections during packet loss, rather than latency, when trying to use the CMC inside the editor alone.

maiden flame
#

Predicting sprint in BP works fine with latency when testing it now, but even for default movement the CMC breaks down when there is packet loss.

royal linden
#

How to replicate Event? I'm calling from the server, and I would like clients to execute

thin stratus
thin stratus
maiden flame
# thin stratus GAS has its own PredictionSystem and thus is basically more or less incompatible...

I see. Either way, I wouldn't say it's impossible to make sprinting in BP only. You can get prediction working with high and variable latencies, assuming there isn't any packet loss.
Does the method of adding custom SavedMoves, to properly replay Moves, help to solve disruptive corrections during packet loss? I don't know if you consider this part of properly replaying moves, or if packet loss is a separate concern.

thin stratus
odd hamlet
#

So I want after the begin play of the AHUD to increment a value from thhe game state for each player that basically get`s an AHUD, why when I try to print it, it gives me 1 for the client and 1 for server?

odd hamlet
#

Basically, how can I get a refrence or to know when the HUD is done for each player?

reef bison
odd hamlet
#

tried that didn`t work

reef bison
#

what exactly "didnt work"?

odd hamlet
#

you mean from the hud, get owning player, and from there to increment it?

#

or what?

#

and what do you mean by the client can send a rpc, what doees the server do in this case?

reef bison
#

where are you storing this value to be incremented on the server?

magic vessel
#

Why do you want to do this? If you want to increment for each Player that has joined, you could use the PlayerArray on the Game State

odd hamlet
#

hmm

#

I need basicaly to update each players minimap

#

but the map gets created first

#

and the hud after

#

and I don`t know how to manage these things, because the player spawns but the hud is created after

maiden flame
thin stratus
#

I mean, you are free to think that whatever you do fixes it.

#

This is not a blanket statement. I'm working with this shit engine for 10 years.

maiden flame
#

Well, no, I'm trying to understand better also.

thin stratus
#

Does your Sprint setup involve changing the MaxWalkSpeed on the CMC and use an RPC to tell the Server to update it and then replicate it back with some OnRep variable?

maiden flame
#

It does

#

But I can't see corrections with latency

thin stratus
#

Try spamming the sprint key a bit

maiden flame
#

I did, and even changed directions suddenly to throw it off

thin stratus
#

And use p.NetShowCorrections 1

maiden flame
#

Still works solidly at 0 packet loss

#

Oh, I'll try that

#

But visually it's not like disruptive or unresponsive

thin stratus
#

Cause corrections are being smoothed

#

To a certain degree at least

maiden flame
#

Yeah, that makes sense

#

But what am I missing for it to be considered functional and not stuttery or unresponsive? Because it seems smooth, so all I'm saying is that it isn't impossible

#

I'm assuming the corrections that are problematic are the ones that feel janky

thin stratus
#

Well for one, if you would start sprinting and the Server corrects you back, the Client won't replay the moves properly, cause the MaxWalkSpeed isn't controlled by a Flag in the SavedMove

#

Basically the client doesn't know it sprinted

odd hamlet
#

exi bro you have any ideea why on the hud begin`s play I set a variable from each playeer controller when it finished to true, but in the game state when I go through each player with a loop and wait until next tick operator it will show me only true for server and false for client, why is this happening?

thin stratus
#

HUD is local only?

odd hamlet
#

yeah, isn`t it?

odd hamlet
thin stratus
#

Yeah, but are you checking the variable in the GameState on the Server?

#

Not sure what your actual setup here is

odd hamlet
#

basically what I am trying to know, is when the AHUD for each player is created,

#

how can I Know that?

thin stratus
#

PlayerController creates that. You can check Source Code for that

odd hamlet
#

what is source code?

thin stratus
#

UE

#

Do you want want a callback?

odd hamlet
#

yeah

#

I need to know when the AHUD is ready in order to do an operation on it, do you catch what I am saying

thin stratus
#

As far as I can see, the HUD is created in PostInitializeComponents

#

That happens more or less during the spawn phase of the PlayerController

#

So anything post- BeginPlay should be fine

odd hamlet
thin stratus
#

I mean that you can access the HUD from the PlayerController at any point after BeginPlay called

odd hamlet
#

oh ok

maiden flame
odd hamlet
#

I will see what I can do abouut it

thin stratus
maiden flame
#

As I understand, the CMC is doing some smoothed corrections, but none are jittery even at high latencies. Not at the start, during, or end of the sprint.

thin stratus
#

Yeah sure, if you are fine with whatever you have there, then go for it

#

A CMC implementation would have basically "no" corrections. Package Loss is a different story.

odd hamlet
maiden flame
#

Thanks for clearing up the picture a bit, I appreciate your insight

thin stratus
#

You won't have access to anything else in BPs

#

If you need more, override "SpawnDefaultHUD" in C++ in your own PlayerController

odd hamlet
#

Yeah bro, and for the second player it doesn’t acces a boolean in order to make it true

#

Why is that?

thin stratus
#

Idk what you mean

odd hamlet
#

that boolean Hud appears get`s true at the end of begind play of the AHUD

#

for the server it get`s to true, but for the second player it never gets to true, why

thin stratus
#

What is calling that function?

#

You can't access the HUD of other Players, you are aware of that, right?

thin stratus
#

No

#

That's why I said: "HUD is local only"

odd hamlet
#

hmmm but I don`t really acces it

thin stratus
#

How are you setting that boolean then?

odd hamlet
#

in the end of the AHUD but I am geting the player controller, and for that I am getting the get owniing player controller

thin stratus
#

Yeah but that is all local

#

Nothing of that will replicate to the Server unless you send a ServerRPC telling the Server that the HUD exists

reef bison
#

its very noticeable in 100-200ms emulation

dark edge
#

just tune your movement such that half input is walk and full input is sprint

thin stratus
#

Just tick "AllowClientAuthoritiveMovement" and be done with it.
Then proceed to ignore your players asking to take care of the cheaters.

lament flax
#

what "net role" does an actor have if its the owner ?

thin stratus
#

Depends on the Actor I guess

#

generic Actor possibly ROLE_Authority

lament flax
lament flax
thin stratus
#

I guess still Authority

#

Don't think the Server has AutonomousProxy for their own Character

#

Unsure atm

lament flax
#

ill test after dinner

#

if its not ROLE_Authority ill tell you

nocturne quail
#

Do i need two copies of a map to set one for Editor and one for Server?

#

or can i use one copy of a map for both?

#

i mean for packaging

odd hamlet
#

where you want me to create the rpc

#

man I am so fucked

#

with this

thin stratus
#

@nocturne quail You need only one map. Not sure what you are trying to do.

thin stratus
nocturne quail
thin stratus
#

Yeah but why would that need a duplicated map?

odd hamlet
#

okay so my whole problem is that sometimes the client doesnt get the struct of the generation of the map, and thats why I need to know when the hud is ready in order for it to get the struct and create the minimap

solar stirrup
#

Are you using RPCs to send that to the client?

thin stratus
#

Why can the HUD/Minimap not just ask for the Data?

#

You usually solve this by going both ways.

nocturne quail
thin stratus
#
  1. Let the HUD/Minimap ask for the Data when it gets created.
  2. Tell the HUD/Minimap about the Data when it replicates.
#
  1. Fails if the Data hasn't replicated yet and will be caught be 2.
odd hamlet
thin stratus
#

Yeah just get the data when the HUD gets created

odd hamlet
#

the minimap from the server can vary with the one from the client

#

it`s noot always the same

odd hamlet
#

I store the data in game state, and after in the Hud begin play I do an get game state, cast it , and take my data

nocturne quail
odd hamlet
#

this is on the begining of the gamee, the problem... is not in general, sometimes it doesn`t spawn shit for the client, sometimes it does, but i want it to spawn all the time

thin stratus
nocturne quail
thin stratus
nocturne quail
#

so i can disable those things for server right?

thin stratus
# odd hamlet yep

Then what stops you from marking it as RepNotify, and telling the HUD, in addition to what you do on BeginPlay, that the Data is there?

nocturne quail
#

and use one map

thin stratus
nocturne quail
#

yeah i will make dedi server

thin stratus
odd hamlet
#

the map get`s spawned before the HUD is created

nocturne quail
odd hamlet
#

I cannot send it like because the hud doesnt existt when the struct is made

thin stratus
#

That doesn't mean that the Data replicates instantly

#

You handle this as if Ping doesn't exist

thin stratus
#

So just forget about it.

odd hamlet
#

even if it connects laters, if I am not mistaken?

thin stratus
#

Yeah that too

odd hamlet
#

ok, I will try it out, if I don`t succeed I will come again here and cry 😥

nocturne quail
normal viper
#

Just create map in the Player Controller, so each player will get their own version

#

If you create it once then they both are trying to access the same map

lament flax
#

so ROLE_Authority looks the sames as HasAuthority()

wheat heath
thin stratus
#

That stuff is done via a DotProduct.

#

The two directions you want to test with are:

  • Player Forward Vector
  • Direction between Players (normalized!)
#

If one is standing behind the other, e.g. Player 1 behind Player 2, then you will get:

  • DotProduct > 0 for Player 1
  • DotProduct < 0 for Player 2
#

I would assume you want to consider both, cause otherwise you don't know that Player 2 is not facing Player 1

wheat heath
#

Done it, but the code reverse it and they cancell eachother.

thin stratus
#

That's the way to do it though

wheat heath
#

I know, it was my closest approach.

thin stratus
#

Yeah I saw the post. The answer remains the same.

wheat heath
#

I know, just checking.
Thanks, but both players give me negative always.🥺

thin stratus
#

Then you are doing it wrong. You gotta share your code then.

wheat heath
#

GIve me a sec, appreciate the time.

limber gyro
#

is doing any authority check in the gamemode class redundant?

twin juniper
limber gyro
#

i was just wondering if there was any case where that would be usefull

twin juniper
#

game mode is server only

dark parcel
#

Didn't you asked that already? Just saying.

limber gyro
#

i did, i just didnt get an answer

#

or maybe i didnt get an answer in time and didnt see it

dark parcel
#

It was answered but anyway it is redundant

twin juniper
#

Hard question:

Why would you want to use a Client RPC and how to use it? cuz in roblox for example, I needed a player variable to access that specific client but it's strange to me that that can work without it

limber gyro
#

if you call a client RPC in the server it will run on the client

twin juniper
limber gyro
#

can be used for a few things, are u looking for a specific example?

twin juniper
#

yes and how it work under the hood (but in a simple way)

limber gyro
#

well it could be used to send data from the server to the client to save a match for example, for a local match history

#

under the hood im not quite sure how it works, u need an owning connection to send RPC's so thhrough that connection that RPC is sent to the client and does whatever you want it to do

ancient adder
#

How do I update a value in an archive that was serialized few steps ago?

int16 SomeInteger = 0; // Value is unknown here
Ar << SomeInteger;
// Serializing other properties and figuring out the value of "SomeInteger"

// Now I have the actual value of "SomeInteger", How do I go back and set it in the archive?

I tried Tell() and Seek() but looks likes they're not implemented or I'm using them incorrectly because Tell() always returns -1

twin juniper
#

I've read that they should be avoided

limber gyro
#

you cant just call them freely, specialy if they are reliable

#

u gotta be aware of bottle necks

twin juniper
#

not a client to a client

limber gyro
#

in any case if you call reliable RPC's too much u can overload the reliability buffer and cause issues

thin stratus
#

Yeah well Client to Client would go against the basis of Authority-based Multiplayer.

#

ClientRPCs, the same as MulticastRPCs, can be used for any kind of non-state, one-time event that the Client should execute.

twin juniper
thin stratus
#

Telling a Client to gracefully leave the Game.
Telling a Client to show some Hit Effect.
Telling a Client to show some UI Effect.
Telling a Client to close a UI Menu.
Etc.

limber gyro
#

im gonna take the chance since Cedric is here and ask this, so i have a dash in my CMC where i just set the velocity, the thing is ,that dash is not frame rate independent, whats the best way to make it so?

wheat heath
#

@thin stratus

limber gyro
twin juniper
thin stratus
#

For example yeah.

#
    /** Notify client they were kicked from the server */
    UFUNCTION(Reliable, Client)
    ENGINE_API void ClientWasKicked(const FText& KickReason);
#

Basically what UE already does in that example.

thin stratus
#

Source Code

twin juniper
#

I mean, what class, the GM?

thin stratus
#

Another example would be if you have some sort of Chat System where you can send messages to specific players or a team.

thin stratus
thin stratus
limber gyro
twin juniper
limber gyro
#

so im probably better of doing a 1 time aplication of force than doing it continuosly?

sinful tree
twin juniper
#

but it's from the server to the client

sinful tree
#

The only way to execute a client RPC is to execute it on an actor owned by a client.

#

A controlled pawn possessed by a client is owned by that client. Running a Client RPC on that pawn will only send it to that one client.

twin juniper
limber gyro
#

Theres no need for a chat actor, u can just run the rpc through the player controller

#

if i am not mistaken

sinful tree
#

Or a component, yes.

twin juniper
#

player controller is replicated, so how do I know that it's owned by the client?

#

and not the server

limber gyro
#

i think the old official ue4 tuts did a chat just like that

twin juniper
#

is there a list somewhere?

limber gyro
#

well sorta

sinful tree
#

Because player controllers are assigned ownership to the client they were created for.

limber gyro
sinful tree
#

Possession assigns ownership.

limber gyro
#

the pawn is also owned yes

sinful tree
#

PlayerState is owned by the PlayerController it was spawned for as well.

limber gyro
twin juniper
#

but replicated

sinful tree
#

Yes

limber gyro
#

player state exists in both the client and the server

sinful tree
#

Just don't confuse the word owner here.... Ownership doesn't mean that it's created by the client, or that the client has authority over the actor or component.

thin stratus
#

@sinful tree With a bit of C++ you could theoretically make a limited Multicast.

#

By abusing a GroupActor that is only relevant for the people in the group.

#

Then you can send the Chat Message to the Group through that Actor.

#

But weeeell

sinful tree
#

Still has the other issues of being a multicast though, yea?

thin stratus
#

Yeah, though instead of sending one ClientRPC per GroupMember

sinful tree
#

It's being assigned as something the client has some control over in the network sense - it allows the client to send server RPCs on that actor/component and to receive client RPCs on it.

#

If the actor isn't replicated, then RPCs can't be used on it at all.

twin juniper
#

so client RPC work on the PlayerController, PlayerState, could you name them all?

sinful tree
#

PlayerController, PlayerState, Possessed Pawn & any actor or component that has one of these actors as an owner or are in the hierarchy of their ownership.
PlayerController is considered the "top level" and is what allows a player to RPC to the server at all. PlayerState happens to be owned by the Player Controller, so your clients can use RPCs on it. Same with the possessed Pawn - it is owned by the PlayerController, so RPCs work on it for that particular client. If you created another replicated actor and set the owner as the controlled Pawn, then you'd be able to RPC on that new actor. As soon as that Pawn is de-possessed though, the ownership of that new actor would still remain to that pawn, and since you no longer have ownership of the Pawn, you wouldn't be able to RPC on that new actor anymore.

twin juniper
#

okkk thx

thin stratus
#

If you want to know if one player is behind the other, you need two

#
DotProductOne = Dot(PlayerOne.Forward, DirectionToPlayerTwo);

if (DotProdcutOne > 0)
{
  /// PlayerOne is facing PlayerTwo
}

DotProductTwo = Dot(PlayerTwo.Forward, DirectionToPlayerOne);

if (DotProductTwo < 0)
{
  /// PlayerTwo is not facing PlayerOne
}

if (DotProductOne > 0 && DotProductTwo < 0)
{
  /// PlayerOne stands behind PlayerTwo
}
limber gyro
#

what if i manually set the owner in the server? say for example i have "randomBoxActor", if i set it owner to something that is connected to the client could it send an RPC?

limber gyro
#

thats interesting

sinful tree
#

As long as it is replicated

#

The other thing is, you don't necessarily want to keep swapping around ownership of actors. Like, you wouldn't change ownership of a "Door" in your game so that your client could RPC on the door.

#

You're better off having something handle the interaction of the player that would be owned by the client to begin with, then have that thing RPC to the server first, then the server doing the thing with the actor the client is not owner of.

wheat heath
thin stratus
#

Doesn't really make sense. Even if you perform the Dot stuff for both Players, with PlayerOne and PlayerTwo being inversed, it would result in the same.

#

Or rather, the other player would have inverted results, cause they are not facing the first player.

wheat heath
#

I know, i does not make sense, but is what happens every time.

#

FOrget about the event, is just to screen shot

crisp sable
#

**LogNet: **Warning: Failed to init net driver ConnectURL: 192.168.1.138:7787/Game/MainMap:
LogBeacon: AOnlineBeaconClient::InitClient failed

amber vale
#

Hey, do y'all usually use the server or the client as the target for emulating network latency?

#

I think it depends on what you're doing with those items. If the player is going to be in control of all of those things, then it would be useful to give the player ownership of the actors they control.

#

It would be, at least manually going through and updating ownership. You should create some kind of object to unite all of those objects together, like an "equipment handler." Or you could give the players an actor component to handle that, like an "equipment component."

rain condor
#

I need to bind an event dispatcher on sv side?

amber vale
rain condor
#

I have an inventory

#

And i use an event dispatcher for inventory changed

#

Sv has the inventory logic

amber vale
#

Event dispatchers and delegates are not replicated; they only fire locally. If you want to broadcast something on a machine, you'll need to bind it and broadcast it on that machine.

#

It sounds like an OnRep might be better for your situation though. OnRep functions are automatically fired on all machines (except the server)

latent heart
#

(Unless you're in BP)

rain condor
#

i'm on bp

latent heart
#

Then the OnRep events will fire even on teh server.

rain condor
#

But if i bind it on client, can they cheat?

amber vale
#

No

rain condor
#

Ok

#

Ty

fossil veldt
#

I am not a big fan of the built in packet emulation tbh, I always have used clumsy instead

fossil spoke
#

PostLogin?

#

Not quite sure I fully understand your question.

amber vale
#

You want to wait until all players are loaded in before doing anything?

fossil spoke
#

Can you reword your question?

amber vale
#

You can use the game state's player array to check how many players have joined the match

twin juniper
#

Anyone has some sort of knowledge about networking with DAs ?
I'm using an interface for this system, it takes the DA in the actor and stores it inside a component, then the actor get destroyed

How would that be done with the Data Asset and getting it to replicate?

fossil spoke
#

Does the Host know beforehand how many players are coming into the Session?

#

Or is it dynamic?

amber vale
twin juniper
amber vale
twin juniper
#

(that's the default
I think)

fossil spoke
#

If the Host knows how many are coming, you can just wait until that number of Players has joined..

#

In PIE you can query the number set by the Editor settings relatively easily.

#

I cant remember off the top of my head how you do that

#

But you can get the number of "clients" being created by the Editor

amber vale
# twin juniper loading them at the start of the game

Then everyone has access to the data assets already. If you have a data asset object variable in your character class, for example, you can just get that object locally for whatever value you need. If a data asset has variables that are changing and you want to replicate those changes, that's a different story. Data assets might not be the best choice in that situation, unless you want to replicate whatever functions are actually doing the changing

fossil spoke
#

Just setup an editor specific code path, that might poll the current joined players and initiates it when enough have actually joined.

#

🤷

#

Editor specific code isnt unusual.

amber vale
fossil spoke
#

As its different in many ways to normal play

twin juniper
#

someone told me that I had to use some kind of pointer and other stuff

fossil spoke
#

I dont know what your setup is, not easy to suggest a place to handle it.

#

GameMode maybe?

#

🤷

#

Firstly, try finding out how many PIE Clients are being created.

#

Then use that number to poll

#

Think about what pieces of information you need, how to get them, then how you need to use them.

amber vale
# twin juniper no multiplayer setup needed, right?

If you have a class, AMyCharacter, with a variable, UPROPERTY() TObjectPtr<UDataAsset> MyData, and that character gets spawned on every machine (as it should be), you can just call MyCharacter->MyData->MyProperty whenever you want to get data from it. Everyone has that data asset.

twin juniper
twin juniper
#

FItem contains 1 DA and some variable

amber vale
#

But what class? Like a character class, a player controller, etc.?

twin juniper
#

it's a component inside the player's character

amber vale
#

Is ItemsArray being replicated?

twin juniper
#

it will

#

(I can always set propreties inside the struct to not be replicated tho)

amber vale
#

How are you adding to the array? A struct is a bit of an unusual choice to represent an item

twin juniper
amber vale
#

I'd either create a UObject to represent the item during runtime, or make the item itself represented by a data asset.

#

Regardless, the key to getting this replicated properly is making sure every machine can make the same struct.

twin juniper
amber vale
#

If the player fires something like "PickUpItem" locally to pick up an item, and that calls a function like "AddItem" on the server, then you can just add the item to ItemsArray on the server and replicate it. Then the new item, including its data asset, will be available to everyone once it gets replicated.

#

I highly recommend looking into the FFastArraySerializer and FFastArraySerializerItem structures for managing your inventory. They're fantastic for replicating structures like this, and they're used everywhere for handling inventories.

twin juniper
amber vale
#

It's really up to you. You can do this either way

twin juniper
amber vale
#

Your interface should only be triggering locally: your player presses a button; they do a local line-trace for an actor; they cast that actor to the "interactable" interface; and once they confirm they've actually interacted with something, that's when you tell the server, and the server handles what happens next

twin juniper
#

even the line trace is client only?

amber vale
#

You can ask the server to do the line trace instead if you want, but traditionally, that only happens on the client.

#

Shooting a gun works the same way: the client performs the trace and tells the server what it hit

twin juniper
amber vale
#

Well in that case the listen server is acting as the client. If you only line-trace when interacting on the client, and you interact on a listen server, it will still do the line trace locally; "locally" just so happens to also be the server in that case.

twin juniper
#

Client -> LineTrace + "interactable" interface -> Calls a Server RPC (input is the player's character to know which one to do the change) that calls the AddItem to Inventory of the player's ref from the input -> function runs for everyone (right? server will run and add it for everyone?)

amber vale
twin juniper
#

thx for the help, I'll try to implement it and see if it works!

amber vale
#

Good luck!

ruby lodge
#

@sinful tree Hey man, I just found out that pure p2p where all players are standalone apparently is not compatible with unreal engine. Multiplayer in UE works only in an authoritative state where there is always a server and there are clients. That means I will need to launch a dedicated server for lobbies and parties as well I guess

sinful tree
#

A dedicated server is an instance of the game that is purely running as the server (no graphics, doesn't have a player playing it)

#

Lobbies/Parties come before a client is connected to any server.

ruby lodge
#

So, this means for pre-match lobbies like in COD where they used to yell at each other back in the days I have to use dedicated servers as well?

ruby lodge
sinful tree
#

You're not connecting to a server. You're using Online Subsystems to communicate.

#

So, let's say you clicked on "Join Game" in your game, you'd have it communicate to the Online Subsystem that you want to find a game. It can do some matchmaking for you, and then send you details about the "Lobby" it found for you. You then have that client set up any UI as you want to represent what the Online Subsystem tells you about the lobby and you'd have it set up to bind to further messages to know when players leave or join that lobby, and you'd have a button to "leave" that lobby which communicates back to the Online Subsystem that you want to leave, or you can have a button to communicate that you're "ready" or any other data you may want to send through to the lobby. The Online Subsystem will relay this kind of data to other listeners of that Lobby so they too can know what the status is of the other players in the lobby.

#

Again, this is all before a client has actually joined an Unreal server. It's all client-side.

ruby lodge
#

Ah I see

#

well good that I am currently working on aws gamelift flex match which is responsible for matchmaking 😄

#

That means I don't actually need the matchmaking or p2p of Steam for all that

nimble pike
#

@sinful tree he means a pregame lobby like the valorant warmup game

ruby lodge
#

I don't mean a playable one

#

a menu ui one

#

like in cod back in the days for mw or so

nimble pike
#

sure, but it is the same concept for the most part

quaint rain
#

What can I do to ensure my Door retains its state for late-joiners?

  • I have a door actor
  • The door has a RepNotify enum "DoorState" with Open & Closed
  • I set the value of DoorState via a server RPC
  • When the value is set on the server, the OnRep calls a function, which animates & rotates the door 90 degrees

Everything is working as intended, except the door will be closed for late-joiners. The late joiner can still walk through the door; which tells me the server is still holding the correct state but the client isn't getting the memo.

sinful tree
# ruby lodge That means I don't actually need the matchmaking or p2p of Steam for all that

I'm not sure GameLift has the concept of Parties/Lobbies for players though. Sure, it can launch your instances for you but if you wanted to have an actual "lobby" where you can have players chat with eachother or select characters but still see the status of the other players before the game starts and your actual server is started, you probably would still need to use Steam or some other system to route those kinds of communications for you.

ruby lodge
sinful tree
sinful tree
ruby lodge
#

gamelift does not have parties/lobbies. It has matchmaking and dedicated servers

sinful tree
#

If you want the clients to know about eachtoher.

#

An example would be like... Dead by Daylight. The survivors can all see eachother's avatar and some of their build details and they can't see the hunter, but the hunter can see all of them. The players can all ready up, and when all ready the match will start, or they have to wait until a countdown finishes if there's someone who didn't ready up. This is done VIA a lobby system where there is no game server running to keep them updated, but they are all listening to the lobby data. If I remember right, there's also a chat system available too.

ruby lodge
#

oh and the online subsystem steam is then utilized for that

#

instead of using the default one

ruby lodge
nimble pike
#

oh, good point

quaint rain
#

Yeah, RepNotify.

I am using a timeline for the animation and I can't put that timeline in the RepNotfy function, but instead I am calling a graph event from that RepNotify function. Would that cause issues?

nimble pike
#

what about the mesh itself?

ruby lodge
quaint rain
#

Yes, the mesh is replicated. I can see everything moving as expected while playing as client.

I'ts only broken for late-joiners.

sinful tree
#

The mesh doesn't need to be replicated, just the actor. You're controlling the mesh locally VIA the OnRep.

#

Do you have any replication conditions on the DoorState variable?

ruby lodge
#

see if the value is the same

#

if not, then you know where to fix

quaint rain
sinful tree
#

Too much being replicated there.

#

Don't need to replicate the timeline and the meshes.

neon summit
#

Yeah you're doing what I did don't need to have timeline replicated

ruby lodge
sinful tree
ruby lodge
#

I just don't see how a client side system will allow them to communicate

sinful tree
#

Then you need a lobby/party system. And something has to communicate the data between clients as they are not going to be connected to eachother.

#

The Online Subsystems can do this.

ruby lodge
#

the online subsystems need a server or don't they?

sinful tree
#

Online Subsystems are external to Unreal.

#

It has nothing to do with playing a game.

#

Or hosting a game.

ruby lodge
#

but I need to know how to utilize them inside of Unreal

sinful tree
#

Yes.

ruby lodge
#

I know the common replication methods for unreal

sinful tree
#

And those have nothing to do with the Online Subsystem.

ruby lodge
#

but all these usually communicate with a server

sinful tree
#

It's like another system you communicate with.

ruby lodge
#

any tutorial or so you can suggest?

#

I assume that's a more complex niche type of thing that won't be easily found on yt or in forums

nimble pike
#

The idea behind an online subsystem is that steam will handle some communication logic for you. For example, you can assign players a state and ask steam what that state is (e.g. ready, not ready, in character selection, etc). You can get access to steam's friends interface, etc. Steam even allows a voice chat!

ruby lodge
#

I got the idea of it now but I need to know how to use it

sinful tree
# ruby lodge I assume that's a more complex niche type of thing that won't be easily found on...

Well again, it depends on what you're going to use - if you are using GameLift, I don't know if they have something that can represent a "Lobby" for players wanting to join games that can facilitate communications for you without requiring players joining a server. You could technically build your own system using Lambda functions and using REST calls, with a little bit of DynanoDB. Otherwise, yeah, you'll have to look into using Steam Lobbies, or Epic Online Services or other such offerings to help facilitate such communications.

nimble pike
#

To be clear, a steam "lobby" does actually live on servers, its just that steam handles that for you. With gamelift you will have to host a dedicated server on your own

ruby lodge
#

so a steam lobby like the one we are talking about is not actually client side only

nimble pike
#

A steam lobby cannot feature a playable experience like a warmup match or anything of the sort, you need a proper server (p2p or dedicated) for that

quaint rain
sinful tree
ruby lodge
#

and thus not connected to a gamelift dedicated server

nimble pike
#

internally it is a server, but its steam hosted and you cannot do anything with it. OSS will handle everything there. For all you care as a game dev, it is client side

ruby lodge
#

perfect

nimble pike
#

Do get a playable game you need all the unreal networking stuff, which means a proper listen server

ruby lodge
#

I don't want more than that

nimble pike
#

OSS is disconnected from unreal's stuff

ruby lodge
#

as long as it can do friends, voice chat, text chat maybe and update the selected skin

nimble pike
nimble pike
ruby lodge
nimble pike
#

EOS

#

start with OSS, though

#

its easier

#

but thats an opinion

ruby lodge
#

i can't implement both tho, can I?

nimble pike
#

you can, but they wont interact with each other

ruby lodge
#

or do I need to make a second project and change it up to EOS

nimble pike
#

no, you dont need a second project.

ruby lodge
#

as far as I know epic games and steam games now do cross play

sinful tree
#

I think the entire point of online subsystems is they're supposed to be platform agnostic, you just use a common interface to communicate to all of them, if they implement such functionality.

nimble pike
#

I'm not sure. I have experience implementing for Steam and Xbox, they do not interact.

nimble pike
ruby lodge
#

I found that mid 2022 it was changed

ruby lodge
#

on the same server

nimble pike
#

oh like 2020

#

I havent done much with EOS, when I tried the best way was third party plugins

#

like late 2021

ruby lodge
#

nowadays it's more robust than before from what I have heard but yea

#

OSS is my first station either way

quaint rain
nimble pike
#

wayy more, it was a pile of frustration then, at least for me. Again I have no recent experience with EOS

ruby lodge
#

Alright

#

so now I have a match plan and know that I know a lot less than I thought I know

#

that being dropped, thanks to you all for the help!

nimble pike
#

By the way, some unsolicited advice

#

Please set up budget notifications and restrictions on AWS!

ruby lodge
#

Does the tutorial show it?

#

cause IDK how lol

nimble pike
#

AWS is notorious for random huge charges from unexperienced devs

#

no, I'm sure other tutorials exist though

ruby lodge
#

haha yea, alright gonna check it out

#

I know google has a hard cap if it notices something might have been made as a mistake

#

at like 50$ or so if it's made in a few seconds through a looping function or whatever

#

but I will def check on aws

#

thanks for the reminder

nimble pike
#

And if you host anything on S3, make the name as unique as possible, they have a stupid "bug" they refuse to fix, where anyone can try to put something in it and you get charged for the attempt even if it was rejected

ruby lodge
#

S3?

#

I will probably use a c5 instance

nimble pike
#

simple storage service

#

Lets move this back over since this channel is not where this should be

ruby lodge
#

sure

sinful tree
#

I remember being charged $5 by AWS one month because of a bunch of "alarms" that were active because even though I had a GameLift fleet it wasn't active and just because it wasn't set up to scale it threw those alarms, and because I didn't clear them out, I got charged for having active alarms on a system that wasn't even turned on... Like... What?!

worthy oak
#

Ah yes AWS has a lot of “gotcha” pricing 😂

nimble pike
#

Yup, some free tier confusion got me when I started. Been making sure to read all the fine print on AWS since

worthy oak
#

yeah they have a good free tier but they charge for a lot of stuff you gotta be aware of XD

past flicker
#

I'm trying to rotate a character to face away from a wall on collision. On the server this code works, but on the client the Actor is still facing their original forward vector. I have verified the client is calculating the same transform as the server, and even the debug sphere I'm drawing for Look At Target is in the correct location on client, but the actor won't face it. Any ideas? Some quirk of rotation? The CMC overwriting?

fossil spoke
past flicker
#

I'm using Get Control Rotation for movement, but movement is disabled during this code.

#

This is a wallsplat situation, so the player has no control.

thin stratus
past flicker
#

Get Control Rotation is same on server and client, 0 if I splat them without touching the client, and if I rotate the client camera they stay synced. Is there something I can disable to quickly test how this affects the situation?

#

It was Orient Rotation To Movement. Thanks!

grim prism
#

Hey, i have a problem, I've added sprinting to my game yet when i play as a client, it no longer works, an image of code is attached, any idea why this is happening? Any help would be greatly appreciated.

past flicker
wooden jasper
#

Hi,
What do you guys think about my approach for frame-independent hitboxes?

  1. First i bake the bone position, which i want to trace into a curve using a AnimationModifier.
  2. A custom "Hitbox" ability Task is triggered in the ability (client predicted)
  3. The "hitbox" task starts a timer with a fixed tickrate (also ticks between frames/ multiple times per frame)
  4. I evaluate the previously baked curves and trace spheres on the baked bone positions (relative to skelMesh)
  5. I also trace between the last position and the next position to get rid of gaps in the hitbox

I would love to get some feedback on this. The main reason i did it like this was, because i wanted the hitboxes to always be deterministic, no matter if you have 10 or 100 fps.
It also helps with desync because the hitboxes will be the same if framerate differs between server and client.

woven basin
#

Not sure when the videos for that will go live, usually 2-3 months

#

Just remember if you are talking about melee fighting it’s not just the attacking character, you need to apply the logic to all units in the radius of the attacker, so each frame is a calculation of both sides.

wooden jasper
wooden jasper
nocturne quail
#

that JoinServer query don't support to get list of server launched using the command line?

"J:\UE-5.3\Engine\Binaries\Win64\UnrealEditor.exe" "J:\ARMA\ARMA.uproject" Oklahoma -server -log -nosteam
void UARMAGameInstanceBase::JoinServer()
{
    SessionSearch = MakeShareable(new FOnlineSessionSearch());
    SessionSearch->bIsLanQuery = true;
    SessionSearch->MaxSearchResults = 10000;
    SessionSearch->QuerySettings.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
    SessionInterface->FindSessions(0, SessionSearch.ToSharedRef());
}

void UARMAGameInstanceBase::OnFindSesisonComplete(bool Succeeded)
{
    if (Succeeded)
    {
        TArray<FOnlineSessionSearchResult>SearchResults = SessionSearch->SearchResults;
        UE_LOG(LogTemp, Warning, TEXT("SearchResults, Count , %d"), SearchResults.Num());
    }
}
split siren
#

If you were to make a game and squeeze as many players into a single session as possible, how important would a push configuration be? Reading Iris source it seems Epic is aiming to transition completely to push config (at some point), but did anyone actually tried how big of a difference does it make with high player count?

thin stratus
magic vessel
#

How are Booleans replicated? Does it take up an entire byte for just the 0/1 or something else?

thin stratus
magic vessel
#

I was considering using a Bitflag instead

rain condor
#

How can i refresh inventory when i pickup an item without close it? (Multiplayer)

magic vessel
#

If you have a repnotify for when an item is added, I would call an event that the UI listens to

jade patrol
#

hey, is it possible to have two players on one screen and controls on same keyboard. Setting IMC for 2nd player controller does not seam to work out of the box

rain condor
#

i have an event dispatcher

#

who trigger when inventory changes

vestal forum
#

is there a working sample project for iris?

nocturne quail
magic vessel
rain condor
#

@magic vessel I have logic inventory on sv side

#

I use a replicate struct

magic vessel
#

If you change it to a repnotify, then you should be able to call the same event on the client

true stream
#

Im trying to access a client (player controller) from the postlogin event in game mode, but apparently I cant, despite saying that it will trigger whenever a player connects.

#

so, how should I pass over some game rules I have set in the game mode over to clients?.

magic vessel
#

Where are you calling the update?

rain condor
#

@magic vessel Event dispatcher?

#

On func pickup item inside inventory comp

vital furnace
#

how store and read replicated variables in game Game State in blueprint ?

magic vessel
rain condor
#

On inventory widget

magic vessel
#

Can you show some code?

mental star
#

If I wanted the player to communicate state info to its controller. Would a delegate be the recommended way to go about that?

Or could that introduce some latency

rain condor
vital furnace
# vital furnace how store and read replicated variables in game Game State in blueprint ?

I’ve set up a team selection widget at the entrance of the lobby. This widget displays the number of players per team and offers two buttons to choose a team. For example, it might show that the blue team currently has 5 players out of a possible 10, while the red team is full with 10 out of 10 players. When a player clicks the blue button, they are added to the blue team’s player array, which is stored in the game state. Now, how can we set and retrieve these variables in a multiplayer context, both as a client and as a server?

thin stratus
#

GetGameState->CastToCustomGameState->Get/Set

hoary timber
#

hey, I have an actor, that updates dynamic material instance in tick, and it works nicely on host/server side, but doesnt seem to work on client's side. I tried logging to screen in tick, and that only works for server side too. Not sure if im not understanding something correctly here? Variables replicate correctly, methods also seem to be called correctly, so it's only tick that doesnt seem to work, any ideas?

near spoke
#

Hey guys, I'm losing my head over this one since yesterday... I can't get to pass a Data Asset loaded from disk from server to client, I'm using Get Assets By Path and on the server it works fine, but when I try to inspect what the client receives its just Unknown|Null 😐 maybe it's not possible? Or is there another way?

thin stratus
#

Any code you can share?

hoary timber
#

i just doublechecked, and seems like the tick is working fine actually, but i still have an issue

#
void ACanvasPuzzleLinkedDoor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

    if (bIsDissolving)
    {
        UpdateDissolveEffect(DeltaTime);
    }
}

thats tick

void ACanvasPuzzleLinkedDoor::UpdateDissolveEffect(float DeltaTime)
{
   
    if (!DynamicMaterialInstance) return;

    ElapsedTime = GetWorld()->GetTimeSeconds() - DissolveStartTime;
    Alpha = ElapsedTime / 6.0f;
    EasedAlpha = FMath::InterpEaseIn(0.0f, 1.0f, Alpha, 2.0f); 
    DissolveValue = FMath::Lerp(0.52f, -0.4f, EasedAlpha);

    DynamicMaterialInstance->SetScalarParameterValue(TEXT("DissolveValue"), DissolveValue);

    if (ElapsedTime >= 6.0f)
    {
        bIsDissolving = false;
        this->Destroy();
    }
}```
Thats the method i want to update in tick

private:
UPROPERTY(Replicated)
float ElapsedTime;

UPROPERTY(Replicated)
float Alpha;

UPROPERTY(Replicated)
float EasedAlpha;

UPROPERTY(Replicated)
float DissolveValue;

UPROPERTY(VisibleAnywhere, Replicated, Category = "Components")
class UStaticMeshComponent* DoorMesh;

UPROPERTY(Replicated)
class UMaterialInstanceDynamic* DynamicMaterialInstance;

UPROPERTY(Replicated)
bool bIsDissolving;
These are my values in .h, and GetLifetimeReplicatedProps is set

all the variables seem to replicate, this->Destroy() happens on both sides. Only issues is that the material isn't getting updated, even though bIsDissolving is set to true. I tried to show a message on screen, but it only shows on server side, so im not quite sure how to check if I even enter that method on clients side
#

idk why it didnt format it to c++ :c

lament flax
#

how can i known if a client is listen server ?

hushed ridge
#

Anyone else getting no results when trying to find sessions with EOSPlus?

ancient adder
nocturne quail
# thin stratus Servers like that are DedicatedServers and those do not use Presence. So if you ...

i will build a DedicateServer.exe , the question is where i should call CreateServer ?
i can only think of level blueprints when the server is launched it should be calling this function to start a session, right?

#if UE_SERVER
void UARMAGameInstanceBase::CreateServer()
{
    FOnlineSessionSettings SessionSettings;
    SessionSettings.bAllowJoinInProgress = true;
    SessionSettings.bIsDedicated = true;
    SessionSettings.bIsLANMatch = true;
    SessionSettings.bShouldAdvertise = false;
    SessionSettings.bUsesPresence = false;
    SessionSettings.NumPublicConnections = 10;
    SessionInterface1->CreateSession(0, FName("MySession"), SessionSettings);
}
#endif

OR maybe in the gamemode?

thin stratus
#

Have a look at AGameSession class. That's not so well known. It does however offer a lot of cool stuff. One of those being a RegisterServer function you can override (in your own Child Class of AGameSession).

In your own AGameMode Child Class you can then go ahead and override GetGameSessionClass and return your own.

e.g.

void ACustomGameSession::RegisterServer()
{
  /// Do your Session Code.
}

TSubclassOf<AGameSession> ACustomGameMode::GetGameSessionClass() const
{
  return ACustomGameSession::StaticClass();
}
#

@nocturne quail

nocturne quail
thin stratus
#

Only if you want to exclude the code from Client Builds

nocturne quail
near spoke
#

Guys what's the correct way to pass variables created in GameMode object to a client player controller? I'm always getting a null on the client side

quasi tide
#

GameMode doesn't exist on clients

#

On the server, just set a variable value in the controller and onrep it.

rose egret
#

how to get camera location on server ? i want the camera to be controlled by client . CameraManager.bUseClientSideCameraUpdate is true but still not get updated

lament flax
#

is this a good start to test high ping in PIE ?

#

also, what does Run Under One Process really change ?

sinful tree
#

A continual 500ms and 10% packet loss would be completely unplayable, but your game should hopefully be able to recover from a burst of high ping & packet loss like this.

sinful tree
# lament flax also, what does `Run Under One Process` really change ?

When playing in the editor running under one process means there's only a single game instance actually launched, so it wouldn't technically be a real multiplayer game as the engine would be simulating connecting to itself, and it wouldn't necessarily behave as if it was different instances of the game connecting.

lost inlet
#

just at least use the network emulation settings

lament flax
#

idk if i should test with this untick, i guess i prefer doing some real testing with a build

weary lava
#

I asked this in the GAS channel, but i'm getting some issues with spawning a projectile and network replication, because the projectile's rotation only follows the client's location and yaw rotation, and the pitch is not included (the projectile just goes straight forward, and doesn't account for the player looking up or down). This only really happens when I have an external actor spawn the projectile, when the actor being controlled by the client does it, the projectile correctly shooting in the direction the player is looking.

lost inlet
#

what even is the context of this

#

GetPlayerController(0) on the client will be fairly okay as long as split screen is never a consideration but I typically avoid it

#

I'm not sure why you're not just passing the player controller or pawn around in the event

#

that event comes from somewhere right

#

OnClicked

#

this is why context is important

#

what BP am I even looking at

#

what broadcasts the event, from where

#

oh wow it is, though it's dependent on specific FKeys, and the player controller is the thing that actually broadcasts the event in the first place. yeah, I don't think I'd rely on this in particular since the least they could've done is add the PlayerController to the event as a courtesy

#

not the most sophisicated system since it just uses GetHitResultAtScreenPosition to work out what's in the middle of your screen

#

I guess it works, it's just ugly. When I've worked on interaction before I just did a sweep when the use key was pressed and then send that data to the server if there is

#

And since it was a sweep, there was some sorting logic if two interactable things were close together

#

I suppose that is also an important detail, but the in-engine functionality isn't particularly difficult to copy

#

GetHitResultAtScreenPosition really is where the sausage is made, the hit result would contain the component you're clicking on

#

and GetHitResultUnderCursor*

rustic sable
#

I wanted to trigger an OnRep then destroy the pointer in the client function but seems I can't use it this way

lost inlet
#

please elaborate

rustic sable
#

well everything was working great with equipping items but for destruction I had
Player->EquippedChest->Destroy(); Player->EquippedChest = nullptr;

The client doesn't get called until the pointer is nulled so too late to replicate, destorying the mesh

#

maybe just a client function would work better here and instead of OnRepUsing just keep the pointer as replicated then handle it on the client

lost inlet
#

I'm not sure I'm getting a sense for the problem?

rustic sable
#

just for destroying the armor meshes when the player unequips and item and to have it replicate

#

the equipping part works fine, everything replicates as expected

#

right now it's double click in the widget > Server returns the item to inventory > if successI would want to trigger the OnRep for the client to destroy the mesh

lost inlet
#

and the OnRep is on what?

rustic sable
#

all the equipped bits, in this case EquippedChest

lost inlet
#

why not just do cleanup in EndPlay?

rustic sable
#

hmm? the player is just changing armor

lost inlet
#

oh I thought you meant the instance

rustic sable
#

oh sorry no

lost inlet
#

I'm still not sure why an OnRep of the EquippedChest variable wouldn't do what you expect

rustic sable
#

well in order to trigger it I need to change it to something right?

lost inlet
#

well you are changing it in your snippet, to null

#

that'll replicate

rustic sable
#

it's not tho.. ok good to know it should

lost inlet
#

are you testing in listen server mode or something?

rustic sable
#

I was under the impression that you had to handle it in the OnRep

lost inlet
#

huh?

#

you'll get the OnRep when it's set to null

#

with the new value... of nullptr

rustic sable
#

right but on the client side the mesh was never destroyed

lost inlet
#

this is why I ask if you're testing in listen server mode

#

because from the serverside, OnReps would need to be called manually

rustic sable
#

I mean the editor is set to listen server but checking this on the clients

lost inlet
#

well the first "client" is the server

rustic sable
#

yes, I get that. I have it set to 4 and checking on the non listen server clients

#

but calling destroy on the object on the server won't replicate correct?

lost inlet
#

well it's a replicated actor, the actor will be destroyed on clients too

#

it's not going to affect the OnRep

#

did you add a breakpoint to your OnRep?

rustic sable
#

yes and logs etc

lost inlet
#

does the client "predict" the nulling of the value?

#

because by default, OnReps only get called when the client value differents from the server

#

COND_Always will make the OnRep get called whenever the server value changes

rustic sable
#

no it doesn't predict yet but I think that might be a good way to approach it

#

also thanks for validating that the destroy() should be replicating, I need to take a closer look at what's happening inside the actors I think

peak mirage
idle coyote
#

So what would be the best way to detect an overlap event and then wait for a specified time before processing the event again?

#

I have a melee weapon striking another player and I want the beginoverlap to only be called once.

#

for a given "swing" of the weapon

twin juniper
#

Hello, I got a lil question about optimization

#

Is it a good practice to set every relevant variable to repnotify?
I just found out that the servers tries to sync them every tick
So I was wondering if it would have an impact on perfomance if you set all your variables on repnotify instead of event driven

fossil spoke
#

Dont process any further overlaps if the Bool is true.

fossil spoke
#

"the servers tries to sync them every tick"

#

What do you mean by that as well?

#

It seems your understanding of how Replication and Replicated Properties work is faulty?

twin juniper
#

Sorry. I meant to say just replicated

fossil spoke
#

RepNotify is simply telling the Property that when its value changes on the Client, it should call its corresponding OnRep_xxx function.

#

It has nothing to do with performance.

twin juniper
#

let me reword it

#

Would it be better to have all the variables replicating every tick or would it be better to sync them on events?

fossil spoke
#

So properties are only ever updated by the Server to Clients (replication), if the Server identifies their value has changed.

#

They are not updated every frame.

#

They are evaluated on the NetUpdateFrequency time for the Actor they belong to.

twin juniper
#

ohh

fossil spoke
#

This is the default "polling" method for property replication.

#

The alternative is called "push" model.

#

Which is only available in C++

#

You as the programmer mark a variable as having been changed

#

So the engine doesnt have to evaluate that itself (which costs cpu time).

#

Then it sends that value to Clients.

#

That is how you would achieve an "event driven" approach to managing the replication of a property.

twin juniper
#

Gotcha

#

thanks a lot

#

its clearer now

fossil spoke
#

Please take the time to read the Network Compendium

#

It is the first Pinned message in this channel.

twin juniper
#

I got another question

fossil spoke
#

Sure

twin juniper
#

Gib a min

#

Why is this variable is not passing down to the client?

#

Im trying to pass a reference from a actor from the server to a client

fossil spoke
#

Enemy is invalid on the Client?

twin juniper
#

Enemy is valid, I mean the one above

#

The chosen actor

fossil spoke
#

ChosenPokemonActor?

twin juniper
#

yup

fossil spoke
#

Why are you passing it through an RPC if its already a Replicated property?

twin juniper
#

Its not replicating cuz its marked as invalid

#

The is valid is going throught not valid

fossil spoke
#

That didnt answer my question.

twin juniper
fossil spoke
#

Ok

twin juniper
#

I just did that as a desperated attempt

fossil spoke
#

Does the Actor have bReplicates enabled?

twin juniper
fossil spoke
#

When do you call this RPC?

#

The Actor might not have been created on the Client yet?

twin juniper
#

How do I force the client to wait for the actor to spawn on the client?

fossil spoke
#

Well that would probably be a good use for OnRep for the property instead of passing through an RPC.

#

The OnRep would be called on the Client when the Actor is received.

twin juniper
#

I'll try that right now. Thanks for your help so far

devout sonnet
#

I need help understanding replication. I've made the simplest game I can possibly think of. Any advice on what I should do would be appreciated. I don't understand how to get the other players number to be displayed.

Game: Highest number
Description: two players enter a number, whoever enters the larger number wins.

sinful tree
# devout sonnet I need help understanding replication. I've made the simplest game I can possibl...

This is more complicated than it seems.

You'll need to utilize the PlayerState to store data that should be replicated about a particular player as it doesn't look like you have a Pawn.

Replicated variables only replicate from the server to clients - clients setting replicated variables will only set them locally on that client. This means you'll need to send a server RPC on a client owned actor, like the owning client's PlayerState, to send the number the player inputs to the server and the server can then set the value in a replicated variable for other clients to receive.

In order to display the value of any particular player, your UI will need to know about all the different PlayerStates. It's usually best if you create a widget for each PlayerState that exists and have it keep reference to the PlayerState it was assigned so that you can read values from that PlayerState. To complicate things further, all PlayerStates may not exist by the time you're trying to create these widgets to display their values as "Begin Play" doesn't fire all at the same time everywhere and there is latency involved with multiplayer games - to overcome this for now, you could have a widget that you construct and in that widget's OnConstruct, you can delay 3 seconds, and after that delay, get the Player Array from the GameState, and create a widget for each playerstate - feeding in the reference of the playerstate to the widget you're creating.

If you want to know which playerstate is your local one in a widget, you can get the Owning Player of the widget and compare it against the return value from a PlayerState's GetPlayerController function. If they match, then that PlayerState is yours, and you can customize the widget based on this condition.

candid tinsel
#

is it possible to call an event to happen when two players collide into each other

thin stratus
#

I know the CMC has an event for this, or at least it tells the character about it. But not sure that's exposed to BPs

candid tinsel
#

im trying to call the event to ragdoll when two players hit each other when sprinting

#

i tried using actor behin overlap then used the player as the other actor but it acted on everything not just the players

nova wasp
#

then just... don't trigger if the other hit actor isn't a player? seems pretty straightforward to me assuming it passes that in

candid tinsel
#

nvm i fixed

#

always something stupid that causes not to work i basically i made the cast to player as pure

#

only thing is that it records the hit event only on the player that is hit not also the player thats doing the hitting if that makes sense

candid tinsel
#

this is what i meant

#

like only the character that is getting hit is going into ragdoll state while im trying to make both of them go into ragdoll state

dark edge
#

How is the hit being done?

#

What is moving to cause the hit?

candid tinsel
# candid tinsel

this is the event hit its inside the same character blueprint that is on the other actor

neon summit
#

Maybe because you only rag doll if velocity is greater than 400

candid tinsel
#

that doesnt change anything

#

if you look at the video the one that is running when their velocity is greater 400 it causes the ragdoll event but it only happens on the other character that is standing

neon summit
#

Yeah you're right my bad

candid tinsel
#

actually i removed the velocity but now it only happens on the client screen that both players go into ragdoll state

neon summit
#

If you do a print does it print for both? Does the hit event fire for the one you're controlling

candid tinsel
#

not the other actor

neon summit
#

Probably need to ragdoll before the cast too maybe. Gets confusing when they're both the same character

#

What's the replicate graph

candid tinsel
candid tinsel
# candid tinsel

the ragdoll replication works completely fine on everything else and the code from movement state in after is the same i used when pressing a button for example

#

i think it doesnt have to do with the replication but the event hit it self

#

im basically trying to make it that if 2 players are running above speed 400 and they collide into each other they go into ragdoll state

#

i tried it this way but got this weird glitch

dark edge
#

What are the rules. Do you want both characters to ragdoll if either one is going above 400?

candid tinsel
#

basically if they are both running

dark edge
#

Or do both need to be going above 400?

#

How are you testing? If they are both running, you can't drive two characters at the same time.

candid tinsel
#

i tried it with two clients and the collision works perfect but when its the server doesnt go into ragdoll state

dark edge
#

The server version of which character? There are two characters on every machine

candid tinsel
#

the server as in the player on the main screen

dark edge
#

Ragdoll should be a rep notify btw

candid tinsel
dark edge
#

Knocked down is state

candid tinsel
#

the server goes into ragdoll only in the client screen

dark edge
#

Back up and do it like this:
Hit -> if other thing is a character and self is going fast, set enum on other thing to ragdoll

#

Enum should be repnotifh

#

In enum repnotify, switch on enum to set ragdoll or not

#

That would effectively be "knock down other guy if I'm going fast"

#

You got to remember the event hit happens everywhere. When two characters hit each other, there are four event hits that fire. Two computers times two characters

#

You can switch by authority to proceed with the hit, but try what I sketched out first. It might work as a poor man's prediction

candid tinsel
#

ok but when you say enum should be rep notify which one are you talking about is it the movement state on the code i showed earlier? because that already has rep notify

dark edge
#

Then why aren't you using the rep notify? Just in the rep notify, set weather to ragdoll the mesh or not. Then all you need to do to make the thing ragdoll is set the enum.

#

Although you gotta make sure it's not instantly getting out of ragdoll, idk what your code is for that.

candid tinsel
candid tinsel
neon summit
#

What's the on rep function?

candid tinsel
#

its set when the player is in the ragdoll state

dark edge
#

Repnotify

dark edge
#

Show the rep notify function.

candid tinsel
#

the movement state?

neon summit
#

When you set a variable to repnotify it creates a function

dark edge
#

The function basically is "what to do when this enum changes"

candid tinsel
dark edge
#

So keep that energy. You are now in ragdoll, make the thing ragdoll.

candid tinsel
#

wym by that

neon summit
#

Just call your ragdoll event on the ragdoll switch I believe. Off the switch of the replicated variable. Not sure if it'll work correctly with the other stuff and seems overly confusing

candid tinsel
#

this the results i got when i used print string on event hit other actor is character

#

on the input action to activate ragdoll it works perfectly and i used the same code logic to activate the code on other stuff like on landed event and it replicates perfectly too but im not sure why its not working on event hit

#

thats why i was thinking i might need to implement something different to the event hit so that it works on the server and the client

#

if i use the same code on the input action and put it in the event hit it only works for the clients but for the server it doesnt go ragdoll in the server screen

candid tinsel
#

so i tried it with the server hitting both clients and the server only goes into ragdoll when it hits a second player/client like in the video

normal viper
#

I'm not able to run events on server when they are called from Widgets? I need to do it trough Player Controller?
Here on button click I'm calling to the Building (actor that I want to be destroyed).
Inside Building I have event Cancel Construction.
Server of course can delete his building, but clients can't. I guess I just cannot call to rpc from widget? Or like the Building actor cannot call to server?

hollow bear
#

Not enough login credentials to launch all PIE instances, change editor settings

are anyone able to help me with this? Im not sure what exactly to do here. Im playing with 2clients with the server listen mode.

normal viper
candid tinsel
#

fixed the issue turns out i need to put an authority switch on the event hit

static charm
#

hey guys did a tutorial and was doing so well bu tlast hurdle, cant get any session to show up in my server broser any idea? it never seems to find any servers when i create them, its def not failing it seems to hit the for each loop and end , i guess it cos the results is 0?

lament flax
#

Can OnRep be missed ? Or does the server send a call until noticed by client ?

twin sable
#

are TOptional networkable in 5.4?

solar stirrup
solar stirrup
#

UHT will whine if it's not supported

queen escarp
#

im getting access none on my player hud wb wich is created on the player controller and"works"

#

on clients. tiups :/ ?

#

oh wait mb

pseudo crown
#

how to create Join and Host Server?

nocturne quail
# pseudo crown how to create Join and Host Server?

this question can't be answered in 300 lines of text

you have to watch tutorials how peoples are doing it.


Local listen server/join
Local dedicated server/join

Nat listen server/join || Custom master server
Nat dedicated server/join || Custom master server

Steam listen server/join
Steam  dedicated server/join

Packaging Server || Seperate
Packaging Client || Seperate
Packaging Server/Client || Together

these are some core things you need to learn

#

also look at EOS, AWS etc

odd hamlet
#

sometimes the players don`t spawn as they should, any ideea why this is happening?

nocturne quail
odd hamlet
#

2 sec ain`t a bit to much?

nocturne quail
#

start testing from 0.2sec

odd hamlet
#

its annoying because sometimes my player gets spawned under the world

nocturne quail
#

this means the player start is missing or at bad place

#

put player start with +100z on gound, let the player fall on ground

odd hamlet
#

yeah i am doing that

odd hamlet
#

it`s so annoying because sometimes my player still gets spawned badly afffff

#

i put them to spawn face to face

#

and sometimes they spawn almost in same place

nocturne quail
#

you should mark a player start to not be used if it was already used

odd hamlet
#

yeah maybe you are right,

odd hamlet
worn light
#

Hello I want to make a lobby system in which I can invite other players and start the match. My game will have dedicated server so I wanted to know that can I use play as client in unreal engine for testing lobby
Also I want to know is it possible to make a lobby and test it by using play as client instead of play as listen server

fossil merlin
#

I've come across an odd issue I've not seen before - I have some code to play a montage during an auto fire timer. Nothing new there; however, on the client everything looks normal. On the server, though, it waits to finish playing the montage completely before firing the next bit of code resulting in a very slow fire rate server side (where it matters). Has anyone seen this before or know where I can have it NOT do that?

fossil merlin
#

I have and the only thing I notices is that the code fires normally if the montage call is not there. The issue is the server waiting for the montage to finish before executing code. I don't see anywhere where that should be the case.

#

It's almost like it's firing on the OnCompleted pin, when it's not.

nocturne quail
# fossil merlin

that Fire Anim only calls on Server, how do you know it was called on other clients and it was working fine?

fossil merlin
#

Checking from different net modes with 2 players in PIE, and that call comes from a multicast. On the client, it's all good...on the server, it's slow as it waits for the montage to finish first. Very odd behavior I've not seen before.

nocturne quail
#

if the server is waiting, the clients will also wait, else something bad with your code

fossil merlin
#

You'd think - but the client is not waiting. Just the replication layer and server. Again, if I remove the montage call completely, everything fires at speed and is all good. It's just the presence of the montage call that slow it down. Not sure if it's a bug, or what.

nocturne quail
#

How did you call FireAnim? can you post the code?

fossil merlin
#

The fire anim call is in the lower right

nocturne quail
#

you should call ServerFire if !Authority

#

the second mistake, you should not check for Authority in Multicast events

#

server calls multicast already on all clients

#

when you Fire: Checkif HasAuthority,
yes -> MulticastFire
no -> ServerFire

fossil merlin
#

The MC fire event calls the Fire event - not the other way around. If I did as you suggest, no code would ever execute.

nocturne quail
#

Fix you code next

#

start with what i said

fossil merlin
#

Even so, and I did try it, the code still waits on the montage to finish before firing again.

nocturne quail
#

post new code

fossil merlin
#

I even tried plugging in the montage directly to (tried both) the server fire call and the MC, and it still waits.

#

IGnoring all other variables.

nocturne quail
#

you don't understand the concept of multiplayer replication, you need to watch this video to get learn
https://youtu.be/OhrijWnJdyE?t=116

Check out my Patreon: https://www.patreon.com/user?u=60713904 Join the {GDR}; Discord server and download my free project files: https://discord.gg/dUm3ZtYDuV
Buy me a coffee: https://ko-fi.com/bluntstuffy
Follow me on Twitter: https://twitter.com/BluntZombie

This tutorial is mostly about how to setup a multiplayer framework in Unreal Engine 5,...

▶ Play video
hushed ridge
#

if I use EOSPlus with Steam for crossplay, is it a requirement for the steam account to be linked with some sort of Epic account?

#

basically EOS without EAS

proven pagoda
# fossil merlin

This multicast has an issue. NetMulticasts are broadcast to clients as far as I know. You're executing on the server only the multicast, but what about the server itself? You switch authority in the multicast after checking if locally controlled, meaning only the server player will execute fire on the multicast when you're trying to send it to all clients. From what it sounds like, none of your clients are playing the anim so they're not locking up like the server? My thoughts.

#

And anims will stack on top of each other if they have too many frames so if you're rapid fire then it won't play the next anim until the first one is done. I'm assuming you're using an animnotify for the bullet and effects?

#

Unless I'm wrong and there's a way to interrupt your anim using the fire function

fossil merlin
#

I was able to identify the problem, and did remove some of the authority nodes as they were not needed. The issue lied in the fact that my CanFire macro was being called twice (elsewhere than what is shown) which was causing my montage issue. Once that was removed the code ran as expected.

twin juniper
#

Could someone please tell me why server player is returning false on is locally controlled?

#

despite being a player

neon summit
#

whats the best way to avoid using this delay?

mystic estuary
mystic estuary
neon summit
mystic estuary
#

Instead of relying on time, make it so that there is an event that is fired when your system is ready that you listen from UI

neon summit
#

It's created on Possessed event of pawn that calls a client rpc to create widget. The client's pawn isn't spawning in time.

mystic estuary
#

Listen for OnPossess event client side, and spawn the UI based on that

#

IIRC BP OnPossess is server-side only. C++ has AcknowledgePawnPossession, and it's called a bit differently in BPs

neon summit
#

sorry i see IIRC alot but I dont know what that stands for

mystic estuary
#

If I Recall Correctly

neon summit
#

oh ok lol

mystic estuary
#

Nothing multiplayer related 😄

neon summit
#

anyway I've solved this before but would like to know the BEST way

#

I'm starting a new project than my main project

mystic estuary
#

Listen for C++ AckPosession, and create all your stuff based on that. Alternatively you can create it from CH's BeginPlay when IsLocallyControlled

neon summit
#

im not doing c++

mystic estuary
#

Alternatively you can create it from CH's BeginPlay when IsLocallyControlled

#

But the best one is the former. It's a shame that it isn't exposed to BPs, it doesn't take anything. I personally don't see any limitation relatively to that

neon summit
#

I typically have put the widgets on the controller but it shouldnt really matter right?

#

Im assuming CH means character

twin juniper
mystic estuary
mystic estuary
mystic estuary
twin juniper
#

so what can I do to run this code only run on the characters that each player controlls including the character of the server?

mystic estuary
#

What do you mean by that? Do you understand what "controlled" mean?

twin juniper
mystic estuary
#

Exactly

twin juniper
#

So, I want to run this code on the actor that you control on your "copy" of the game

mystic estuary
#

Are you familiar with terms simulated proxy and autonomous proxy?

twin juniper
#

Not really, I havent heard of it. But if I have to guess simulated proxy means the other actors that the server syncs with you