#multiplayer

1 messages ยท Page 11 of 1

fathom aspen
#

You're talking to me like I work on the game?

#

You literally jumped to a whole new topic without providing context

#

First understand why this works the way it's

#

I can help when people provide me with the full context

#

You just threw a random function without explaining what that is

#

And you also suppose I know what you're game is about.

#

See the previous questions by other people how they asked

sinful tree
#

Likely because you're only setting the variable on one instance of the character. When you spawn an actor, they have their own instance of the blueprint. There are no variables shared between characters for example. Both characters will have their own "Notes 1" variable that can be set true or false.

#

And if that's the case, you might be using the wrong class to store the variable in if it's something that is shared between all players in the game.

#

As I suspected, your code isn't doing what you think it is doing. When you're pressing 1, you're setting that boolean to true only for that one character. It doesn't do it for both.

queen pine
#

https://youtu.be/hkcXkuYnNyk
I'm running into some replication issues with static mesh actors which are for the most part being replicated correctly.
Within my duplication sequence, I'm spawning an actor using a template. During this process, the initial duplicate has no collision, but I believe that there are still a couple of frames where the client has collisions and therefore causes the other actors to go haywire. I know I can improve the duplication process and its replication, but I feel that there are also some issues with the actors' replication itself. I'm wondering if the actors are going dormant on the server and causing delayed replicated corrections.

sinful tree
#

There's a fundamental bit of understanding you're missing is all.... Each character has its own instance of that blueprint. When you call these series of events its only happening on the one instance of the character that is calling it.
If you're wanting to have common data between all players, you may want to use the GameState to store these variables. This way you're only having to change the value once and all players can read from it.
If you're only wanting specific characters to have the value set, then you have to get a reference to the characters that should have the value set, and set that value on their instance.

#

For example, if you pressed 1 on the first player, and pressed 1 again while in control of the second, you'll see that both should now have the proper text displayed, and that's because both players are having the server set their own value.

echo geode
#

Does replicated component's functions GetComponentLocation, SetComponentLocation.. etc is network replicated like AActor's functions like SetActorLocation, GetActorLocation() by default?

echo geode
#

I have this property in my actor.

UPROPERTY(BlueprintReadOnly, Category = "IK Hold Transform")
FTransform IKHoldTransform;

and i am updating this property to change location, rotation for multiplayer purpose in my actor tick, so my idea is trick that maybe i can use scene component's getter, setter methods to make it progress though it on the network code.

opal fox
#

When im trying to replicate a variable with a new value, and then basically on the same frame use the variable its clear that the value is not replicating fast enough to reach clients. Putting a small delay before trying to use the value fixes the issue but doesnt seem like a very solid solution, do you guys have any ideas on a good solution for this issue?

sterile oriole
#

Doesthe pawn owned by a client player on the server and the pawn on the owning clients local machine have their own controller or do they share one?

dreamy vapor
#

Hi, how can I fix this problem?

frank phoenix
#

You must be using a source build of Unreal Engine, which you can download from the Epic Games Github.

If your project is using a binary build from the Epic Games Launcher, you will need to migrate it to a Github source build.
graceful flame
#

Do you know what the GameState is?

#

If not, then read the compendium PDF that was also linked. It explains it all in great detail.

sinful tree
#

In the world of programming, you have to make up the code that works exactly for you. Other than the fact that you want to have 2 players display the same text, I know nothing about how these variables influence your game so all I can do is make suggestions of how you can proceed and you need to figure out what the right path to take is. There is no predefined answer for what you're attempting to do.

As I've stated, right now, when you press that 1 button you're only setting that boolean on one of your two characters that exist. Your code to display the value reads from the first known player character (the Get Player Character 0 you're calling) and when running on any particular client, it's usually the character they control, but in a listen server, that can sometimes be the wrong character. So your text display is not reading the value you think you're reading. If you put a print string after "Get Player Character 0" you'll get two prints, but they'll be different for the server and the client, guaranteed.

If you need to have specific characters have those booleans set, then you need to figure out how to get references to any of the characters that need to have the value updated. How you get those references is up to you - I don't know what conditions you may have for setting that boolean on any specific character.

If you need to have all characters have those booleans set, then there's no point in having them on the character, and you may as well use the GameState instead to store them as this can act as more of a "global" actor that everyone can read from. You'd RPC like you are right now in your character, but then when running on the server, you get your gamestate, cast to your custom class, and set the variables. Then you'd just need to change your text bind to read the values from the GameState instead of your characters.

azure cape
#

hey, is it possible to make an event in blueprint that, when called from the client, runs both on the owning client AND the server?

#

cause afaik run on server will make the client call it on the server only, run on client will do the opposite, and multicast will run it on both server and client but also on all the other clients

sinful tree
azure cape
#

okay, thanks

still owl
#

Hello ๐Ÿ‘‹

Does anybody know if it's possible to make a client stay on the current map if the Server Disconnects?

I'm running a Listen Server setup and when the game ends and the Server Player returns to the Main Menu, the Client is automatically booted out. Preferably, at this point, the client should be able to stay here as long as they want without being booted.

If this is not possible, what would be the best way to handle this gracefully?

quasi tide
#

It is possible - it'd be a matter of host migration pretty much

#

Just kind of a PITA to handle

still owl
#

Ah i see!

Any info on this anywhere?

fair bough
#

Hi guys, my name is Miroslav, I'm currently working on my internal project...
I've spent 50+ hours trying to get the dedicated server working but can't find a solution :/
I've downloaded source, generated files, built with VS for dev server, dev editor and dev client, cook the content and everything else there is but still when I connect to my server it throws the error and shuts down for some reason..
I'm using SGK kit with Character Customizer, but the crash log throws nonsense (at least I don't know how to fix) because when the game is compiled and launched no errors are being shown...
Here's the crash log, if someone can give any valid information where to look at and how to fix I would be more than happy to send a friendly gift via PayPal, thanks! ๐Ÿ™‚

graceful flame
#

The errors indicate that is likely a problem originating with that character customizer plugin you're using. Does that plugin come with support? If so I'd suggest reaching out to them for help as this is not a generic issue that we can help out with, but perhaps someone here is using the same plugin? I dunno...

magic furnace
#

Anybody have a clue on team voice implementations outside of subsystems? The VOIPTalker is cool, but doesn't seem to support muting people or similar. Is there any other alternative that doesn't require an epic / steam account? Steam is fine, but the audio quality is atrocious.

#

I guess I haven't taken a look into the VOIPTalker replication yet. So maybe I could just overwrite a function.

graceful flame
magic furnace
#

I should have formulated it better. Any account haha. I would also take tips on making the Steam version sound good.

graceful flame
#

Sorry, I've yet to add voice to my game, can't really suggest anything but Im pretty sure some games use discord as their voice service.

magic furnace
#

Yeah, I'm looking into it.

#

Thanks for the reply

quasi tide
#

Store the int in the gamestate. When input is received on client, run on server event that will update the value on the gamestate

#

Clients can read the value from the gamestate

graceful flame
#

Also you said "to all servers" but that seems incorrect. There's only one server where the game instance is running. (even though you might have more than one physical server running its own instance of your game with clients).

#

Okay then use a replicated boolean and make it so ONLY the server sets the value.

#

(something happens) Server Event --> set (replicated) boolean to true. Server then replicates this actor's bool value.

You can then have another actor blueprint use the new value from a reference back to that original actor where the value was changed.

#

If I remember, @oak prawn you're trying to have a variable (on a character) change so that another variable on a widget can reflect that change. But the issue is that you are not understanding WHY it fails the way you currently have it setup. The answer was already provided. You need to use the GameState to store those booleans and read them from there using the widget. Currently you're only getting and setting the boolean for Player 0.

#

Look at the diagram on page 10 of the PDF.

gritty warren
#

Quick question - I'm reading a lot here that says Lyra is 'trash' and built haphazardly. I'm wondering if anyone can shed some light onto that. What about Lyra is bad?

#

(in terms of using it as a basis for a multiplayer game)

elfin lintel
#

Is it possible to override an RPC function in a child class? When overriding the _Implementation function, it causes a stack overflow. When trying to override both the _Implementation function and the base server function, it won't compile as it wants the base server function to be implemented in the .cpp file, unlike normal. I tried doing some google searching but couldn't come up with anything

fathom aspen
#

Call Super with _Implementation

elfin lintel
#

Thank you!

dire nest
# gritty warren Quick question - I'm reading a lot here that says Lyra is 'trash' and built haph...

For the most part such comments don't accurately represent the situation. Lyra is not designed as a basic/simple framework where you can just load it up and immediately begin extending it for their needs, rather it is focused more at what epic considers modern best practices scaling to the most advanced projects. As a result there is a significant learning curve when you start extending certain aspects of it and some of the "best practices" epic deployed are not necessarily well fitted for some kinds of games. Also, Lyra should be considered a 0.9 release, some of the concerns are likely to change with the upcoming 5.1 release.

gritty warren
#

I have another question, one that has been burning for a while.

Anybody have a ballpark of how many actors (or, in this case players I guess) can be replicated before things get wonky for your average internet connection? Like I'm wondering about battle royales with up to 100 players. Is there a reason for that cap? What about much more, like in the case of MAG or PlanetSide? (I'm assuming there is some kind of best practice guidelines here)
Final addendum to this question - do things like NPCs bog down multiplayer games significantly?

#

I really appreciate all the help here. This has easily been the best educational discord server I have ever joined

dire nest
# gritty warren I have another question, one that has been burning for a while. Anybody have a...

There is not a simple answer to that question. It depends on many factors, not the least of which is how many actors syncing per time internal (average/worst case) and how much data is being synced. There are many tricks you can do to reduce this, but things get more complicated the more abstractions you deploy. Also in UE 5.1 they are releasing a prototype replication system which is claimed to be designed to improve this situation at scale.

peak sentinel
#

Do I have to replicate changes on acceleration, ground friction and such other non-replicated variables in CMC?

#

Let say an ability in #gameplay-ability-system changes movement speed, but to efficiently simulate the movement I need to change other values too

#

And if it's client, I assume it has to send server an RPC to replicate the changes, no?

storm mountain
#

Hi everyone! I am trying to learn the engine and I have put a ton of hours into tutorials, read the compendium, created a very basic game where a character can kill the other but now I am stuck. After hours of searching it seems like I am just bad at searching so here I am. I want to learn how to use the game framework the right way in Multiplayer. None of the tutorials I found are actually showing what it means to "store the game rules" in the Game Mode. What does it mean that Game state should hold how many players is alive? To focus this to an example I am trying to make tank trouble but in ue. Say a tank is hit, it sends an event dispatcher saying so. Should this go to the player state? Should the player state have a boolean of being alive and react to this change? Do I need to create another event dispatcher from the state to be picked up by the game state? Do I go through each player state and bind them to an event in the game state to react to each death? Is this too many questions? I am stumped, everything I do feels like the wrong way. Is there a tutorial out there that can show me the way? Or anyone willing to answer some of my questions? Thanks so much and so sorry for the long text

sinful tree
# storm mountain Hi everyone! I am trying to learn the engine and I have put a ton of hours into ...

Game Mode isn't really about handling game rules, it's more about handling players joining/leaving the game and respawning. The Game Mode would likely keep an eye on the Game State to know what it needs to do.
Game State is definitely more about where the game currently stands - team scores, objectives completed, match time remaining etc. As I mentioned above, the Game Mode may want to keep an eye on the GameState and the Game Mode may not necessarily want to respawn a player if their team has run out of "lives" which would be a value you could store on the Game State.
Player State is used for storing data about any specific player, like their name, their kill/death counts, or they have a certain cosmetic they want applied on their tank, perhaps their currently selected tank class or anything specific about that player that would need to persist between respawning.
Your player's controlled Pawn then would be used to store anything transient but pertinent about the pawn, so like it's current health status, perhaps its remaining ammo.

Your pawn can tell the game state that it was defeated, and if you plan on having different game states, then perhaps create a base game state which you can later child that has some common functions built into it like when a tank needs to report that it is defeated. Then when your tank is defeated, it just needs to cast to the base Game State class to report it was defeated.

rough jolt
#

Not sure if this even fits here, and i know it's a lot, but i'm quite stuck on this and it's making playtesting my game impossible, so here goes

These are both glitches happening with my star wars fangame, which I cannot as hard as I try to track down.

Both of these only seem to happen in the packaged build as far as I could tell, and are very inconsistent and hard to replicate, I cannot pinpoint a cause

I know there's a lot of context missing but if anybody is willing to help, i'd be happy to show the code, send the code, or even just get into vc and try and fix it because this has gotten bad enough to the point of halting progress.

Sometimes, when the host player's ship crashes, the game will terminally freeze and stay like that, kicking all clients out
-It only seems to happen in the host computer as far as I can tell
-It seems to happen about once every 15 crashes, and only if the ship loses both wings before crashing (I think??? it's hard to tell due to how rare it is)

In a game, client players will get a random massive FPS drop spike
-It seems to stop when the host dies and respawns (maybe again, hard to tell since it actually needs playtesters???)
-Rejoining might also fix it?
-I haven't been able to establish a pattern whatsoever because these two bugs are so game-breaking its hard to properly playtest

I have logs from the packaged build and I can get more, but I wasn't able to get anything from them

Thanks to anyone willing to help in advance

storm mountain
manic trellis
#

Hi There,
Can anyone redirect me to proper document for network optimization.

clever aspen
#

So I thought I'd give multiplayer a try, and whilst I understand the theory behind replication, I cannot seem to crack it programming wise.

  1. Local player calls Empty Inventory
  2. Empty Inventory does a simple check and then calls Server_EmptyInventory (UFUNCTION(Server, Reliable))
  3. Check to make sure the owner is Authed(Server)
  4. Call Client_EmptyInventory(UFUNCTION(Client, Reliable))
  5. Check if inventory is empty and add an onscreendebug message.

InventoryItems - TArray (UPROPERTY(Replicated)

However, the local players inventory is never emptied. Shouldn't this be replicated back from the server? I was using a ReplicatedUsing function but since the InventoryItems is a TArray and can constantly change (Add,Remove, Sort etc), I don't think that is the way to go about it.

void UInventoryComponent::EmptyInventory(AActor* Owner)
{
    if (!InventoryItems.IsEmpty())
    {
        Server_EmptyInventory(GetOwner());
    }
}

void UInventoryComponent::Server_EmptyInventory_Implementation(AActor* Owner)
{
    if (GetOwnerRole() == ROLE_Authority)
    {
        GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, TEXT("Server Emptied Inventory!"));
        InventoryItems.Empty();
        Client_EmptyInventory();
    }
}

void UInventoryComponent::Client_EmptyInventory_Implementation()
{
    GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::Red, TEXT("In Client_EmptyInventory"));            

    if (InventoryItems.IsEmpty())
    {
        const FString Message = "Your Inventory has been emptied - " + GetOwner()->GetFName().ToString();
        GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::Red, Message);            
    }
}
chrome bay
#

Property Replication and RPC's are not syncronised - there's every possibility the RPC will arrive and/or execute before the inventory is emptied

#

InventoryItems should be a replicated property

#

Then you remove the client RPC altogether and use the ReplicatedUsing callback

clever aspen
#

Ok, so thatโ€™s where I went wrong. Trying to tie RPCs and Replication together ๐Ÿ‘

chrome bay
#

Basically remove the client RPC, and use the OnRep callback and you'll be fine

oak prawn
#

I found where the problem is. Since my game is installed as a gamemodebase, it does not share keys with other players. I assigned a new gamestate and a key in it and now my problem is solved. Thanks everyone. This hassle-free code may be of use to someone

winged crown
#

Hello everyone, I'd like to ask something. I'm using a motion warping component to make a vault ability. The ability is done and works perfectly on the server, but when I test it in the client, most of the times this ensureMsgf is being called. I'm trying to find why is this happening, but up to no avail. Do someone knows some of the reasons?

#

ps: When I remove the motion warping notifies from the animation montage, the msg isn't called, but then the motion warping doesn't work. So the issue is over there

graceful flame
# manic trellis Hi There, Can anyone redirect me to proper document for network optimization.

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

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

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

โ–ถ Play video
graceful flame
oak prawn
#

@graceful flame thanks for everything

frank birch
#

any downsides in giving my AI pawns a playerstate? ๐Ÿค”
I know it comes as false by default so I want to know if there is an obvious problem in doing so ๐Ÿค”

sinful tree
frank birch
#

my GAS system for the player is on the playerstate, AI needs the same system. Usually AI puts the GAS inside the pawn but I just wanted to not have duplicated code in my player pawn and my ai pawn ๐Ÿ˜…
maybe I can override some of the player pawn and keep the pawn logic and just change where I get my ASC ๐Ÿค”

#

or I can also live with the extra replicated data. This won't be an AAA game ๐Ÿ˜…

#

oh boi, datura is been writting for a hot minute now, I opened pandora's box ๐Ÿ˜ฐ

sinful tree
#

Playerstate is usually replicated to everyone and is always relevant, and that would include the ASC, so it is just a lot of extra replication for very little gain if you were to put it on your AIs, especially if you plan on having lots of them.
The only time I can think of it being useful to have a playerstate for AI is when you're using bots - then they can have the same data that a player would normally have with their own playerstate.

How GASDocumentation did it was on the pawn, and there was a common base character between players and AI, but then they split off from there where AI Characters would have the ASC on the pawn. The base character class can be where you keep most of your shared logic between players & AI.

#

It can also be the place for a common function for getting the ASC where on the AI you return it from the component directly attached to the AI, but for players you get the playerstate's ASC.

frank birch
magic helm
#

One thing to be aware of is that when the player disconnects the player state is usually despawned(which destroys the ASC with it), you can turn that off to have it stick around via overrides and stuff though

winged crown
#

Hello everyone, I'd like to ask something. I'm using a motion warping component to make a vault ability. The ability is done and works perfectly on the server, but when I test it in the client, most of the times this ensureMsgf is being called. I'm trying to find why is this happening, but up to no avail. Do someone knows some of the reasons?

ps: When I remove the motion warping notifies from the animation montage, the msg isn't called, but then the motion warping doesn't work. So the issue is over there

solar stirrup
#

ghost ping?

fathom aspen
# magic helm One thing to be aware of is that when the player disconnects the player state is...

I was wondering if this is a common issue with ASC not being duplicatable and able to be saved for the inactive duplicated PlayerState that sticks around after the player disconnects. A while back someone here asked about that: #multiplayer message
And he ended up not duplicating/copying anything of the old original PlayerState but kept it around. Why the attributes of the ASC can't be duplicated/copied is what I wonder about?

#

The answer given there, about non uproperties will be lost in the process isn't the one I guess. At least I managed to copy non-uproperties and transient ones with no issues

quartz iris
#

How can I display the names of every player in the lobby with a widget?

#

Because i'm having trouble with getting the widget to know other players apart from the local player (0)

sinful tree
# quartz iris How can I display the names of every player in the lobby with a widget?

The GameState contains the Player Array which is a list of active Player States (which is where you should store your player names). To display them all, you'd just loop through the Player Array and get the Player Name (a variable that is on the base PlayerState that you should use).

If you're trying to display the name above the player's head, then you can get the playerstate from within their controlled pawn and again, read the Player Name variable.

quartz iris
quartz iris
fathom aspen
sinful tree
#
  1. Player Controllers are not replicated. There is no means to reference other player controllers other than your own on a client, so getting an array of Player Controllers won't yield anything fruitful for clients as it'll be null references.
  2. You're still trying to access said array by an index anyway, which is still not the appropriate way of doing it as you don't know who that particular person is at that specific index.

Can you clarify how you're trying to display the names of the players? Again, is it a name over their head or a list of players?

twin juniper
#

Is there any way to custom serialize a value to something else that isnt net serilize in struct? for example float between 0-65535 down from 4 bytes into an int16 for 2 bytes but recieved on client back to the float?

warm nacelle
#

I am not sure as to why but I am trying to do something when the player controller possesses a pawn and it seems to be calling it twice. I am using the OnPossess event because I was using the BeginPlay with the same results, its as if its creating two player controllers and I am not really sure why. I assume it has something to do with a server version and client version but no matter what I can't get it to only fire once. Does anyone have any idea why?

sinful tree
#

Same with BeginPlay.

#

You can differentiate which by using some checks, like HasAuthority, or IsServer

warm nacelle
#

I actually did try to use the hasauthority thing to check it but it still fired twice with authority and not at all with remote. I figured this was the case though, gonna have to do some research to figure out why but I this did help confirm why its firing twice so thanks!

fathom aspen
#

If it's the same call stack then that needs further research indeed

#

Update us with the results if you come to find anything ๐Ÿ™‚

peak sentinel
#

Quick question: Is it possible to disable/enable replication of a variable by a bool?

#

Like conditionally replicating a variable if a boolean in CDO is set?

#

I have a RegenRate rate float for a weapon, and I only want it to be registered to replicated variable list if bReplicateRegenRate is set

fathom aspen
#

I think you can define your own custom condition

tiny valve
#

is anyone else getting the error Assertion failed: isValid() Sharedpointer.h from the dedicated server console after turning off 'run under one process' and making changes to the code

dim trail
#

How can I execute functions only on a server that have a return value?

fathom aspen
#

RPCs can't have return values if that's what you mean

#

Ping-pong

#

Call an RPC back with the result/return-value

dim trail
#

Why canโ€™t RPCs have a return value?

fathom aspen
#

Because that defies what an RPC is

#

RPC is called on one end and executed on another end

#

So it's return value will be on the other end anyways

sacred coral
#

Hey, i've been fiddling around in lyra for some time now, i was wondering if any1 tried to get pawn possesion/unpossesion working. I can't figure out why the simple character switching (between 2 pawns) seems to not be working. The Player Controller seems to be assigned properly both on server and on client yet the characters lose their ability to move after first switch.

open pendant
#

I know the answer is probably not, but is there an easy way to control with a bool if a bunch of events are triggered on client or server, other than creating duplicate events for every action?

fathom aspen
#

That's a very broad question, but a generic answer goes like: Have all the events as regular functions and depending on your boolean value you call either a server/client RPC that encapsulates them all.

#

So you end up having two RPC events that call them all

open pendant
#

Thanks ๐Ÿ‘

molten agate
#

anyone know why my dedicated server exe not appearing after building

versed thorn
#

with top-down view and mouse cursor enabled how do I sync cursor so that GetHitResultUnderCursor on the server get same result as on client?

sinful tree
sinful tree
#

Extra data that you may not necessarily need.

versed thorn
#

but what about "don't trust client" approach?

sinful tree
#

There's some things you have to tell the server. You can do some verification on the server to make sure whatever the client is passing isn't bogus.

versed thorn
#

I see. Thank you

left flicker
#

I am looking for how to assign player starts to specific players. More specifically, not just a random player start. And really it's just for one of the players (in this case the host of the game on a listen server)

full maple
#

My solution, which is similar to what I saw other people doing on the forums, was to turn off the default pawn and spawn my characters on the game mode. Since the game mode is server-only, this ensures characters are spawned by the server (which is important). You can add a tag to the specific player start you want so that after you find it in the game mode's begin play, you spawn the player there. Then use the PostLogin event to get the controller to possess the pawn.

left flicker
#

How do I get the player start in the game mode?

#

I tried to make a player start variable, then getting all actors of of class with tag, getting the first element of that array (0), and spawning actor of class at that transform, and possessing it

#

I got an error that it 'accessed None when trying to get the array item

hoary spear
#

sounds like it didnt find the playerstart

#

you should always validate references

#

and hopefully have some fallback

left flicker
#

I connected the 'player start' variable connected to an 'is valid class' and it comes through true

#

I'm not sure if I did that bit right exactly. It is checking after specifying the tag as well; if that makes a difference.

#

Also, I'm not sure if I even made the variable properly. The variable in the game mode is a player start class reference, with the default value being 'PlayerStart'

molten agate
#

what do i enter for option for dedicated server

#

in open level

sinful tree
# molten agate in open level

Pretty sure you can't do this. Dedicated server needs to be launched at execution, it can't be launched from open level.

molten agate
#

Console Command ?

young spoke
#

Hello, I have this issue where I want the players head to shake when they sprint. I have setup an anim notify when the animation steps down. On the notify event I play a camera shake on the player however it plays a shake for all players in the game

#

How can I have it so only the sprinting player has a camera shake?

sinful tree
# molten agate Console Command ?

Same thing. Once the game is running you can only open a level as standalone or listen server. Dedicated servers normally have their own separate executable and you'd have to start that executable on its own.
Dedicated Servers are also normally headless - so they do not have any window open and the game isn't being displayed while they are running. You can set it in the command line so you can see the logs while it is operating.
It's not that it's impossible to start a dedicated server from within the game when it is running, but you'd need some C++ to make it execute as a command line operation, not from open level or console.

sinful tree
young spoke
#

Yeah

#

I use get owning pawn

#

then cast to character

#

I added is locally control which worrked

#

but it seems the event is called twice

#

when I do a print string

sinful tree
#

It would be. The animation is likely being performed on all clients, and if it's a listen server, the server too.

young spoke
#

Yes but when I add more players it is still only played twice

#

same with 1 player

versed thorn
#

I spawned actor, trying to call server RPC on it from client but got warning UNetDriver::ProcessRemoteFunction: No owning connection for actor ... so I set owner after spawning to player controller and now I got no warning but RPC is not called ether

young spoke
#

idk why

#

there is only 1

#

Yeah so anim notifies are playd twice idk why

sinful tree
#

But are you seeing
Client1: Hello
Client1: Hello

or
Client1: Hello
Server: Hello
?

graceful flame
#

Hello

wheat grotto
#

Hi everyone,
We are using playfab for our multiplayer services.

We are working on the name tag functionality. In our case the name of the players which joins after player โ€˜Xโ€™ is visible to player X and names of the players joined before the player X are not visibile to player X

graceful flame
wheat grotto
graceful flame
#

And where does the name originate?

#

player state?

wheat grotto
#

Iโ€™m able to get names of the player joining after player X but not of the players joining before it

graceful flame
#

Are you using steam?

#

EOS?

#

Where does the name come from? It comes from somewhere then gets set into player state, is that correct?

#

Is player name a string that you prompt the user for then save?

#

For my game since I'm using steam, I get the player name and steam avatar from Steam API then I store it in a struct which I use in other blueprints such as GameInstance and PlayerState. The name is shown as a widget component attached directly to the character and its value is set using a replicated variable bHasName which uses repnotify so that other players can see the name.

#

When they first load up the game they have to authenticate and after doing so I can access their name and avatar from Steam which is then stored.

dawn cypress
#

Found an issue with replication after building it in Shipped mode. Why the engine behaves differently in that mode when it comes to replication? Is Development build it works as intended. I have an array of structure and I insert there like 90 records. After that whole actor stops to replicate its values, also no RPC goes through that contains this particular property

quartz iris
#

So I should be getting the player character in the gamestate instead of the controller?

sinful tree
quartz iris
#

I think I should start with the list

#

Atm I have it setup like this

quartz iris
sinful tree
#

Ok the list is fairly simple.
Your widget just needs to get the GameState, and from the GameState get the player array. You probably do not want to use predefined variables like what you're doing - you can easily construct text fields within the loop, and populate them with the player's name and then add those newly constructed widget objects to a vertical box.

quartz iris
#

Wouldn't that still not work as it's technically the same thing?

#

I guess the play array is replicated?

#

Is the bind event necessary?

sinful tree
sinful tree
quartz iris
#

It was recommended for me to use

#

But I guess I don't need it right?

sinful tree
#

I can't answer that. I don't know what it does.

quartz iris
#

How could I get the player character within the player array?

#

There's some variables I need inside the characters

#

Would it be "get pawn"?

sinful tree
#

or yeah GetPawn I suppose.

quartz iris
#

Ah k awesome

#

omg

#

thank you ๐Ÿ˜„

#

it works perfectly.. i spent 3 days trying to figure out why it wasnt working with player controllers

quartz iris
# sinful tree

Will this keep updating or do i need to manually update the variables

sinful tree
quartz iris
#

One more question..

#

How could I get the players steam name (which is located in the player controller)

#

And display it on the widget too?

sinful tree
#

It shouldn't be stored on the player controller, it should be stored on the playerstate.

modern cipher
#

if i modify a fastarrayserializer element on beginplay and mark it dirty,
PostReplicatedChange gets called with an empty TArrayView<int32> ChangedIndices

peak sentinel
#

They don't have PreReplication()

#

Probably I'll be fine if I call the function from AActor outer ๐Ÿค”

quasi tide
#

James has a blog post on how to add networking support to a uobject though

peak sentinel
#

I have a replicated UObject, but couldn't think calling their custom PreReplication() from AActor before replying to siliex

#

Boilerplateโ„ข๏ธ goes brr

quasi tide
#

Boilerplateโ„ข๏ธ

quartz iris
#

Would you be able to go over the player name over head?

sinful tree
#

That one's roughly about the same. On the pawn itself you can get a reference to the playerstate, thus you can pull the playername from it. You then would feed that into the widget component that would store their name above.
The difficulty with this however, is when to actually make the call to populate the value into the widget as you need to ensure that the playerstate is appropriately replicated first as begin play of the pawn may happen before the playerstate is replicated, same with the name values themselves.

elfin lintel
quasi tide
elfin lintel
pastel fiber
#

If I make a small (hobby-like) multiplayer game, how much money do I have to prepare or spend for hosting the game?

#

How can we (as a player) know whether or not the game model is listen-server or dedicated server?
For example, I am playing War Robots, how can I know its model?
@whole grove : Do you have any idea? ๐Ÿ™‚

graceful flame
waxen umbra
#

This might be a strange question, but I have set up a way to replicate container inventories to the player by using a view component on the client, the view gets a list of items on the server that's in the inventory. These are UObjects with custom replication implemented.

I noticed that when I open a few different containers it seems that the items are already on the client after it's been replicated the first time, even though they hold no obvious references to them. Is there any way I can check to make sure that they are no longer replicated/relevant and get collected?

#

Basically running between two different containers I expect them to behave as if it's the first time I open them each time, but it appears the item objects exist on the client after the storage has been closed

pastel fiber
#

Folks, if we develop multiplayer games, can they be run in both listen-server mode and dedicated server mode? Code once and run every where?
I am wondering whether or not the code in each mode is different so we have to create two versions. ๐Ÿ™‚

waxen umbra
#

In particular you need to think about the listen server player, where they are both client and server at the same time, which matters when relying on things like OnRep functions.

pastel fiber
#

Oh ok. Thank you very much. I have not learnt multiplayer parts deeply yet. ๐Ÿ™‚

waxen umbra
#

There's also going to be concerns for larger worlds and performance and so on

uncut schooner
#

How do I open a listen server level

#

Whats the command

fathom aspen
#

The map name comes before the additional options string

#

So you have A and B flipped

pastel fiber
#

Are multiplayer games with listen-server mode also commonly used for mobile devices?
Mobile devices selected as the hosts will be overwhelmed. ๐Ÿ™‚

kind ember
#

Has anyone worked with FCharacterMoveResponseDataContainer ?

vivid seal
#

anyone have a good method for handling variable fire rates on a weapon with prediction? Specifically, if the client mispredicts fire rate, how do you deal with the server correcting that? Just void any shots that were too fast and refund ammo? Auto-fire any shots that were missed from a client predicting too slow and the server taking rtt to respond and correct it?

sinful tree
#

ROLE_MAX doesn't look like it's used very much (searched within 15198 .cpp files in the UE source from \Engine\Source) and there's no specific comment in the documentation about it. Safe to say, I think you'd want to use ROLE_AUTHORITY anyway as it's known that if you have authority over an actor, then you're the instance of the game that spawned that actor, which is the highest authority anything should have really.

molten agate
#

in listen server when the host change level the client also change level anyway to fix it ? like changing the host ?

sinful tree
molten agate
#

any other way ?

sinful tree
#

Beyond coding it yourself no.

molten agate
#

is there any c++ function or macro for changing host ?

sinful tree
#

As I said before, the engine does not have anything built in to support host migration.

short arrow
#

There is however a few plugins for it that you can purchase

molten agate
#

??

plucky prawn
# molten agate ??

You have to use a source build of unreal engine to use dedicated servers

molten agate
#

how many gb is it

plucky prawn
#

Yes

#

About 150-200gb total

molten agate
#

omg+

plucky prawn
#

After you install the dependencies

#

Not really worth it imo. If you have build infrastructure and are using UGS it's fine but it's sort of a pain otherwise

molten agate
#

any other way to get dedicated servers

plucky prawn
#

No

pallid mesa
umbral horizon
#

if i set an actor property to replicate. Is it 100% sure that when that actor property replicates, the replicated variables in that actor itself would be updated by the most recent properties by the time the actor property replicated?

sinful tree
versed thorn
#

I spawn character inherited from ACharacter on the server, auto possessed by ai, and for some reason I can't call RPC from Client for this character, it is owned by the player controller on the same Client, any ideas how to fix it?

wheat grotto
#

Only few players are able to see other player names in multiplayer

jade patrol
#

is it normal for an empty 3rd person dedicated server to be 1.74GB ? ue5

fathom aspen
fathom aspen
fathom aspen
versed thorn
#

Owner is replicating

fathom aspen
#

Should be working fine. Try routing the RPC inside the PC then

versed thorn
#

through PC works fine

#

but it's not what I want

fathom aspen
#

You can always route RPCs in your client owned actors to achieve what you want. But anyways what are you trying to achieve?

versed thorn
#

in this case I am making character control rts-like. So if I click some where I want character to move/attack/pickup/etc. based on what I clicked and if route this through PC then this logic goes in PC and not in character where it belongs

#

I just don't get why is it seems to be impossible to just set owner and call RPC's

fathom aspen
#

As long as the TragetPawn is replicated then it will work fine

#

Imagine every actor you want to call a client/server RPC on has to be client owned?

#

Does that seem to you a good design?

versed thorn
#

yes

fathom aspen
#

It's bad

versed thorn
#

I need max 3-4 actors for client

fathom aspen
#

Doesn't matter. In general that's a bad design

versed thorn
fathom aspen
#

TargetPawn->GetOwner()->ServerMove(Self)

versed thorn
#

why SElf?

fathom aspen
#

I assumed you're in the pawn class

#

You will be in the PC class probably

#

So it will look like this there:

#

ServerMove(TargetPawn)

#

You do that after you click which done client-side

versed thorn
#

and ServerMove is a PC function?

fathom aspen
#

Yes

versed thorn
#

I see. Thank you

dusky yoke
#

Hey guys. I'm spawning actors (armor) on my AI, and setting them to the master pose component. For the server this works fine, but for the client the Master Pose is not being set - the armor is spawned, but not following the characters. Any suggestions on how to fix this?
I've set the armor actor to replicate, & replicate movement (just to debug), and also the component skeletal mesh to replicate.

fathom aspen
#

SkeletalMeshComponent doesn't need to be set to replicate

#

You are doing this on server so it's normal

dusky yoke
#

Hmm okay ๐Ÿ™‚ I mean, the component spawns so that makes sense. Just the master pose that is the issue

fathom aspen
#

Use OnReps

#

After you SetMasterPoseComponent on server, you also set a boolean value to true, say bHasSetMasterPose

#

Make it a RepNotify variable

dusky yoke
fathom aspen
#

And inside the OnRep function you SetMasterPose

dusky yoke
#

Spawning actors should be done by the server, makes sense

#

Will give it a shot in a bit and get back to you ๐Ÿ™‚

fathom aspen
dusky yoke
#

Thanks for the link! ๐Ÿ™‚

light monolith
wary wyvern
#

Hi! Does anybody know, why UObject might not get replicated (or recieved by a client maybe) with a client log spamming with warning :

08-27 16:49:57.492  5258  6572 D UE4     : [2022.08.27-13.49.57:492][792]LogNet: Warning: UActorChannel::ProcessBunch: ReadContentBlockPayload failed to find/create object. RepObj: NULL, Channel: 129

Background: I have an array of UObjects(2-3 of them each player) inside UActorComponent. Component replicates uproperty array, and replicates uobjects, using ReplicateSubobjects() function. Everything work fine in editor, even if I start PIE with separate server process. But if I build server and an app, client prints warnings above and does not recieve these objects on it's side.

4.26 from Source (both client and server, ofc)

fathom aspen
light monolith
#

I'm doing this but the game state isn't valid by the time this actor replicates

fathom aspen
#

The GameState has to be valid by the time any actor calls BeginPlay on client

light monolith
#

it works some times

#

is it because I have "Net Load on Client" ticked?

fathom aspen
#

I'm not sure

#

That is ticked by default I guess, so probably not. And again, you are guaranteed a GameState has replicated only when BeginPlay is called on client. That comes after all the OnReps has been called and PostNetInit

light monolith
#

so you mean I should replicate on begin play for late joiners instead of rep notifies?

fathom aspen
#

I'm not sure what's your end goal there, but if that works for those who joined in time, then go for it

#

You can't have both. You should stick to one approach

sweet ore
#

when i try to click my own cube it is working fine and i get true

#

but when i try to click any other player it is not working

sinful tree
sweet ore
#

there's no way to do it? i want to set the value to true in my own player when i press thier cube

sinful tree
#

Then you need to get a reference to your character and set your character's boolean to true.

sweet ore
#

as same as widget. i tried to set my var to true when i press thier widget it is working but the cube isn't

worn wagon
#

Does anyone have experience with interpolating a UProjectileMovementComponent? From what I can gather from the docs, I set the interpolated component to the visual component of the actor, in my case a skeletal mesh, and then I set bInterpMovement to true.

ProjectileMovementComp->bInterpMovement = true;```
From there I need to use ```ProjectileMovementComp->MoveInterpolationTarget()``` inside of ```PostNetReceiveLocationAndRotation```. But the movement of the projectile still looks jittery on the client. I have tried supplying MoveInterpolationTarget with the ReplicatedMovement location & rotation as well as using GetActorLocation/Rotation, both don't work for me. What should I be doing exactly?
pallid mesa
#

One of them is basically storing the montage start timeframe using a synced clock

#

and when a late joiner joins the game

#

on the onrep for the interaction time variable

pallid mesa
#

you can compute wjere the montage should be at

light monolith
#

I'm doing that (maybe) but the game state sometime gets created after the onrep event(s), but idk maybe its because i'm not testing in standalone mode

pallid mesa
#

thats normal

#

in such case a very easy fix for blueprint users is having a timer that repeats until the gamestate is valid

#

basically your timer will simply check if the gamestate is there

#

and once its there

#

u can proceed with logic

pallid oxide
#

hey guys, i am trying to get my project to working properly but i can't find a solution to this error

pallid mesa
elfin lintel
#

To use On_Rep events on Uobjects, do I need additional functionality besides overriding GetLifetimeReplicatedProps, IsSupportedForNetworking, CallRemoteFunction, and GetFunctionCallSpace?

I have a uboject class that derives from another uobject class I created called NetworkObject that implements those functions. Then in the problem Uobject class I'm replicating it in GetLifeTimeReplicatedProps and have it set to ReplicatedUsing="OnRep_XXX".

The outer AActor that spawned the uobject is replicating the uobject class and also implements ReplicateSubobjects (and I get a successful OnRep_UObject call in the AActor class). But I can't get an integer to trigger the OnRep event inside the Uobject class. Here is all (I think) of the relevant code: https://pastebin.com/ZMNsL5vk

sinful tree
#

There's no such thing as "An authority client". There is the server (which can be a client too if its a listen server), and there are clients.
Authority is based on where the object is spawned - so if you're spawning on the server, the server has authority, if you're spawning on the client, the client would have authority.

If you're running something currently on the server, and you want a client to do something, you'd have to use a "Run On Client" RPC on a client owned actor (like the PlayerState, their controlled pawn or PlayerController) and if you want them to spawn an actor, then you'd call a Spawn Actor node on that Run On Client RPC. If you're wanting to spawn something only on the server (including Listen Server hosts), then that actor can't be marked to replicate.

sinful tree
#

There is no such thing as non-authority clients. Authority is granted to an actor based on where that actor is spawned and "Clients" are not actors. The term client is used to describe an instance of the game that is connected to a server.

If you want an actor to be spawned on every single client, excluding the listen server host, then you probably need to start while running on the server itself - the server can communicate with all the clients and run a Run On Client RPC on one of their owned actors (PC, PS, Controlled Pawn) excluding the listen server's owned actor, and in that RPC spawn the actor. Keep in mind, that each client would then have an individual actor that the server and other clients cannot reference. The clients would "have authority" over the actor they spawned as it was spawned on their end.

If you want an actor to be spawned on every single client, including the listen server host, with the same idea that each client would have an individual actor that the server and other clients cannot reference, you cannot use a replicated actor as you're spawning on the server which means there would be a replicated actor sent out to all the clients as well, but I believe you can disable replication on a single actor using the "Set Replicates" node after spawning it. How you spawn it would be the exact same, through an RPC on an owned actor of each client, including the listen server.

oblique river
regal geyser
#

When players bump to each other, they start pushing the other player away from them in Event Tick event until set distance with AddForce. Issue is that when client X pushes away client Y. Client Y can experience slight movement stutter and if I understand it correctly, it's because CharacterMovement component has its own Client side prediction and when server starts changing Server side CharacterMovement position, the difference is large enough for the client to experience this stuttering. What is the smart way of fixing this issue?

unkempt tiger
#

if I've got a replicated property that I want to condition via COND_InitialOnly, must I set it during construction? Or will it be fine if it's right after construction?

fathom aspen
#

Either way. Though in the latter it has to be set in the same frame the actor was spawned in

unkempt tiger
#

Awesome, thanks for that insight ๐Ÿ’ช

fathom aspen
fathom aspen
pallid oxide
#

i think i've fixed it

#

but i need someone to playtest with me

fathom aspen
lunar dirge
#

Question if I setup a dedicated server how can I run it so people can connect with out me using port forwarding can I use something like Amazon AWS if I already have EOS setup in my project?

sinful tree
lunar dirge
sinful tree
lunar dirge
#

Ah ok I think I understand

elfin lintel
fathom aspen
sterile oriole
#

Excuse me for being a noob. Where does OnPossess of the APlayerController class get called when the game starts, on the server or on the controlling client's local machine?

fathom aspen
#

Server

sterile oriole
#

And would it's remote role then be autonomous_proxy if it was called on a listen server machine, and simulated_proxy for all clients on the server?

fathom aspen
#

A listen server has no remote role. It has a local role and it's always authority

#

For other clients it will be autonomous as it only exists on their owning client

sterile oriole
#

Woah. So even though Controllers derive from AActor they are different in their remote role role from other classes Derived from AActor. Something like a class the derives from ACharacter, if it were someone using their machine to play the game and be the listen server, would have the remote role of Auto_prox on the server, but all clients on the server would have remote role of authority. But you're saying a controller playing as the listen server would have no remote role, but all clients on the server would be auto_prox. Why is a controller so different in that sense?

fathom aspen
#

I didn't say client controller would have a local role of autonomous. It's authority. The remote role is autonomous.

#

Because controller != pawn

#

Pawn is replicated to all while controller is only replicated to owning client

sterile oriole
#

Oh I understand now, I think I was trying to do things a bad way. What is the point in a game that all player pawns have been spawned and possessed and the game is just in session? Would it be the pawn's BeginPlay?

fathom aspen
#

Nope. The pawn is possessed at a later stage. The event for that is called Possessed (in bp)

#

There is no such a thing a global event

#

It's per pawn

#

So you will need to keep track

worn wagon
# pallid mesa how jittery? what's your update rate?

I left it at the default of 100, shouldn't that be enough? Also, I got it to work for the most part, I had to call MoveInterpolationTarget before calling the super implementation which sets the actor's root component location, which makes sense as doing it before would have mean the OldLocation used for interpolation would be the same as NewLocation.

void AWeaponItem::PostNetReceiveLocationAndRotation()
{
    const FRepMovement& LocalRepMovement = GetReplicatedMovement();
    FVector NewLocation = FRepMovement::RebaseOntoLocalOrigin(LocalRepMovement.Location, this);

    ProjectileMovementComp->MoveInterpolationTarget(NewLocation, LocalRepMovement.Rotation);
    
    Super::PostNetReceiveLocationAndRotation();
}
#

The issue i'm having is when it collides with something, like the ground, it will clip into it before clipping back out. So while the movement is smooth it does some weird stuff.

#

Increasing the net update frequency doesn't help either.

sacred coral
# oblique river Did you ever solve this problem? I am in the exact same situation, switching to ...

No. From what i was able to figure out while reading trough code there are 3 issues you need to solve to get posses/unpossess to work correctly in lyra:

  1. Pawn Cosmetics Component needs to check what you're switching to, and act accordingly, at minimum - it shouldn't remove the mesh from the character on unpossess but should refresh it on possess(). This probably requires an extension of playerstate to manage and replicate what pawns are currently belonging to what player. In Lyra ASC exists on PlayerState so ***i assume that the right way to do it, is to hold that info there ***

  2. LyraPawnExtensionComponent::HandleControllerChanged() probably needs rework too, or im dumb (Most likely I am, since changing pawns proves to be a problem ). Anyway, from what i can see, while possesion/unpossesion happens, ability system component on player state gets uninitialized?. I'm hoping Epic will sooner or later document/tutorialize such basic features. But from the limited knowledge i have writing games and multiplayer i guess what should happen is ASC should stay active all the time, or, should be reinitialized after pawn change. I have no idea if that is all that needs to happen, and i don't have a lot of time to look at it or explore it further.

  3. But most def something funky is happening in unpossess chain in general -> i thought that maybe my vehicle class was to blame but same shit happens when i switch between lyracharacters even locally. Switching trough the network is a comepletely diffrent issue, and i guess has to be addressed as well.

TLDR: It looks like a lot of work, so my final thought is that surely im missing something, and there is a better way to do it (like controlling server authored vehicles trough abilities or something). I would love to get pointers if any1 has any. Other than that, i dont have time to deal with this. I've moved on to different stuff, aint gonna waste time running experiments on codebase like this.

worn wagon
#

Okay so simulating physics on the UpdateComponent (a box collision) fixes that issue, and now I just need to change it so it can't rotate as that's the functionality I want.

#

I just didn't really want to do that because i've had so many issues with the new chaos physics clipping through geometry ๐Ÿ˜ฉ

worn wagon
sacred coral
#

Yeah, but at the same time i thought this was about giving community a solid codebase to build upon. I hate reinwenting the wheel, and since ancient times of UDK, Epic has a big problem with writing tools that are easily extendable.

#

like the game feature plugin seems like an great idea, but holyshit extend upon it, and your project starts to look like a bubble wrap of bubble wraps

hollow eagle
#

Well yeah, don't use something as complex or as extensible as that if you don't need it...

#

Lyra exists more as an example of how a large experienced team can work on a project rather than a starting point for some small game being done by an individual. There's bits and pieces that are useful there, but it's way over the top for most people here.

#

The engine itself is already a solid codebase to build upon, and many of the assumptions in Lyra are either too generic for most games (resulting in lots of complexity) or too specific to Lyra itself (meaning it isn't reusable). Don't just take a massive sample project and assume it'll work for whatever you're doing.

sacred coral
#

Id agree, if we were talking about something else than switching pawns at runtime

worn wagon
hollow eagle
#

Lyra is an example of AAA complexity if nothing else.

#

My biggest problem with it is that Epic made it seem like something that was easy to get started with, and if you act like you're doing nothing but modding an existing game it sort of is. But most people coming to Unreal are trying to create their own games, so this attitude about it doesn't make sense (or they did a bad job of explaining who the target audience for the project is).

worn wagon
#

It's very valuable to look through the source code and see how the people who made the engine would structure a complex game, and some of it helped me out. But yeah unless the game you're making is going to use most of the features in it you're going to be wrestling with the codebase trying to understand every corner of it to achieve something simple that you could do effortlessly in a blank project.

molten matrix
#

Hey folks, I'm hitting an issue with the CharacterMovementComponent. For some reason, my character rotates on the client but not on the server. I've tried controlling the rotation from the client both by calling Controller->SetControlRotation(NewRotation); and by using AddControllerYawInput. I assumed that both these things would properly end up eventually RPCing the rotation to the server.

For some additional context, I have things set up so that when I right-click somewhere the angle from the character to that location is calculated and then on tick, it's lerping towards that angle.

I'm using bUseControllerDesiredRotation set to true and bOrientRotationToMovement set to false (but I've also tried the other way around). I also tried setting bUseControllerRotationYaw. Not sure if it is relevant but the character is simulating physics.

Any idea what might be going on or next steps to try? I'd rather not have to dig deep into the CharacterMovementCode yet again...

worn wagon
#

I think bUseControllerDesiredRotation and bOrientRotationToMovement should be set to false

#

@molten matrix

blissful saffron
#

Has anyone run into issues with NetMulticast not working? It doesn't fire on clients. We've done a lot of debugging and have also been looking into jitter from the CMC, which is not properly replicating to clients. We've created a workaround using client/server functions but NetMulticast isn't working

worn wagon
blissful saffron
#

I didn't do teh debugging on this myself but I'm told that they ensured it was firing from the server

blissful saffron
#

yeah, that's kinda where we are. I was just curious if there was an issue anyone knew of

worn wagon
#

If you're calling it from the server it should run everywhere.

worn wagon
blissful saffron
#

yeah, we did

#

I'm really not srue

#

at the moment we're fine, but it's weird and I'd like to figure it out

worn wagon
#

Is this blueprints or c++?

molten matrix
worn wagon
molten matrix
#

Top-down

vivid seal
#

When you add a param to an OnRep function, is that param the previous value the client had for the variable, or is the server sending it's own previous value before replicating?

blissful saffron
#

the old value would be the client's old value

vivid seal
#

okay neat

elfin lintel
# elfin lintel To use On_Rep events on Uobjects, do I need additional functionality besides ove...

Is it possible that my problem here has something to do with the fact that my AActor outer that is trying to replicate the problem uobject is a child actor of an AActor that also implements ReplicateSubobjects and GetLifetimeReplicatedProps? The parent AActor is replicating a UObject class and a TArray<UObject> that is working fine. Its the child AActor that is having problems replicating its subobjects (the uobject is replicated, but its properties are not being replicated)

ionic coral
#

Ight been stuck on this problem for 2 -3 days now

I have a player customizer before you enter a session you can build your character (apply pants even change the colour of each limb) it all works fine

i join a game and everyone that joined before me is blank and everyone that joined after me i can see

the first player the joined (the server) can see everyone the second player that joined can see everyone except the server and so on

#

basically the event "colourfix" is run on server so it gets the event to run on the server then that goes to another event multicast so it shares it from the server to everyone els

#

i have played around with it

#

i have done just run on server

#

i have done just multicast

#

ok umm nvm i just fixed the skin colour now i got to do pants

#

but

#

i might no how to fix it

#

i dont know how but i tried multicast again but a little differently and it just works

fathom aspen
ionic coral
#

that explains why my old multiplayer game it works and this one doesnt

#

thank you soooo much man

ionic coral
soft dawn
#

Hey all! I'm seeing this in my client logs and players report they can't move on spawn sometimes LogCharacterMovement: <character> is stuck and failed to move! <location information> Actor: <some other player controlled character> So if i'm reading this right it seems like characters are stuck because they are colliding with other characters when restarted? I just have a deathmatch arena game mode and use the default restart player gamemode function. I'm thinking i need to override this function and check if its ok to restart the player or not. Does that sound correct?

unkempt tiger
#

Possibly weird question: is there a way to spawn an actor on the local client (for prediction purposes until the actual actor is replicated), so that calling HasAuthority() on the client returns false as it would with replicated actors?

sinful tree
unkempt tiger
sinful tree
#

XD

unkempt tiger
#

As soon as I tried instantiating the same actor class on the local client for prediction purposes, HasAuthority checks returned true and it was running code that it shouldnt have

fathom aspen
pallid mesa
#

because what can happen is that the simulation fights against the interpolation therefore you end up having rollbacks coming from interpolation

#

however the interpolation wont do miracles

#

if your projectiles are fast

#

small

#

and such... it will be enough

#

but for such cases you probably wouldn't use actors

heady python
#

Im broadcasting a delegate in my gamestates OnRep_MatchState. I want all binding actors to be spawned before they receive the broadcast. Is there any way I can ensure that this happens?

sacred coral
#

its really simple as well, you just have to move code around

worn wagon
#

Looks very good now

#

Turns out I was incorrectly trying to set simulated physics on the root component to false on the client instead of that bool

#

I thought since that was the updated component it would make sense to do it like that

pallid mesa
#

๐Ÿ‘

umbral horizon
#

does gamemode's PostLogin gets called for ai bot controllers?

alpine shuttle
#

How to make players push each other out of the way based on previous velocity? How to improve this blueprint? ๐Ÿค”

fathom aspen
fathom aspen
soft dawn
sinful tree
#

Yes, RPC to that client (through their PC, PS or controlled Pawn) and while running on their client, set that actor hidden.

#

Or just make sure you're running on the client in general when doing it ๐Ÿ˜›

#

Authoritative instance of what?

#

No. For a listen server you can't use Set Actor Hidden as it replicates. One potential way of doing it is hiding the root component if you're using a character - This shouldn't replicate.

#

And if it's just something happening locally, like on a button press, then there's no need to RPC.

#

For example, this works without replicating that the full actor is hidden, so it can be used by the listen server host and by clients, and it'll only hide on their end.

oblique river
# sacred coral No. From what i was able to figure out while reading trough code there are 3 iss...

I can see that you have spent more than enough time on that little issue. It should not be that difficult! In one of Epics videos about input tagging they say in a way that Lyra are prepared to control another pawn, a vehicle for example. I have searched the forums, web, videos and still I have nothing on this particular problem. Controlling another pawn and then back to your originating pawn. I hope some clever Lyra guy reads our messages. It would be a BIG expansion of Lyra to get this solved.

sacred coral
#

simple fix really, just moved execution so everything is happening only on possessed pawn. (so an unpossessed pawn even if abandoned, mantains its character parts untill its being possessed again, then the refresh happens)

#

Controls are still unknown though

#

the issue is definitely happening on unpossess, and is not network or actor class related

#

as it happens even if you unposses and possess the same pawn

oblique river
# sacred coral the issue is definitely happening on unpossess, and is not network or actor clas...

Everything in Lyra is done by tags, which is actually pretty neat and clever - and confusing. As I understand it the original pawn have abilities applied, for example it has input tag ability applied. But when the pawn loose control it also loose its abilities. So when the pawn is in control again you have to reapply all the abilities before the pawn works again. The reason that another pawn work fine being possed is that it is not a Lyra pawn with abilities, it is just a ordinary UE pawn.

sacred coral
#

I assume the tags are held in ASC on Playerstate?

#

imma debug those then

oblique river
# sacred coral I assume the tags are held in ASC on Playerstate?

What IS GOOD DEV GODS!
In this video I'm giving a boring lecture about Gameplay Ability System. Its a very high level overview and is not meant to be an indepth lecture as that could take a couple of hours easy. There is some good information and good references in this video so try not to skip it but I understand if you do!

If you have any qu...

โ–ถ Play video
oblique river
# sacred coral I assume the tags are held in ASC on Playerstate?

This week on Inside Unreal, Technical Writer Michael Prinke will guide us through a tour of the Gameplay Ability System! We'll set up Graystone from Paragon with a couple of gameplay abilities in the Third-Person template.

ANNOUNCEMENT POST (contains project files and resources)
https://forums.unrealengine.com/unreal-engine/events/1850699

TRAN...

โ–ถ Play video
#

I believe that the solution is in these two videos. I just have to watch them multiple times. The Intro to Gameplay is VERY usefull for understanding the ability system and how Lyra handle tagging.

sacred coral
#

but afaik movement isn't handled by an ability

#

I mean, there is a possibility that lyra pawn does check tags to toggle it

dim trail
#

my health bar widget isnt updating the percent of the bar when the enemy takes damage, any reason why? heres my BP

#

the health bar stays at 100%

#

does it need to be RPCd?

short arrow
sacred coral
short arrow
#

You should be updating health directly inside of the widget fam

sacred coral
#

health value = always x - y

sacred coral
#

should be : health value = health value - damage afaik

dim trail
sinful tree
#

Looks good, just need to remove this. You only need to divide Health by MaxHealth to get your value between 0 and 1.

dim trail
#

it still wont update the widget itself for some reason

#

does it need to be inside the widget?

sacred coral
sinful tree
short arrow
#

Nothing has to be anywhere. But there is obviously a better place for things

#

I can put my entire character code in widgets if I wanted. Doesn't mean I should ๐Ÿ‘

dawn ledge
#

check if your cast is failing

short arrow
# dim trail

Are you sure the event is firing on the client

dim trail
#

its working now

#

health was 0, oopsies on my part

regal geyser
#

Is there a way where Server can call an Event that will only trigger on chosen Clients from the same blueprint which is owned by the server?
Server Event checks all clients, if they meet given criteria, server will call an event that will be triggered only on chosen clients

short arrow
dim trail
#

do widgets replicate to all clients if the properties are set to replicate?

short arrow
regal geyser
dim trail
#

how do i get my widget to replicate to all clients?

short arrow
dim trail
#

multicast would be bad

#

well, if i damage a mob i would like the other clients to see the bar decreasing as well

short arrow
dim trail
#

yes

short arrow
#

In the widget blueprint, you can either get the owning player pawn -> cast it to base character -> get health value -> update it every 0.X seconds

Or you can use a rep notifier event with a dispatcher inside of it that sends the new value of the players health. And then listen for that dispatcher inside of your widget

#

I'll show you if you're confused

regal geyser
# short arrow I'm confused

Maybe I don't understand how it works, this is clear explanation what I'm trying to do:
BP_Object is in the scene by default
This BP_Object has Server Event in which server checks all clients, and if they meet certain criteria, then Event X will be triggered locally on these clients.

My understanding of Run on Owning client is that this will only trigger on server, because BP_Object owner is the server.

#

The only thing that comes to my mind would be that Server will store all clients controllers/IDs/.. into an array and send this array via Multicast, then each client checks if this controller is his local one and if yes then this event will trigger.
Because if I'm not mistaken you cannot call an event on a specific client, you either do Multicast to everybody or you only trigger it on the owner, which can be only 1, but you need to call it on a bunch of specific clients

short arrow
short arrow
#

@regal geyser

regal geyser
# short arrow <@447481946575208448>

So basically the only way is to actually run that event on players controller/pawn. If for example I want this "BP_Object" to start flickering for X seconds and then stop via TimerHandle, is it smart to call this Fire Event on client's controller with reference to this BP_Object, and this controller would call an event on this BP_Object => StartFlickering? Or is this just completely dumb. Because I would like for the logic that needs to happen inside this Fire Event be completely inside this BP_Object

dim trail
#

best way to do death? I was thinking of using an onrep uproperty bool death and call onrep death->destroy actor when health <= 0

short arrow
#

that's is the best way to avoid going back and forth

#

and sending unnecessary traffic back and forth

regal geyser
#

Yes that sounds way smarter ๐Ÿ˜„ Thank you so much for your time!

fathom aspen
#

You do it server side

#

And for a general example see ShooterGame. Or Lyra. Hasn't looked at the latter myself

short arrow
fathom aspen
#

Haha fair enough. Stay away then!

dim trail
#

should I RPC destroy actor?

short arrow
#

destroying actor on the server automatically destroys it on clients

#

no further action is required

fathom aspen
#

You are already on the server by the time you check if the pawn is dead. RecieveDamage (done on server) -> health <=0 -> Destroy

torn geode
#

In a very simple to understand way congrats

short arrow
round star
round star
#

server is the boss

dim trail
#

destroy actor doesnt seem to work

short arrow
#

the event has to be running on server

dim trail
#

to make it run on server it has to be RPCd correct?

short arrow
#

is this not fired on "any damage" ?

dim trail
#

its fired on onrep health changed

short arrow
#

insert a "Has authority" node, and then on authority call Destroy actor

#

if that doesn't work then your code logic is most likely flawed. clients shouldn't be setting rep notifies for replicated actors

fathom aspen
fathom aspen
#

You don't even RPC

short arrow
fathom aspen
#

How do you trust the client saying his health is below zero

short arrow
#

that's what I mean, is he not setting the variable on the server to begin with?

fathom aspen
fathom aspen
#

Only parts

short arrow
#

ikr

#

we can only guess ๐Ÿคทโ€โ™‚๏ธ ๐Ÿ˜„

fathom aspen
#

If you are using the legacy damage system you should be calling a function like ApplyDamage that does the damage and the function that listens to the damage is called RecieveDamage. Both are run on server as this is all authority stuff. You can also look at the new stuff offered by GAS. No matter what option you end up with, the workflow is one

#

Never trust the client saying the health is zero and RPCing to server. While you can do a check if the server health is zero there, it's still not the workflow you should be sticking to, but the one I mentioned above

round star
#

defeats the purpose of the server checking anything if the client is trying to set everything

fathom aspen
# dim trail

Oh yeah right. Forgot to mention that even the variable like Death shouldn't be set there. It's also set on server.

prisma crane
#

I know this question has probably been asked multiple times, but I'm struggling to have the server browser display the current player count in listen servers using the OnlineSubsystemSteam in UE5.
Based on information i've found it should be using something like SearchResult.Session.SessionSettings.NumPublicConnections - SearchResult.Session.NumOpenPublicConnections. Yet this always appears 0. I've also seen suggestions on using the SteamAuth but no demonstrations on exactly how to use it.
Any suggestions on what to attempt or where to look?

thin stratus
#

That's nothing answerable

#

Depends on too many factors

#

You will need to make your game and figure out what server specs you need by profiling

blazing spruce
#

Hi, I'm trying to have it so when a player steps inside the sphere overlap it shows a widget indicating that something can be interacted with, if I have it without the IsLocallyControlled check, as soon as any player steps into the sphere all players can see it, but it should only be visible to players within that sphere, if I include the IsLocallyControlled check it works properly when playing in the editor but if i play through steam the server player cant see any of the indicators but clients can, any ideas how I can get this to work properly?

thin stratus
blazing spruce
thin stratus
#

No, sorry

surreal wadi
#

Could someone point me to a good way to implement Voice Caht on Android without relying on the OSS?

cyan frost
#

Hi all, hope this is the right channel.
If I set an array variable to replicate with a notify function, the notify function is not called when elements are added to the array. Is that the expected behaviour, and if so how would I call a function on the client when the server updates the array and it replicates the change?

sinful tree
#

I think only the server doesn't receive the Notify itself, but clients do.

cyan frost
sinful tree
#

Yep

cyan frost
#

Thanks for the fast response Datura, I really appreciate it. I'll go back to my code and try to figure out what I've done.

elfin lintel
copper horizon
#

Does anyone know why my client can't move their character on a LAN session? I assume it has something to do with replication but I'm not sure.

vague fractal
#

Got there a question about the OnRep system.
Say i have this here

void Foo::BeginPlay()
{
  // if has authority
  OnRepVarOne = Something;
  OnRepVarTwo = SomethingElse;
}

Is it guarded that OnRepVarOne would be send first and then OnRepVarTwo or could this happen in any order ?

Also another question related to that.
Is there any way to like.. wait for the update on a OnRep variable ? I feel like i'm in need of that, but only at the start of a game

sinful tree
#

Set local booleans in the onrep, call an event in the onreps as well that checks if both booleans are true before proceeding.

vague fractal
stoic hatch
#

Hello guys
Would I be losing too much if I do not use the unreal Character class, in terms of online gameplay ?
Like I'll be starting a new project, that's supposed to be a fighting game, and I'll not need some stuff that's inside that class, so I'm thinking on creating my own "character class", but I read online that this class has some online functionality so I'm a little afraid of miss something by not using the Character Class. Ow I never done an online game or anything related to it before, but I read a little bit about how the online system works inside unreal.

vague fractal
#

Yeah, you'd lose the whole CharacterMovementComponent which has all the replication logic in it just as client side prediction.
And this class is a monster

stoic hatch
#

yeah that's the thing, I read about all this replication and things that's on this class, to be honest I don't quite understand everything, but it seems like a lot of complicated stuff

vague fractal
#

I'd say better deal with that instead of trying to make your own here tbh.
At least if you don't have the experience to do that

stoic hatch
#

ok, I'll stick up with the character class and try to modify what I need

sinful tree
#

If they're true, do whatever you want to do next.

vague fractal
#

That would mean i need to have that inside of the Tick or similar.
Is there no proper way to wait inside BeginPlay ?

sinful tree
#

No it doesn't. Use the OnRepEvents to fire another function. That function then checks the booleans.

vague fractal
#

I guess i should specify my case a little bit more.
The problem here is that i need to wait that a seed got replicated. And only if the seed got replicated the player can start to locally generate the procedural world

sinful tree
#
OnRepFunction1() 
{
    Boolean1 = true;
    CheckReplicatedBools();
}

OnRepFunction2() 
{
   Boolean2 = true;
   CheckReplicatedBools();
}

CheckReplicatedBools() 
{
   if (Boolean1 && Boolean2)
   {
       DoWhatYouNeedWhenBothRepsHaveBeenReceived();
   }
}
vague fractal
#

Maybe i'm just thinking wrong here.
My problem was mainly the chance that the player spawns while the world is still empty, but i think i could just do it differently by making the actual player only spawn once the world is there

copper horizon
clear island
#

quick question is UE_SERVER macro automatically defined when running inside a dedicated server?

thin stratus
#

You will have to debug it yourself a bit and post your findings. From the little info you provided this can literally be everything

fathom aspen
#

And yet people wonder why their questions are left unanswered

thin stratus
#

Yeah that's a prime example for that feedback thread

thin stratus
#

At least I never did anything special to utilize it

clear island
#

I saw some conflicting information online, some people saying you have to define it

thin stratus
#

Same OnRep function that is

thin stratus
clear island
#

will do

fathom aspen
copper horizon
# thin stratus Way to little information for people to be able to help.

Iโ€™ve debugged it as much as I could. Basically all I did was start a session on a listen server and when i start the game everything goes smoothly for the host but when the client joins, they canโ€™t move, look around or do anything. Inputs still work but the player and camera keeps getting teleported back to itโ€™s spawn position. Thatโ€™s all i can tell you i literally know nothing about networking in unreal.

thin stratus
#

I saw that ages ago on UT

#

They used it for the same thing. To ensure 3 different variables are set

#

At some point a struct is preferred though

thin stratus
#

Auto correct ftw

#

Fresh and clean character child*

rancid monolith
#

in PvP FPS games with projectile weapons, how is replication of projectiles usually handled? Right now in my project I'm just using a server RPC from the client to spawn projectiles but it's not ideal because of the delay between firing and the projectile actually spawning.

I was thinking of having the projectile physics/hit detection be done all on the client, and have a "fake" projectile on the server act as a visual just to show that the client fired their weapon, but I imagine there are better ways of doing it. Is there a more "standard" way of going about it?

thin stratus
#

That's sadly a pretty heavy topic

#

You can go quite deep with this

#

What you are doing atm is usually the start

#

UE has no actor spawning precition

#

You can do something like UT does (check its source code) for slower projectiles

#

They spawn a fake one that they then sync up with the replicated one

rancid monolith
thin stratus
#

Yeah to match the client somethingsomething

#

Haven't look at it in a while

#

For faster projectiles you can check if you can't just fake the projectile visually and use a line trace for the actual shot

#

Depends on the game design though

rancid monolith
thin stratus
#

But you will then also run into the problem of ping

#

Where you gotta decide who you want to favor

#

The shooter or the one being shot at

#

By default you probably pref the one being shot at

#

Because locally you fire at a ghost that is long further (if running) on the server and even further on the client

#

So you gotta see if you need to do some rollback stuff on the server to see where the client was when being shot at

#

But that's pretty deep down the rabbit hole

rancid monolith
#

yeah, not surprised

thin stratus
#

A good example of this is Dead By Daylight. The Killer often hits you even though you are "far" away when having a high ping

#

Cause bhvr favors the melee hit against the long gone simulated character

#

Feels unfair for one side

#

But nicer for the other

sinful tree
#

Kids have it too easy these days! Back when I was playing Team Fortress (yea the Quake 1 mod version) and I had dial-up internet running along with 300 ping, I just shot where I thought they would be on the server.

rancid monolith
#

Is there a reliable way of getting how much time has passed between the client calling an RPC and the server seeing it?

#

That would probably be helpful if I attempted rollback

thin stratus
#

Hm, I mean you can send RPCs back and forth fwiw

#

With timestamps

#

And then use half the RTT to figure out how long it takes

#

I do that for a more in sync timeseconds variable

#

Should be some examples on Google for thay

#

That*

#

Not sure what the CMC does

#

It might hook into the net driver or so to confirm timestamps. You can read through its source too

rancid monolith
#

cool, that gives me a direction to go in, thanks

copper horizon
graceful flame
# rancid monolith cool, that gives me a direction to go in, thanks

I implemented something similar for a slow moving projectile in my game. I have the client spawn one with all visual and SFX so it doesn't have input delay then I call upon the server to spawn a real one which is used for collision detection with pawns. I set the client side one not to replicate and adjust the owner see / no see. The client projectile becomes hidden shortly after being launched and the replicated server one which is visibile to everyone except the owner eventually becomes visible to the owner who launched it. So the end result (most of the time) is an instantly launched projectile that can sometimes visually teleport slightly (depending on amount of lag) after its been fired. Since its already travelling away from the camera its much smaller in the viewport so when projectiles swap visibility its not as noticeable.

#

The gotcha with this method is if your projectile has any sort of tracer / trail effect. The teleport will be more visible. My projectile doesn't have a smoke trail or anything like that.

marble gazelle
#

RPCs are messages send from the server to the client, client to server or server to all clients.

Usually you use a Server RPC (RPC from owning client to server) to request smth. Like "I want to dodge" then the server either does this, or refused to do so.

In your case you just have setup Server RPCs, so the client's likely won't notice the value changes on the stamina.

What you want is basically have the stamina being replicated and using a RepNotify to react to the change. The RPCs you might only need to request changes to this value from the client, but maybe this is not needed, maybe your stamina drains as a response to smth that already is being evaluated on the server.

How ever if, for some reason, you need to send an RPC from the server to the client, you need to mark it as Client (to send a message to the owning client) or Multicast to send the RPC to all clients (I think + the server, but I always mix things up)

peak lintel
#

Thank you!
So the function DecreaseSpeedBoost must take place on the server and the variable SpeedBoostTimeLimit must be ReplicatedUsing=OnRep_SpeedBoostTimeLimit

And in OnRep_SpeedBoostTimeLimit the same body of DecreaseSpeedBoost func?

marble gazelle
peak lintel
marble gazelle
peak lintel
tiny zephyr
#

Hey guys

#

i tried playing a packaged linux build on editor and i get this error
pls any idea?

twin juniper
#

Do you guys recommend projectile or line traced based shooting for a gun? In the past I've seen people claiming that projectiles have better performance, but that's just doesn't make sense to me so I'm asking.

chrome bay
#

It doesn't make sense at all

#

But it's also highly dependant on other factors, like how good your implementation is, etc.

twin juniper
#

for example him

chrome bay
#

That's nonsense

#

I don't know of a single game that simulates projectiles as rigid bodies

solar stirrup
#

Because linetraces are somehow heavier than physics

chrome bay
#

IKR

bitter oriole
#

Some people have really weird opinions on optimization

#

Yeah, traces are wayyyyyyyyy faster

#

You can run thousands of traces per frame

#

You don't want thousands of projectiles

quasi tide
#

They have upvotes too. Amazing.

magic helm
#

Aren't traces using the physics system anyway?

woeful ferry
#

Embree traces go brrrr

fossil veldt
#

Yo is it actually possible for a client to update a RepVar's value on the server without an RPC?

fossil veldt
#

I need a function that runs clientside but then updates a repped property for server

fossil veldt
#

ty

woeful ferry
#

RPCs is the only form of communication from client->server

fossil veldt
woeful ferry
#

Yes, that's what I mean

fossil veldt
#

ya cool, thx

worn wagon
#

Is there any way to "spoof" a spectating player being the owner of the pawn they are spectating so that properties that are only replicated to the pawn owner are also replicated to the spectator? I'm trying to do first person spectate, and the first person skeletal meshes are only visible to the owner.

#

I'm curious if there's an easy way to do it like that, or if I will have to do something more complex.

fathom aspen
#

You should be able to get the spectated pawn from the ViewTarget and set the visibility of his 1P mesh to true

#

iirc SetVisibilty replicates, so you might want to try using SetHiddenInGame

worn wagon
#

Yeah I can do it manually I suppose, I figured i'd have to. I'll also need to make sure any animations/FX being played are networked to the spectating pawn.

#

If that's true I will have to, since even when not spectating the player actively I need the animation code to still be run, but the mesh not be visible unless actively spectating

#

Otherwise you can swap and it won't be playing the active animation

fathom aspen
#

Correct. You do that only when in spectating mode. Should be easy to handle

#

And for a general approach if you want some data to be replicated to owner and spectating players you should consider using proxy actors that are relevant to them where they can pull data from

#

Also note the spectator pawn is local only. So say you are playing sound fx, then you can't RPC to it. You can however, play it locally when it happens on the spectated pawn

karmic kite
#

is there a way to make the web browser plugin replicated amongst multiple clients ?

sinful tree
worn wagon
karmic kite
sinful tree
#

You can't replicate widgets. You'd have to replicate through a different actor. Same thing with any inputs into it - would have to be RPC to the server through a client owned actor to make changes to that actor that everyone could then see.

fossil veldt
#

Well not really easily do-able tbh cos you'd have to sync up the inputs in the site too and clicks

#

you'd have to make some kind of listener for javascript events probably and forward them to the other clients

#

sounds like a massive pita tbh, either that or you have some sort of shared VM for the browser and then just push changes to the DOM over network to each client

#

both sound equally as annoying

round star
#

Do you think it is feasible to have a dedicated server to run a 40x40km world

sinful tree
fathom aspen
#

You can hold an array of all PlayerStates belonging to spectators on each spectatble pawn to easily access them

worn wagon
#

Ah okay I was thinking something else. I can handle most of the stuff in the actors that get replicated anyway, like the player pawn and the weapon actor

#

Thanks for the advice @fathom aspen, I followed your tutorial too for setting up the engine way of spectating ๐Ÿ˜„

#

it looks like it handles "onlyownersee" by default too, I didn't notice before because the meshes were off screen

#

I see the fp meshes just no anims by default

fathom aspen
#

Oh nice that it does ^^

#

Hmm, that must be investigated. Wasn't implemented with FPS support tbh

#

So I either change the title or make it supported

worn wagon
fathom aspen
#

Yes

#

IsSpectator() from PlayerState

worn wagon
#

Ah awesome! I should have just searched the docs for that exactly my bad xD

#

I was using google instead and got nothing

fathom aspen
#

Yeah it never leads to you anything useful heh

worn wagon
#

Seems like i'll still have to go through the controller to get the PS though, unless there's some kind of GetLocalPlayerState function

fathom aspen
#

Eh? PlayerState is replicated to all

#

Also always relevant to all etc.

worn wagon
#

I meant for getting a handle on it locally, that's something I haven't had to do yet at least

#

GetLocalViewingPlayerController()->PlayerState

tiny valve
#

does anyone know how to fix the server crashing immediately when i disable 'run under one process'?

fathom aspen
#

Unless you're doing local multiplayer (split-screen)

#

In online mp you only have knowledge of your own local controller on client

#

On server you have knowledge of all, but eh that's still not what you want

#

Cause it will be returning the listen server's local controller in case such one exists

quartz iris
#

Hey so I have a system setup where the player looks at wherever you're aiming (its an fps game) however I need to be able to toggle the player looking at where the cursor is because for instance if the player is holding a shield I don't want them to be able to look up with the shield etc but they can look up just not moving the shield

rough goblet
#

I am using a blueprint project and I recently started making some test games to try out multiplayer in the hopes that when I know more about how everything works I can do a real project. Ran into an issue while making a parkour game:

using the net mode "play as listen server" or "play as standalone" the host can wall jump but if there is another player they cant. Playing both as clients neither can wall jump. I am using a line trace and then setting the velocity based on the direction that the player hits the wall but I also tried using launch character which also did not work. If anyone can offer some help that would be great, thanks. (If important I am using 5.0.3)

sinful tree
# rough goblet I am using a blueprint project and I recently started making some test games to ...

If something works when "play as listen server" on the host instance and "play as standalone" but not "as client", that's an indication that you're not replicating something you need to. Movement by default is server authoritative, meaning, you can't really move your character unless the server knows about it, otherwise the server resets it. The Character Movement Component has some basic stuff for movement already replicated, such as moving around, jumping... Jumping off of a wall is a bit more complicated.

You'd have to RPC to the server somewhere after you've checked if the player can wall jump on the client, and then let the server check if the player can wall jump, and if so, perform the launch of the character.

gleaming kite
#

values that are set in the constructor will still be replicated to clients, correct?

#

and if so, if I replicated them with COND_InitialOnly, they would be sent to clients when they log in right?

karmic kite
#

anyone know how to fix the youtube autoplay feature when using the web browser plugin

worn wagon
#

This is in the context of a rep notify

#

on a pawn

fathom aspen
worn wagon
fathom aspen
#

Always look at the implementation

worn wagon
#

local controller with viewtarget

fathom aspen
#

And anyways think about it. How do you access another controller that isn't yours if you're on client

#

Local can be server, but usually it's client

worn wagon
#

I'm not trynna do that, I'm trying to get my local controller in the context of a pawn, I know I could also just do getfirstplayercontroller too

#

I heard there would sometimes be issues with that with steam networking? All heresay though

fathom aspen
#

So GetController would be enough

worn wagon
#

That function is nice though because it returns null if i'm not the owning controller or a spectator

fathom aspen
#

That is your controller again

fathom aspen
#

Which you seem to be doing

#

That function is there because they wanted a way to get the controller of the player spectating my pawn

worn wagon
#

I see, so since there's only ever the 1 player controller since it's clientside and no spitscreen, even Pawn->Controller will return the local player controller and not null if it's not the owner?

fathom aspen
#

But it's dumb because it returns only the first one it finds

#

And it's local mp

worn wagon
#

Okay, but it seems P;awn->GetController will return the local controller regardless of the owner?

fathom aspen
#

Ideally if you want a way to tell who's spectating you from the spectated pawn I would have an array of PlayerStates spectating that pawn

#

And based on them I can access a lot of stuff

worn wagon
#

Hmm okay

fathom aspen
#

It's also the owner

worn wagon
#

Aight so I need to use GetFirstPlayerController

fathom aspen
#

Since that happens under the hood when possessing the pawn

fathom aspen
#

Though it must be used client-side

worn wagon
fathom aspen
upper vector
#

im trying to create a new game mechanic in my 2d game, can anyone help me? (also what channel do i send this in)

fathom aspen
#

You seem to be playing the sounds on the server. Such cosmetic stuff should be done on client instead

#

Use the Remote pin instead and debug

pastel escarp
#

Any idea why when using ServerTravel , Only the host travel to the new map but other previously connected clients stay at the same map ?

fathom aspen
#

Shouldn't be the case. I find traveling in PIE weird sometimes so it could be it

#

If not show code

#

What actor that code is in?

#

Ok. Then I would debug. Other than that I can't spot anything sus

#

But a lot of things could be not working as you expect

#

I'm not an expert in sounds but this isn't not how I would play sounds. Instead I would have a multicast firing from the character that is shooting bullets (sound of a firing gun) and another multicast fired from the bullet actor when it hits something (sound of a hitting bullet). Both will fire fine as long as they are being fired from the server

#

Along the way I would debug and not count on PrintString

#

Even if it worked, it would play sounds only for the players in question. The shooter and the one being shot at, at best

#

That's not what you want

#

You want all relevant connections to be able to hear the sounds

#

This proves that my earlier message was dietered dietered

#

Reread what I sent you

fathom aspen
#

No. That defies what a multicast is

#

Use a client RPC then

#

Get Other Actor, check if that is a player character

#

And fire on it the client RPC that plays sound

#

So the client RPC is inside your character BP not bullet actor

barren surge
#

I'm finding that because only Client->Server RPCs can be issued in the PC owner chain, we are ending up with practically all the functionality in the game in the PC class/or broker ActorComponents attached to the PC. Are there any resources demonstrating a manageable approach?

fathom aspen
#

Well there are three: PS/PC/Pawn
And you can always make them own other actors, or attach components to them as you said

#

I don't see the issue in that. It's just how things work

sinful tree
#

Just a heads up, you want to avoid pulling values across execution paths, especially so in Multiplayer. The values from the OnOverlapBegin event are only valid on anything connected to its execution path and trying to use them on the separate Multicast event could result in unexpected behavior. The only reason it may be working right now is because that OnOverlapBegin also gets triggered on clients if the actor exists on clients, so it's pulling values from the last OnOverlapBegin event that was triggered on the client. If there's data that you want to pass through to the clients, then you use the RPC and add inputs to it so you can pass those values from the server to the client. So that being said, you may not even need to use an RPC for this - the clients themselves could be detecting the overlap event and playing a sound - and you could check if the "other actor" is locally controlled, and if so, play the sound - this way only the client whose character was hit would play the sound.

rancid monolith
fathom aspen
fathom aspen
#

There is one in PlayerState, if what you mean is GameFramework actor classes

#

APlayerState::GetPingInMilliseconds()

rancid monolith
#

that's what I was looking for, thanks

gleaming kite
tall blaze
#

anyone know how to go about randomly assigning players a role before the start of the game? for example like among us 1 player is assigned the role and abilities of a killer and everyone else is normal. or what this process is called so i can try to find some documentation on it. ive been struggling with this for a few days now. thanks

fossil spoke
#

This is common for games that require extra setup before allowing players to actually play.

#

PostLogin is called by the GameMode when a Player joins.

#

You can use this to do stuff like assigning them a team or any pre-play setup they require (like what you are asking).

#

You can then spawn and possess them a Pawn depending on your needs.

#

This would mean that you would leave the DefaultPawn field empty on the GameMode, as you want to give them a Pawn of your own choosing later on.

dapper jewel
#

Hi guys, little question how good i need to be to get a job in network programming in unreal engine?

fossil spoke
dapper jewel
#

Thanks you

#

Any tutorial for networking after the tutorial in unreal doc?

fossil spoke
#

Look through the pinned messages in this channel.

dapper jewel
#

@fossil spoke thank you

tall blaze
fossil spoke
#

The point is that the GameMode isnt deciding the Pawn as soon as the Player joins via DefaultPawn

#

You (as the developer) have to do that yourself instead.

#

When appropriate.

#

That might take the form of a Character Selection screen for example

tight plinth
#

Hello to all! Just some theory question. How network code of Gang Beasts works? Or Party Animal. Any ideas how did they make client prediction, lag compensation for fully physic-based games? Because i can't even understand how to replicate simple ragdoll in UE without input lag.

meager fable
short arrow
tight plinth
tight plinth
short arrow
#

I'm failing to see how that will help you with input lag

tight plinth
#

We can simulate it on the client till predictable location for example.

#

I don't know actually. Just thinking how can i compensate lag in my case.

#

Other idea is to use "long" attack animations. When attack starts we send command to server with attack type and anim start time. When server gets this RPC it will know when animation has started and exact hit time and location. We can cut few frames from animation (lag compensation) and start it from specific frame on the server. Once the hit has happened Server starts ragdoll simulation and sending of snapshots to the Client.
Kind of fighting games networking style.

tight plinth
#

By the way i'm pretty sure that Unity also using non-deterministic physic engine. So why it better for phys based games? Fixed frames not guarantee same ragdoll behaviour. I think ragdoll unpredictable at all. That's the main problem. Please correct me if i'm wrong.

#

Also i tried to turn on Physics Sub-Stepping, but i didn't mention any difference in ragdoll simulation. Shall i do something extra for it? Maybe it can help me to make ragdoll at least little bit more predictable to reduce deviation

left flicker
#

I'm trying to get the host to spawn in one spot and the players to spawn in another. 5 spots for the players and 1 for the host. I've got it set up so that if the player has authority they should go to the player start that is for the host, and if they don't then they spawn in the player starting pool. But everyone seems to have authority and spawn in the host spot
Why? lol

dim light
#

Hi man! Can u help me? I make game with multiplayer, and i need make a text with player nick top of his head, and i have: Client and server not replicated, how fix this?

fathom aspen
#

Well they haven't spawned yet. Use IsLocalController on the PC

fathom aspen
#

Also don't use multicasts

#

You are doing stateful stuff, that means you should stick to replicating properties

#

Also you have PlayerInfo replicated but it's in PlayerController, which means it's only replicated to owning client and just that (not to all)

#

Instead you use the PlayerState to store PlayerInfo which ia replicated to all

#

Use the search tool of this channel. This has gone over too many times

#

Also see pinned messages they have some juicy stuff you don't want to miss

left flicker
fathom aspen
#

I won't say no

left flicker
#

The first is in the game mode and the next two are in the player controller

fathom aspen
#

Again my answer still counts

#

In GameMode you're always server

#

So that HasAuthority is useless

left flicker
#

That makes sense

fathom aspen
#

Take the PC pin and get IsLocalController

#

Branch it

#

True - listen server player

#

False otherwise

#

Also why the heck you have RPCs

#

GameMode isn't replicated so there is no sense in having RPCs there at all

#

You're always on server there

left flicker
#

I was following a tutorial on youtube and that's what they did and it was working somehow

fathom aspen
#

Yeah not amazed at all

#

YT stuff

#

They work because they are executed as normal functions

#

But it's bad practice that shows you don't understand what's going on

sinful tree
#

You'll also have trouble with this bit of code. The players could end up spawning on top of each other.
Also, just because it's working, doesn't mean it is what you should be doing. RPCs are avenues for clients to potentially "cheat" or cause problems with the game. By leaving the "Assign Role" RPC available as Client->Server RPC means that any client could call it if they wanted, set their role as host which would bugger up your remaining spawning logic. This is something that the server itself should determine.

fathom aspen
#

Correct ^

#

You got lucky because you're in GameMode

#

Which is server anyways

dim light
#

@fathom aspen i do:

left flicker
#

@fathom aspen That's true. I don't really understand it too well. I'm trying to get it to work and then deconstruct it a bit to understand it better, while also making progress toward my project. I learn better by watching and following along, so I'm trying to rely on less than ideal youtube tutorials lol.

@sinful tree I knew it could have the problem of spawning on top of each other. I just did that up quick to test it out. I've got to go back and fix it up so that they don't do that. I don't know the ideal way to do that. I was thinking of getting those player starts in an array and then removing them after a player spawn there. But I don't know for sure.
But wow... I didn't know about the potential for cheating. That is pretty concerning. I'm not really sure of an alternative set up. I'll have to do some more digging and try to figure that out.

lol damn youtube tutorials

fathom aspen
#

You just "fixed" one point and left all the others @dim light

#

Reread what I sent you

dim light
#

GetXXX(0) its ?

fathom aspen
#

Yes?

sinful tree
fathom aspen
#

@dim light

#

That was another point you missed. Search tool is so damn underrated

fathom aspen
dim light
#

Sorry, thanks, i try, using search tool be hard for me, i bad know English....

fathom aspen
#

Though you will have to make sure that you store them in the array once @left flicker

left flicker
#

So, might be a stupid question... Should I just set the 'Assign Role' event to not replicate then?

fathom aspen
#

That can happen if you're the host as their is only one

left flicker
#

The tutorial, he did set it to replicate "just incase"

fathom aspen
sinful tree
#

That means this person has no idea about multiplayer.

fathom aspen
sinful tree
#

There is no "Just in case"

#

If you need to, then you do so, if you don't know you need to right now, you can always do it later if necessary.

fathom aspen
#

You have pinned messages in this channel. Should be enough. The compendium has been my favorite so far

dim light
#

@fathom aspen I need to init pawn in PlayerController or in Pawn? And need set pawn Ref to PlayerState ?

fathom aspen
#

Do it directly inside the pawn as I say in that forum link I sent before

#

There is no need for level of indirections here

#

The issue though is that you can't guarantee the PlayerState has replicated in time when you need that info

#

That's why you use a function that listens for such a thing: OnRep_PlayerState

#

If you're using BP only you'll find yourself lost cuz that is not exposed to bp

#

And for multiplayer you should be using cpp instead

left flicker
#

I have to go for a bit, but just really quickly before I do; After they spawn, they share a camera (the host has it's own and then the other players share one). And I did have it working before, but it doesn't seem to be working properly now The host gets the appropriate camera, but the players don't take to theirs. I'll try to sort it out later, but any feedback is always helpful. I'm sure I can figure it out either way.

sinful tree
fathom aspen
#

But in your case to workaround that, inside BeginPlay you do a SwitchHasAuthority check and use the Remote pin to get the pawn and set the info when it's there @dim light

fathom aspen
#

This Role system ughhh

sinful tree
#

I think the issue is that the possession of the player's pawn happens after the begin play of the level on the client, and thus forces the camera on to the pawn. Putting a small delay on the remote path appropriately had them move and stay on the second camera.

#

Yeah, the begin play of the pawn happens after the begin play of the level. Having no default pawn prevents the camera from changing from what was set in the level blueprint.

fathom aspen
#

Yeah the timing is the issue there and overall the level BP has always been sus. Instead I would do it inside an initiated event after they all spawn that traverses all the players and does that accordingly

#

You would still need to somehow reference that camera actor inside the bp in question

sinful tree
#

Nothing wrong with using Get Actor of Class with Tag in this particular instance if it's only done once at the start.

runic cairn
#

So I've been using this documentation as a reference point for how I tune my NetUpdateFrequency for actors, and I'm wondering if a value of 10 is just too low for player controlled characters. I mainly ask because the CMC relies on FRepMovement struct for simulating the movement of simulated proxies. At a value of 10, you only send FRepMovment every 0.1 seconds meaning everything in between updates is predicted and therefore larger deltas in the mis-predictions.

elfin lintel
#

Iโ€™m trying to figure out the best way to organize/implement class structure for my game. Itโ€™s a sports simulation type game similar to Out Of The Park baseball, so it seems pretty heavy on the data side, with so many classes that a player needs to be aware of at once (I think) (players/coaches/conferences/teams and related statistics).

Initially I had all of these as uobjects as I know I did not want hundreds and hundreds of actors when uobjects would work fine enough. After having some trouble replicating them and discovering this discord and reading that for the most part I should be using structs instead of uobjects unless I need inheritance (which I donโ€™t), Iโ€™m at a bit of a crossroads in terms of how to implement multiplayer functionality. Especially since I canโ€™t just totally convert my uobjects to structs because then I canโ€™t run UFunction RPCs on those structs like I can UObjects. So here are the options I see:

#
  1. Donโ€™t try to replicate everything or really very much at all. Use RPCs to retrieve the data when it is needed. (Server RPC GetTeamAStatistics() โ†’ calls Client RPC SendTeamStatistics(TeamAStatistics)). This feels clunky and seems like it would have a lot of near duplicative code, as I would need a different Server RPC and different ClientRPC for each context of requesting those statistics. (I could be wrong about this last sentence).

  2. Keep my Uobject functionality, but move stored data into a separate struct that can be replicated by an actor. This would mean calling server RPCs on the Uobject, which would then manipulate the properties on a struct that exists within its outer. This is what I implemented last night, and it seems to work, but feels clunky. Example of trying to change a property -> ParentOwner->DataStructInsideParentOwner.Number++;

  3. Get rid of the uobjects altogether and replace them with structs, with all the data and functionality. Since I canโ€™t have RPCs on the struct, move them to the structs owning actor. The RPC would be called on the actor, which would then call a (non-UFunction) function on the struct with all the actual functionality. Essentially the Actor owner would just be a conduit for all the actual functionality and properties living on the structs. I thought of this option as I was thinking this through, and seems like the best option, but I havenโ€™t implemented it / tried it yet and I am not sure it would work.

worn wagon
#

Is there ANY way to send RPCs to a specific client depending on a server side condition, no matter how hacky it is? There are some situations where I have to do a multicast but really it's a waste of bandwidth because only a few players need the information, if any at all. To my knowledge you can only send RPCs conditionally based on owning clients and nothing else.

#

I think back to coding in garrysmod where I could just do net.Send(Player) and wish there was something like this

#

Unless I'm misunderstanding something about RPCs, it seems like a really basic feature that should be available as standard.

elfin lintel
#

Could you send some type of playerID as a parameter for the multicast, then in the multicast check the clientโ€™s playerID against the parameter, and only run the code if they match?

marble gazelle
sinful tree
worn wagon
#

@marble gazelle @sinful tree Wow so simple I'm surprised I didn't realise it.

#

Thank you

marble gazelle
#

in the end: just needs to be a Client RPC for the owning client ๐Ÿ˜›

worn wagon
#

A little annoying to have to use the PC as a proxy, would be nice to keep the code somewhere else but it's fine I guess

marble gazelle
#

can be any actor that the client owns

#

or a component on this actor of course

worn wagon
marble gazelle
#

yeah, for normal client RPC it can be any actor that is replicated and owned by the client or a component on this actor

worn wagon
#

I want to send to specific clients, so like looping through all pcs on server, checking a condition, then only sending to those

marble gazelle
#

then give your PCs a component that wraps this communication for you \o/

worn wagon
tacit bough
#

I've been doing multiplayer stuff in Unreal for a little while now and it kind of works, but I basically "wing" it, instead of applying patterns. Here's my question: What does the general pattern look like for something I'd like to run on all clients and the server, regardless of the client or server initiating it?

How I'm doing it right now (it works, but could it be more simple?):

#

And yes, I've read the networking compendium/bible, but fail to take away BP-only relevant patterns for basic scenarios like this. That's what I need help with. Thanks in advance

sinful tree
tacit bough
#

An example of applying this would be a door. Would what you said about own replicated state still apply?

#

If I only have the event run on server, the door (in my example) only opens on the server (it doesn't replicate).

sinful tree
#

Lots of examples of opening doors in this channel already, but yes, the door itself would handle whatever replication it needed. You wouldn't need to do a multicast of the interact event itself.

tacit bough
#

Alright, thanks!

grave lynx
#

Hey, I'm storing a int inside the player game instance (to choose the max players for a lobby), then I would like to change the value inside the game state, because this class manage the lobby timer etc. I tried to access to the game instance inside de game state, but of course I can't, any other way?

sinful tree
#

So when the server wants the value, you'd RPC to client on their playercontroller lets say, that event can then pull the value from the game instance, and RPC back to the server the value, again on the playercontroller, then when running on server you can set the value in the gamestate.

gritty warren
#

Anybody have good suggestions for tutorials / courses for multiplayer games?

I'd straight up pay a pro to teach me how to make an optimized wave mode multiplayer game

fathom aspen
#

Check this channel pinned messages

gritty warren
whole vessel
#

I've been spinning my wheels for the past day trying to get any sort of online working between packages on two separate machines. I've tried Null and Steam, but at this point I'd be happy if I could just get LAN working, but no matter what I do, the FindSessions node returns an empty array.

I've tried almost everything I can think of, but nothing on my router yet. Would I need to set up some kind of portforward, even just for a LAN connection?

acoustic veldt
#

Hello All,

I have a question related to "Set Actor Location". The short version is that it seems if I call "Set Actor Location" in a "Run As Server" event on a client controlled actor..it is being completely ignored. The same "Set actor location" call that happens immediately after, on listen server controlled actor works fine.

Movement replication is otherwise working just fine.

I assume there is something fundamental I am missing that explains this however I haven't been able to pin that down. My assumption is the server should be able to move actors wherever so its surprising to me.

elfin lintel
#

Where are you calling the โ€œSetActorLocationโ€ server function? And is it the player pawn or another type of actor?

sinful tree
acoustic veldt
#

Hi There !

Set Actor Location is being called in custom event set to Run As Server inside the character blueprint. Yes, this is the players pawn.

Sorry if I use any terminology incorrectly.

sinful tree
#

This is some example code I've tested with on a first person character that is marked to replicate and is spawned by the server, and both the host and the client can move themself around to the different start points by pressing the E key.

acoustic veldt
#

Thank you for sharing that.. I wonder if its because I am passing the character to be teleported as a parameter into the event.

The first "Set Actor Location" Is using the character passed into the event as the target. (This is the client player pawn)
The Second Is using a reference to self as a target. (The self is the server and is working)

Note: I just manually typed in locations for each to debug this.

#

I will keep poking at it. Appreciate the responses that at least validate that I am not crazy ๐Ÿ™‚

sinful tree
acoustic veldt
#

Ah. Ok. That is great advice.

At the moment this event is only ever called by the server and never by the client. But I suppose there may be other ways a malicious actor could abuse this?