#multiplayer

1 messages · Page 663 of 1

vague spruce
#

good call

peak sentinel
#

Do you guys set FX related multicast events to reliable? I'm testing with average latency and unreliable RPCs almost never run

#

Like %5 of the chance clients see visual effects on unreliable RPCs

winged badger
#

that depends on how much you clogged your network

#

ours work fine

#

setting everything reliable makes network perform worse, not better

peak sentinel
#

I am unable to use Unreal Insights because my Windows is not working very well lately, but I can say I am not using that much bandwith, actually not even close to "much"

winged badger
#

bandwith is not the only thing that can choke your network

#

especially with listen servers

vague spruce
#

@winged badger you using rider?

peak sentinel
#

CPU can affect bandwith?

winged badger
#

for writing, not for debugging

#

VS for debugging

vague spruce
winged badger
#

and how much time server can spend evaluating actors for replication

#

most network chokepoints are in those 2 categories, not bandwidth

peak sentinel
#

I see, well still I can say I guess I am not close to that point, so probably I should debug more before trying to understand whats going wrong

#

Thanks Zlo

vague spruce
#

@winged badger fantastic idea on using vs for debugging. this is great, thank you!!!

fluid summit
summer tide
#

How do you troubleshoot multiplayer replication issue using VS?

ebon plume
#

How do i prevent local player controller to change a variable in the player state ?

#

I know i could use a switch has authority but thats not really the point. I am trying to prevent cheaters from changing PlayerState variables

vague spruce
#

the player state is server-side. even if a cheater were to change the variable on the client, the server would overwrite it

#

there is a copy of the player state client-side which serves up replicated values

#

if your game is server-side authoritative, it's unlikely that a cheater changing values locally would affect other players

ebon plume
#

Can i store the players Health for example in the player state and then request the Health var in the player BP to show in UI ?

I did it and it works but im now curious about cheat protection and i think you just answered that.

The only other thing would be:

Where should the TakeDamage be called to adjust the player health ? -> in the player state ?

#

I tested by grabbing and printing the player state replicated Health variable.

When i change the health variable from the Player BP, it works. I feel like it shouldnt

vague spruce
#

yeah for sure the player's health can live in the player state, but modifying the player's health should not happen client-side. the server should be the one modifying the player's health and then that should get replicated to the client

#

if you run the code client side it'll always change, for sure. but that doesn't mean it's changed on the server

#

tag your TakeDamage function as UFUNCTION(Server, Reliable) and then implement it

#

you'll notice that the health doesn't change on the client

#

that's because you now need to grab the replicated value and show it

ebon plume
#

OH it works

#

I see

#

I printed the health from the player state in the event tick and tried changing it in the Player BP, it printed the new Health variable but instantly overwrote it

vague spruce
#

is the variable Replicated?

ebon plume
#

Yes. Actually i have a problem now

vague spruce
ebon plume
#

It prints:

Client 1: 100
Client 1: 100
Server: 100
Server: 100
Client 2: 100
Client 2: 100

Then i change the Health variable in the Player BP to 500 and it Prints:

Client 1: 100
Client 1: 100
Server: 100
Server: 100
Client 2: 100
Client 2: 500

#

Okay I did it with 1 player and running dedicated server:

Prints:

Client 1: 100
Server: 100
As expected.

I change the variable to 500 in Player BP:

Client1:500
Server:100

This is correct im assuming ?

Becuase any TakeDamage or GetHealth will be called on the Player State and the clients health shouldnt matter at this point ?

ebon plume
vague spruce
ebon plume
#

The player state should hold all information that the player has throughout a session, taking a shooter for example his score, KDA, rewards, etc. Everything unique to controlled pawns, such as stats (health, stamina), accessories (weapons, tools) and pawn specific UI should all be stored in that pawn.

Is this true?

I have been told differently

keen condor
#

hello , how can i replicate rotation in c++ in an easy way (by using functions that already exists) . Didn't find it in the doc.

vague spruce
ebon plume
#

Store player stats . etc . in the Player BP itself which sounds like BS.

I am thinking I should store everything in the Player State and then reference those variables from the player BP. Hopefully Lag doesnt cause huge issues here with server response times.

meager wing
#

That being said, if you're not worried about cheating for whatever reason, you can honestly just do whatever works lol

#

Im not familure with all the good practices

ebon plume
#

Yes. Worried about cheating. I think the PlayerState idea will work

#

Now I am trying to think of how to store the players inventory in the PlayerState.

Wonder if I could use a DataStruct with Objects and the in the Player State, Have a replicated Empty Array or Struct of some time and then when the player adds to inventory, the server function is called and adds a specific Struct Element to the Inventory

meager wing
#

I don't see why not

ebon plume
#

I have been struggling with the multiplayer inventory concept for about a solid week now

fading birch
#

in terms of server authority, there's no real difference between character/player state

meager wing
fading birch
#

no more than storing them in the playerstate

meager wing
#

As well then, do whichever works I suppose

ebon plume
#

But when you try and change Player State stored health variable, it will not work. This seems to be more protected?

fading birch
#

if the variable is replicated it doesn't matter

#

the server will correct any change the client tries to make

keen condor
#

I managed to fix my rotation issue , but now if i wwan't some to join me in game (i'm running as listen server) what am i suppose to do ?

fading birch
keen condor
#

thanks buddy

meager wing
#

Been trying to find an elegant solution for replicating physics smoothly. Didn't expect it to be such a subject.

My current project is a game that resolves around stacking and organizing boxes that are easily knocked over

#

But it's so damn jittery when testing online, clients with even moderate ping get janky jittery movement

#

I was looking at the SmoothSync plugin

fading birch
#

physics is a bitch to replicate

#

it's why the CMC exists for character movement

meager wing
#

There are so many physics based multi-player games, which makes me know it's possible lol

#

But I can't find one definitive solution

meager wing
fading birch
#

Chaos is a buggy mess still

meager wing
#

I haven't messed with it yet, just read that it'll be way more deterministic and thus easier to replicate. Or that's what I understood, still really new to networks

fading birch
#

Most of the time you fake the physics replication. Replicating actual physics can be extremely expensive. There is sub stepping for physics, which you can use to make it deterministic, however that means your players will suffer a very degraded experience if they have a poor connection

sinful tree
# ebon plume Yes. Worried about cheating. I think the PlayerState idea will work

Where values are stored doesn't particularly matter for cheating in your case - whether it's a Pawn or PlayerState, both can have replicated values from the server that can prevent the player from modifying their values. Preventing players from cheating is largely alleviated by not trusting clients to tell your server what is what. Eg. If you let your client tell your server "I hit this particular actor for 30 damage" - what's to say the client can't manipulate the values to say "I hit this OTHER actor for 300000 damage". Instead, you should just let your client say "Fire gun" and that is sent to the server to then figure out who was hit, and for how much damage, and the server then replicates the results back to all clients.

Storing a health attribute or any values in Pawn is fine if it is related to that pawn, but PlayerState can work ok too. It doesn't make as much sense to store in PlayerState if say, you can control multiple pawns - then you'd have to create multiple health variables in your PlayerState anyway which you may as well have put into the Pawns themselves.

fluid summit
#

Hi! i'm doing some tests for replication.
I'm using a listen server and spawning a bunch of TestActors on server and replicating both the actor and one float variable on each of those actors. Than running a timer to change the value of the float every second.

#

if i try to read the value of any actor spawned on the server, it reads okey and it changes.
If i try to read it on the client that it's supposed to be replicated, i don't even have the actor in there.

#

Am i missing something?

sinful tree
fluid summit
#

yeah, it's the one on the first picture "ProxyClass"
Only relevant to owner
Replicated
NetLoadOnClient

#

also, i just found that if i spawn, let's say 100k of those actors from one client controller (using RPC On server).
When i close that client, the 100k actors stay on the server (i tought that they died with the owner)

#

Could this be the reason for both things?

#

i'm calling "On server" from the player controller and passing self.
Would this mean "Self" version of the server for the player controller?

#

in that case it would make sense to not replicate the actors or the float within the actors to the client

sinful tree
#

I think you may be running into issues because you're trying to create 10000 actors and replicate them through the array.

#

I've set up a test actor on my end same as yours, spawning it the same way (but only 1 of them), and using a key press to check the random float, and it works fine.

fluid summit
#

that makes sense, on the game i'm developing i have a similar setup with the array and i ran on to the same problem

#

let me check without the array

vague spruce
#

in the GASDocumentation it says to use LocalPredicted for the execution policy for abilities. however i'm getting issues with montage prediction where the montage basically fails to play. ServerInitiated seems to work way better for me. is there any reason why i shouldn't be using ServerInitiated? it's the only net execution policy that isn't a massive PITA

eternal canyon
#

cause they all have their own uses

vague spruce
eternal canyon
#

he doesnt say to only use local predicted then

#

Local predicted is when u want to predict the ability

vague spruce
#

do i risk a super laggy game by just setting all of my abilities to server initiated?

eternal canyon
#

Server initiated is when u want to wait for the server to activate the ability before starting

vague spruce
#

what can i do to prevent this montage from not playing predictably? i'm failing on this:

#

the ability is executing fine both on the client and the server but for some reason the montage isn't playing, it's just getting rejected and my gameplay ability is going to On Interrupted

eternal canyon
vague spruce
fluid summit
ebon plume
#

Anyone seen this type of error ?

fluid summit
ebon plume
#

Heres another one for example:

#

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

fluid summit
#

what are the replication properties of the actor that ownes that health property?

ebon plume
#

Currently, nothing owns it other than the PlayerState

#

I havent used it anywhere

fluid summit
#

maybe it's trying to update the other player's version of that playerstate, but they have no open channel for that actor?

#

maybe try a "has authority" before setting the heal

ebon plume
#

Okay yeah it only throws the error if i play with more than 1 client in the editor

fluid summit
ebon plume
#

Worked though lol

#

But i get what you are saying

fluid summit
#

maybe the replication is sending of the new state to the other clients, i would check if the other player sees your hp correctly if it changes, just in case.

ebon plume
#

Will test now

#

So when i do this. It updates on both. Which is right ?

#

I can see the same result on both screens

vague spruce
#

is there a clean separation of organization that yall do when replicating? i'm having a hard time piecing together what code i have running on the server and what i have running on the client

sinful tree
ebon plume
#

Im not understanding

sinful tree
#

When running multiplayer you have more than 1 computer running the code.

  1. The server.
  2. Any clients.

So when something "begins play" it can "begin play" on:

  1. The server.
  2. Any clients.

By putting in a "Switch Has Authority" you're telling the execution to only proceed on the computer that has the authority over the actor. In this case, it would be the server.

fluid summit
# fluid summit the problem was the array, thanks! i also got around 100/150 less ping at 250k a...

just in case anyone is interested, replicated arrays can hold around 5k pointers (448kb) if not within a struct

`Static arrays are sent over the network efficiently by only sending the changed values. This rule however is overridden if the static array is within a struct, due to the "all or nothing" rule attached to structs. Thus avoid large static arrays within structs, as then the entire struct is sent even if a single array value is changed.

Replicated static arrays must be less than 448 bytes. Thus some static arrays of structs cannot be sent due to this restriction.

Replicated notification of static arrays only work on the first initial replication update. Subsequent static array replication updates do not call ReplicatedEvent. However, if other replication notified variables call ReplicatedEvent, the static arrays then also call ReplicatedEvent. Static arrays within structs will always called ReplicatedEvent. Thus, if you are finding that static arrays aren't calling ReplicatedEvent at the appropriate times, replicate a boolean at the same time to make sure that ReplicatedEvent is called.`

ebon plume
sinful tree
#

It just doesn't need to be marked as a replicated function.

#

Eg. This would only run on the server.

ebon plume
#

Like so

sinful tree
#

Yep

ebon plume
#

okay, i was confused thinking you were telling me to remove begin play node entirely lol

sinful tree
#

If you leave it as an RPC event, I believe that opens a means for players to cheat as a client can then spoof an RPC to run that event.

ebon plume
#

ahhh. okay thank you

fluid summit
sinful tree
#

Don't trust clients.

fluid summit
#

Oh i actually understood now what that means.

#

I tought i was safe as long as i make the call to modify stuff from the client doing a RPC on server.

sinful tree
#

You can, but the server should be verifying the action - not just doing it because the client asked to do it.

#

Unless of course, you don't really care.

ebon plume
#

Question:

I am storing an array of asset data for the inventory. The asset data derives from my cpp files and was just wondering if it would be smart to make totally separate arrays for different types of items in the inventory ?

For example:

I have a data asset for weapons.
It has all the UPROPERTIES i need for all my different variables.

For consumables etc, should I make another seperate data asset with different properties ?

Rather than just have some large generic data asset

vague spruce
#

An overview of the essential concepts for writing multiplayer game code in Unreal, in under 25
minutes or your money back.

Sample project: https://github.com/awforsythe/Repsi/
Patreon: https://patreon.com/alexforsythe
Twitter: https://twitter.com/alexforsythe

00:00 - Introduction
01:24 - Net Mode
03:33 - Replication System Basics
05:13 - Acto...

▶ Play video
#

this video will tell you everything you need to know

#

i just watched it, i even learned some new stuff i had no idea about

summer tide
lost inlet
#

not really, since the value passed to the onrep there will be the previous value

#

why do you even need an OnRep function for this?

summer tide
#

IsAlive is being passed ot Anim class. Then being used in AnimBP to play dead animation.

lost inlet
#

that's not my question

summer tide
#

It works when I use server and multicast to set IsAlive

lost inlet
#

you don't manually set the clientside value at all when you use an OnRep

#

which is why my question was why are you using an OnRep at all?

#

I'd understand if you were using it to fire a delegate or something

summer tide
#

Not sure trying to avoid using server and multicast to set IsAlive variable. I setIsAlive to false when the player health is 0.

lost inlet
#

so you called it OnRep_ despite the fact it's not that and it's an RPC?

#

that makes no sense

summer tide
lost inlet
#

link the video please and the timestamp

summer tide
lost inlet
#

that is not what that timestamp shows

summer tide
#

Ok i'm confused. Let's put that aside for now.
Just to set IsAlive variable is it ok to set it via server and then multicast. Or there's better way.

lost inlet
#

there's no multicast here?

#

what are you talking about?

summer tide
#

Forget about on_rep

lost inlet
#

IsAlive is replicated, the OnRep gets called on the client when the value is changed via replication and the new value differs from the local value

vague spruce
#

sup. i'm still dealing with this. i've got a bunch of AIs that spawn in and have health bars. i can't seem to figure out the best time to set up the player health bar initially. no matter if i do OnRep_PlayerState, PossessedBy or BeginPlay, there's always some missing information. sometimes it's the user widget, sometimes it's the player state. how do you all solve this?

#

ok, im done. im just gonna stick this on tick with a boolean flag. i've had enough

fading birch
#

where are you storing the health?

vague spruce
#

it's in the player state, in an attribute set

#

it worked on tick. i just wait for all of the elements to be ready then i create the health bar and enable a boolean. unfortunate, but i've spent several hours on this

fading birch
#

bind a delegate in your widget

#

and call the delegate from your playerstate

#

ezpz

vague spruce
#

that's not a bad idea at all

#

wow

#

hm but wait

#

what if the player state is done before the widget is created

#

or vice versa

fading birch
#

you're just trying to update the health in your widget?

vague spruce
#

i'm trying to update health for the first time

#

just on init

#

the updating works fine when it replicates

fading birch
#

I believe the GAS Shooter example actually has that setup

#

with multiplayer in mind

#

can probably look to see how they did it

#

I don't have anything open in front of me atm

vague spruce
#

yea thanks ill check it out

#

i usually keep it handy anyways

fading birch
fluid edge
#

Hi guys, I'm having a very hard time replicating my weapon pickup system. As the image below shows, I'm picking up an actor on the ground if it implements an interface, going to the blueprint where that interface message is sent, and setting my Pistol variable to that blueprint. Then I attach the Pistol variable to a socket in my hand and update the animation so I have a pistol idle animation. This works fine in single player mode. But I have no idea how to get it to work in multiplayer. I've tried many different RPC tactics but I don't know where to put them in which blueprint or how exactly how to do it. Any help would be greatly appreciated.

#

Top image is in my character BP event graph, middle image is the parent blueprint event graph of the pistol I pressed T on, and bottom image is a function in my character BP

thin stratus
#

There is a lot of things wrong for multiplayer

#

Your key press runs locally so the whole pickup interface does. You need to server RPC the input pressed and then let the RPC run the collision check, loop, interface etc

#

Then in your pistol parent, you are using a lot of GetPlayerCharacter0. That's gonna be the server then, which is wrong. You already passed the player into your interface, use that.

#

And then lastly, things like attaching something is a change of state. That should be handled by an OnRep variable. Given your code, after my suggested changes, runs on the server, you just need some variable you can set, e.g. a character reference, that is then rep notify and attach in the OnRep function

#

+- whatever other state changes you perform.

#

The weapon type for pistol can be pulled from the current weapon of the player, as long as that current weapon is replicated.

#

Well actually you attach in the character, so a RepNotify weapon reference instead would do the trick

#

@fluid edge

fluid edge
rapid bronze
#

If I run an interface call on server, will all subsequent implementations run on server too even if going through other interfaces?

thin stratus
#

If you run a function on the server it stays on the server

#

Unless that next function is a Client RPC on a client owned actor or a multicast

rapid bronze
#

So let's say i have 2 interfaces

On one i call sever RPC and then i call the next interface

In the implementation of the last one will still be run on server?

thin stratus
#

I already answered that

#

Interfaces are just functions

rapid bronze
#

👌

#

Got it, thanks

thin stratus
#

To be really precise: An interface is another class that your class inherits functions from. Cpp usually allows inheriting from multiple classes. UE4 doesn't allow that. The only reason that interface class are allowed is that they need to be abstract, means their functions aren't allowed to have a definition (so code in them unless implemented in the class that inherits from the interface) and they can't have any properties. At least no uproperties.

rapid bronze
#

I see

thin stratus
#

It's more or less a method of grouping unrelated classes together so you can execute functions on them without knowing what actual class they are

#

Nothing of this has anything to do with multiplayer in terms of rpcs

rapid bronze
#

So in the end it's just a normal execution chain but themselves can't have properties

thin stratus
#

Yeah

#

And the functions in the interface blueprint can't have a default implemetation

#

You can only define name, inputs and outputs

#

Implementation is done in the BP class that inherits from/implements the interfaces

rapid bronze
#

Makes sense

Cheers for the explanation, appreciate it ^^

tawdry marsh
#

can anyone tell me if i can use my mouse debug and make it so i can use it in the export as well. thanks

#

anyone?

#

hello?

elfin sail
#

i want to init setup for player character like jersey ,shoes, helmet etc

#

where should i write this code ?

#

on server or client

#

at first time

sinful tree
#

Server I imagine would be reading these values and then replicating them to the client, so if the player's character doesn't exist yet, the server should determine this and then just replicate the default values to the client.

grizzled stirrup
#

If you are seeing logs such as LogSteamSocketsAPI: Verbose: SteamSockets API: Log Ping measurement completed does this mean Steam Sockets is correctly enabled?

#

If so it looks like they have fixed their routing issues that were previously causing high latency even in lobbies connecting from the same room

#

Ok seems I spoke too soon, on 2nd and 3rd attempts, ping is up to 80-100ms for players playing in the same room

#

I guess the routing is pretty variable and sometimes you may get higher or lower latency

#

In general would you advise using Steam sockets over the older default socket even if it results in 80-100ms minimum delays for all clients? I like the security features but it's a tough tradeoff

finite goblet
#

does toggling bAlwaysRelevant has any effect at runtime?

elfin sail
#

yes

#

UE will not optimize

#

this object will always be there

#

how far away from you does not matter then

fluid edge
#

Okay I made the RPC change in the first screenshot, then got rid of the Casting in the second, as well as changed the Pistol variable to RepNotify, and moved the UpdatePistolAttachments code into the OnRep function for that. Is that what you were envisioning? @thin stratus

fluid summit
#

Hi! does anyone have an idea of why this may be happening?
I'm spawning a simple actor from my controller on server side that is set to replicate with "Only relevant to owner"
i check on the client and the server, the actor is there.

#

if i change the parent class of this actor to "Character", same replication settings, the actor won't spawn on the client, it will only spawn on server.

thin stratus
#

Just make sure the booleans in the OnRep aren't having a raceCondition

#

Or check if you even need both, given that the function already replicates

#

Some UE programmer that start with networking don't realize that setting two variables that are replicated doesn't mean they replicate in order

keen condor
#

Hello , i have a stupid question. I remember having the option of running my game as dedicated server, actually i'm just having "play as listen server / play standalone or play as client

rich locust
#

Play as client acts the same

vivid seal
#

play as client is just the dedicated server option renamed

keen condor
#

ok thanks guys !

fluid edge
fluid edge
# thin stratus Yeah

Looks like the clients cant see themselves or anybody else holding a pistol still

thin stratus
#

:P Then it's time to debug why

vague spruce
#

i will say, going back and making my game replicate properly is really cleaning up a lot of mess!

graceful flame
#

So on pg 20, Game State it says the Game State is replicated to all clients. Does that mean if I start making vars and custom events and stuff I don't have to make any vars replicate or use server to multicast like I've been doing elsewhere with my blueprints?

fading birch
#

No, you'll still need to do that.

graceful flame
#

ohh okay

fluid edge
fluid summit
#

any idea on why this is working on the server but not on the client?

#

i'm spawning a local pawn (no replicated at all) storing it on a variable (not replicated) and than telling the controller with a rpc (local) to move the pawn

#

if i'm the server works okey, but not on the clients.

fluid summit
#

Found the problem, if you want to spawn an actor locally and run it with AIController, you need to disable replication and autoposses on the pawn, than spawn a AIController on client and make it posses the pawn

tight glen
#

Really dumb question. Where is the best place to store a character mesh when hosting a lobby. I have tried game instance but then I have to keep track of players joining and leaving, and I have tried saving them into the player controller but when the level changes the variables are then lost. Is there a best practice for where to save variables like this? I want to make sure that clients have access but that they can't set the values themselves.

fluid summit
#

I think player state is the best place if your info needs to be moved across levels

tight glen
#

well I made my own player state as a child of the original player state but when I cast the original to the child it always fails.

#

If I have to I can always just modify the playerstate in C++

fluid summit
#

you can't cast the parent to the child, it should be the other way around.

grand stratus
#

guys
now in client side
the game state takes so much time to be replicated i dont know why
who can i make sure that it got replicated to the client
without keep checking validity of the game state and delay for a bit and check again until its valid

tight glen
fluid summit
#

what are you doing to persist the data on player state between levels?

tight glen
tight glen
fluid summit
grand stratus
#

@tight glen how i can do this while i test the game in standalon

tight glen
tight glen
grand stratus
#

but what does this benefit me?

#

cause iam sure that game state is not replicated fast

#

some time it works

#

fast , and some time it takes time

tight glen
# grand stratus but what does this benefit me?

This week we'll be joined by Ryan Gerleve and Dave Ratti to discuss general server optimization in UE4, as well as techniques and solutions to improve your Actors' performance in a networked environment.

NEWS

Unlocking Breach’s combat with Unreal Engine
https://www.unrealengine.com/en-US/tech-blog/unlocking-breach-s-combat-with-unreal-engine
...

▶ Play video
#

This shows how to use it

#

because you may be updating things that don't need to be updated/used. It will show you what is being updated and what is actually being used. Then you can modify your code or replication settings

grand stratus
#

ok

tight glen
#

if you have questions or issues let me know and maybe I can help. From what I have seen/heard sending tons of un-needed data can cause that issue

tight glen
# fluid summit you need to use seamless travel in order to do so and i think there's a few othe...

Found some info that describes what you said here. I will try this out. I apprecitate the help and advice.

https://stackoverflow.com/questions/63298100/which-ue4-class-is-best-for-storing-user-data-in-multiplayer

grand stratus
#

i knew that seamless travel makes th egame state and game mode the same

#

so if i seamless travel

#

to another map does the game state changes untill all players join the map

#

i mean 3 were in lobby

#

so game state player array has 3 elements

#

does when we travel to another map

#

the server join s first then other players , so the game state would not change while traveling from 1-> 2 -> 3

#

or it will just be 3 cause no one left

fervent yacht
#

That might not be his guide.

#

3 elements... 0, 1, 2

#

😄

#

I wouldn't have a clue, I'd just test it and see, horribly large amount of googling I use if things don't work as anticipated now.

#

So I checked, yeah that's his guide and will generally tell you where to call things like that. The server arriving first is a necessary evil, so the world being replicated after taking time makes sense.

ebon plume
#

I iam using a struct for weapon attributes such as fire rate, etc.

Is it okay to set these variables in the weapon BP itself or should these be store on the server side ?

In regards to cheat protection

fervent yacht
#

So you can just check if they're realistic when called from the server

#

Like maybe even keep track of how many times it was called, if that's over x in x time, then this is cheating.

dark edge
ebon plume
#

Also, is it bad practice to handle actor spawning and attaching weapons to the player with all the socket details etc all on the server?

The only request from the player is to ask to pickup item basically

fervent yacht
#

Yeah that would be the most realistic way.

#

Basic rule of thumb is just if it's visual, then client, if it affects gameplay server is my understanding. Anything in the client is enemy hands.

ebon plume
#

Okay so for testing i am currently setting a variable in the player on begin overlap with an object (weapon for example) and then requesting (from the server) to pick this item up.

How can i validate that the item he wants to pick up is legit ? again, for testing im currently passing that variable (actor) to the server as an input for the actor to spawn. I already know this is bad

fervent yacht
#

Spawn it on the server only would seem legit, actors are automatically replicated down by default to my understanding. If for some reason your actor didn't show up, then I'd address that then.

ebon plume
#

What if the player manipulated the actor (class) it is trying to add

#

How would the server know its BS

fervent yacht
#

Server can run validation, but if it's spawned on the server then how are they manipulating it? Basically each client is running a copy, but all the real data is server out, the clients can only request things from the server, then it's in charge of updating everyone. So I'm not sure offhand how the client would ever call that with their own stuff basically.

#

But either way, you just add the validation before the spawn, check that it's of your class etc, maybe have to check if it's possible on that level or whatever code you need.

ebon plume
#

Here is where im getting the class variable to tell the server what im trying to add

#

and then

fervent yacht
#

So the actor would have to already exist for the player to sent it through right? Meaning if the server doesn't know about the actor, then it wouldn't acknowledge it as existing.

ebon plume
#

So for the actor, do i need to spawn it from the server ? Its a Pickup-able object

dark edge
#

Your pickup message looks like
"Hey server version of me, try pick that thing up"

Just do a distance check and call it a day

dark edge
fervent yacht
#

Yep, server won't care what the client claims happens.

#

Try this experiment, add a wall to the player on beginplay

#

then walk through it, the server will allow it, because the wall doesn't exist on the server.

#

So, the client is wrong.

#

And the server corrects the client

#

I meant add it client only.

ebon plume
#

So i cannot manually place replicated objects in the scene by drag and drop ? When you say spawn, do you mean spawn at runtime on the server ? Sorry if im being dumb.

dark edge
fervent yacht
#

Spawn on server, actors are automatically replicated.

#

Yeah he's dead on, relevancy at play there.

#

Here, I may have some resources to make this more clear.

dark edge
ebon plume
dark edge
#

Why wouldn't it be. You want the pickup to stay in sync right?

fervent yacht
#

I'm trying to find the easier version, but Ryan Laley has one intro set that's good

ebon plume
#

Okay, im slowly getting what you guys are saying lmao. I need to watch and read more on networking.

And yes

fervent yacht
#

There is a guy named Bryan iirc on youtube that really made it click for me

#

Here, this guy really shows it well.

dark edge
#

Basically to keep it simple, what happens on the server is what ACTUALLY happened. Everything else is fluff

fervent yacht
#

Exactly

ebon plume
#

So i think in my case, im technically doing it right. I just need to add some checks and validation

fervent yacht
#

Nobody else mattered, we just do them the courtesy of letting them know what happened. Server rules.

dark edge
fervent yacht
#

By the King's permission as it were, nothing happens without it.

dark edge
#

Whether or not you need to validate really depends.

fervent yacht
#

Not a problem until it's a problem, just work the skills until it's natural.

ebon plume
#

Okay. I will get into some videos...

Just wanted to make sure i was going in the right direction with the pickup system

dark edge
#

In my project I just relay the pickup button press so I don't have to validate anything. But it depends on the pace of your game etc.

fervent yacht
#

Exactly.

#

I'd let the interact call go through, then let the server deal with it, tell the client what happened.

ebon plume
#

Thanks guys

fervent yacht
#

Better to never let them do more than ask 😄

dark edge
fervent yacht
#

Yeah, that would, but hey, I'm more evil than you. That's the UI guy's job. I'll handle that when I'm there 😛

dark edge
#

It's all a function of interaction density and whether or not things are aimed and speed and urgency and a million other factors.

fervent yacht
#

Yeah that makes sense.

dark edge
fervent yacht
#

Too many things too close could certainly cause issues.

#

Depends, done both, right now just playing with my own, usually interface is my preferred thus far, but still fairly new to it all myself. Sounds like you might have a bit more depth on it tbh.

#

Most multi questions here aren't that complicated yet :D.

#

I think I forced space on spawns when I hit that issue last time I messed with it.

dark edge
#

I like the scenecomponent approach as then you can have a location that interaction happens and also it can have state.

fervent yacht
#

Looks like their plan for modular would be more component based.

#

Hmmmm... not familiar with that in any of the multi I've done.. got resources for education?

#

I've seen it done through actor components added for inventory calls.

plucky prawn
#

Is there a way to do client -> server replication where the client (or rather their player controller) do not own the actor?

#

I guess a good example would be have a widget open up a door or toggle a light that isn't owned by anyone

fervent yacht
#

Oh lol, I'm on the wrong discord server, no wonder XD

dark edge
elfin sail
#
  1. //DOREPLIFETIME(AWhooshPlayerState, PlayerProfileStruct);
    2.
    //For Player Profile
    // DOREPLIFETIME(AWhooshPlayerState, WhooshPlayerID);
    // DOREPLIFETIME(AWhooshPlayerState, CycleID);
    // DOREPLIFETIME(AWhooshPlayerState, HelmetID);
    // DOREPLIFETIME(AWhooshPlayerState, FrameID);
    // DOREPLIFETIME(AWhooshPlayerState, TyreID);
    // DOREPLIFETIME(AWhooshPlayerState, FacialHairID);
    // DOREPLIFETIME(AWhooshPlayerState, HairID);
    // DOREPLIFETIME(AWhooshPlayerState, SkinTuneID);
    // DOREPLIFETIME(AWhooshPlayerState, GlassesID);
    // DOREPLIFETIME(AWhooshPlayerState, JerseyID);
    // DOREPLIFETIME(AWhooshPlayerState, MaskID);
    // DOREPLIFETIME(AWhooshPlayerState, SocksID);
    // DOREPLIFETIME(AWhooshPlayerState, ShoesID);
    // DOREPLIFETIME(AWhooshPlayerState, CountryID);
    // DOREPLIFETIME(AWhooshPlayerState, HeightCm);
    // DOREPLIFETIME(AWhooshPlayerState, PlayerType);
    // DOREPLIFETIME(AWhooshPlayerState, Weight);
    // DOREPLIFETIME(AWhooshPlayerState, Gender);
    // DOREPLIFETIME(AWhooshPlayerState, SocksLength);
    // DOREPLIFETIME(AWhooshPlayerState, FirstName);
    // DOREPLIFETIME(AWhooshPlayerState, LastName);
    // DOREPLIFETIME(AWhooshPlayerState, TeamID);
    // DOREPLIFETIME(AWhooshPlayerState, DisplayName);
#

which one is better ?

#

should i replicate each value separate or complete struct ?

kindred widget
#

I've been told that structs automatically do per property replication so that changing one value won't automatically send the whole struct each time. So I personally would just do a struct. Not to mention the amount of OnReps you'd need to make for that many variables to update potential UI would be a nightmare to keep up with.

elfin sail
#

i just want to know about code readablity

#

there is one think when ever a property change character have to check on each property

#

whick is chnaged

#

but i do each property separate then only respected delegate will fire

#

that's the thing is bit bothering me

kindred widget
#

You could very easily write some functions into the struct itself to compare against a same type struct to check if certain areas are different. For instance you likely want to just update all visual aspects if any of the clothing, gender, weight, cycle, tire whatever stuff is changed. Where as you might have different delegates for names or teamID specifically. It'd be very easy to separate your delegates in the OnRep by passing in the old data in the OnRep function and comparing for differences.

elfin sail
#

like by checking not old one ?

#

did this make sense ?

kindred widget
#

Not fully following.

#

Personally. Those states aren't likely to change often. You don't have anything there that might actually change more than a couple of times a second at the fastest besides initialization time. So a single delegate and single onrep should be entirely fine. If for some reason you actually end up with performance issues related to these things updating, you could optimize it at that point fairly easily.

#

But as far as the simpler question, for readability, definitely single struct versus dozens of loose properties.

elfin sail
#

with single onrep and delegate

#

thank you soo much you make my decision easy for me

raven tangle
#

Any ideas why would a struct not replicate?

#

a Blueprint JSON Object struct from the BlueprintJSON free plugin to be specific, from server to client

#

set to Replicated, and after the Set node it has value on the server side but has no value on owning client

bitter oriole
raven tangle
#

@bitter oriole So how does one make an object meant to be replicated? 🙂

bitter oriole
#

By making all relevant data replicated inside the object code

#

For a struct that would mean make all fields UPROPERTY(Replicated)

#

And make sure all sub-field structs also do that and are USTRUCT

#

For Json it might make more sense to simply send the data as text

raven tangle
#

The plugin imports Dom/JsonObject.h

#

which looks like an engine out of the box object

#

can't seem to be able to find it in the Engine's source

#

anyway, I'll try replicating it as a serialized string, then parse it into the object

#

@bitter oriole thanks

bitter oriole
raven tangle
#

mm, ok

hexed pewter
#

Is the client-server model that unreal engine uses for its multiplayer framework the ultimate solution, or are there any other significant ideas on how to handle multiplayer?

empty axle
bitter oriole
#

It's also the only one that really fits what the engine is meant for

crimson valve
#

One of the other models that has been used in the past is "Lockstep". But it requires deterministic gameplay. With that mode, the simulation doesn't move forward until input is received from all clients. This can be OK for turn based games, or small number of players with low latency. Originally CoD Spec Ops was using this model. Keeping your gameplay deterministic is a huge headache though in a realtime game, which is why CoD doesn't do it this way anymore.

#

There are some Korean games that use a more peer to peer model as well, each client connects to the other connected clients and I think are generally client authoritative. Easy to cheat in this, and you get desync issues.

#

Each client basically runs their own simulation

#

But without the deterministic guarantee of lockstep, and without the input lag that lockstep introduces.

#

So there are other models, but yeah client-server is really the standard way.

#

and I don't know how you would do any of the other approachs in Unreal. Would probably require a lot of custom networking solutions

peak sentinel
#

Even some RTS games use client-server method today

hexed pewter
#

Yea thanks for answering. This is exact level of comprehension I wanted, and even more. I was kinda curious what it looks like from perspective of someone who has some experience in creating multiplayer framework, and whether what unreal uses is absolute/universal go-to solution

hexed pewter
crimson valve
#

It's like every client running their own listen server... and them all having some way to decide who wins when there is a debate

hexed pewter
#

smells like desync, or trouble

crimson valve
#

It actually worked surprisingly well most of the time. Felt pretty good when connections weren't poor.

crimson valve
#

Unreal doesn't have that extra layer, and so any rewinding it does is more of an approximation. This is why Call of Duty has such good feeling netcode.

hexed pewter
#

Oh thats interesting, is it possible to try to rewire ue4 in that way or at least to some extent?

crimson valve
#

Yeah, to some extent

peak sentinel
crimson valve
#

Yeah, but listen server is still Client-Server.

#

It's just the server is run on a client

peak sentinel
#

Yeah, you're right

crimson valve
#

There's even one thing in CoD that is client authoritative (but don't tell anyone) 🤣

peak sentinel
peak sentinel
crimson valve
#

As far as I remember, there were 0 dedicated servers. It was all Listen Servers.

#

At least until you get to the Battle Royale one

peak sentinel
#

What I dont understand is what if every connection has a bad quality of network?

#

How they manage that?

crimson valve
#

The experience would be shit 🙂

peak sentinel
#

Haha so they dont care? 😄

crimson valve
#

The probabilities work out in their favor, and they have host migration setup to detect that situation and switch hosts

#

The client authoritative piece is that the line traces for visibility tests for the map icons is actually done on the clients and then sent to the server to share with other clients. Otherwise because it's a listen server it would be too expensive.

#

Everything else is server authoritative

hexed pewter
crimson valve
peak sentinel
#

You have UT source code that you can analyze Epic's method of networking

#

Also GAS is pretty useful

crimson valve
#

what is GAS?

peak sentinel
hexed pewter
#

I just asked about GAS on #cpp, but i got scared off by the premise of complexity. Not that I dont like challange, but i'm pretty new to unreal

crimson valve
#

Oh yes

#

IMO, what Unreal lacks in the Quake style of networking, it totally makes up for in the ease of doing everything else.

hexed pewter
#

Have you touched the id tech?

peak sentinel
#

Its actually pretty abstract

crimson valve
#

I think CryEngine & Lumberyard have Quake roots too, but I'm not 100% on that.

hexed pewter
# peak sentinel Its not that complex, its just too much information to learn

I wanted to make a dota 2 like demo, where to control one of the heroes. I like to imagine I'll be able to make it nice a playable for multiplayer, but only to certain extent. Like moving character, throwing spells, killing other player, dealing damage ect. No fancy stuff like creeps, ai, gold, ect. Would you recommend GAS for that? Thought behind this project was I would be able to put that as a thingy in my cv, not sure how much of value it would be tho

crimson valve
#

Unreal networking from what I've seen would be great for something like that.

hexed pewter
#

That is quite fortifying to hear (pun intended)

peak sentinel
#

When you use GAS, most of the time everything works like "GAS to your own framework", so for anything can be considered as "abilities" GAS is great but.. (its a big but there) some engineers I've met worked with some AAA titles said GAS is pretty much okay but not totally great for anything, so most big studios either create an equivalent one or extend it

hexed pewter
#

Oh, that sounds like, you have to try it to find out. Fair I guess.

peak sentinel
#

If you're planning to get benefits of its prediction system and your framework already works with gameplay tags, for your own project its great. But for getting a career, rather than GAS itself, understanding the 'behind the scenes' part would be useful imo.

hexed pewter
crimson valve
peak sentinel
crimson valve
rich ridge
#

I was having some issues with my projectile, and server spawned projectiles was quite off... so i created anim notify and printed the socket location where I was spawning the projectile, and guess what they are different locations on server and client?

Any work around ?

#

Simple anim notify to debug

#

This is what it prints

#

locations are different.

#

and believe me I didn't move my character at all while i was doing right click to do projectile attack.

silent valley
#

@rich ridge By default animations or even poses don't play/apply on server, so on server your character might be in default A pose.

#

set VisibilityBasedAnimTickOption to AlwaysTickPoseAndRefreshBones

#

or trust the client for the position they are firing from 🙂

bronze apex
#

Hey! How ServiceRequest UFunction specifier should be used? And the difference of this with NetMulticast, Reliable?

rich ridge
#

i guess i will have it turned on for characters which are doing projectile attacks

#

thanks brother, you saved my day

quasi tide
crimson valve
#

What I mentioned before--

IMO, what Unreal lacks in the Quake style of networking, it totally makes up for in the ease of doing everything else.

#

and that's just talking about the networking side. Unreal is way easier to use across the board.

#

I guess my previous message was unclear too. Unreal networking is way easier for almost all things you want to implement, compared to Quake/Source

quasi tide
#

Price for God tier big brain stuff I guess. Difficult to use 🤣

#

Imagine if Valve actually cared about their tooling, what a world

crimson valve
#

It's also like... you can get by with Unreal networking for the most part, and if you really need to get fancier it's always possible to just write your own networking layer for it.

#

There was a great video I saw the other day about Rocket League networking. They integrated a custom physics engine and did some fancy stuff on the server with how player movement is processed and sent back

quasi tide
#

I'm fortunate enough to desire to create the types of games that are right up Epic's alley, so I don't think I'd need to go that deep with it for quite some time

crimson valve
#

With what I'm working on I'm already needing to write some custom stuff so that I can have clientside-predicted server-authoritative physics objects.

#

If it's pure server authoritative, it ends up looking awful

#

so all the clients need to be able to predict but then eventually need to agree on the positions 🙂

#

Basically just adding dead reckoning to it

signal lance
# crimson valve There was a great video I saw the other day about Rocket League networking. They...

They integrated Bullet physics engine pretty sure
What they do for networking is full client side prediction (server authoritative) for the whole scene, this allows them to have reliable collisions between clients since they are moved to your local timeline (predicted) together with the ball, works pretty good in practice even with non deterministic PhysX

Their server isn't waiting for player inputs, it uses last know input, if the input buffer is running low they tell the client to send more/run the simulation slightly quicker

#

If I remember correctly their talk

crimson valve
#

Yeah, I think that's pretty close to what I remember. For the input buffer, the server doesn't actually ask the client to send more or less. It handles this by just creating fake moves or I think skipping moves to cause the buffer to be consumed faster or slower on the server which works out to the same thing.

#

and then yeah, I think I misremembered. The server doesn't rewind the simulation, it's the client that does that based on including frame numbers in the responses.

#

which is your "moved to your local timeline" note

#

It's very fancy. 🤣

#

Do the other player's moves get transmit to the clients for the clientside simulation?

#

The piece of "move to your local timeline" I think is also where the Bullet physics was important. I'm not sure how you'd do that in PhysX

twilit radish
#

I mean their talk sounds great and all but if you have played the game your self and get latency issues, be prepared for a rough time 😅
That said it does work pretty well overall though, but does fall apart with latency more and more. (Or packet lost of course)

#

But that’s basically every multiplayer game in a nutshell.

crimson valve
#

True, but it's a really hard problem that they picked as their core mechanic 😄

#

I definitely see mispredicts at least a couple times per game

twilit radish
#

In the time I played I had usually a 8ms ping, so I had zero to no issues unless their servers were lagging 😛

crimson valve
#

Most of the time when I see mispredicts, its when other players narrowly miss the ball.

twilit radish
#

But yes since they use client side prediction obviously it will go wrong at times especially with more latency / packet lost.

crimson valve
#

yep

signal lance
# crimson valve Do the other player's moves get transmit to the clients for the clientside simul...

Yeah, the local client just uses the last known input for other players pretty sure

It's very fancy. 🤣
😅

For the input buffer, the server doesn't actually ask the client to send more or less. It handles this by just creating fake moves or I think skipping moves to cause the buffer to be consumed faster or slower on the server which works
Can't remember exactly but I know they mentioned upstream and downstream input buffers, can't remember which one they are using but I know they mentioned one in which the server tells the client to run quicker

The piece of "move to your local timeline" I think is also where the Bullet physics was important. I'm not sure how you'd do that in PhysX
I implemented something similar to what they did in RL for our project using a custom solver instead of PhysX and it worked pretty good, can't tell for what it was but it worked pretty good 👀

With PhysX I think it still can be achieved but the rewinding and replaying would have to be done in a separate physics scene or possibly with the PhysX immediate mode

#

Replicating physics is a complex problem, especially in a server authoritative environment

twilit radish
#

I’ve seen it said before, but what is it that makes this so difficult? Is it that you can’t easily do the process it self (rewinding) or is it because mismatches in physic time frames because of how UE4 does physics?

crimson valve
#

It's because you're trying to get three seperate timelines to cooperate and feel good

#

and can't communicate important things like "he hit the ball" immediately

twilit radish
#

Should have clarified, I’m referring to rewinding.

crimson valve
#

So there are just and multiple different ways of doing it and tradeoffs to each of them

#

Oh

#

That is a question for Blue Man it sounds like 🙂

signal lance
#

For our project we switched to fixed timestep which helped a ton but PhysX is by nature not fully deterministic so there is always gonna be some misprediction which will result in desync, this is why RL switched to Bullet pretty sure.
This gets worse at higher latency since there is more time for errors to happen.

The rewinding part is just setting the object to the state server sent and replaying all the moves in your history buffer.
With PhysX you have to move objects to a separate physics scene to do it so you are not simulating/predicting unrelated objects or possibly the immediate mode which I haven't looked into much.
Not sure about Bullet but for example Chaos allows you to simulate a group of objects you want directly instead of the whole scene and pretty sure they did it for their network prediction plugin Epic is working on.

#

Syncing networked physics is like having multiple alternative realities with slightly different timelines and outcomes 😅

#

In other words.. an enormous pain in the butt

twilit radish
#

So it is possible to rewind things but basically requires engine modifications and more setup?

signal lance
#

You can probably get 80% there without any engine mods, only thing you really need to mod the engine for is fixed timestep (with physx at least, chaos has an option I think)
But you'll need to write your own movement replication instead of using the default

RL talk is probably one of the best resources on this topic

blazing spruce
#

Hey, should i do a line trace for interaction input in the player controller? or should this be handled by the character class instead?

fading birch
#

What's the best way of hiding an actor based on relevancy? I have IsNetworkRelevant overridden and setup properly. I can see that it's not relevant to certain clients, but it's still visible to them. I just want it to not be if it's not relevant.

silent valley
#

Actors would usually be removed if they are no longer relevant to a client...

fading birch
#

I am not seeing that happen :/

silent valley
#

How do you know they are not relevant?

fading birch
#

i put breakpoints on it and checked.

silent valley
#

I think you broke something then 😁. Did you write your own relevance logic? It has to be the server deciding no longer relevant. Then the server closes the actor channel, which is received by the client which calls EndPlay on that actor.

#

We mainly use the basic net distance squared which does exactly that procedure I just outlined.

#

Although I think now we maybe have more advanced stuff going on too with ownership and rep graph, but the basics still hold.

fading birch
#

Hmm. It is running from the server, we have it setup to be non relevant if it doesn't belong to your team. The weird portion is if you're on the team that spawned it and then swap teams, it's still visible. If you're not on the team and it's spawned it behaves as expected.

fluid summit
#

Hi! which one do you think it's more hack proof for a dedi server?

quasi tide
#

Considering the first one will only run on the server and the second on whoever has network authority - the first one. (You should expand the Has Authority macro to see what it actually does)

#

(of course this is with 0 knowledge on how you are doing anything else and who owns what)

fluid summit
#

I'm just worried because someone mentioned that RPC are vulnerable to hacks

lost inlet
#

a cheat can arbitrarily call RPCs

#

really don't like net code in BP but I'm not sure what you think will change with this since the original was a server RPC anyway and will execute on the server

quasi tide
#

What don't you like about having net code in BP?

lost inlet
#

feels limiting and produces spaghetti

quasi tide
#

Alright

sinful tree
#

If this is what I think it is, you're trying to increase the resources of a player, be it through item use, or some other upgrade system.
If you allow the client to tell the server VIA RPC what the value is, then the player could potentially feed in a spoofed value - so say you were expecting them to use an item and it provides 3 Food, a malicious player could spoof that call and provide 3000 Food.

#

Alternatively, if you only allowed the player to say... "Use item in inventory slot 3", the server can verify if there is anything in slot 3, what it actually is in slot 3, if the player is allowed to use whatever it is in slot 3 currently, and how much of resources is provided by consuming whatever it is in slot 3, then provide the resources of whatever is in that slot to the player VIA replication through your replicated struct.

#

All that the "Switch Has Authority" check effectively does is verify whether it is a server copy running the code, or if it is a client's copy running the code.

There's also no replication taking place in this image - if the "AddResourcesAuthority" event was called on an execution path that was executing on Client, it will execute whatever comes next only on the client. If it was on the server, it will only execute on the server.

fluid summit
sinful tree
#

Is that event clicked interface being called while on the server?

#

I'm guessing probably not as you have a GetPlayerController 0 which won't work correctly on server.

fluid summit
#

oh i didn't tought about that one, i'm still having troubles firing the "clicked" event while on multiplayer.

#

i'm gonna check on that one too

sinful tree
#

Any player input events are not replicated to the server by default, and you can't RPC to the server through an actor not owned by the PlayerController.

empty axle
#

you can RPC through any actor that you are owning

sinful tree
#

How I've set up interaction on my end was to take the input event > "Run On Server" event with reference to desired Actor to Interact with > Server checks if actor is valid, decides if I'm within range of the Actor to begin interaction and if I'm allowed to interact > Interact Interface on the specified Actor which can do whatever is needed while still running on the server.

#

I do have some checks client side as well before starting the RPC, just to prevent spamming or unnecessary RPCs if it would be a legitimate attempt to call.

crimson valve
#

Is there a list somewhere showing all the events relevant to multiplayer games in terms of client and server connection points? E.g. OnConnectionComplete?

bold summit
#

When I play in editor as client and do stat net I see a ping of ~200. My network emulation profile is average so expecting to see values much lower. Are there other places to set latency?

eternal canyon
#

But there are also console commands for setting ping

#

I forget them rn

#

Tho

dark edge
#

Key=SpiritStones, value=10 etc

bold summit
sinful tree
fluid summit
#

Yeah, Map was the first option, but it doesn't replicate.

dark edge
#

I would do an array or structs or something else then. That is gonna get super gross if you ever want to extend the resources

heady python
#

Why can I, from my UI, call a server RPC on my player controller, but not on my gamestate if the gamestate exists on clients too right?

eternal canyon
#

and u also own the other object ur calling the rpc from

dark edge
#

You might own the player state but you really shouldn't be doing much logic in these state actors

heady python
#

got it, thank you guys

charred crane
#

I'm using a button to cause a post process to appear on screen and it seems to break when i switch from 2 to 3 players in editor. Does anyone know why this might be a problem?

charred crane
#

Seems like it stops working as soon as a second client is on the same machine

obsidian rivet
#

hey i wanted to make a local multiplayer game but not split screeen everything is replicated but i dont know how to implement it

sweet marsh
#

Hey guys, i'm having a few issues with multiplayer state changes, basically i have an audio component that changes the music based on the match state, now oddly enough for the client even though the functions fire when i step through the music file isn't changing and i have no idea why, anyone run into this@

tawdry marsh
#

can someone help me

keen condor
#

Hello guys , i read the "setting up dedicated server" from unreal doc, but i didin't understand where i can find server code. (Accept clients methods , packet managing etc .... )

dark edge
dark edge
peak sentinel
#

How do you guys predict ammo usage in weapons? There is always desync between client and server on my setup

dark edge
languid whale
#

So im trying to set up a system were a player can select a skin and then other players would be able to see the selected skin. Only issue is that so far the only thing it does is apply the skin the player has selected for every other player even if they did not select that skin. So for example; if you were to select skin 1 as player one and skin 0 as player 2 then player one sees player 2 with skin 1 and player 2 sees player 1 with skin 0 and not skin 1. Does anyone know what im doing wrong?

peak sentinel
#

And same with weapon-switching on no ammo etc.

empty axle
grizzled stirrup
#

Is it possible to replicate the scale of a component on a replicated actor without replicating a float and manually calling SetWorldScale3D on the component for example? I know there are sometimes functions automatically replicated such as some of the hide or show actor functions

#

I don't need to replicate movement in this case, just a once off scale init

empty axle
languid whale
#

@empty axle The skin selection is done before the weapon can spawned so it cannot be stored in there I think. Would saving it to the gamestate and applying it when the weapon spawns also work? And then I should just replicate the int that selects the skin from the array right?

empty axle
languid whale
#

I meant game instance sorry, but does the same story still apply then?

empty axle
#

game instance is not replicated at all

#

so it will not work as well

languid whale
#

ow ok ill see if i can cast to the playerstate then

grizzled stirrup
languid whale
#

@empty axle So I should replicate the integer that decides the array index in the playerstate right? And then should there be custom events that fire on the server/multicast or just completely remove those?

empty axle
crimson valve
#

Anyone have a good recommendation for adding proximity voice chat to a listen server based mp game?

tawdry marsh
languid whale
# empty axle Yes and you just need one server RPC to change that index. No multicasts requir...

So I have it set up like this now: The skin selection widget button press activates a custom event which is fired on the server, this custom event casts to the playerstate which sets the replicated integer to a certain value and executes a function in the playerstate that gets a array item based on this integer. Now this array item is then pulled when the 3rd person weapon spawns (The 3rd person weapons casts to the gamestate) But it still doesnt show unique skins, it only shows the skin the player has chosen and displays it for everyone

#

I think i messed up somewhere with the texture array selection thingy but im unsure where

languid whale
#

ok let me crop it all nicely for you hold on

#

please note that i did not change the 3rd person weapon code much since i didnt really know what to do there, should i just use beginplay for everything instead of using 2 seperate events?

golden nest
#

Hi, does anyone know if i check the "Use seamless travel" in a lobby GM and change to a map where i set the default GM to be a Gameplay GM, does the defults GM, PC & PS change to the default in the Gameplay GM.

sweet marsh
# dark edge Are you 100% sure the state change is replicating correctly?

It does definitely replicate however it appears that because i change the matchstate quickly i.e. in the handlematchstart() it changes the matchstate to another state, this seems to be causing the problem with the client... a little bit annoying as the gamestate should still react accordingly

languid whale
#

@empty axle sorry for the ping but im unsure if you recieved my message 😅

empty axle
#

Inside this onRep you can apply the skin to the weapon locally if the weapon is already created and when you are spawning the weapon also apply the skin based on the variable inside playerState

languid whale
#

So I should set the event in the widget to not replicate then right? Then send the int from the widget to the Repnotify int in the playerstate and in the playerstate I can do stuff with it then?

blazing spruce
#

Hi, sorry if this is a stupid question but how important is the Game Instance class? im reading through the Network Compendium and notice it isn't referenced under the 'Common Classes' section, im also going through a VERY old BP Multiplayer series on Epic's YouTube where the guy referenced the Game Instance class and that he'll be doing a lot in there

sinful tree
#

It also doesn't get removed upon moving levels and the like, so it's useful for holding data that needs to persist.

blazing spruce
empty axle
blazing spruce
blazing spruce
#

So what is the difference in functionality between the two?

sinful tree
thin stratus
#

I'm not really referencing the Gameinstance class, because I tend to never use it for Gameplay

#

usually not even to store persistent data

#

I use it for things that have to to with the overall game, which is something you might encounter needing in later stages of your game dev

blazing spruce
#

Got ya, ill carry on with this series as well as the compendium and maybe when it comes to it come back and confirm weather things can be/should be done else where later down the line, thanks everyone!

thin stratus
#

Is that the Lobby Tutorial?

#

@blazing spruce

blazing spruce
#

Unless you recommend a better up-to-date tut?

thin stratus
#

I don't know any but that tutorial is utter garbage

#

They teach so many wrong things

#

I called them out ages ago, they aren't redoing it or taking it offline

#

It's such a shame

blazing spruce
#

Lol typical! ill keep looking then haha thanks for the heads up!

thin stratus
#

Which is me calling them out

#

2016...

#

I don't think they fixed this

#

Yeah no they didn't

blazing spruce
#

Yeah they haven't by the looks of it lol a lot of the comments on there now are people saying they've done things wrong too

thin stratus
#

Let's just mark everything replicated

#

sadlnkgöalskgjklöag

#

Getting angry seeing this online

#

;_;

languid whale
#

@empty axle So i tried a couple of things but its still not working sadly. So what ive done now in in the Onrep function called the variable for the thirdperson weapon and set the skin there which didnt work, I think because when this variable is set the weapon hasnt been created yet. And when I try to save the variable in the playerstate and call it back in the 3rd person weapon it only works for the client that has selected the skin. The server, and therefore the other client, dont see the change in skin.

thin stratus
#

They have RPCs in GameMode, RPCs in Widgets

languid whale
#

this is my function which doesnt work

thin stratus
#

The list is endless

thin stratus
blazing spruce
#

Yeah i dont mind ive bought mannnnny udemy courses now lol i actually have already gone through the Tom Looman one but it was ages ago now i think my problem is that i did C++ courses first without learning anything in BP, then decided to learn BP because most youtube tut's and a lot of stack overflow was BP so i haven't touched C++ for ages now, the game im working on is all written in BP so i was trying to get everything done in BP first then kinda 're-learn' C++ by converting it all over to scripts before releasing it

#

this was before discovering this discord ofc so much more help available here lol

thin stratus
#

Converting projects from BP to C++ is a good idea

quasi tide
#

I second Tom Loomans course.

blazing spruce
thin stratus
#

BP

blazing spruce
#

Yeah its a good course maybe should go back through it at some point lol

thin stratus
#

But it's not a tutorial. It's all commented, but def not a tutorial :D

blazing spruce
thin stratus
#

Just search for Multiplayer Lobby Kit

blazing spruce
quasi tide
#

Oh yeah, exi - I was able to solve my inventory issue a few days ago. I uhhh....forgot to set the actual TArray to be replicated 😅 - everything else was replicated though, lol

languid whale
#

Ok I got it ALMOST working now, I'm really close I think. So the host only sees his weapon but the connected clients do see the proper weapon of the host. Now I need to figure out how to get clients to replicate too and not just the host. Any ideas?

empty axle
# languid whale this is my function which doesnt work

So the OnRep fires for everyone?
It's fine if the weapon is not there yet, you still need to handle that case. The second case to handle would be to get the replicated variable inside Weapon BeginPlay and apply the skin also there.

Important notice here is that you need to apply the skin to proper weapon. So if the skin replicated for some player state you need to update the weapon that belongs to that player.

violet sentinel
#

how to politely explain in simple way (or link to an article) that it is not a simple thing to convert a singleplayer game into coop game

languid whale
quasi tide
grand stratus
#

guys iam using seamless travel , from what i know that the variables in gamemode and game state dont change. But i think mine reset when i use the seamless travel , i dont know why

#

iam trying to use these variables after i travel and its back to its original form

violet sentinel
#

game mode and game state recreated on travel

#

player state has copyto methods to copy data

grand stratus
#

okay

#

so does the player array in game state also changes

#

or since its a player state array , this array is copied and not recreated

violet sentinel
#

APlayerState::SeamlessTravelTo(APlayerState* NewPlayerState)

grand stratus
#

but what if i need the player array in game state to not change

#

so when i join the map

#

io check the number of player controllers in map with the number of player states

violet sentinel
#

players migrate to new game state

#

and initnewplayer called for each of them

grand stratus
#

so how can then check that all players were inside the game are all ready after the travel

#

cause not all players will be ready at same time

rich locust
#

When I start my dedicated server everything is smooth, but after a long period (4-5) hours maybe game lags even more

#

How can I find the thing doing this problem

#

any ideas, any tools I can try ?

bitter oriole
#

Unreal isn't built for long sessions

rich locust
#

wow

#

No way around it ?

#

Its so hard to find these stuff

quasi tide
#

4-5 hours doesn't seem like a long session. I wouldn't jump straight to float imprecision. Depends on what they are doing in their game.

rich locust
#

I gave an example

#

it actually is longer than that

dull lance
#

^ Could be improper memory management

rich locust
#

maybe a day ?

#

I didnt calculate it

#

but it does take a long time

quasi tide
#

My first thought would be memory leaks/not handling actor lifetime stuff

peak sentinel
#

If we can use Unreal Insights on dedicated servers, that might help to him

#

iirc there was a use case for it

dull lance
#

if it's a blueprint-heavy project though, potentially rip rip

peak sentinel
#

Well besides everything he said he runs the instance more than 5 hours

dull lance
#

that shouldn't be an issue

quasi tide
#

Plenty of UE games get ran for more than 5 hours.

dull lance
#

with proper memory management & administration

#

proper loading & unloading of stuff etc etc

peak sentinel
#

No I was trying to say it feels like not a match based game so he might need to end up learn how to solve that floating point accuracy thing too

#

Besides from memory usage issue if its exist

quasi tide
#

Yeah, when he reaches 4km in size

rich locust
#

we are way above that

#

Its 25 hours

#

game has lag more than at start

#

Adding ping to it

#

I had around 100-120 ping as Im not in US

#

and this server is US

dull lance
#

what about performance tho?

rich locust
#

Many things seem okay

#

some stuff gets harder

dull lance
#

have you benchmarked performance & timings?

rich locust
#

I have not

peak sentinel
#

Foxhole (a game made with Unreal Engine that its matches sometimes takes months to finish) resets its servers daily or each 2 day

rich locust
#

please direct me to about how to do so

#

I am going to look into unreal insight, network insight

rich locust
#

How about character movement component tho ?

dull lance
#

The patience

peak sentinel
#

Also for a quick info you can look at your server providers website, I assume they should provide info about CPU and memory usage?

rich locust
#

It is pain to play with even with low latency

peak sentinel
dull lance
#

if performance gets worse as time increases, that cries out leaks

quasi tide
rich locust
#

Not our game 😄

quasi tide
#

What about the CMC?

rich locust
#

Is there a tutorial or guide on how to use it properly for a networked game

peak sentinel
quasi tide
#

Like every tutorial on Youtube uses the CMC

dull lance
#

not sure cmc is the problem

#

unless you're RPC'ing like crazy with it

quasi tide
#

It most likely won't be.

thin stratus
#

DediServers literally have codelines to suggest restarting after 24hours

#

So you 100% always want to at least restart once a day

clever plinth
#

I am trying to understand why a ChildActorComponent never appears on a client connected to a listen server (even when set to replicate and net load on client). The parent is also set to replicate. Is this a known issue?

dark edge
#

Is it best practice to have a bunch of variables on a StatsComponent or just a struct? That is to hold the classic RPG type stats.

peak sentinel
#

I hold them inside of structs if I'm not using PushModel system

dark edge
peak sentinel
#

There is a PushModel system in the engine lets you mark properties dirty manually, that way your variables dont run inside of the loop

#

But if you're using structs, PushModel system sends every property, normal one only sends the ones changed

dark edge
#

ah ye i gotcha

#

One more question on this topic, I like to use RepNotify whenever possible. What's the state of the art regarding RepNotify and Structs? Just run the RepNotify on every update and branch out into different code depending on the variable INSIDE the struct that changed?

blissful totem
#

Trying to get a client to join my session over blueprints. The Join session Success pin fires, but the two never seem to connect. Any ideas? Important bits:

#

I have confirmed:

  • both client and machine are connecting to steam (on space war)
  • The host is adding "listen" as an option (shown above)
  • The client completes a search for sessions, finds exactly one, confirms it has a unique key associated with my game on the session, and then calls join session as shown. The "On Success" pin fires and prints the string
#

Full sequence of events is:

  • Host creates session
  • Host loads map with option listen
  • Client searches for sessions, and finds the host's session
  • Client completes Join Session successfully
  • Client does not load map to join host. Host doesn't see any activity to suggest client joined, at least on the PostLogin event
ebon plume
#

Okay I need help. Been struggling with this for quite some time now...

I have a character that is a floating droid - well it appears as floating because it's just positioned around capsule head height.

I am using controller rotation for the spring arm pitch and yaw. The Droid mesh itself is a child of the spring arm. So when I look up/down it rotates everything (as intended)

To get around the capsule itself rotating, I'm simply not using inherit pitch. I am using the YAW so it rotates horizontally. As intended.

Everything works locally.

Problem:

The spring arm rotation is obviously not replicating because I am not allowing the capsule (parent) to rotate on the vertical axis.

To get around this... I replicated the spring arm directly with relative rotation. This works but creates a huge problem with latency when using network emulation.

Any advice would be GREATLY appreciated.

I also looked at ALS system and it seems they are moving things with sockets. Wonder if that could work ?

Also, sorry buttercup_ lol.. we started typing at the same time

dark edge
#

@ebon plumeShow your component heirarchy

#

Like this

ebon plume
#

Not using the inherited one

#

Wonder if my problem could lie there ? If so, should I go into the character cpp itself (unreals cpp class) and add ones there ?

But still. Don't see how that would replicate the spring arm properly. All the replicated rotation and movement comes from the parent capsule

dark edge
#

Attaching anything gameplay related to the spring arm or camera just smells funky to me, that seems ass backwards

#

What is your DESIRED effect? A mesh that pitches as it moves?

ebon plume
dark edge
#

So basically the same problem as replicating gun pitch in a shooter?

#

just need the other players to see the droid pitching up and down as you look around?

ebon plume
#

Yes

#

Horizontally everything is fine

#

And I don't want to rotate the capsule pitch obviously lol

dark edge
ebon plume
#

Yeah it's based off the character and using the inherited movement component

ebon plume
dark edge
#

Use that to drive the rotation of the drone

ebon plume
fluid summit
#

Does anyone have an idea of why it may not be working? according to documentation, replication of Struct array should work okey.

#

"Stats" array of structure type is set to replicate

fluid summit
#

oh my bad, the problem is that i was getting a "copy" of the array item instead of "a ref".

rancid flame
#

I'm hoping someone can help me or point me at something to read more: I've worked with Unreal for 7 years but never touched any multiplayer code (yet!). I read somewhere that "Unreal is great at client/server games but for other stuff you have to write it from scratch."
For PC/Console (not mobile) multiplayer games with 2~4 people, would that be client/server still? The person who starts the game is effectively the server?

hollow eagle
#

It could be, or it could have a separate dedicated server.

#

Depends on the game and requirements.

rapid bronze
#

Yup, if you are a Listen you are the Server too, if not Dedicated is separate

hollow eagle
#

The issue with using a player as the server as the "default" scenario is that it means the experience is going to be highly dependent on someone's network. Also means you probably need NAT punchthrough.

#

Unreal can work fine in this scenario with no modifications, it's still just client/server

#

It just has different concerns around networking that aren't specific to unreal.

rancid flame
#

Oh jeez. But if we're a small company it's not usual that we run our own servers anymore is it?
I know some consoles do that as a platform. But on steam?

hollow eagle
#

Depends

#

Managed services like gamelift and playfab make that more accessible

#

but it really does depend on the game itself

dark edge
#

I can't think of any beyond maybe age of empires 2? Or starcraft?

hollow eagle
#

Destiny + Destiny 2

#

they're hybrid

#

Main networking is done over P2P, with *multiple low tickrate dedicated servers handling "important" events.

#

anyway, switching between dedicated and listen isn't particularly hard. If you're writing things that don't assume the server has a player (you shouldn't do this anyway) it's incredibly easy to test both dedicated and listen servers.

#

So it's not something that absolutely has to be decided on early

dark edge
#

I suppose star base is also p2p. Assuming you program it right, you should be able to play your project as standalone, listen server, or dedicated, with no problems.

rancid flame
#

Holy shit I'm so out of my depth as a UI programmer. I gotta learn a lot!
I'll look up Listen vs Dedicated. Thanks for the pointers!

vague spruce
#

do ue4 dedicated servers get some kind of unique identifier i can use in my backend api?

#

or is that something i should generate?

foggy idol
#

i have this in my "Ready To Start Match" on my gamemode

#

but once "is game mode ready" becomes true the client gets disconnected

plucky prawn
#

Your problem there almost certainly is not this function. What do you do when this function returns true?

foggy idol
#

is gamemode ready is set true on begin play

foggy idol
#

and overridden in BP

#

it starts the match i.e spawns players

#

in this case ive connected it to a function called CanStartMatch which always returns false

#

yet the client is still being disconnected

keen condor
#

Hello, i read few tutorials on unreal subonline system which i understood decently , but there is something i'm still missing. My goal is to make a multiplayer game based on a dedicated server but from what i know , a dedicated server is composed by many files and classes that manages a lot stuff as packet sharing, accept client connection and lot more. The thing i don't get is how i can use a dedicated by ignoring all this stuff and by just using preset functions in unreal. My guess is that all this stuff is implemented in unreal but i can't find where it is and how i can eddit it. I'm just curious about how things work inside the box. Thank you verry much ❤️

rancid flame
#

Does anyone know of any good example projects? I see there's a Multiplayer Shootout project but it was last updated for 4.24

potent dagger
#

This tutorial uses a sample project from Unreal and converts it to multiplayer and explains things good, its getting me started pretty well https://www.youtube.com/watch?v=1hzcLMnZ3eI

Check out my Unreal Engine 4 courses:

➤ Souls-Like Action RPG with Multiplayer: https://devaddict.teachable.com/p/souls-like-action-rpg-game-with-multiplayer
➤ Multiplayer First Person Shooter with Dedicated Servers: https://devaddict.teachable.com/p/multiplayer-fps-inspired-by-cs-go
➤ Multiplayer Top-Down Dung...

▶ Play video
#

He also has a vid on integrating Steam Multiplayer thats good

rancid flame
potent dagger
#

I believe its the hour of code project from unreal, might be in the learn tab on the launcher, ill take a look too. I was just using his knowledge for my own project. Ill have a look around for it

#

@rancid flame Looks like its in the Marketplace, just search Hour of Code

rancid flame
steady briar
#

for like a melee weapon trace, is sweeping collision as unreliable as just having constant collision/overlap while moving? i remember people saying collision isnt always so great for moving objects on the server, so a lot of things use line traces etc. anyone know what i mean?

small mirage
#

I swapped from overlaps to traces as it was really inconsistent for me, so far traces worked perfectly well and its pretty easy to implement

peak sentinel
#

UT is recommended after you learned the basics and wondered how prediction and such advanced things work, ShooterGame is good for understanding basic concepts, and the first one covers everything about entry to replication very well

bitter oriole
#

Both are also extremely old and outdated fwiw

peak sentinel
#

But we only have those provided by Epic 😦

bitter oriole
#

Yeah, just pointing out they are both old

#

ShooterGame is nearing a decade in age

tidal venture
#

Hey does someone have experience using the plugin "Smooth Sync" on the marketplace?

fossil spruce
#

Hey all 👋
Does anyone have a replicated Pawn class with movement in C++, or a git link with one? Need for study reference.

bitter oriole
tidal fiber
#

how do you debug to see what information your game state is replicating?

pallid mesa
#

have any of you turned on UseAdaptiveNetUpdateFrequency? If so... how?

They override everything in "ConsoleVariables.ini" engine ini file... and there is no way to do it without changing that one engine file.... have you found another solution?

violet sentinel
pallid mesa
#

aight! Thanks

violet sentinel
#

you can specify it in your DefaultEngine.ini too

pallid mesa
#

not currently due to the initialisation order

#

so you need to call it by hand right after ConsoleVariables.ini gets called

unborn trellis
#

I'm having troubles with the Minimap for my multiplayer game. The minimap function is working however, it's only showing the camera for the first player spawned. So the client sees the camera that's tracking the server. How do i have it so it's independent?

#

i have the screencapturecam2d (idk the name of it) and a spring arm component

#

does it have something to do with the material?

thick blade
#

Hi, did anyone encounter such a weird bug when joining online session? Let's say player A creates a session and player B wants to join. After successful join, player A leaves session and player B is stuck on 'joining' which means, if any player creates a new session he/she will automatically join this new session (ofc despite choosing previously different session to join and even from different player).

#

Literally I can't do anything to stop player from automatically joining this new session.

elfin sail
#
 void AWhooshPlayerState::OnRep_PlayerPropertiesUpdate()
{
    OnPropertyUpdateDelegate.Broadcast();
  
}

void AWhooshPlayerState::UpdatePlayerProfile(const FPlayerProfileStruct& playerProfile)
{

    PlayerProfileStruct = playerProfile;
}
#
UPROPERTY(ReplicatedUsing = OnRep_PlayerPropertiesUpdate)
        FPlayerProfileStruct PlayerProfileStruct;
#

its not working

vague fractal
#

"its not working" is not really saying much

#

You gotta be more explicit

feral sleet
#

What is the correct way to call events replicated in other actors? All the examples I've found events are called by Character or by PlayerController, can I call an event from an attached actor like a weapon class?

elfin sail
vague fractal
elfin sail
#

even its relicated ?

vague fractal
meager spade
#

Server -> Clients never Client -> Server with Replication.

#

(Replication != RPC's)

#

only TArray is replicated

vague fractal
meager spade
#

client can ask server to update a replicated property

#

via a RPC

vague fractal
#

That's what i mean

meager spade
#

but a client cant change a replicated property and expect it to update on server

#

Replication != RPC tho. RPC is remote procedure call, and is not replication

#

to me those are different systems

vague fractal
#

I guess in my head it's just a pair cuz that's pretty much the only way to actually replicate changes besides with some other methods like BeginPlay and similar

meager spade
#

RPC's don't need to change stuff tho

vague fractal
#

Tru

meager spade
#

@tulip ferry there is FastArraySerializer

#

but its just a TArray underneath

#

it has callbacks on client side

#

when an element changes

#

and you have to mark array/item dirty, etc

old knot
#

hi, i watched all multiplayer video series from unreal youtube channel and i did same as them in my project. but i have a problem. all input actions and axis work expect mouseX and mouseY, and i should press and hold mouse button to rotate character! anyone knows why is that?

vague fractal
#

Is the "random" sequence here useable for multiplayer games, or is there the problem that each client gets their own random sequence ?

blissful totem
#

How do you replicate constructor args in bp? I'm spawning this unit with the "Team" field exposed.

#

The team field is used in the constructor to change the color of the unit. The teams field is set to replicate, but the client colors everyone as if they were on the default team.

vague fractal
#

I'd probably just create a Init method which does this kind of setup.
I guess in this method you'd also have to set the values over the server

empty axle
vague fractal
blissful totem
#

I tried creating an init before. It seemed like the host was spawning the unit, then running the function as multicast before the client spawned the unit, and thus the client wasn't running the function when it spawned it on its end

vague fractal
#

You shouldn't use a multicast for this since if a player is not relevant it wont get the new state

#

That's likely a case for OnRep's

blissful totem
#

k

thin stratus
#

Team should be replicated at the time of the Actor being repicated and ready for play

#

There might even be better functions but BeginPlay works

blissful totem
#

ah that makes sense too

wheat grail
#

Hey guys, this question is pretty basic, but my understanding is that if I mark a function as Client in the PlayerController and call it from the GameMode (therefore Server) it should only be triggered in the client that owns that controller. Right?

thin stratus
#

A ClientRPC called on a PlayerController from ServerSide will call on the Client that owns the PlayerController. For one cause the Actor is owned by that Client, and then of course because no one else has that PlayerController on their end.

wheat grail
#

That's what I thought. Thanks for confirming. I have an odd behaviour where it being called twice and something inside the Gameinstance (which I call inside that player controller function) is not being triggered at all. Probably something in my end, I just wanted to discard that moving piece

blissful totem
#

it seems that the local player controller's player state isn't ready to cast to my custom player state on the client end during the pawn's begin play

#

That doesn't sound like something that should happen. Do pawns really run begin play before the player controllers are initialized?

blissful totem
#

I put in a loop at the front to wait a bit and try again until the player state is replicated but that feels super gross

hexed pewter
#

I finished my widgets for handling server browser and hosting a server. Next I'm trying to get sessions to work. In blueprint there is this node create session. From What I understand creating session in c++ isn't as fast as calling a single method, what is a good place to start working on session in c++?
edit, found it I must have missed the docs on online subsystem before

wheat grail
#

Who should be setting the ViewTarget of a PC? The server or the Owner?

kindred widget
#

@wheat grail ViewTargets are local. So Owner. Native PlayerController has an implementation for this already. Your client can set their viewtarget themselves, and there's already also a ClientSetViewTarget Client RPC you can use to have the server tell a client to set their view target to something.

wheat grail
kindred widget
#

Depends on the use case. This for some sort of camera in a level set as a default view?

wheat grail
#

Yup. Its just an actor that acts as transform (with no rep)

kindred widget
#

Personally I'd find some sort of client local function to call that from. PostLogin is pretty early to be sending RPCs. HUD or PlayerController's Beginplay would likely be perfectly fine for that. HUD negates networking checks. PC requires IsLocalController check.

wheat grail
kindred widget
#

An InitialOnly replication value with an OnRep might work for that as well.

vague spruce
#

sup. i'm designing a UE server that registers itself with a backend API. i'm wondering where i would put this kind of functionality. i'm thinking it should happen in AGameModeBase::BeginPlay because at this point the world has fully spawned. am i doing this kind of functionality in the right place? is this even the right channel to ask this? or should it be in #online-subsystems

grand stratus
#

guys

#

since iam using seamless travel

#

all the game state and game mode got recreated

#

and since i need th evariables in game mode and game state to check thing after travel

#

i need a way to pass these variables or a way to get it or to make the game state and game mode the same

violet sentinel
sick frigate
#

Looking for some advice on integrating Vivox. Jumped on a project that has it implemented as a subsystem but i just took a look at their shooter game example which instead extends the game instance.

#

Wondering if anyone else has opted for a subsystem?

silent valley
#

We just switched from a monolithic GameInstance to a few subsystems, including Vivox subsystem.
Makes no difference really but it's a better separation of code.

fluid summit
#

Does it make any sense to replicate a variable inside the player controller with condition "Owner only"?

dark edge
worthy eagle
#

Quick question, for a game instance in multiplayer, does each player have their own game instance or is it shared throughout the server? Just starting to implement multiplayer functionality and am a little fuzzy on game state, game instance, player state, and etc.

hollow eagle
#

One game instance exists for each running game. One exists on each client, one exists on the server.

#

The server does not have multiple game instances. It has only one, regardless of number of players.

clever plinth
#

Is there a mechanism to extract stats from the character movement component about the size of corrections being made to character transforms/positions/velocities? I'm seeing visual glitches on the client end when changing movement direction (w/ simulated latency enabled) and wanted to see if there was a stat that will confirm what my eyes are telling me

sinful tundra
#

Hello, I'm wondering if I can get a bit of help spawning pawns for listen server and other clients? I have a widget button that spawns a pawn by calling a gamestate run on server event and passing the player controller (which then multicasts for all clients to see the pawn). It works for the server, but doesn't for clients. I'm really not sure what's the best way to handle this (and I'm sure I'm doing this wrong...)

dull lance
#

^ You don't need to Multicast for this though... do you?

#

Pawns just need to replicate and be spawned by the server

#

unless you're talking about "seeing" as toggling SetVisibility / SetActorHiddenInGame

dull lance
sinful tundra
#

ah okay

#

the pawns should be replicating, but i'll double check. i'll get rid of the multicast and see if that helps

#

hmm.. i'm still seeing the same issue. listenserver works, but not a client

#

could it be something to do with the widget button on client not being able to call a gamestate run on server event or something?

dull lance
#

Are you trying to run an RPC from a Widget?

#

Or does the RPC exist in your PlayerController/State?

#

Rephrased: In what class is the RPC declared?

sinful tundra
#

Widget calls the event in game state class

dull lance
#

Yeah, no

#

Check the network compendium (Pinned comment in this channel)

#

Widgets can't send RPCs

sinful tundra
#

The run on server actual event isnt on widget

dull lance
#

GameStates can't send RPCs to Server either

sinful tundra
#

Oh

#

Which class should I use for rpcs?

dull lance
#

you need an actor that has local ownership

#

From a widget PoV, your most logical choices are PC/PS

sinful tundra
#

I guess it didnt make sense to me to have a player controller have a spawning rpc, which is why I thought gamestate was best. I know game mode only exists on server, so that was a no go. Hmm... okay. I guess I'll move that rpc to player controller

dull lance
#

no no

#

The Controller only handles the RPC part

#

to the server

sinful tundra
#

Ohhh.. gotcha

dull lance
#

then you can run whatever your Gamestate/gamemode/etc needs to do

sinful tundra
#

Thanks for clearing that up for me. I'll give that a go

#

That totally did it XD I've read that network compendium, but still getting confused when putting it into practice, heh. I'll go through it again!

clever plinth
#

I realize this question may have some nuance to it (and depend on settings/gameplay, etc), but roughly what kind of latency tolerance can one realistically expect to get from unreal's character movement component?

nimble parcelBOT
#

:triangular_flag_on_post: abtin#4237 received strike 1. As a result, they were muted for 10 minutes.

wise zephyr
#

hey guys i have a question for you all with replicating instance static meshes...has anyone here used that in their multiplayer game

wise zephyr
# empty axle what's the question

hey thanks..do the instance static meshes have different indexes for the client and server? like the "body index" on the instance static mesh

empty axle
wise zephyr
#

so basically i got a forest..and if you get close enough to the tree you can interact with it..it is replaced by the static mesh instance..and if you leave that area..it goes back to an instanced mesh

#

im going to do some more messing around

empty axle
#

if it is preplaced in the level then yes, otherwise it depends how do you spawn them

wise zephyr
#

ok cool thanks

#

is there a way to get the instance by its transform instead of index?

#

so when i replace the instance with an actual actor back to the instance...the index changes..this is gonna be tricky

tidal fiber
#

real quick is there a way to print messages in only the relevant PIE instance? it's confusing when all the clients are printing in every window

empty axle
tidal fiber
#

ty

vestal forum
#

can I stream a level for a client but not other clients?

grizzled stirrup
#

For a game like Borderlands which randomly generates weapon stats when a weapon drops, would the best way to replicate this be to spawn the default weapon and then set a replicated struct on it containing all stats which would replicate down to clients and init the weapon via an OnRep function?

thin stratus
#

That or you set them upfront when spawning

#

And they would be replicated on BeginPlay then

#

@grizzled stirrup

peak sentinel
#

You can just mark them as Replicated and set their condition as InitialOnly and on beginplay if you're auth set their values

#

Or you can spawn them as deferred and set their values before finishing spawning

thin stratus
#

Yeah the deferred is what I meant

#

Can be combined with the InitialOnly one

winged badger
#

or just replicate a seed

#

and have the client figure it out

#

instead of replicating a whole bunch of stats

grizzled stirrup
# winged badger and have the client figure it out

Yeah I was thinking this may make the most sense as long as the rand seed result will always match on client and server which it should if they both call the same func on begin play and don't reuse an old FRandomStream

winged badger
#

i wouldn't wait until BeginPlay though

#

deferred spawn on server - SetSeed, triggers the stat generation, finish spawn

#

on client either OnRep_Seed or PostNetInit, same call