#multiplayer

1 messages ยท Page 129 of 1

crisp shard
#

still failing at making a replicated elevator system

#

legitamtely the hardest thing i've attempted to make thus far and i feel like im either being retarded or this is actually just that hard

prisma belfry
#

Simple question. When i print a string in my gamemode (which ofc runs only on server). Why do I see the message on both the listenserver and the other connected client (running from editor)

#

is the print somehow replicated or do they both think they're the server?

#

I think i figured it out, the print is actually replicated. hence the "Server: ..." so only the server is calling the print

#

EventOnPosses is called only on server side which added to my confusion

short arrow
#

If it were replicated, you'd be seeing
Server: Hello
Client: Hello

#

It'd be a multicasted event if that were the case

#

Finally, Event OnPostLogin is in the gamemode IIRC, which doesn't replicate at all. It only exists on the server, so it can't really replicate even if you selected the option to.

prisma belfry
#

yeah I agree with all of that, I think you misunderstood

#

you can clearly see on my client that it also says "Server: Hello", this surprised me as I a corrected assumed that the client never ran the print code

#

but apperently the text that gets printed from the server, also shows up on the client

#

thats what I mean with "the print is replicated"

short arrow
#

so you weren't asking if prints were replicated, you were asking if they are suppose to show on both screens?

prisma belfry
#

yeah I guess so, maybe i chose my words poorly

dusk orchid
#

if the rpc function is in the playercontroller class then you can just reference itself, else you can get the owning controller of the *pawn

keen hound
#

What would be the best way to detect a certain player as a admin

torpid nymph
#

is it possible to change the net cull behavior so that the actors don't disappear from the client? I want the object to still render but right now moving away from relevancy seems to destroy it

#

I don't want it to be always relevant since I don't want it to continue sending rpc's

hollow frigate
#

I'm a bit confuse... what would be the best approach for Health bar (the one above other players/ennemy), Right now I built a Health/Damage Component that relate the information to the widget but I can't get it to replicate at all

serene kestrel
# torpid nymph is it possible to change the net cull behavior so that the actors don't disappea...

Are you actors "static" such that they aren't getting updates? Then dormancy might be an option and you just increase the relevancy to match the visibility you want. If not, you'll have to make an engine modification to allow for Actors to keep their channels open when not relevant. Warning though there's lots of edge cases to handle when you begin to go down that approach.

Another option is to use the ReplicationPause feature which I don't believe is documented anywhere. You can tell an Actor to pause it's replication for a specific channel. It will still be considered "relevant" but it won't send any updates

dire cradle
torpid nymph
hollow frigate
serene kestrel
#

You'll want to override IsReplicationPausedForConnection(const FNetViewer&) which gets called on the server before replicating to an Actor

#

Since the feature is not widely used, there are bugs that you may want to fix if you want it to work perfectly

#

But should mostly do what you want

hollow frigate
dire cradle
#

ok wait i didnt see the screenshot

#

Is the problem other people not seeing the correct health? Or is it the owning player?

hollow frigate
#

other people

dire cradle
#

Because it seems like you're only updating healthbar on owning player

hollow frigate
#

yes I reverted the replicated logic

#

just wanted to show you the actual base of the logic

dire cradle
#

Instead of using Run on owning client, set CurrentHP as RepNotify, then update the widget inside that repnotify function.

sinful tree
# hollow frigate I'm a bit confuse... what would be the best approach for Health bar (the one abo...

Health / MaxHealth needs to be replicated properties and should set to Rep W/ Notify. It can be on the character itself. You set the health & max health variables on the server only.
Apply Damage / Any Damage events have to happen on the server. You calculate what their new health value was after Apply Damage and set it in the health variable.
The Heatlh variable when set up as a Rep W/ Notify variable will give you a generated function called OnRep_Health which will trigger on clients when the value replicates. You can use that function to update the widget component with the value.

hollow frigate
#

I did that and now the the bar doesn't update anymore ๐Ÿซ 

dire cradle
#

Make sure the Set Percentage function is set up properly

#

And also check if the damage is being properly applied

#

Because it seems like it should work

hollow frigate
#

well it was working for the owning client prior, so its weird that its not anymore, its somehow was just working with the ROC. Like if the server wasn't replicating the information fast enough

dire cradle
#

Was the owning client also the server?

sinful tree
dire cradle
#

You can also put print screen nodes to validate if the health is changing correctly on clients or not. So you can pinpoint if the problem is in the widget or the networking.

hollow frigate
#

just tested, it doesn't pass HealthBar Get Valid

#

since it's the server its not the one owning it I gues

dire cradle
#

Where are you creating the healthbar?

#

Each client should create their own independently

hollow frigate
#

it's on the player as a widget component

dire cradle
#

Where do you set the reference to the user widget object

hollow frigate
dire cradle
#

Where is the initialize called?

hollow frigate
dire cradle
#

Lastly, where does this initialize gets called? lol

hollow frigate
#

on the character begin play

dire cradle
#

The reference should be getting dropped somewhere

#

The any damage is inside the character correct?

hollow frigate
#

the reference is working if it's not called by the server

#

no it's in the component also

dire cradle
#

is the component set to replicate?

hollow frigate
#

the widget component yes, but I think the other is not facepalm

dire cradle
#

you don't need to have the widget set to replicate

#

it should only exist locally on every player

hollow frigate
#

true

dire cradle
#

that might be the problem

hollow frigate
#

ok so replicating the component fix it but its still not showing to other player

dire cradle
#

is the widget also set to replicate?

#

if it still is, untick it and try again

hollow frigate
#

just tried both, its not that

dire cradle
#

Ok what's the exact problem right now, does the health value update correctly now? is it only the widget the problem?

hollow frigate
#

yes, the health update properly for the owner

dire cradle
#

the value doesnt update on clients?

#

or does it update but the widget isnt showing it properly

hollow frigate
#

so I'm running the test with 2 clients, both client can see their own health bar update with the right value but they don't see other client bar updating

dire cradle
#

Inside the RepNotify, can you put a print screen node to show the health value on screen, so we know if it's the value that's not being updated or if it's the widget not displaying correctly

hollow frigate
#

I just tried with a print string inside the HBWidget and the health is getting updated properly for both client, same inside the repNotify

dire cradle
#

Ok so it's an issue with the widget

#

is valid is still returning false?

sinful tree
#

The problem lies here.

hollow frigate
#

no its working fine otherwise the bar wouldn't be updating right

sinful tree
#

Begin Play fires on both server and clients.
The cast will only ever succeed on the owning client as controllers do not replicate to all clients.

dire cradle
#

Controllers still exists on their owner clients

#

otherwise the clients wouldnt be able to move as the input wouldnt be mapped

#

oh i misread i think

#

yeah wait

sinful tree
#

Right, but the begin play is triggering on clients as this is on the character, but other clients won't have the controller.

#

So Initialize will only ever be called on the server and the owning client.

dire cradle
#

Yeah that's a bingo

#

true

#

Set the reference before the player controller cast

hollow frigate
#

its fixed!! Yeahhh

#

thanks! I would have never found that one damn.

summer tide
#

If my player is mounted on another character using possess, when my player disconnects, the mount disseappers and the character on top stays. How do I solve this>

limber gyro
limber gyro
#

ye

summer tide
limber gyro
#

i am not sure of the name

summer tide
limber gyro
#

im 90% sure u can get the player from the controller

summer tide
limber gyro
#

umm, maybe im wrong

summer tide
#

So my mount disappears and the character on top stays. I don't want the mount to get removed.

limber gyro
#

well, then u probably need to unposses whatever it is that is being possesed when ur character logsout

#

ive never done anything similar tbh

summer tide
#

Anyone has done something like this in the forum?

limber gyro
#

this might be usefull

lost inlet
#

a lot of terrible suggestions in that thread by just a cursory glance

gilded thorn
#

Is MarkItemDirty() gone in unreal 5?

summer tide
latent basin
#

Why do we do this and what does it mean?

#

This is a simple upper body montage playing representing a melee attack

#

is this so that it doesnt run on my client because i cant see the mesh since its owner no see?

#

So it saves resources?

summer tide
limber gyro
sinful tree
# summer tide If my player is mounted on another character using possess, when my player disco...

The issue stems from the Game destroying the PlayerController when they disconnect which then calls this:

void APlayerController::Destroyed()
{
    if (GetPawn() != NULL)
    {
        // Handle players leaving the game
        if (Player == NULL && GetLocalRole() == ROLE_Authority)
        {
            PawnLeavingGame();
        }
        else
        {
            UnPossess();
        }
    }

Which results in the pawn being destroyed:

void APlayerController::PawnLeavingGame()
{
    if (GetPawn() != NULL)
    {
        GetPawn()->Destroy();
        SetPawn(NULL);
    }
}

To resolve, one would have to override PawnLeavingGame() or Destroyed() to remove this behaviour.

latent basin
limber gyro
#

i think hes only working with BP's tho so...

latent basin
#

Basically On click leave button I have an event called in my base player controller which calls an interface, that basically ragdolls my character and kills them in game (ran on server), back inside my widget i then carry on and destroy the session caller so it logs my player out of the match and then can just put my player in the menu again

#

The interface though to ragdoll my player and kill him is binded in my player class

#

hope binded is the right word

summer tide
latent basin
#

Destroy session caller event in my game instance

sinful tree
#

PawnLeavingGame there's no call in blueprint.

low trellis
#

Hi guys. I have a multiplayer game and server all done from source build (windows)

What is the easiest way to Pack it for Mac Version.

I have 2 MacPro 1st is on M1 Pro chip 2nd is on Intel i7 when I drop the project to Mac M1Pro I can play the game in Editor and all works, but when I want to Pack it, it says Unknown Error.

Same if I want to connect to the server from Editor, its not going through.

thin stratus
#

Connecting from Editor to a standalone Server is not really adviced, since the editor does a lot of extra quirky stuff.

So you should focus on packaging. And the easiest way to package for Mac is to have a Mac and package it there.

If you run into errors you will have to figure out what they are. There should be more than Unknown Error to find in the build log

low trellis
#

is it a problem If on windows all done on source build 5.1 and on Mac I am using Epic build 5.3 ?

ionic iris
#

I have a question, i have created a component that can store player data such as collected points to a webserver
however i am not sure where to keep the component on, like what is the best practice
i do not want it be live on clients sides, so i was thinking of creating a gamemode with that component attached. but scores are store you know in player state, so maybe game state ? but as per documentation game state lives on all clients
i do not want to work on security aspect yet ๐Ÿ˜„
what do you suggest

worn flint
#

Hey guys, if I have two Characters and I want them to be able to just move in a scene, I just need to place two player start and set bReplicates = true in the constructor right ?

crisp shard
#

I have created the elevator system so that when you click the elevator button from any floor it will call the elevator to that floor.

Iโ€™m trying to get an animation of this to happen and I have it so that the elevator floor will always โ€œriseโ€ up to the correct floor@but for some reason if youโ€™re below the floor that the elevator is currently on and you call it to your floor then the elevator will teleport below the floor and then rise up to the correct floor.

In theory, it works but if someon was to be on the elevator this would cause issues in where players are located and would glitch you below the floor you actually are very quickly and the take you the proper floor

fiery wadi
#

Anyone know of a way to test a steam multiplayer game on the same PC ? or do i have to install on a 2nd pc(which is a bit inconvenient) to test?

chrome bay
#

You will need either a second PC or you'll need to run a virtual machine on the first PC

fiery wadi
#

I assume a Virtual PC will need it's own Steam account also

chrome bay
#

usually yeah

#

Shouldn't be too much hassle installing on a second machine if you have an App and a second account, just push to steam backend and download on each client.

fiery wadi
#

Ah ok thanks, I really didnt want to keep walking back and forward from pc,s located in different rooms of my house when one is downstairs and one is upstairs

tardy fossil
#

well the good news is you only really need to test it to ensure its working

upbeat basin
#

Is there any better solution than using replicated TArray<FKeyValueStruct> variables and then updating TMap variables from this array on the OnRep function to fake TMap replication?

pine sage
#

Hi !
So I think I missed something somewhere, or it is not possible like this.
I have a TArray<UCustomSaveGame> that I want to replicate to the client

#

the replication happens but the values in the TArray are all null

#

My initial thought is a savegame could be replicated, but it might seem I could need to wrap them in an actor and set it to replicate ?

#

    Any replicated actor can be replicated as a reference

    Any non-replicated actor must be stably named (loaded directly from a package)

    Any replicated component can be replicated as a reference

    Any non-replicated component must be stably named.

    All other UObjects (non actors or components) must come directly from loaded packages```
#

guess that answer my question ... right ?

#

not even sure wrapping will work actually

chrome bay
surreal plaza
#

Is it possible to pull the player controller (whatever it might be controlling at the time) on the listen server without any more information?

surreal plaza
#

This would be in the context of a pawn that is calling server methods.

thin stratus
#

The one of other players is better retrieved relative to whatever they are doing

surreal plaza
# thin stratus Only the local one

So in my case, I have a customizable bullet that is a pawn to support once it is fired, tracking it's behavior. The player will have orbiting, zoom, and pan functionality in flight to see where it is going. When a player fires a bullet, they hit "T" and snap to that pawn. In the case of subsequent bullets, hitting "T" from bullet view will move the next bullet and so on until they get to all bullets then return to the player. So in my case, where is the ideal function to 'possess next bullet' and from where should the controller reference be pulled?

sinful tree
surreal plaza
sinful tree
#

You could technically put the input on your character and on the bullets, but you'd be duplicating the code unless you have it call somewhere else. You should be able to "Get Controller" from a possessed pawn which you should be able to use to possess with and not need any casting.

thin stratus
#

I would question if you want to do that

#

The whole possess of a "Pawn"Bullet

#

If you just want the camera to follow etc., you could simply handle that via the PlayerCameraManager

#

It becomes increasingly difficult to map a player to their actual Character if you unposses it

#

@surreal plaza

#

If it's not like the Redeemer, where you actively street the projectile, I would not make that a Pawn anyway

#

I would just have a "LastShotBullet" or so an array of those on e.g. the Character

#

And then in the PlayerCameraManager, get the current ViewTarget, which is the Character

#

Check if the Character has such LastShotBullet

#

And then set the Camera accordingly

#

That way you keep all the ViewTarget benefits of you character

#

And if the character dies, you still have a valid PlayerController and PlayerState assigned to assign deaths and kills and what not

vivid river
#

I have what might be a very basic question, what is the "right" way to have a player control a secondary item in a multiplayer game at the same time as their possessed pawn?

I have vehicles that can have a turret attached. The turret is a spawned actor that is attached to a socket on the vehicle pawn. When not online, it's simple to just directly update the transform of the turret rotation form the pawn BP. But online that doesn't work even if I'm calling for the server to then multicast that to clients.

I'm guessing this is a known thing as it's really just the same as having a weapon pickup that has it's own animations/features. Wondering if anyone has a any pointers or article links for the right way to implement.

desert lance
prisma belfry
#

I want to run some blueprint code when both my playercontroller and playercharacter are both spawned and connected on both server and clients (my controller spawns the character). sounds simple but driving me a bit crazy.

I tried running the code in playercontroller OnPossess - But only called on server
I tried calling a multicast on playercontroller from playercontroller OnPossess - doesnt get called on client, eventually found it playercontroller is special and replicated unique
I tried calling a multicast on my playercontroller from OnPossess in the playercontroller - Doesn't get called on client because the client seemingly hasn't spawned its version of the playercharacter yet
I tried running it in beginplay with a IsLocalController check followed by a server call to run the code on server as well - works on client but for server the controller isn't assigned to the playercharacter yet (pre-onpossess I guess)

I really wanted to avoid using delays. Is there a proper way?

cyan lynx
vivid river
#

@prisma belfry alternately run something from the playerPawn onBeginplay? As that will only start once it's been spawned, and the controller is already in existence. Depending on what you need to trigger and replicate where, you should then be able to have an event run on server copy of the pawn and multicast to the other copies.

prisma belfry
#

I tried that @vivid river but on the server "GetController" returns null ( on client it works)

#

OnRep_Pawn seems interesting, I'll try it

#

oh OnRep_Pawn is not exposed to blueprints but I can add some C++ specifically for it, just hope it works then

cyan lynx
prisma belfry
#

its a vain reason maybe, I just want to assign a damn casted version of the player character on the playercontroller, but I refuse to believe it can't be done cleanly so im taking it as a learning opportunity

#

/** Pawn has been possessed, so changing state to NAME_Playing. Start it walking and begin playing with it. */
virtual void BeginPlayingState() override;

#

also looks very interesting. Excellent documentation ๐Ÿ˜…

tropic snow
#

net profiler on a source build is showing up blank after recording a session. Anyone know why? I even build the sln.

scenic mulch
#

Hello i was wondering how do i get the player ping to the server ? i want to have a widget where the player can see how much ping he has .

limber gyro
#

I am trying to get my steam to play nice with lobbies(i am using lobbies as parties cause thats what the documentation leads me to belive they are for).
When i join a session it creates another lobby and disbands the previous one, basicly it ruins the previous party.
I did some digging into the subsystem and from what i understood there ate 2 types of sessions, "internet sessions" and "lobby sessions" (correct me if i am wrong).
When "use presence" is true, it creates a "lobby session" but when its false it creates an "internet session", im trying to mess with that to see if i can get the session to create without creating a lobby.

My issue is that i cant create a session without "using presence", does any one know how to do this, is this even possible?

shadow hatch
#

not sure if to put this question in multi or animation or someplace else but

#

i was wondering whats the best way to make sure all clients know another players yaw / pitch etc

#

mostly used for head rotation and aiming offset

dark edge
shadow hatch
dark edge
shadow hatch
#

maybe i could try without the delta, i am pretty bad at rotators and vectors so a lot of the times its guesswork for me lol

dark edge
#

AFAIK the entire ControlRotation isn't replicated around, but you might find it somewhere

shadow hatch
#

i remember in some project i just did a multicast inside the pawn or the player controller itself then read the value from there

#

which will work i know but it feels clunky

#

from player input to server to multi basically

#

could crack open lyra again and see how they handle it

dark edge
#

yeah it looks like remoteviewpitch is the only automagically replicated view property for Pawns afaik

#

kinda annoying

#

I guess it's based on the fact that most of the unreal games use the pawns yaw as the yaw

magic vessel
#

I'm getting a fatal error with my fast array
LogWindows: Error: appError called: Assertion failed: FixedShadowIndex > Index

#

Okay, I can replicate it. It occurs after:

  • Add an item to the array
  • Use the item
  • Add another item to the same slot
  • Attempt to Use that Item and then Remove that Item
brisk swift
#

Seems like my health on a client is always 0 when I press play in editor so it's instantly destroyed, if I remove the destroy then client can walk fine but can die again if damage is applied. It always triggers health changed and kills the client like something is dealing damage to it but nothing is

cloud lake
#

i'm using 'play standalone' with 2 clients and a dedicated server to test multiplayer.
the issue i have is that the derived data cache isn't used, so it always has to compile shaders which makes testing very onerous. is this normal?

hollow eagle
#

Having to compile a few shaders doesn't mean the DDC isn't in use.

#

It means a few shaders need to be compiled, which can be for a variety of reasons, most of which are at a minimum ignorable.

cloud lake
#

helpful to know that regardless though

thin stratus
#

Well standalone opens semi standalone instances of the game

#

If there is no apparent reason for Standalone and you just want to test something, simply play in the Editor

#

@cloud lake

bright fern
#

Hi everybody,
I'm working on a multiplayer project and I have a question about PlayerStart.
Do I have to put them inside the editor or can I spawn them from C++ code?

thin stratus
#

Like, the PlayerStart is meant to be a Transform with some extra fluff for your Character to spawn at

#

So it kinda should be placed into the level

#

If you are determining the transforms in C++

#

Then the PlayerState becomes redundant in that regard

#

But I mean, you can still spawn them from code if you want

bright fern
#

I'm pretty new to Unreal, I was understanding that you need a playerstart to spawn the Character in the level

#

We want the project to be used by lots of people, so I don't want to put the playerstart by hand

thin stratus
#

No you don't need them.

#

By default, if you don't change anything, UE's GameMode spawns the DefaultPawnClass by finding a PlayerStart

#

All of that can be overridden and changed or completely ignored

#

For Multiplayer it's usually good to override the given functions

#

E.g. FindPlayerStart or ChoosePlayerStart

#

And then doing whatever you want in there

bright fern
#

@thin stratus thank you

surreal plaza
# thin stratus Ehm, why?

There is a case in my game where I want to make effectively a knights of the roundtable type of situation. So for any X number of players, they are evenly distributed around the table. Is that a case where code based spawning is advantageous?

gritty nymph
#

Yup โ€ฆ you want custom spawning logic you make custom logic

mystic estuary
#

Hello, does anyone know what's the correct way to forcefully disconnect a client from a server?

tranquil yoke
#

Change Level to something else

mystic estuary
#

Do I need to do that client or server side?

tranquil yoke
#

Client

mystic estuary
#

uhh, alright, thank you

thin stratus
#

@mystic estuary You can try destroying their playercontroller on teh server

surreal plaza
# sinful tree The T input to call PossessNextBullet should likely be on the PlayerController i...

@thin stratus I am trying to move some functions to my playerController like we discussed yesterday. I am trying to give my custom pc a reference to the gun on begin play using GetController. That way, I can do Input->Run On Server -> (Gun) -> Find appropriate bullet. But GetController only works on the listen server player, not the client side players. GetController returns null. Is that expected or do I potentially have a wiring problem?

thin stratus
#

BeginPlay is too early to access teh Controller on Clients

#

That's what OnRep_Controller or OnControlledChanged is for

surreal plaza
surreal plaza
thin stratus
#

If the DoGunStuff is in the Controller then sure

#

I usually place my RPCs into the Gun

#

And make sure it's owned by the Client

#

And then they need the ref on the Clientside too

#

But it's honestly enough if you keep this all in teh Character

#

Iirc the stuff we talked about was the projectile follow stuff?

#

The ViewTarget is the Character anyway at that point

surreal plaza
#

Yes, this is the projectile follow stuff.

worn wagon
#

I've noticed after switching to 5.3 that RPCs seem to be limited by MinNetUpdateFrequency quite heavily. I always thought that only affected replicated properties, so it has me very confused. I thought RPCs were meant to be sent instantly?

#

For now, we have a simple throttling mechanism for multicast events: a multicast function will not replicate more than twice in a given Actor's network update period. Long term, we expect to improve on this and have better support for cross channel traffic management and throttling. - https://docs.unrealengine.com/5.3/en-US/rpcs-in-unreal-engine/

Designating function replication across the network

#

That must be it, just super weird I never ran into this issue until recently.

#

Maybe there were changes to when actors get "throttled", or maybe I'm just losing my shit. I'm positive I never ran into this issue and I am doing things virtually identical to what i've done before over the network.

dark yew
#

So ive been watching and getting a semi overview on multiplayer works.

I wanted to start going step by step and this tutorial series seems like exactally what I am looking for, but Im a little worried since its from 7 years ago. Should i be worried about that?

https://www.youtube.com/watch?v=abmzWUWxy1U&list=PLZlv_N0_O1gYqSlbGQVKsRg6fpxWndZqZ

In this video we take a look at the finished project and step through each of the features that will be covered in this series. We show our functional Main Menu and its options, a lobby where players can chat with one another and select their characters for the game, some server options such as changing the map or match time as well as the abili...

โ–ถ Play video
#

or if anyone knows of a better series id love to watch them

gleaming kite
#

I have an odd lifecycle question, what causes a pawn to be spawned for a player controller on remote client connection, then possessed and promptly destroyed, then spawned again and possessed like nothing ever happened? I have HUD functionality that is created OnRep_Player state and sometimes the HUD is claiming the character is null. (mostly during bad simulated latency and packet loss). The HUD is only created from the player so its really not possible for it to be null unless its destoryed. Ive noticed that during this odd behavior, the camera view goes onto the pawn, then down to 0,0, then back to the pawn, presumably the new one the gamemode has created.

spark shadow
#

Hello, I'm trying to make ActorComponent that binds its function to an input but it works only on server and not the clients
what am I missing?

fair latch
#

Begin play is prob too early for client. Your controller is prob null

#

@spark shadow

spark shadow
#

something like this?

#

now it doesnt add on server either

dusk fable
#

hey , need help with this approach , a multiplayer game , players go through a series of levels , in those levels they collect points , and the points travel with players as they go from level to level , how do i achieve this score track system ? like , i want each player to store his own score

#

not necessarily a step by step guide , i need the approach and i will find my way

sinful tree
# dusk fable -------------------------------------- hey , need help with this approach , a mu...

There's a persistant data compendium in the pins here.
Off the top of my head you have some options:

  1. Use PlayerState to store the values and use seamless travel - there is more info in the persistent data compendium on how to copy values between travels using this method.
  2. Use save games on the server for each player. The server uses the unique net ID of the player for the save game. This can be loaded into the playerstate when you want to be accessing and modifying it. Save before moving, load when a level begins.
  3. Use save games on the client and send the data to the server on begin play of their controller. This would require you to trust the client to send you the correct points they have which means they could spoof it, so it's not very secure. This does allow your clients to connect to any server and retain their points.
  4. If the points don't need to be persistent between server launches, you could use the Game Instance of the server and store the points in a Map variable of Unique net ID to Points, and then look up the player points from there on level loads and replicate them on the playerstate and store them back in the game instance before moving levels.
formal solar
#

Hi guys I'm working in UE4 using Online Subsystem Steam and the node 'Host Session'. My question is, do I need to specify a map for this? If I create a session, will players who join said session just get teleported to the map I am currently in?

shy gust
#

Is the GameMode always loaded? do I ever really need to check if the game mode is loaded if im, for ex: checking something on it - on begin play in another BP ?

sinful tree
shy gust
idle gale
#

Hi!

I am looking for a cheapest way to store player data for read / write on a remote server.

I also want to use Unreal 4.23 for HTML functionality

#

If anyone has suggestions for what to look for, please let me know

sinful tree
#

That's not something that is really pertinent to Unreal itself.
Cheapest way to store player data on a remote server also isn't very descriptive of what it is you're actually trying to do. Like, I could suggest that you have a small Raspberry PI or some old computer hardware hooked up to your home network that you then have an API on that you can call to save small bits of JSON and retrieve the data from. Could essentially be free save for your power and internet usage.

idle gale
sinful tree
# idle gale I want to have a database of items collected by each player and they currently e...

You'd need to research how you want to store that data first using whatever tools you want to use (Bunch of JSON files, NoSQL, Postgress, MySQL, DynamoDB, EOS, or using a BaaS like Photon, Playfab, Braincloud, Acceleratxr, Accelbyte etc.), and find out how you can have Unreal communicate to those services. Unreal is ultimately flexible and can be set up to communicate with any of these kinds of services and there is no single right answer for what you're trying to do based on what you're describing. The difficulty level and cost of setting up and maintaining such services depends on how you want to approach problems like uptime, scaling, backups, security, authorization, etc. and can even be influenced by if the service you want to use has some form of Unreal SDK you can implement or has a plugin for you to use which can make the Unreal portion of it effortless. Again, cheaply can be a simple JSON file for each player that's hosted on some old computer hardware hooked up to your own home network. If you want more than that, you'll need to do the research and find what is acceptable to you and what price is right.

At the end of the day, all Unreal should have to do with it is sending requests and receiving responses which is most likely the easiest part of the entire process and all that this Discord is really meant to help you with - not saying you can't ask questions about this kind of stuff, but the help you'll likely find is limited :/

hushed rain
#

I'm really lost here. Can't figure out why the server is allowed to walk on top of geometry collections but the client is prevented/teleported. Any idea? I've tried messing with all of the CMC settings but nothing worked.

sinful tree
#

Getting any warnings in your output log?

hushed rain
#

but it's weird to me because they are clearly the same geo on each screen not sure why that would matter

sinful tree
#

I believe it can matter as if there isn't a shared reference to the geometry that is known about on both the server and client, then the server doesn't know what the client is walking on and corrects their position to what they know the client can be walking on.

hushed rain
#

Oooo

#

I'm basically triggering it via an interface and then repnotifying a non replicating event to spawn the geo

#

perhaps if i call the event on the server?

#

Hmmm nope just spawns on server then haha.

hushed rain
#

Hmmm seems no matter how I spawn the geo nothing changes.... wtf lol

#

Errr. nvm, somehow figured it out and not sure what I did haha. Thanks for the words @sinful tree you're great.

dark parcel
#

You should only spawn something on server side

#

If the actor is set to replicate it will spawn it on the clients

hushed rain
#

I'm also spawning a component, not an actor

#

Sorry, "adding" a component.

#

This replication in the geometry collection is what fixed the movement, but now I can't affect the geometry on the client. D:

#

Might have to change my geometry collection component to spawn a new actor or something lol

prisma belfry
#

Anyone see a problem with making a "ClientState" macro library like this:

open orchid
#

hey i have question guys

#

aws or photon cloud for multiplayer w/ unreal engine?

fathom aspen
sinful tree
#

A better check there is if it's not a dedicated server, check "Is Server" and if true, then it is a listen server, if false, it is a client.

slow wing
#

Is there a way to make some replicated vars be part of the spawn bunch a client receives when the server spawns an actor?

twin juniper
#

Tranek said something about using AbilityTasks to replicate, but what if i dont use any AbilityTasks but my code is only like this, how do i replicate?

sinful tree
sinful tree
#

In fact, this ability wouldn't need to be run on the server at all.

twin juniper
#

But it worked on the listen server

#

Oh maybe it's not a replicate problem

#

becasue my client isnt even jumping

graceful flame
#

Jump is already built into the CMC itโ€™s even got client side prediction thereโ€™s need for an extra RPC.

sinful tree
#

The character movement component already has its own built in mechanisms for replicating movement. There is very little benefit in having to RPC to the server to request to jump which then grants the ability and triggers it - in fact, this'd be kind of bad as you're having to wait the round trip time to actually get the movement response, so if they had 200ms ping, they'd be waiting about 400ms to see that they jumped.

If you want to gate jump behind an ability for ensuring tags are met etc. Just grant the ability the one time at start up. Then trigger the ability from the input press, no RPC needed.

#

Anything movement related you probably want to have the ability granted from the get go so that you can at least have some client prediction working so it doesn't feel unresponsie.

twin juniper
#

I think i'll do that later, now my ability isn't even firing

slow wing
sinful tree
#

I'm not entirely sure, but I am sure that references that don't currently exist on a client wouldn't exist if they were referenced when spawning the actor either.
Your best bet is almost always to use OnRep variables and trigger the logic they require when they have been replicated. Even if it's a one-time thing and you want to ensure several variables are received on the client before doing something, you can build up some local logic (think a bunch of booleans set locally that you check on a function call each time a variable is replicated) that checks to validate all information required is received before continuing.

slow wing
#

Alright, yea that was the alternative was just hoping to avoid it if possible. Thanks for the info ๐Ÿ™‚

limber gyro
#

Hey guys, i have a bit of an odd request but i guess it still inside of the scope of this channel.
Let's say you are interviewing some one for a junior network position, what questions would you ask?
Feel free to PM me the questions if you dont wanna spam here.

cloud lake
#

befoer i give myself a bunch of onerous wrok, anyone have this issue:
I have a sysstem that attaches weapons to my main agent mesh. works great in single player, and it also works in multiplayer. As long as i don't use the 'DefaultWeaponPickupScale' variable i have, so i can make adjustments to weapon size.

when i set the weapon mesh scale to say, 1.5, the weapon still spawns but it has a major offset so you see it flying around in the air.

i can fix it by 'baking' the scale of every weapon mesh, but it will suck to maintain and i also have about 20 weapons/agents.

#

anyone else experience this issue with scaled meshes not replicating properly when attached to sockets?

twin juniper
#

In PlayerCharacter, i have OnRep_Controller() and OnRep_PlayerState(). But i want an event in which i have both PlayState and PlayerController. Do we have that event?

#

the only thing i could find is OnRep_Owner(), but it doesn't have both

#

there is also an event called PreReplication(), but there is no PostReplication() which is quite weird

cloud lake
#

Canโ€™t you just get the player state on rep of the controller? It seems weird on rep would return multiple variables since itโ€™s activated when one specific one changes? Maybe I am misunderstanding though

twin juniper
#

no i can't

#

wdym onrep return? it's a void function

cloud lake
#

Right I just mean, OnRep fires when a variable is changed. How would it handle two variables changing? I would think if u need playerstate in your onrep controller you would just get it using onrep controller -> get controlled pawn -> get player state from pawn?

twin juniper
#

but my player state didn't exist in that event

cloud lake
#

Then how would u have an onrep cover both ? Bit confused

twin juniper
#

i need an event not necessary onrep

#

i guess i could try begin play

cloud lake
#

What are u trying to do

#

hope this isn't a dumb comment but you're aware you can create events that have inputs right? so u can easily create an event that takes a player controller and player state as an input.

limber gyro
cloud lake
limber gyro
twin juniper
limber gyro
#

i think ive read something about position not being replicated by default in the documentation

#

but i cant recal

cloud lake
sinful tree
cloud lake
#

right

twin juniper
#

right but that's some racing so maybe not very right

#

i guess I'll go redesign my system

cloud lake
#

yeah it sounds like you're just hoping there's some kind of OnRep that handles 2 variables changing and being valid at the same time, i don't really think it can work like that\

limber gyro
#

Movement Replication

If an authoritative Actor has Replicate Movement enabled, or bReplicateMovement is set to true in C++, it will automatically replicate its Location, Rotation, and Velocity.

#

check that variable and see if anything changes

cloud lake
#

like 'if this one is valid, poll the other one till it changes and check if thats valid, then let you run a function'

cloud lake
# limber gyro check that variable and see if anything changes

triple checked and yeah they have replicate movement on.
i think i've found the best solution for now which is just using the 'import scale' rather than rescaling them in maya. that means i can just modify the scale with 2 clicks by reimporting the mesh after modifying that import scale which seems to be bomb proof / always works in multiplayer :/

#

but yeah, scale seems to consistently break them (float with a major offset).

limber gyro
#

could the scale also be scaling the socket relative location to the object?

#

i dunno man, seems like its gonna be trouble down the road

cloud lake
#

yeah def has already, i tried to fix this for good a couple months ago, game is pretty playable atm etc.

#

this runs on authority

#

then the attach runs

twin juniper
#

Wait, after i give ability to ASC, can i activate it once or infinite amount of time?

cloud lake
#

what is ASC?

twin juniper
cloud lake
#

yeah i was, i just wrote ability system in our game

#

but started in 4.26 so, prob the default one is better now

twin juniper
#

oh.. i sometimes forget this channel is actually multiplayer

#

thought it's the same channel with GAS

#

my bad

#

they are all the same undocumented thing really

steady nimbus
#

so I got a question regarding using GameInstance as a way to store persistent variables between open level (hard travel). Right now I have a set-up:

  1. Players connect to server 1: a Hub-like lobby where players equip gear, abilities, etc
  2. They can start matchmaking (via Playfab) and once enough players match, they all move (via open level - hard travel) to the new server (server 2)

What I'm trying to do is store the players various data like equipped items/ equipped abilities/etc since the pawn/player controller/playerstate are all going to be destroyed. From my research, the only thing I can find is to store it in the GameInstance. Locally this works when I store variables in the GI and retrieve them on onPossess but unfortunately it doesn't seem to work when I am actually testing between two separate servers

#

so my question is: Is GameInstance the wrong approach to store this data? as far as I understand, the GameInstance should live throughout the life of the current play session, but in real server -> server travel it doesn't seem to work

cloud lake
#

i've had this issue before and created a PlayerData struct inside the playercontroller, then when the playercontrollers swap on level travel, i pass the data.

#

your setup might be a bit dif from mine though so maybe there's an easier way, but yes i have had the issue with PlayerData (when i tried to stash it in the game instance) not persisting when server traveling.

#

the Event Swap Controllers gives you an opportunity to pass the data as the controller is destroyed and respawned on travel

#

i guess i'm not really storing it in the game instance at this point though, when you think about it. but the variable does exist there too.

steady nimbus
#

ah yeah I initially had that which I wish I could use because it'd make life so much easier, but the problem is that is only seamlessTravel which means I'd need to have the server travel with the players if I'm not mistaken. The problem is hard travel doesn't call Event Swap Controllers

#

unless it's possible to seamless travel for clients and not servers? right now i'm calling open {ip}:{port} for my traveling, which I understand is a hard travel -- don't know if there is an alternative!

cloud lake
#

so you're saying, there's 2 dedicated servers and you're going between them?

#

like, in my setup, i have:
server: running multiplayer lobby.
client: running 'entrymap'.
EntryMap does the 'hard travel' you're referring to on each client, which loads both players into multiplayer lobby (running on a dedicated server, idling away till players join) using ip:port.

once they're in multiplayer lobby though, everything needs to happen at the server level for me since i want both clients to travel at the same time. if the server was running a dif map to the client, i imagine it would just bioot the client because it assumed it was cheating or something.
if you wanted to have one client then load into another server running say, multiplayerlobby2, i'm not sure how you would get that to persist.

#

(unless u were doing it with like, a user account or smoething which would definitely work).

#

maybe its possible though.

steady nimbus
#

yeah essentially two dedicated servers: one being the lobby that everyone can connect to and then the other dedicated server is essentially the โ€œmatchโ€ when whoever queued goes into the server. So I donโ€™t necessarily want all clients to travel โ€” just some, Iโ€™m using Playfabs account system so I definitely have playerId and whatnot

#

so thereโ€™s only every one โ€œhubโ€ dedicated server but there could be a bunch of ongoing matches

cloud lake
#

ah so you want a social lobby

#

with say, 20 players

#

then 2 go through a portal to play

#

and join into a new server, but you want to keep their stuff?

#

but the stuff is only saved per session?

#

its a weird sort of middle requirement, like, if they have gear thats attached to a user account thats not just for one session, this is no problem

steady nimbus
#

yeah I guess I was somehow trying to avoid api calls to fetch all their gear again on traveling but trying to explain it more now it seems I need to fetch all their stuff again from a db/service that has everything set

cloud lake
#

well, just to be clear, what stuff are we talking about here

steady nimbus
#

So each player has equipment/inventory per account that is attached to their account. But they donโ€™t necessarily need to take everything into the match itself, only what they have in their inventory/equipped

cloud lake
#

sure, you can persist it between multiple matches for sure tho.

#

i do that in my game, where they can rematch and the data will persist.

#

but if they went to a dif server and i wanted to display wins and losses between sessions, i would have to do the api call

#

like martin plays leorange a 3 round match, i can have it update the score each match and view it between each, persisting the data in the game instance provided the server does not change, even tho the maps are restarting etc.

, and then we finish our session, that kills the server container. now i come back (joining a dif server ip / dedicated server instance), and i want to see 'total wins' or something, i would have to do an api call there i don't really see another way to do it.

#

there could be a way though, my knowledge is not exhaustive by any means.

#

but it seems like trying to join a server with a client that has its own data that is just kinda 'accepted' by the server seems like it would allow cheating

#
Epic Developer Community Forums

For MMO games, there may be dozens of map levels. Thousands of players are on different maps. The architecture of UE4 is that each map needs to start a dedicated server separately. When players go from map A to map B, they will disconnect from the dedicated server for map A and establish a connection with the dedicated server for map B. Because ...

#

so yea i think you either need to use something like socketio (we use this to manage the server containers) or varest or aws lambda etc.

#

maybe playfab hass something, no idea.

steady nimbus
#

Ah gotcha, okay weโ€™ll that at least explains the weirdness โ€” appreciate taking the time to help!! Yeah Iโ€™ll probably just fetch via api on joining the new server the players data. Thanks a ton!!

cloud lake
#

gl. yea what i'm getting is you want to have some api way of accessing data for what you're doing regardless, its not like you're doing the most simple thing possible.

#

like there's the game multiplayer element, but also the social lobby element, you'll end up needing something like this for sure.

steady nimbus
#

yeah I see why most games don't try going for a social lobby element and just go straight into matchmaking

bold dune
#

I didn't really read what you're talking about, just skimmed it.. but you wouldn't use socket.io you'd want to use UE beacons

#

We used beacons in one of my projects to have some characters/admins replicate across dozens of dedicated servers

hidden cave
#

Can someone explain to me how a network replication system works

#

Because I'm going nuts

latent heart
#

Something changes in the server. The server says, "who should I tell about this?" and sends it to the people that need it.

#

The people that need it the update their local values and potentially call an event.

limber gyro
#

multicast rpcs dont need an owning connection to go throug?

dark parcel
limber gyro
#

ye i know

#

but how does it go where it needs to go?

dark parcel
#

Wdym by that,

#

As for ownership, server have authority of all the actors

limber gyro
#

im trying to understand say for example, i want to show a message to every one, that comes from the server

#

how does that rpc travel, does it go throught the regualr way through the PC?

#

PC= playercontroller

dark parcel
#

Client -> server rpc -> multicast rpc

#

If you are already server

#

You just multicast rpc the msg

#

For clients you can only call rpc from things they owe. Typically they only owe the controller and the pawn they controll

limber gyro
#

let me put it this way, lets use the message example, i can do that in gamemode by fetching with a FOR LOOP all the player controllers and sending a client rpc through that, how would i do that with a multicast?

#

assuming im calling the RPC from the server

dark parcel
#

Game mode only exist in the server

limber gyro
#

exactly

dark parcel
#

So if u need to send msg, from game mode. Then you can do just that

#

Loop thru all player pc and do client rpc

#

Epic made videos for chat system in their official YouTube channel

limber gyro
#

ye i know that, im not trying to do that im just trying to understand multicasts better

dark parcel
#

Mostly uses the player controller

#

It used multicast too to broadcast the msg

#

You can take a look at it I suppose

#

Multicast rpc basically server telling all machine to replicate the function/event

#

Let's say u want to play a montage

latent heart
#

If you want to multicast to everyone, run one on the game state.

#

It is replicated to and relevant to everyone.

#

A multicast rpc is sent to everyone the actor it is run on is relevant to.

#

If it's called on the client, it will still work, but only run locally, not be sent to anyone else.

limber gyro
#

ok but i would still need a connection of sort right?

#

if i want to communicate with a widget through a player controller

latent heart
#

Yes. Rpcs only get sent to people connected to a server...

limber gyro
#

no i mean an ownership connection

latent heart
#

No.

#

No ownership is required to receive an rpc.

#

A multicast rpc. From the server.

latent heart
limber gyro
#

so the owning connection is only for the "client" rpc

latent heart
#

Correct

#

And server rpc.

#

A client rpc is sent to the owner of an actor. A server rpc requires the client to own the actor it is sent on.

limber gyro
#

another thing, i still dont quite see how a multicast would look like in the message example code wise

#

i would still need to do a for loop to fetch all the individual player states no?

#

maybe its just a bad example

#

and not the way multicast are intended to be used but from the documentation and description it looks like it would fit

latent heart
#

There is no looping involved. The rpc does that for you internally.

#

And unless you call it on a player state, the player state is entirely uninvolved.

#

If you call it on a game state, it does not check anything else, it just sends it to everyone via the game state.

#

What example are you looking at?

limber gyro
#

im not looking at anything im talking about this example of sending a message

limber gyro
#

so i just do something like GameState->GetPlayerState()?

#

does GetPlayerState, even exist?

#

how does that call look like?

#

so that we can reach the PC

latent heart
#

What is the example you are looking at?

limber gyro
#

i am not looking at anything, i just sugested the simple task of sending a message to everyone with a netmulticast

sinful tree
#

When you have a replicated actor, there's a "channel" that is opened on it. Multicasting on that actor from the server, regardless of who the owner is, will attempt to send a message on that channel.
If that channel isn't open on a certain client, say because the actor isn't relevant to that client, then they wouldn't receive the multicast.

limber gyro
#

that i got down, im just trying to understand how a multicast called directly for the server can reach players without doing any sort of loop

#

say i have an authority switch on my game state that calls a multicast on the server and i want to reach my players UI

#

theres gonna need to be a path to the PC's with pointers right?

latent heart
#

You don't specify which players receive the message. They just all do. If the actor is relevant.

sinful tree
#

Not necessarily. Example: Create an event dispatcher on your game state. On your multicast, call that event dispatcher. In your UI, bind to the event dispatcher in the gamestate.

limber gyro
#

oh ok, so event dispatchers are an option

sinful tree
#

If you're multicasting from an actor that doesn't have a good path to find the local player controller like the gamestate, yeah, it's a bit tough.... I think maybe Get HUD -> Get Owner would maybe be the easiest way to find the local player controller from like gamestate or playerstate, assuming online play only.... But if you're doing HUD stuff, then maybe at that point you should be using the HUD class ๐Ÿ™‚

limber gyro
#

thats exactly what i wanted to know

#

thanks

latent heart
#

Local player subsystem...

limber gyro
#

more things to look into

#

how do u guys manage to fit all this stuff in your heads? its just so much information

latent heart
#

10 years of UE experience? It all stays in eventually.

#

I haven't even done any mp work in 5 years. I just keep up to date in here.

limber gyro
#

ok so now a proper question, in tests ive found that players with bad fps have choppy movement, is there like a variable that i can turn on to smooth this?

#

im assuming its choppy because they are sending data irregularly and in less than ideal time intervals

solid river
#

Is my understanding correct?
GameMode only exists in the server so HasAuthority() always returns true in GameMode.

short arrow
#

ye

gloomy dune
#

Hi, I'm making a grappling hook using cmc. Phys function uses attach point location. I spawn projectile on the server and process the hit on the client and on the server, where I set the attach point value and set bWantsToGrapple = true. But in this case, there is a delay between when the player input and spawning projectile, and then in the OnProjectileHit function I process the hit on both the server and the client, where the hit point on the server is different from the hit point on the client. If projectile GravityScale = 0 then there will be no corrections, but in another case a large number of corrections appear.
What is the best way to spawn projectile in this case? Is it better to do this on the client? I know this may not be safe, so I would like to ask for advice on how best to do this.

worn wagon
gloomy dune
worn wagon
gloomy dune
worn wagon
#

You could spawn the grapple projectile actor on the client just for the visual effect

#

But then you run into the issue of the server projectile replicating down and you have 2

#

I know games like UT in the past would take this approach of syncing up the client projectiles and server projectile when it replicated

#

I don't know the specifics of your game but you could also have a fully clientside grapple actor if it doesn't need to do anything more than move along the predicted path

hoary spear
mystic estuary
#

Hello, what do people usually do to create development cheats that should do something that can be done server-side only, but should be usable client-side?

For instance, what if I want to create some cheats to add health to the character using GAS? Gameplay effects are only applicable on the authority

silver totem
#

Does anyone use "advanced sessions" plugin? Can someone explain what exactly does it do? Their documentation is very weird and redirects me to the VR page, on github it says "for unreal engine 4" but apparently also works for ue5?

teal frost
silver totem
#

Ok, gotcha

#

Speaking of, there's NO official way to append custom session data like name, game mode etc. Without messing with the source code yourself correct?

torpid prairie
#

Yo guys, im making a game where a few players are survivors and 1 player is the monster and i want to test some stuff. I had the question of how i would randomly choose 1 player that loads in my level to play as the monster and the rest as the player character BP. How do i do this?

sinful tree
#

Sort of need to know the number of players that will be joining the game first. Based on that you would wait for them all to join, or for some cut off time in case they don't all join, and then choose one of the players from the PlayersArray from the GameState, and do whatever logic you want with that particular player and do whatever other logic with the others, and then start the game.

torpid prairie
#

Guys!!! I know this is like very chaotic and hard to understand probably but i have a problem and lack the knowledge to to something about it. I have a somewhat simple idea and will try to explain it as simple. Players join a level. One player needs to be monster. Other players need to be player. I have made a very messy blueprint of this and its not working at all. I have made a monster spawn point actor and a player spawnpoint actor. its so hard to explain that im gonna provide screenshots. I would appreciate every help

icy jetty
#

see Datura's earlier reply

torpid prairie
#

i see... So basically i would have to set up the scene to be a black screen with maybe the text waiting for players to join

sinful tree
#

Once all players join > Loop through players > Check if Monster
Monster > Spawn at monster spawn point
Not Monster > Loop through spawn points until you find an empty one, spawn the character & possess them, break this spawn point loop when found.
Completed Loop > Start Game.

If you want to add variety to where players spawn and not always the same set of spawn points, call a shuffle on the player spawn point array before calling it so players would be randomly distributed.

torpid prairie
#

okay so the method of looping through spawn points and checking if they're empty is correct but just need to add that break and wait for every player to join?

sinful tree
#

This part is no good as each call of the loop body it'd be pulling another random number. Pull the random number and set it somewhere before looping, then you can check it within the loop.

#

Otherwise, yes, your set up looks mostly ok.

torpid prairie
#

like this?

sinful tree
torpid prairie
#

ah i see

#

you think i need c++ for the part where i check if all players joined because i cant seem to find documentation on that from unreal

#

Yo man i have already implemented the break but there is something weird going on where there is always 1 unpossessed player character just standing there when there is no player controller to possess him and the monster that spawns cant be controlled he just stands there.

#

and oh yeah the players are getting spawned at the same playerspawnpoint... Im so sorry to be taking up your time but im just tryna learn :p

#

could this be a problem where the MonsterPC isnt being excluded from the array so it can be the monster PC thats being overwritten

#

this should fix that right?

true stream
#

Question, I'm starting a new project, it will be a prototype for a game that has some similarities with chess, will have multiplayer, both turn based and realtime, what makes more sense to do, start a new project and then add multiplayer or grab a working multiplayer FPS game from one of those out there and adapt it to a more RTS-ish like game?.

torpid prairie
#

im gonna give up for the day

cinder goblet
#

I am trying to replicate a rock switching colors when you click on it. Currently Server is replicating to client, client sees a color change but does replicate to server. I've spent hours on this, any advice is appreciated. More details below.

The rock is generated at begin play by an object called grid placer which places currently 64 rocks. When the player controller left clicks on a static mesh (I look for a "Tile" static mesh in collisions and I'm certain this is successful) , and event runs on server which multi casts an event in which an interface is called. This interface tells the clicked Tile to update based on color (color is a variable storing an enum in Player). Tile then updates an Enum variable which OnRepNotifies an event in Tile which changes the color.

sinful tree
#

In fact, it absolutely shouldn't be, as it's on the player controller, so it'd only ever run on the server and the owning client since player controllers don't replicate to all clients.
Input > Run On Server > Do things on Server like setting OnRep variables, OnReps then can apply visual changes for all clients.

cinder goblet
#

Okay, thank you. When I remove the multicast I no longer see the visual change on the client but I'm getting the feeling that's actually closer to correct since it shouldn't be done there in the first place.

sinful tree
#

Check your hit result is actually returning something, I'm not sure Get Hit Result Under Cursor can run on the server (for a client, if it was a listen host's player controller it would work)

cinder goblet
#

Rather, server changes appear in both, client cannot create changes

#

Okay, I'll look there. Thank you

#

Looks like it doesn't have a result for the client. What would you recommend doing for the client to click on the object?

sinful tree
# cinder goblet Looks like it doesn't have a result for the client. What would you recommend doi...

You can gather the hit actor on the client when they press the input, verify it is valid, then pass it as an actor variable in the RPC.
The server should likely check that the actor is within range of the player or whatever other checks you want to make sure of so the player isn't attempting to just spoof whatever actor though when running on the server, and after validating, call your interface with the actor passed in through the RPC.

cinder goblet
limber gyro
#

netUpdateFrequency has a default value of 100 but in the documentation it says that a good value for pawns is 10

#

so which one is correct?

#

the 100 i assume?

silent sigil
#

I believe the answer is, it depends

#

if you have a lot of pawns fewer updates is better, especially if it isn't a game that requires tight replication

#

if it's a competitive game that requires high precision levels of replication, more is better

limber gyro
#

im not saying correct as in whats best for the implementation, im saying correct as in the best default value

#

clearly some one made a mistake somewhere, either in the code or in the docs

#

its more about curiosity than anything

silent sigil
#

oh, my bad. I can't speak to that

fossil spoke
#

@limber gyro An appropriate default for that is going to be different depending on your game.

#

Its likely 100 because you will get a smoother experience, albeit at the expense of server CPU overhead.

#

Replication frequency is certainly something you need to be actively concious of as a developer and tailor it to your needs.

quasi tide
sinful tree
#

Sorry, I'm a bit clueless on your problem as I haven't worked with sessions very much myself but what you have shown is exactly how it's supposed to work.

torpid nymph
#

what would be the cause for an actor disappearing when outside of net cull distance? Intended behavior is that it stays visible, just not sending RPC's, but on my actor it's disappearing when I leave net cull (I tested and changing the net cull changes the distance the actor disappears)

#

note that this is an actor that is spawned at begin play, placing it in the level works, but spawning it with begin play makes the actor disappear when outside of relevancy

chrome bay
#

That's exactly what culling is - the actor gets destroyed on any client it's no longer relevant for.

#

If you place it in the level, it's considered a "Map Startup" actor so does not get culled - but it's actor channel will be closed.

dire sable
#

Hey, I have an object with collisions made via physics asset animated, but the animation does not happen on the server, so the server collisions stay outdated. What should I do to make it happen on the server, so my client can 'feel' updated collisions? I have VisibilityBasedAnimTickOption set to AlwaysTickPoseAndRefreshBones.

upd: Enabling 'Allow to tick on dedicated server' in Skeletal Mesh solved the issue.

torpid nymph
#

or where is this functionality being handled so I can take a look at implementation

chrome bay
#

So they would have to have static names, and manually be marked as map startup actors. The latter part is easy, the former part is much harder. Could start by reading through this:
https://vorixo.github.io/devtricks/procgen/

torpid nymph
fathom aspen
steel canyon
#
Epic Developer Community Forums

https://github.com/EpicGames/UnrealEngine/blob/ue5-main/Samples/Games/Lyra/Source/LyraGame/System/LyraReplicationGraph.cpp void ULyraReplicationGraphNode_PlayerStateFrequencyLimiter::PrepareForReplication() { ReplicationActorLists.Reset(); ForceNetUpdateReplicationActorList.Reset(); ReplicationActorLists.AddDefaulted(); FActorRepListRefVie...

#

I'm looking for an answer~

blazing socket
#

I'm sure this question has been asked before, but what's the best way to handle spawning a replicated actor by the player controller? Since the PC only exists client side, I can't have a function that executes only on server on the PC, right? So I have to call a function from the playerstate that executes only on server?

quasi tide
#

PC -> Server RPC to spawn something. Done.

#

The Server has all PCs

#

Client only has their own

blazing socket
#

Oh okay sweet

#

that's easier than I thought haha thank you

blazing sinew
#

hi, I'm making a murder mistery game, where the murders have a red color name and only them can see other murder players with red name color, in multiplayer, event and replication how can I do that?
I created an enumerator with 2 different roles (normal and murder), and I even created an enum var inside the character
I'm trying that in player controller OnPossess

#

that's inside the player character

#

the problem is that like that even the innocent players can see the murders

dark edge
#

compare them

#

The rule is "Text is red if this character is a murderer AND the local player's character is a murderer"

blazing sinew
dark edge
#

cast that to your player pawn class and get the Player Role

#

if it = murderer and self.player role = murderer then text is red

blazing sinew
# dark edge Not sure if it's the best but this'll work

so in my player character I have to make an event, for example, UpdateColor and call it on join in game mode or player controller
in the UpdateColor event: if PlayerRole (got by pawn) = Murder and PlayerRole (own on character) = murder then set the color to red (on character)

quasi tide
#

Because it has the specifier "NotBlueprintable" on AInfo class, which is the parent class of AGameSession

lost inlet
#

That was a cross-post too...

#

It's not a class I usually see with a BP child though

obtuse epoch
#

Hey, i am having some trouble with network replication. Everything works fine while just doing normal listen server. But when I enable network emulation and set it to average, some events donโ€™t run. My theory is the network is getting overloaded and some events that should get replicated just donโ€™t. So when I remove the multicast event that is supposed to just play shooting animations, fx and sound, the line trace function runs fine, no problems, but as soon as I plug the multicast function back in everything brakes, as I said, some events donโ€™t even get registered and are just ignored. So I wonder if anyone has this problem, and what your solution was, also if you havenโ€™t had this issue before, I would love some feedback on how to optimize network replication and how to replicate Amin montages more efficiently. Thank you in advance!

lost inlet
#

Also replicating an anim montage itself seems fairly inefficient, instead of just having a minimal amount of information to do the same thing

#

The montage is likely replicated as a path to the asset, but if you had an event with a shorter name, or an enum, then that's going to take a lot less bandwidth

#

If you have a lot of inefficient reliable events, then the reliable channel can also get saturated

quasi tide
#

Maybe my brain isn't in the right place right now - but the name of the event has an effect on bandwidth? Am I reading that right?

lost inlet
#

the actual name of the UFUNCTION probably plays a part, yeah, but if the multicast is passing a UAnimMontage, then that's just going to be a whole-ass string to the (virtual) path of the asset eg. "/Game/Animations/Montages/Thing/AM_Thing.AM_Thing"

quasi tide
#

Yeah, the 2nd part yeah. But it was the first part that I was like, "wait what?" ๐Ÿ˜…

sinful tree
lost inlet
#

how does that work over the network?

sinful tree
#

Fair enough

#

I was thinking along the terms of maybe the asset manager has some means of attributing assets to an ID or something along those lines, so if you did reference it across the network there's some look up magic that happens to find it. If it's sending the path, that does kinda suck :/

lost inlet
#

the asset manager really isn't as smart as it seems. unless the FName of the asset is in that master list of FNames (forget where it is), then FNames replicate by their string value rather than their numeric index

obtuse epoch
# lost inlet Well for a start, the "average" profile is slightly exaggerated, but do you send...

I do, and it doesnโ€™t seam to change anything. To get you a better understanding, the multicast function is quite big, I designed it to handle whichever animation, sound or fx you put in the field when you call the custom event. What I didnโ€™t think of is that this can be inefficient and slow, which leads to tons of unexpected problems. I see your idea with the enum, but I didnโ€™t quite get it. If you could explain more in detail I would love to try. Lastly I want to mention that I am not using a ton of reliable events, just for the reasons you said, it can block the reliable channel, so the only thing really using reliable events are the crucial spawning and team selection events

#

And yes, I am sending a UAnimMontage ๐Ÿ˜ญ

lost inlet
#

The average profile simulates packed loss that's actually much worse than what an average player would get. In that case, a lot of unreliable events would get dropped

quasi tide
lost inlet
#

as for an enum, it would be something like Multicast_BroadcastEvent(EMyEvent::EventType); and the client can use their own version of FX data to spawn the same effects

#

Things like animation, sound, or FX should be data somewhere that the client can read without having to be told by the server

obtuse epoch
#

Yes, I understand, but how would you replicate a shooting animation which should be โ€firedโ€ or shown when a player shoots? Right now, as you head, player shoots->multicast play animation(To make sure everybody sees the animation montage)->line trace->

lost inlet
#

the client should know through data available to it (through a data asset, blueprint value, whatever) which animation it should play when a weapon is fired

#

do remote clients need to process a line trace? if they do then you could have an RPC replicating the minimal amount of data it needs to perform the trace

obtuse epoch
#

Like I mean, the line trace is the bullet of the gun

#

Also if I have a ton of different characters with different animations, would your approach still work

lost inlet
#

wouldn't the "characters" in this case have some kind of data asset or BP with the animation data in it?

#

the client should be able to tell which character/class/whatever a player is using and be able to read that from somewhere

obtuse epoch
#

Could work, but seams overly complicated. However I will give it a try. Thank you

lost inlet
#

how's that more complicated than replicating a whole bunch of asset paths every time an event happens?

#

whatever you're doing to determine those FX assets, you just do it in the multicast itself since the client likely has a way to determine it anyway

obtuse epoch
#

I see, I get your point now

sinful tree
# lost inlet the asset manager really isn't as smart as it seems. unless the FName of the ass...

Ok, so after some profiling... There is some magic happening. After the game starts up, the first time an asset is referenced through the RPC, it is a big RPC of about 80 bytes but any subsequent RPCs referencing the same asset from a client to the server or server to a specific client appears to be pointer references as the RPCs are only 4 bytes. Each client appears to have their own "big" RPC when they first send or receive this asset reference to the server for the first time. When attempting to call a different RPC after calling the first referencing the same asset, the second RPC is still small.

So it appears after first referencing the asset over an RPC, the client and server reference it as a pointer after that point. I tried calling an RPC in a separate actor component referencing the same asset after first calling an RPC and it still was only 4 bytes.

lost inlet
#

well that won't be a "pointer". clients and servers don't share memory, it'll likely be some kind of GUID

latent heart
#

The first one is probably a path and a net guid. Then just net guids.

quasi tide
#

Got it. So when connecting to a server, send an RPC for every possible asset so you can go brrr during gameplay.

#

The network version of PSO caching ๐Ÿง 

lost inlet
#

I'd find it funny if there is already something built-in to warm the cache

sudden harbor
#

I'm trying to understand the costs associated with multiplayer games on Steam. From what I understand I will need to purchase an app/dev id from Steam, but are there other costs I am not aware of? Let's say the game is Steam peer 2 peer, is that even sustainable for a large open world TPS? Would a dedicated server be required for such a game? I know how they work, but is there something else I am missing?

lost inlet
#

well how many players in a session?

sudden harbor
#

I was thinking max 32 or 64?

lost inlet
#

if this is just some p2p co-op thing, then you probably can get away with listen

#

ah nah, 32-64 is definitely dedicated territory

#

consumer connections aren't that good

quasi tide
#

You tryin' to make Battlefield on P2P or something? lol

sudden harbor
#

So, technically, the cost would be the dedicated server host?

lost inlet
#

well it's complicated. if there's only 1 "session" then sure

#

there are whole businesses built around game servers

sudden harbor
#

Yeah I know how gaming servers work, I was thinking of paying for one so there are open servers in certain regions then allow players to buy hosting and host their own.

#

But I am just going off how SA-MP works lol I have no idea what I am doing yet but I know the goal post's location now.

lost inlet
#

having a baseline of official servers and allowing the community to host certainly could work

quasi tide
#

SA?

lost inlet
#

San Andreas

quasi tide
#

Ah

sudden harbor
#

San Andreas Multiplayer

lost inlet
#

that old multiplayer mod

sudden harbor
#

Which is technically non-existent now

quasi tide
#

I was thinking Silent Assassin (Hitman). Was confused.

#

But now I'm not

fallow kettle
#

hey devs!!I need help with replication, but I haven't been successful.

This is how I setup my project:

Objective: To Show the team in which the client is in as a text on them something like how they do with Counter Strike

Setup:
GameMode spawns the Controller
Controller Spawns the initial Team Choosing widget to allow the player to choose the team
Once they do this, the Controller spawns the player and posses it

Widget is created from a widget blueprint which has a method to update the text values

After the OnPossess() method in the Player controller (which is working on the server side), the gameMode is used to trigger method in it called UpdateOnNewPlayerJoin() which uses an RPC chain:

UpdateOnNewPlayerJoin() -> Server_UpdateOnNewPlayerJoin() -> Multicast_UpdateOnNewPlayerJoin()

which then loops through all the stored Controllers in an array and Triggers the method UpdateOnNewPlayerJoin()
This chain is responsible for updating the Overhead UIs for now

My problem is that only the host is able to see the updated UIs on all the players while its not the other way round... I do understand that newly joined clients doesnt have the update history which is why the server needs to update it for every player... but for some reason, it just dont wanna update... it would be really appreciable if someone could help me with this please!!

Relevant snapshots:
https://drive.google.com/drive/folders/1kTh7dzG2qLA7X7YVLM_U5vUlFNwsWT_N?usp=sharing

sinful tree
#

Game Mode only exists on the server. You can't use any RPCs on it.

lost inlet
#

And player controllers only exist on the server and owning clients

#

Interfaces for the GI implementation seems a bit of a choice when we have S U B S Y S T E M S

fallow kettle
sinful tree
#

It's not even important to store references to controllers in the game mode. Your gamestate contains the "PlayerArray" which is the playerstates of all players in the game currently. From the PlayerState, you can get the controller it belongs to.

lost inlet
#

there's also an array of controllers (server-side) in the gs too

#

ah nah, nvm, you do have that step

#

misremembered

fallow kettle
#

actually I was playing with the systems where I came across an issue where I was trying to trigger that GM chain from the pawn class in the OnPossessed() method and when I tried to get the ControlledPawn() ref from the controllers, it returned null unlike when I called that from the Controller... is it because I placed the chain inside the GM

lost inlet
#

ah UWorld has a player controller list

fallow kettle
#

like for the purpose I have

lost inlet
#

I'm not sure how a team select got that complicated

fallow kettle
lost inlet
#

If a team ID changes on the player state, then an delegate from an OnRep can easily refresh the UI

fallow kettle
#

so moving from single player... things have changed alot

sinful tree
fallow kettle
#

like the way things need to be set up and all

lost inlet
#

yes things are a lot different but at least multiplayer centric stuff usually works in singleplayer just fine

#

if a game is supporting both

fallow kettle
fallow kettle
# lost inlet if a game is supporting both

Actually I started with creating some basic mechanics and then moved onto try and make it a multiplayer... coz if not, I think it would have been difficult for me to find a starting point

lost inlet
#

that's usually a recipe for disaster

#

you don't retrofit multiplayer

fallow kettle
fallow kettle
# sinful tree Not particularly. GameState just contains that array, so if you want references...

I managed to do the stuff on the game state... but couldnt manage to get the replication... the additional changes I tried:

The player state has a stuct member which stores some deta related to the player... Instead of doing it on the client, I have shifted it to the server

Controller:

void AInputController::PawnSetup_Implementation(ETeam Team)
{
    Server_PawnSetup(Team);
    SpawnPawn();
}

void AInputController::Server_PawnSetup_Implementation(ETeam Team)
{
    Client_PawnSetup(Team);


}

void AInputController::Client_PawnSetup_Implementation(ETeam Team)
{
    if(UKismetSystemLibrary::DoesImplementInterface(PlayerState, UPlayerStateInterface::StaticClass()))
    {
        IPlayerStateInterface::Execute_InitialisePlayerState(PlayerState, Team);
    }
}

Player State:

void AMP_PlayerState::InitialisePlayerState_Implementation(ETeam Team)
{
    FMatchDetails MatchDetails;
    UGameInstance* Instance = GetGameInstance();
    if(UKismetSystemLibrary::DoesImplementInterface(Instance, UGameInstance::StaticClass()))
    {
        MatchDetails = IGameInstanceInterface::Execute_GetMatchDetails(Instance);
    }

    mPlayerDetails.Team = Team;
    mPlayerDetails.CurrentMoney = (Team == TERRORIST)? 1000: 2000;
    
}


#

the 2nd window is the host

sinful tree
#

Client's can't call RPCs on the gamestate. Clients can only call RPCs on actors they own (Like Player Controller, PlayerState, their controlled pawn)

#

You also don't want the actual change to be a multicast. Use an OnRep to trigger anything that needs to happen when it changes, and for anything else, make sure it's reading the variable.
You also cannot reference player controllers of other clients. The PlayerState has a pawn reference too, you don't need to get the controller from it to get the pawn.

lost inlet
#

The client wouldn't be setting values in the player state, the server would be

#

Funky interface usage too

fallow kettle
lost inlet
#

Yes, which calls a client method

fallow kettle
# lost inlet Yes, which calls a client method

yeah... somewhat like... I have all the Action methods like Interact, Pickup etc which are calling the Server methods... so instead of directly calling the server methods, am using them

lost inlet
#

Huh?

#

What sense does that make in this context

fallow kettle
#

I mean... thats the kind of tree I am using for everything

lost inlet
#

The server should be doing the team assignment, but all the server RPC does is just ask the client to do it

#

And it has no authority over that data

coral lava
#

Hi guys, I searched but I couldn't find a proper source or test. Is there a test about how many ccu Unreal's own multiplayer infrastructure supports? Of course it depends on the game, but what is the average power consumption and the number of people a single server can support? Can anyone who has tested and researched on this subject inform me? Thanks in advance.

latent heart
#

Unreal's server are not lightweight.

#

That's about all I know.

hollow eagle
#

The question isn't specific enough.

#

For what kind of game? On what hardware? Are we talking about a single server instance or some sort of scalable structure (which isn't actually part of unreal so if that's the case the question doesn't even make sense)?

#

Fortnite exists, there might be some info out there about what kind of hardware they run their servers on. Valorant also exists, and while individual games are on a much smaller scale they've given extensive details on the performance characteristics they hit on servers (and clients, for that matter).

#

Given that "power consumption" is mentioned the answer is "it depends" in every single case and for the most part the bit that it depends on isn't even unreal, it's the server hardware.

coral lava
#

My question is actually for numbers like instant 1k ccu. But @latent heart answer was enough for me. Thank you very much.

plucky prawn
magic pike
#

Hi, i'm hoping someone could help with a confusion i'm facing related to replication.

#

Take this example. I spawn a gun actor for all players in the network in the begining. Now on pressing P, every character's gun gets destroyed.

#

The above sequence works as expected when playing. The gun gets destroyed both on the server and each client instances.

#

Now the problem I am facing is when I try to make a c++ variant of the above logic.

#

The c++ header side is this

UFUNCTION(BlueprintCallable, meta = (DisplayName = "Destroy Weapon"))
void Destroy_Weapon(AActor* weapon);

UFUNCTION(BlueprintCallable,Server,Reliable,WithValidation, meta = (DisplayName =  "z[Server] Destroy Weapon"))
void Server_Destroy_Weapon(AActor* weapon);

UFUNCTION(NetMulticast,Reliable,WithValidation)
void Multicast_Destroy_Weapon(AActor* weapon);
#

The cpp implements are this

void UMyPhysicsComponent::Destroy_Weapon(AActor* weapon)
{
if(weapon != nullptr)
weapon->Destroy();
}

void UMyPhysicsComponent::Server_Destroy_Weapon_Implementation(AActor* weapon)
{
Multicast_Destroy_Weapon(weapon);
}

bool UMyPhysicsComponent::Server_Destroy_Weapon_Validate(AActor* weapon)
{
return true;
}

void UMyPhysicsComponent::Multicast_Destroy_Weapon_Implementation(AActor* weapon)
{
Destroy_Weapon(weapon);
}

bool UMyPhysicsComponent::Multicast_Destroy_Weapon_Validate(AActor* weapon)
{
return true;
}

#

and then I attempt to call the server destroy function in my pawn by pressing P. Now the weapon does get destroyed, but only on the server instance. The weapons on the client instances doesn't get destroyed.

#

which doesn't make sense to me, as the sequence of operations are the same both in the blueprint screenshots and the c++ variant.

#

Which is to encaspulate the destroy operation inside a multicast, and then encapsulate the multicast in a server call rpc.

#

I feel like I missed out on some step for the c++ side, but can't figure out what.

#

I'm hoping someone here could shed some light on this.

#

Feels like the multicast is simply not working for some reason in c++

grizzled garnet
#

What's the proper way to replicate movement for ACharacter, because AddInputVector isn't replicating to the server (except it replicates in BP???) (asked on #cpp I found a potential solution that I'm trying, replacing the super::getlifetimereplicatedprops with ACharacter::getlifetime...)

#

ok that did nothing, why isn't character movement replicating client->server?

tranquil yoke
grizzled garnet
#

I am fairly certain let me double check (if it isn't then for some reason it got set to a different PC)

#

hmm I overrode PossessedBy without calling Super::PossessedBy I wonder if that might be the issue (one sec while live coding fails to compile the change while the engine is running)

#

OMG that was it... @tranquil yoke thanks for uh guiding me in the right direciton

#

not quite the wrong owner but it was that super::possessedby wasn't called

tranquil yoke
#

ohh, well i was trying to help the other person, but something works for you that is great ๐Ÿคฃ

grizzled garnet
#

oh whoops

#

๐Ÿ‘

sharp vigil
#

in a multiplayer game does each actor automagically have an object ID aka fnetwork guid?

chrome bay
#

Replicated actors are assigned a NetGUID yes - though those GUIDs are unique to each Server/Client connection pair so are not universal

sharp vigil
#

Ah damn. I'm trying to figure out a way to keep track of player characters and pawns on a team using game state.

chrome bay
#

Just track them by pointer as you normally would. NetGUID is for low-level communication only

#

It's what allows the network system to send/receive pointers to objects and have them resolve properly.

sharp vigil
#

So I can just have a map of maps in my gamestate base? Like Team1: &object pointer1 : object1 pointer and this would work?

chrome bay
#

It's a horrendous data structure but yes, you can just keep refs in there

sharp vigil
#

hahaha. Would you have something better to recommend? Maybe something built into unreal? BTW thanks for the help.

chrome bay
#

I would just create a team interface (or use the engines one) and store a team on each item tbh

void nest
#

Can someone explain to me why a rotator when parsed to the server suddenly becomes really weird. On client a rotator's pitch goes for example from -20 to 20. When passing this rotator to the server using an RPC, and then reading the value on the server, -20 suddenly become 350 or something. Why is that? I'm trying to wrap my head around why a rotator changes when passed to the server but I can't think of a single explanation.

#

When I split the rotator and pass the float values along seperately it works just fine

#

But when passing the rotator as a whole, the pitch, yaw and roll values become different.

#

This is extremely weird behaviour imo, would love to understand why this happens.

#

Is this some kind of optimization / quantization happening of some sort?

#

Above zero the values are the same:

#

Under zero, they're not

#

When doing this it works just fine:

#

I don't get it xD

#

Wait is it because a rotator that is passed to the server uses 0 to 360 instead of -180 to 180?

#

Still makes me wonder why

fair latch
#

@void nest rotator gets compressed when being send over the network

magic pike
# tranquil yoke Does actor have correct owning Actor?

Thanks, that was kinda it and fixed it. It was a reference issue. I got it solved by saving a reference to the weapon right after it is spawned as a variable within my actor component having the rpc functions, and then destroy the weapon through that variable instead of destroying it based on the input parameters of the server call function.

#

all this time I thought my multicast rpcs weren't firing at all when in c++ lol

blazing sinew
#

and this is OnPossess in player controller (it uses possed pawn), there is a switch on int to decide if player is innocent or murder

solid river
#

What does local authority in control mean? Is it a character controlled on a Listen Server?

bool AController::IsLocalController() const
{
    const ENetMode NetMode = GetNetMode();

    if (NetMode == NM_Standalone)
    {
        // Not networked.
        return true;
    }
    
    if (NetMode == NM_Client && GetLocalRole() == ROLE_AutonomousProxy)
    {
        // Networked client in control.
        return true;
    }

    if (GetRemoteRole() != ROLE_AutonomousProxy && GetLocalRole() == ROLE_Authority)
    {
        // Local authority in control.
        return true;
    }

    return false;
}
blazing sinew
velvet meadow
#

Hi! So I made an AI in UE5, but when the client alerts the AI, the AI goes to the Server, but I just want the AI following the nearest player, how do I do this?

sinful tree
#

You can't use "Get Player Character X" in multiplayer. You need to give it the reference to the character that you want it to chase, and in this case, you are provided with in in the On See Pawn event.
Also, there's little point in having RPCs in an AI Controlled Character, especially on Begin Play - in this scenario you want to use a Has Authority node connected to begin play and use the Authority branch to call the logic that the "Get Mannequin Type" event does.

#

@velvet meadow โ˜๏ธ

wanton bear
#

in predicting projectile paths, the sim frequency is in ms?
so if im trying to compensate for ms between client and server, i would do the time sent then run the sim, and if its 50ms out and the sim frequency is 10ms, i'd get the 5th result and start the bullet there?

hollow eagle
#

I think you're misunderstanding what sim frequency is, it has nothing to do with the time you're trying to make up for on the server. It's about how often the path should be broken up to test for collisions (or how often points should be added to the list when not tracing if the goal is to get a list of discreet points rather than an arc).

#

Traces are always in a single direction, but a projectile is generally going to travel along an arc. So you need to break up that arc into segments that are small enough that being straight doesn't matter much. The sim frequency is what determines how often the arc is broken up.
This is simplifying a bit, but should get the idea across.

#

If your goal is to only sim the first x seconds on the server then you'd set that as the max sim time. So for 50ms you'd set the max time to 0.05 and check the last result.

wanton bear
#

ah that makes sense, thanks

wanton bear
#

how would you guys deal with working out the amount of time it takes for the message to send from client to server, would you send a datetime object to the server event and subtract the current datetime?

#

i see that ping is stored in gamestate but idk how accurate that would be in this use case

#

could also send the get server world time and get the difference on arrival?

dark edge
#

What are you trying to do, predictive projectiles?

wanton bear
#

yeah

short arrow
# wanton bear yeah

I'm not sure what predictive projectiles refers to, but are you trying to do the thing where players who are lagging can still damage other players by having the server check where the victim would have been x milliseconds ago?

wanton bear
#

send that to the other clients

short arrow
#

then yeah, I'd send the game time in seconds along with the RPC to fire the bullet. Then the server would just need to compare that time with the current game time in seconds to figure out where to spawn the bullet

#

but if you're not making anything competitive I don't see why you'd be using this method

#

You'd be better off just letting clients do their own hit checks and then tell the server what they hit right?

wanton bear
#

wouldn't it end up looking off visually for some projectiles? if someone has 200ms ping or something it might miss entirely on other clients games

short arrow
#

I guess you can pick your poison there

wanton bear
#

yeah ill probably need to figure out some interpolation

short arrow
#

goodluck with that ๐Ÿซก

wanton bear
#

i imagine with anything under 500ms it would be fairly hard to tell if i just interpolated the position from the muzzle to the start of the new projectile path and fired it

short arrow
#

yeah you should be fine, but it sounds a little bit more challenging to me

#

are you planning to hide the server bullet for the client that fired the shot?

wanton bear
#

spawn the client bullet and then do it for everyone else to match it, shouldnt have to mess with the client bullet

short arrow
#

if everyone spawns their own version of the bullet that isn't replicated I don't think you'll be able to make that feel smooth for each individual client

#

I think you're better off having the client spawn it's own bullet, and then the server fire's a replicated bullet that syncs with the clients bullet.. but the server's bullet should not be visibile to the client that fired the shot lol

#

because then the client that fired the shot will end up seeing 2 bullets

#

trying to interpolate and sync all these things together while accounting for ping sounds like an advanced thing to do is all I'm saying

#

maybe you've got what it takes though it's definitely not impossible

graceful flame
#

Projectiles chew through net bandwidth. Thatโ€™s why most games with them have a rocket launcher type weapon with a slow fire rate. Bullets should typically be line traces instead of projectiles.

#

Each projectile has to be spawned and itโ€™s movement replicated during its entire lifetime. Thatโ€™s a lot of data per projectile and if you have a bunch of players all shooting guns with projectiles itโ€™s going to cause problems.

#

If you look at a net profile most of the data is from character movement because the vectors keep updating. Now if you have a whole bunch of projectiles itโ€™s like a bunch of vectors to keep replicating.

hollow eagle
#

fast moving projectiles do not need continuous replication, it's unlikely they'd survive long enough to make it past more than a handful of net updates

graceful flame
#

Depends on the level design. Not all FPS games are indoors with close walls.

#

What if the firefight is outdoors?

hollow eagle
#

even so, mispredictions after a server-confirmed projectile spawns are unlikely unless affected by physics

#

and the likelihood of a misprediction even on a projectile that does have something like bullet drop is unlikely to affect gameplay in a game with lots of bullets whizzing by

#

only slow moving projectiles (or ones that cause large effects like explosions) where a player can easily pick out the fact that what they saw doesn't match the server need continuous (or high-net rate) replication

graceful flame
#

But if you lower the net update frequency then the hit detection wonโ€™t be as good of an experience for the player

lost inlet
#

well I made an actorless projectile system that didn't require any continuous networking

hollow eagle
#

even bullet traces have this problem

graceful flame
#

All Iโ€™m saying is use care with projectiles or else things can get messy real quickly.

hollow eagle
#

yes, use care. But the issues are all solvable without blowing up bandwidth.
The harder part is not blowing perf because you're spawning thousands of projectiles as individual actors.

#

but that's not a networking issue.

#

every game, even the super precise competitive ones like CS and Valorant, have a degree of "wonkyness" around their prediction. "Blood shots" exist in all games except those trusting client hit results (to some degree at least) and aren't specific to true projectiles. Hell, they're easier to solve with true projectiles because you can at least have a chance to correct projectile position when the server confirms a shot.

graceful flame
#

Just donโ€™t give every player a mini gun that uses projectiles. ๐Ÿ˜†

#

The valorant dev video where they explain how they designed hit detection is really good.

hollow eagle
#

it is, their whole perf video is great

#

only problem is just about everything they've done requires pretty heavy engineering work and engine changes

graceful flame
#

Same with the one for over watch.

hollow eagle
#

though you can do "lite" versions of most of the things they've done, just won't be as performant and it'll have limitations

waxen tinsel
#

Client prediction and reconciliation theory for physics based movement.

Hello community!

I'm currently working on a physics-based game using my custom character pawn class, which relies on AddForce for movement instead of UCharacterMovementComponent. Consequently, I lack access to built-in features like client prediction.

To address this, I've opted to implement a simple client prediction, but I'm encountering challenges, particularly in reconciling the client's current predicted state with the last agreed state received from the server.

The approach I've learned involves reverting the client to the last agreed state received from the server and then reapplying every input that has occurred since the client was in that state.

However, my movement operates with AddForces every frame based on players' hand inputs (similar to VR Gorilla Tag movement), making it challenging to re-simulate every AddForce that occurred.

Does anyone have a good approach for handling this?

tame sapphire
#

Is it possible or does any one have advice on how to get the player controller that clicked on the actor from within said actor!? (If that makes sense)

fossil spoke
#

A physics based approach is going to be fraught with challenges

#

@hollow nexus Might be of more help.

sinful tree
tame sapphire
#

Was thinking along those lines , thank you

waxen tinsel
plucky prawn
plucky prawn
lost inlet
plucky prawn
lost inlet
#

well it's only small line traces

#

worked pretty well

fossil spoke
#

We did something similar

#

We also do it in parallel.

#

Very performant

unborn nimbus
#

I'm using the OnlineSessionSubsystem to create a quickplay game. The ListenServer can see the client but the client can't see the ListenServer. Thoughts on what the issue could be?

fossil spoke
#

The Client cant see the Listen Servers Pawn?

unborn nimbus
#

On Join, the "player" spawns some actors. The ListenServer can see it's actors and the newly joined clients. The newly joined client can only see itself

#

I'm not sure how that would help

fossil spoke
#

@unborn nimbus Sounds like you are only creating those Actors locally

#

You likely arent fully grasping the requirements for these Actors to be spawned appropriately such that each network context would see them

#

Read the network compendium

#

And research correct procedures for spawning replicated Actors

unborn nimbus
#

They work appropriately in DedicatedServer/ListenServer configuration

#

But when I launch 2 standalone and have them connect, this is when I see the problem

#

well nevermind I'm lying

#

someone broke something. Ignore me

hollow eagle
#

though actor pooling is probably good enough for things that aren't approaching bullet hell

fossil spoke
#

@hollow eagle @plucky prawn We ended up using a Niagara System to visualise the projectiles as individual particles.

hollow eagle
#

ah nice, yeah that's also a good way. I haven't done enough with using niagara for that kind of thing tbh

tame solstice
#

Hi guys, i'm looking to implement multiplayer into my game, my next step was to implement the combat, though i'm second guessing myself because latency will be extremely important. Should i get the combat working locally first or attempt at net code first as it may influence how i do the combat implementation

#

re: ggpo

dark parcel
#

W.e step you do, the true test is when you simulate latency

sweet sage
#

How do i fix this?

#

I`m changing maxwalkspeed on PostAttributeChange (AttributeSet)
Is it wrong?

fossil spoke
#

You probably shouldnt be doing it that way.

#

You should be overriding the CMC to inject the movementspeed attribute value instead

sweet sage
#

Is there any c++ example?

fossil spoke
#

Probably

sweet sage
#

Do u know any?

fossil spoke
#

Not off the top of my head.

#

Its easy to override the CMC.

#

The function you want to change is GetMaxSpeed

sweet sage
# fossil spoke Not off the top of my head.

The examples use fixed movespeed and movespeed modes (sprint, walk, run).

My game is a mmorpg and i have slow effects / dynamic movespeed. Is it possible with networking in mind?

sinful tree
# sweet sage even this sample is broken lol

Modifying movement speed with effects is tricky. The CMC has its own predictive movement system, meaning that the server listens for where the client is moving and will only correct the position of the player if the location doesn't match where the server thinks they should be, and the movement speed being consistent between them is fundamental to that.
In order for movement speed to be correctly predicted and prevent correction by the server, the change needs to be implemented into the saved move list in the CMC.

If you change the movement speed value on the client first and replicate it to the server (eg. client is requesting to change movement speed), it can work, but under bad ping conditions it will start becoming jittery very quickly with more corrections. To get this working correctly for a "sprint" or "walk" toggle, you have to actually insert a flag in the CMC's move list so the server knows when the client was trying to sprint or walk, so when the server receives the moves, it knows when it should start sprinting or walking based on the client's values and then you'll end up with no corrections.

If you're changing the movement speed value on the server first, the client won't know about the new value until it replicates to the client, but then the server is already going to expect that the client is moving at the new rate, so you're going to have corrections as the client will continue to move at the speed it knows about until the new movement speed is received by the client. One potential way you can handle this situation is by having a grace period when the movement speed is changed where you set the CMC to allow for client authority over movement (like maybe a second at most) giving time for the changed movement speed to replicate then everything should appropriately line up and no longer correct, but even this isn't foolproof and allows for cheaty clients to change their position to basically anywhere in the game in that moment.

teal lance
#

How do you use a blueprint map to store player controller as key with bool value for each player? I want to keep a separate bool for each player but I'm struggling to figure out how to use maps properly

sinful tree
#

Adding things to a map is usually as simple as setting up your map so that it takes the appropriate thing as the key, and whatever you want as the value, then calling "Add" on the map giving in a reference to the key you want to use and setting the value you want associated to that key.
Why I ask if you wanted it replicated, is that Maps do not replicate :/

teal lance
#

I'm storing it in gamemode, I just want to store whether or not each player has readied up essentially so I can check to end the turn

#

I'm not used to how UE does it all so storing and checking that data is leaving me puzzled

sinful tree
# teal lance I'm storing it in gamemode, I just want to store whether or not each player has ...

Well, you don't technically need a map to do something like that as you could just store the bool in the player controller itself, and when someone readies up, get the Player Array from the Gamestate, loop through them, get their controllers, check if each of them have the bool set or not and if so, proceed. If you wanted other players to know if someone was ready or not, you'd probably want the bool stored in the PlayerState.

#

Are you certain about this? The client will be attempting to move based on the max speed it currently knows about, where the server will be receiving moves and playing them back at the max speed it knows about. Even predictively modifying the max speed on the client will result in the server not having the correct move speeds when it is expecting them through the CMC.

Eg. Let's say I apply an effect from an enemy AI that sets the movement speed attribute to 0, thereby negating all movement.... I will get a correction on the client side when that finally replicates as that effect would have applied on the server first but my client thought they could still be moving forward at their full speed until such a point that they receive the replicated effect.

teal lance
solid river
#

What actor does spawn ACharacter?

sinful tree
crisp shard
sinful tree
crisp shard
weak linden
#

Hey, how does JIP (join in progress) work with FFastArraySerializerItem? Or more specifically, does the FFastArraySerializerItems PostReplicatedAdd get called when a client joins?

chrome bay
#

It does yes, because you'll receive the initial state which will differ from the local (empty) state

weak linden
#

Fantastic, that works perfectly for my use case, is there any chances or scenarios that these functions don't get called? I'm using them for non-cosmetic gameplay stuff so it'd be a bit of an issue if they can get dropped for any reason ๐Ÿ˜…

chrome bay
#

No, it's the same premise as all other variable replication

weak linden
#

Awesome, thanks for the clarification!

chrome bay
#

The only case where you wouldn't get the callback, is if the client already had something in their array with the same ReplicationID - but that should never be the case unless you're messing with prediction or w/e

weak linden
#

No, not doing anything fancy regarding prediction, just wanted to use the functions as a "client side hook" for copying collision bodies from actors stored in the fast array to client side collision of another actor (addon/mounted parts of a vehicle).

#

I was using multicasts but they were getting dropped unless I set them as reliable which whilst isn't the worst since they absolutely needed to run, I figured there'd be a nicer way since I needed to store the "parts" in some kind of replicated array anyway.

chrome bay
#

Yeah never use Multicast for stateful changes

#

Or any RPC really

#

There are exceptions to that rule, like if you have a set of transactions with one particular client that are both reliable and only valid for that session, but otherwise, properties always

weak linden
#

Yeah, I figured it wasn't the correct way to go about it, I just totally forgot about the FFastArraySerializer, thanks for the heads up, something that's always been on my mind, is there a more efficient way to send Actors/Components via RPC from clients to the server (or the other way around) rather than just the pointer (I've not really looked much into how that works under the hood, but on the surface I figure it's probably a more costly option than simple data like an int?).

For a use case specific to my scenario, a client picking up an addon/mountable part and attaching it to the vehicle, would it be acceptable to send a pointer to the part itself + location to attach it to the vehicle or is there just a nicer way to do it?

Or am I overthinking it and it's just trivial/a non-issue?

frozen plume
#

Hey, has anyone tried to connect ue to postgres db? Is there any good pipeline without purchased plugins?

latent heart
#

A server? Or a client too?

sinful tree
# weak linden Yeah, I figured it wasn't the correct way to go about it, I just totally forgot ...

The first RPC with an actor, component or asset reference either sent to or sent from a specific client has an initial larger RPC, which appears to be sending the path of the asset. Afterwards, any subsequent RPCs sent to or sent from that client with reference to that same actor, component or asset are small, likely as it now uses a GUID of some kind to reference that asset across the network.

I did some testing of this yesterday sending a data asset and the initial RPC was about 80 bytes but subsequent RPCs were 4 bytes.

obtuse epoch
#

Okay @lost inlet i have Done in this way now, but it is still dropping events after 40 seconds of constant firing.

weak linden
sinful tree
#

Yeah, probably not worth looking into alternatives. I think for the majority of use cases a large initial chunk to get the reference association between the client and server to then use a smaller ID is acceptable.

weak linden
#

Nice, thanks for the info! ๐Ÿ˜

unborn nimbus
#

I'm having issues connecting two users through steam. in PIE, everything works as expected, on steam build, both users get put into separate matches

sinful tree
unborn nimbus
#

Yes, it works

#

on steam it does not

#

If I launch two standalone from the editor. Everything works as expected

#

if myself and another dev launch steam, we do not connect to each other.

sinful tree
#

@_@

wintry forge
#

Hello everyone, this is how I run play anim montage. When the client plays the montage, the server sees it as jagged/choppy.

#

When you use the Smooth Sync plugin, everything becomes very smooth.

wanton bear
#

trying to think how to identify bullets for purposes of destruction caused by the server. so i'd need an id to match for the bullet across everyone.

#

i am already sending the time the bullet was created on the client so i guess i could use that in a map thinkhmm

wanton bear
#

why would i use a struct over map here?

short arrow
#

iirc from yesterday, you're sending an RPC about a bullet being spawned. The struct can contain all necessary information about the bullet. which would include the ID, and the time it was spawned

#

also maps aren't replicatable, so you'd have to break it down into 2 arrays

wanton bear
#

im not sending the map data. it'd just be the time then the client/server would spawn the bullet and map it to the owners time i sent. dont worry i got it

limber gyro
#

is dormancy only set manualy?

frozen plume
light shore
#

I'm going to go insane- so if anyone can help me out quickly.
So I currently have this in my header file
// Server-side function to handle sprint state change UFUNCTION(Server, Reliable, WithValidation) void ServerSetSprinting(bool bNewSprinting);

And then this is my CPP file
// Validation function to prevent cheating bool AJavelinCharacter::ServerSetSprinting_Validate(bool bNewSprinting) { // Basic validation logic return true; // For now, always return true }

But then I get the error: class "AJavelinCharacter" has no member "ServerSetSprinting_Validate"

In the UE 5.3 doc it says that once you add the WithValidation condition, you just have to add the suffix.

latent heart
#

Validation will kick the player for cheating, btw, not just stop the action.

#

(if it returns false)

#

I don't think it's quite a good idea to use it for a player pressing run...

#

Using admin commands when not an admin might warrant it.

#

I know this doesn't solve hte issue, but still ๐Ÿ˜›

sinful tree
latent heart
#

Hot reload maybe?

plucky prawn
#

so i forgot at the time i asked this, but how does this work if i want to send a uobject through an RPC? im guessing the replicated subobjects list wont work for this

latent heart
#

The uobject has to be replicated first.

#

Or it will just send a nullptr ref

plucky prawn
#

ah ok

#

so in that case do i just follow the original replicated uobject guide?

latent heart
#

Yup

light shore
sinful tree
plucky prawn
bleak moon
#

Anyone know how to specify which ip address the game server should listen on?

clear island
bleak moon
#

I guess I should specify that ultimately I want to scan a specific subnet for lan games through the lan OSS

#

Nope. I believe unreal uses the ip address that's configured to scan a specific subnet

#

I just don't know where to configure that

#

Trying to test the lan multiplayer over VPN with others

clear island
#

or just scan all ips in a given subnet range I guess ๐Ÿค”

bleak moon
#

The default OSS is Lan and it has functionality to discover servers using the subnet's Broadcast address

clear island
#

oh I see

bleak moon
#

The issue is I'd like to test it with a VPN LAN adapter not just the local LAN

clear island
#

never used it

bleak moon
#

But it only seems to scan the "normal" one

lost inlet
plucky prawn
#

oh thats the unity implementation

lost inlet
#

yes. "EOSVoiceChat" implements the VoiceChat interfaces for EOS

plucky prawn
#

i thought it was a unity product

lost inlet
#

it is a unity product, unity bought vivox

plucky prawn
#

oh

#

i tried adding the eos voice plugin but i dont have an account for eos or anything and i didnt see any blueprint exposed nodes for it so i wasnt sure what the deal was

lost inlet
#

we used Vivox because of cross-play

#

you can just make one, but you'll need to be authenticated with EOS in some way to login to voice

plucky prawn
#

so theres no way to do voice without using a OSS?

lost inlet
#

though EOS voice still has weird limitations from what I remember, mostly with room size

fossil spoke
#

Vivox is pretty good.

lost inlet
#

define "without using an OSS". you're not using OSS at all in the game?

fossil spoke
#

There is also Odin

#

3rd party voice wont require a specific OSS

plucky prawn
lost inlet
#

the point of OSS is you have a common interface regardless of the underlying platform

plucky prawn
#

ah right

lost inlet
#

and you can actually have multiple OSS instances, just that the INIs define a default one

plucky prawn
#

oh interesting, i thought it was a one at a time deal

lost inlet
#

a game I worked on had the Steam, Epic, and a custom OSS running on the Steam version of the game

#

thank Epic's cross-play requirements for that one

plucky prawn
#

ye for sure

#

so if the voicechat plugin doesnt do anything by itself and the eos plugin is presumably for eos, is there an option for OSSNull? or would i just make one for that?

lost inlet
#

well EOS supports platform login

#

but you need to do the title setup and everything for EOS

plucky prawn
#

hm. im checking out ODIN as DevilsD suggested and it has a free tier so i might check this out

#

i was kind of wondering if it was possible just with unreal though. like how source engine has it built in

fossil spoke
#

Odin does not require a specific OSS to be used

#

Neither does Vivox

#

They implement their own transport layer.

#

You are just simply integrating their stuff into your game.

lost inlet
#

well Source just uses Steam voice, which is what the Steam OSS uses

fossil spoke
#

Both are relatively easy to integrate.

plucky prawn
#

ah ok nice

chrome bay
plucky prawn
#

i think im a bit confused. if the uobject doesnt need to be a subobject of the player for example, but i want to send this object to a player through an RPC do i need to do anything beyond adding the replicating stuff to the uobject?

queen escarp
#

Hey Guys ive got a weird thing here

chrome bay
plucky prawn
#

hm alright. maybe i can use a manager class or gamestate or something

chrome bay
#

Or it needs to be deterministically spawned with the same name on all connections, and you force it to be addressable by overriding IsFullNameStableForNetworking

plucky prawn
#

spawned as in an actor? i didnt know you could spawn objects?

weak linden
plucky prawn
#

i could probably make that work actually

queen escarp
#

anyone got any ideas :/ ?

weak linden
# queen escarp anyone got any ideas :/ ?

Gonna need a little more info regarding on how're you determining the text to be displayed, where is it gathered from, etc, since if the hosting client (server) is displaying the correct text, this is probably just a case of the remote client not receiving the correct information in order to select the correct line of text, for example a DataTable row name or an array index (depending on how your text is stored in the game)

queen escarp
#

i mean this is basicly it'

#

im setting the text in the "FullText1"

#

thats is

weak linden
# queen escarp im setting the text in the "FullText1"

Based on the information you've provided, if the host/server is displaying the correct text, then there's no issue with the function you've posted on BlueprintUE.

If it correctly displays the characters in the correct order, etc at all times on the host, then the problem lies elsewhere, such as how the value of FullText1 is set, if this is within a widget, the client has its own separate widget instance (these are not replicated), so FullText1 will be different if you're ever changing that to a different block of text on the host.

So basically, since we don't have your project on our computers, we're going to need a little more info to help you find your problem ๐Ÿ˜›

upbeat basin
#

What are the overheads of setting a skeletal mesh's anim tick option to Always Tick Pose and Refresh Bones so that the bones can update on server too? I'm always finding myself selecting this option for Character mesh in order to let server calculate transform related things based on the current animation/bone/socket positions. Is there a better way (optimization-wise since it's an option under the Optimization category) or is this considered as industry standard or something?

queen escarp
#

@weak linden that makes sense

#

i mean im calling the function from the server with a RPC funtion to all players to start "AddLine1" from there its all handeld clientwise

old sequoia
# upbeat basin What are the overheads of setting a skeletal mesh's anim tick option to `Always ...

The server definitely needs to "Always tick pose and refresh bones" since it never renders.
The same might not apply for clients, though.
Are clients able to skip ticking the pose if the character is behind a wall?
Selectively set this option at runtime based on if the character is on a server / client.

Secondly, if this adversely affects server performance, consider lowering the update-rate of animations on the server or figure out if characters always need to tick at all times or if there are times when the server doesn't care about the body transform of the character

queen escarp
#

so im not really changing anything from server after that

#

and all variables are replicated and "pre-set" with the text

weak linden
queen escarp
#

yeah but i did it just to be sure*