#multiplayer

1 messages · Page 139 of 1

torpid lantern
#

I read somewhere that I should be using a "start server" & "start client" .bat file to test dedicated server. Is that valid and if so why?

whole iron
#

If I was to set "gamemode settings" in a lobby map, and then transfer to a map (and have the aforementioned "gamemode settings" be saved through the level transfer (and thus impact how the game starts and is played) how would I accomplish this?

[Using Advanced Sessions Steam for multiplayer rn]

gentle mauve
heavy trench
#

Hi everyone, I have been following this youtube tutorial on how to create both server and client builds: https://www.youtube.com/watch?v=DrkG3W8a_ls. I was able to successfully build/package both server and client, but I receive a crash when a client attempts to join the server:

2023.12.30-12.12.59:322][806]LogWindows: Error: === Critical error: ===
[2023.12.30-12.12.59:323][806]LogWindows: Error:
[2023.12.30-12.12.59:323][806]LogWindows: Error: Assertion failed: CurrentApplication.IsValid() [File:C:\GAS Course 5.3\UnrealEngine-release\Engine\Source\Runtime\Slate\Public\Framework\Application\SlateApplication.h] [Line: 255]

There is more to the crash log, so I am attaching it as well. Does anyone know what this error means? Any help would be appreciated, and thank you in advance 🙂

In episode 17 of the UE5 game development series, we'll configure the project to build a dedicated server and standalone client. We'll show how to cook content for each of these configurations, as well as run them both in the debugger and from the command line. We'll then fix a bug that comes about when the client and server tick rates do not ma...

▶ Play video
frozen wraith
#

anyone? 😁

sour geyser
#

im stilling having trouble with this issue. would be glad if any would give the question a shot 😄

latent nest
#

In ue4, is playfab the best way to create multiplayer games for modes like team deathmatch and stuff, or should i try steam, or something compeltely different?

dapper arrow
#

Anyone have pointers on how to get behavior trees to play audio? I tried having the creature it's attached to send a multicast event but it doesn't seem to be sending it for some reason.

hollow eagle
#

Looks like that's inside a BT node? Those don't replicate, they can't have RPCs on them.

quasi tide
#

AIController is what runs the BT, via a braincomponent. AIControllers don't exist on the client (at least not from what I recall)

dapper arrow
#

Thanks! I'm a week into this so still figuring things out, so when you say call a function on your AI you mean the actual creature (in this case it's a robot)?

quasi tide
#

Yes

#

You can create an interface that you'd put on any AI that will run this node and inside the implementing actor, you'd call a multicast RPC

#

Or do a component that replicates

#

Up to you

dapper arrow
#

Yeah interface was what I was imagining in this case to make it more universal. Just to make it crystal clear, BT is never run on the client, therefore if I try to have it do a multicast it essentially does nothing because the other clients do not own the BT

quasi tide
#

Correct

#

There may be some setting somewhere where you can do it. But that'd be a very niche thing.

dapper arrow
#

Makes sense, yeah I've learned it's best to play by the normal engine rules to make it happy. Thanks for the info!

exotic merlin
#

Hello all, I'm running into an issue with a simple client server game, i've tested my game on both multiple machines and with network emulation and I get the same results. The issue is that character movement becomes a bit "chunky" once any amount of lag is introduced (25ms with network emulation). I have a simple ACharacter and I'm using the movement component to replicate to the server (I've tried to remove all other processing that might cause hitches). While I expect the lag, I didn't expect the movement to become hitchy, is this an artifact of running in the editor? or something else I'm doing wrong (if it's just the way it is, I get it, I just want to make sure I understand why). Thank you! (I can provide video if that is helpful).

gaunt cliff
#

--sigh-- So... I'm rather new to unreal engine multiplayer and I'm struggling with where to put what. I have a vague understanding how to use gamemode, player controllers, characters, etc... but when I want the client to communicate a manually changed nickname from their side to the server, I'm struggling with where to put the logic. I can do it... I've seen some people set variablesin game state since it's persistent until you close the executable and separate on client and server.

But, there's also player state.

My first idea was on the gamemode... on post login, to annouce "player xyz has joined the game!"

and "OnBeginPlay" I'd grab the game instance, and grab those variables. Buuuut I know the server has a game instance, by running "get game instance" in the gamemode of a server, wouldn't I be grabbing the server's game instance and not the client's?

And if I am grabbing the client's game instance, what if I want to access the server's game instance, how do I go about knowing which game instance I'm grabbing?

#

Essentially when in a multiplayer game... how can I call "get game instance" for clients and also "get game instance" for the server specifically? How are those calls different?

#

do I need to do custom events that say "only run on server"? or is there a better way?

thin stratus
#

@gaunt cliff

GameInstance is persistent, not the GameState

#

GameMode is server only, calling GetAnything there gets the server side version anyway

#

If you want the Client's GameInstance, you will need to ensure you call GetGameInstance locally

#

One way of doing that is in the BeginPlay of your PlayerController, limiting the call to local via IsLocallyControlled and a branch

#

You then need to send a Server RPC in the PlayerController with the Name retrieved from the GameInstance

#

In the server RPC you can then get the GameMode (since you are now on the server) and call ChangeName with the new name etc

#

In c++ it would theoretically be a bit simpler as there you could send the name in the connection string which is available in Login and PreLogin (not exposed to BPs)

gaunt cliff
thin stratus
#

You can't avoid RPCs

#

If you think you could then you are still highly misunderstanding this whole multiplayer thing

gaunt cliff
#

they can be expensive though, for something as simple as a name, I've setup nametags above player heads using only rep notify

#

i don't want to completely avoid rpcs

#

but the player state is automatically replicated right?

thin stratus
#

Stop thinking about stuff being expensive

gaunt cliff
#

🤣

thin stratus
#

You can't even program multiplayer games yet. And you are using BPs

#

If you want to be performant you will need C++ anyway

#

The RPC is required in your situation

#

You need to send the name to the server

gaunt cliff
#

could i load variables into my player state from my controller, or... my gamemode (main menu) then once a player joins, I can access those variables from the replicated player state?

thin stratus
#

No

gaunt cliff
#

i believe you, but could i get some understanding as to why not?

thin stratus
#

Only the GameInstance survives the joining of the server

#

So after joining all your PlayerController, PlayerState etc are fresh and new

#

And to set something in the PlayerState so the server can access it you still need to rpc

gaunt cliff
#

ahhh so anything on my client player state won't be in the copied servert player state

thin stratus
#

Correct

gaunt cliff
#

wait... why do they say player states are replicated to all clients?

thin stratus
#

There is no copy

#

It's a new object

gaunt cliff
#

or does that mean the server sends us player states, not the other way around

thin stratus
#

That means that a PlayerState of a given player is available to all connected players

#

Nothing else

#

Regular replication rules still apply

gaunt cliff
#

so it's like the player state object is automatically multicasted to all other players? am i saying/understanding that sort of correctly?

thin stratus
#

The PlayerState, same as any other replicated Actor when spawned by the server, will be spawned by the client/s too

#

Connected via a NetGUID

#

Have you read the compendium already?

gaunt cliff
#

I've browsed through it, but haven't extensively studied it no. I will defintely look more through it. I am curious, I followed a tutorial on how to put nametags above player heads and have that replicated to all clients, and the name is set from the client first. Is this using an RPC? I only see the rep notify

#

in my "onrepname" function

#

it's accomplishing this, i think without an RPC?

#

or is it an rpc just without using a custom event?

thin stratus
#

Why would this need an RPC

#

The server already had the default player name

gaunt cliff
#

because im uploading a player name from client to server and then having all players see it?

thin stratus
#

No you are displaying the default player name in those screenshots

#

Nothing there says you are uploading stuff

gaunt cliff
#

ohhh it's the get player name running on the server, correct?

#

for context, this is a view from the player character class

#

without steam running (using advanced sessions plugin) it just displays my computer name with part of the net ID stuck on the end

thin stratus
#

Yeah that's the default usually

gaunt cliff
#

gotcha, I'll dig more through the compendium. I just had this feeling using RPCs all over was the wrong way to do things, like unreal engine had a different built in way to replicate variables to and from the client/server

#

Multiplayer is wacky to wrap my head around, things in single player were easy because you can put logic anywhere usually, at least on a persistent level

#

Now... I'm haivng to learn the proper way to do things and where to put certain logic

#

It's... a lot AHA but Im very interested in getting it right

#

the long way if need be

#

thank you for the insight @thin stratus

thin stratus
#

Server to client is normal replication of variables

gaunt cliff
#

so rep notify and multicasting right?

thin stratus
#

With OnRep being an optional convenient addition to get notified when the variable replicated

#

In BP that's more a property changed notify, so it calls for server too and also if the client would Change it locally ( then only on the client though )
C++ it only calls for clients. When the server sets the variable and it replicated

#

Additionally server can client RPC on a client owned actor to target a player

#

Or multicast in an actor that is replicated to everyone

#

Such as GameState, Character, PlayerState and such

#

Or your own fwiw

gaunt cliff
#

I'm very glad I took a few classes in c++ and did quite a bit on my own. It made it a lot easier reading through advanced sessions source files and then to unreal engine's PlayerState header files... finding the declaration .cpp didn't feel straight forward though in visual studio.

I definitely plan to dive into unreal's c++ soon here because it's not alien to me, but I'm greatly enjoying mainly doing blueprints for now. I still have much to learn.

#

I also found a little tidbit to smack me on the head in terms of security concerns... having a client dictate anything is usually not a good idea

"What do you mean by “send data” then? You can send whatever events or functions you want, at whatever time you want, to the server. How does this not let you send data to the server?"

"Btw: In general, sending data (rather than just UI/events) to the server greatly increases the attack surface for cheaters/hackers. There may be cases where that’s OK, but I’d be very careful about this in any game put up on the internet."

#

and from another post I found...
"For replicated variables, the server has authority. So for the client to dictate anything you’re pretty much limited (rightfully so) to RPC."

"You really need to be more clear what you’re trying to accomplish with this client-server relationship. The answer to this question is dependent on this."

https://forums.unrealengine.com/t/how-do-you-send-data-from-the-client-to-the-server/14541/7

Epic Developer Community Forums

It’s not exactly clear what you want. Do you want to send things via RPC to the server? That’s in the tutorial. For replicated variables, the server has authority. So for the client to dictate anything you’re pretty much limited (rightfully so) to RPC. You really need to be more clear what you’re trying to accomplish with this client-server re...

obtuse field
#

How can I debug server when it crashes? Running Launch Seperate Server - true and Run under one process - false

#

I know it produces logs, but I can't e.g. look up the variables in IDE during debug mode, like with client crashing

hollow eagle
#

attach the debugger to the new process

pseudo crest
#

Hello, often in my multiplayer game the player's character freezes in the current animation frame instead of simulating physics when he dies, anyone knows why?

whole bobcat
#

I'm fairly new to making multiplayer game was curious on what part to start on first i was thinking of making a single player game first then working to make it multiplayer but idk if that is the best approach or not -

quasi tide
#

Definitely not. Design for multiplayer from the start.

worn steppe
#

yeah adding multiplayer to a single player design is the kind of thing they make people do in hell

mystic marsh
mystic marsh
quasi tide
#

Is it reasonable to assume PostNetInit will run after PostInitializeComponents?

worn steppe
dark edge
#

That's like what, 10% of the whole game? Ez

sharp vigil
#

how often is the gamestate updated to clients?

thin stratus
#

Check its Replication Settings I guess

#

It's an actor after all

sharp vigil
#

Ah ok thanks

fathom aspen
#

Since PostNetInit never runs on static ones

buoyant hazel
#

Hi guys, I have a locked door with a password, when I go to the door and press E, if it's locked, it display a widget asking for the code, you type the code and if the code is correct the widget trigger an event interface to the charactere BP and then, the charactere BP ask the server to unlock the door on the door BP. When the widget trigger the event on the charactere BP It failed due to "no owning connection for actor BP_charactere". Do you have any idea why ?

fathom aspen
#

ask the server to unlock the door on the door BP
This is your problem

#

Actors not owned by the player can never fire meaningful server RPCs

#

Move the server RPC to the character and it will work

buoyant hazel
buoyant hazel
fathom aspen
#

no owning connection for actor BP_charactere
Yeah I just realized the spewed error is referencing the character...

#

...which is weird in your situation since if you as a player able to control your character and move to that spot and press an input, then it means the controller is actually owning your character

#

So the character in theory should have a net connection

#

In this situation I would really debug the hell of what's going on in cpp

buoyant hazel
#

Yeah and when I pressed M key I look is locally controlled and everything is fine. If I trigger the same event not from "keypad" but from a key pressed it work just fine. But when it pass by the keypad event it failed "not owning connection"

fathom aspen
#

Indeed if it passes the IsLocallyControlled check then it should not fail with that error

buoyant hazel
#

Oh I forgot to say, If the server is doing it everything work fine from the keypad to the characterre to the door. The issue is only when I try it white a client

fathom aspen
#

Yeah a server would never get that error

#

Since the whole logic is local to the server

buoyant hazel
#

I had the same code on another project and it worked just fine from the first try, I wanted to rebuild it with the plugin "multiplayer modular lobby", I'm not sure why but maybe the plugin create the issue...

fiery wadi
#

If for example I have Map 1 which uses Map1GameMode which has a Username variable inside it, then the player is transported to Map 2 which has Map2GameMode how would you get the Variable from Map1GameMode during the OnEventPostLogin event please?

fair latch
limber gyro
#

i have a dash in the CMC that works in the editor but doesnt work in shipping, has any one seen this before?

fathom aspen
#

To add to what has been said, such a variable can always be concatenated to the Options String which gets sent to the server for a joining client. In fact there is already a "Name" option that you can use (look for InitNewPlayer() function for more) @fiery wadi

fiery wadi
#

Ahh ok thanks for the info, I Was storing the username/playername in the GameMode from Map1 but ofc (Lobby Map) GameMode2 couldnt see it I didnt know you could pass through data in the travel info I,ll look at INitNewPlayer() also but I,ll also look at the SaveGame Object too thanks, Just a quick question I would assume a SaveGame Object is a constant over ANY game mode/instance, and the same can be applied with a Game Instance (IE... The Game Instance is the same regardless of the Game Mode when changing Maps)?

fathom aspen
#

SaveGameObject is saved to your disk, hence why it's resilient to travels

#

However it's going to be local to your player/client, meaning that you will still have to send it to the server

ebon sentinel
#

Hey guys, I'm running into an issue with an event not firing. It's a super simple actor which auto recieves input from player. On the server all of the prints fire up normally but on a client, the "Pressed Action1" print string fires but SR and MTC do not. I've also attached the replication settings for this actor. Thank you all in advance.

#

As you can see on server all of them fire. But on Client, only the Pressed Action1 fires and then it gets stuck

fathom aspen
#

The obvious usual reason for this is that the said Actor is not owned by the player

#

The flash light actor in your case

#

Only Actors owned by the player can fire server/client RPCs

#

If you was to check your output log you would see an error that says: "no owning net connection for actor flash light"

#

Actors owned by the player are usually: PlayerController, PlayerCharacter, PlayerState

ebon sentinel
#

Oh yeah

#

Okay so in this case, when the flashlight is "equipped" I can set its owner to be the player and it should work okay I assume

fathom aspen
#

Not that I recommend such an approach

#

Imagine that you need the same thing for your door

#

Vending machine

ebon sentinel
#

Was going to ask about more global stuff like a door yeah

fathom aspen
#

And whatever other thing that might come to your mind

#

Just route it through the previously said actors

#

If the player was to own the actor, it means that no two players can "control" the same actor at the same time

ebon sentinel
#

So essentially, have an "interact" event that fires on the player and not the actor itself (like the door) that then routes and fires up any relevant event? Like opening the door would be handled via the interact that is housed on the player. Then the multicast would open the door. I have something similar for picking up the flashlight and dropping it which is handled by the player char and they work just fine

fathom aspen
#

Usually you do own the actor, when that actor is a weapon that gets attached to the player for example

ebon sentinel
#

Awesome! But what about an actor that needs to fire events that never gets interacted? Like say a chest that would just open on its own

#

Does it need to be routed through something?

fathom aspen
#

No, since it's not instigated by the player, but instead driven by the server

#

In such an actor you just fire the multicast just fine

#

Multicasts are excluded from the previous rules

ebon sentinel
#

Oh right, because the event fires on the server and then the server tells everyone else

fathom aspen
#

Unowned actors can fire them just fine

#

Correct

ebon sentinel
#

Thank you, that clears up so much!

fathom aspen
#

Good to note though, that the use of multicasts in your case is still questionable

#

Multicasts have two weaknesses

#

They don't care for late joining clients, and they don't care for clients that the actor they are fired on is not relevant

#

Fire a multicast, make a client join, the newly joined client won't see the effect of the multicast

ebon sentinel
#

I see I see

fathom aspen
#

That's why you refer to "replicated properties" in such a case

ebon sentinel
#

Oh wow this is a very good resource

#

Thanks!

fathom aspen
#

Yeah the whole blog is super useful

#

np

fathom aspen
#

To be honest I would love to be able to assume that BeginPlay fires after replicated properties are received on statically placed actors

#

Like it's the case for their dynamically spawned counterparts

quasi tide
#

Is there a PostNetInit equivalent for static actors? Why wouldn't it fire off for static actors?

#

Not that I need it. Just curious.

fathom aspen
#

Sadly no. It wasn't built to work that way

#

Basically:

if (Actor && bSpawnedNewActor)
{
    SCOPE_CYCLE_COUNTER(Stat_PostNetInit);
    Actor->PostNetInit();
}
#
bool bSpawnedNewActor = false;    // If this turns to true, we know an actor was spawned (rather than found)
#

Guess imma just yolo and remove that additional check and call it a day EvilBlob

quasi tide
#

That's just silly.

#

Where do you find this?

#

(Not at my PC at the moment)

fathom aspen
#

UActorChannel::ProcessBunch

#

I think part of this decision comes from the fact(?) that the engine isn't capable to guarantee receiving all replicated properties in the initial replication frame for such statically placed actors

#

But I just can't think of a valid reason as to why the engine won't have such a capability

thin stratus
#

I wonder if that bug with OnRep still exists, where if you have an OnRep, InstanceEditable boolean (for example) set to TRUE in the BP class, then to FALSE in the Instance.
And then set the Boolean to TRUE on BeginPlay (Server only) that it wouldn't call OnRep for the Client

whole bobcat
fathom aspen
thin stratus
fathom aspen
#

I think I just solved an enigma I have been chasing for a while now. Basically if you are using streaming volumes or WP, sooner than later you will start getting the following warning in your logs:
LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: MyDumbActor

It simply means that a certain Actor that is (1) replicated, and (2) placed in your level, has failed to load. The issue happens when the engine replicates the actor before it had a chance to load, which results in the ActorChannel failing to permanently open, and will remain closed until you force a reload of the owning streamed level. The issue will also have better chances to happen if you introduce lag and packet loss.

It turns out that Epic knows about this issue, and hence why they already implemented a mechanism to protect against it. However it seems that they just never cared to enable the most important piece of the mechanism

#if UE_WITH_IRIS
    static bool bShouldServerUseMakingVisibleTransactionRequest = true;
#else
    static bool bShouldServerUseMakingVisibleTransactionRequest = false;
#endif
    FAutoConsoleVariableRef CVarShouldServerUseMakingVisibleTransactionRequest(
        TEXT("LevelStreaming.ShouldServerUseMakingVisibleTransactionRequest"),
        bShouldServerUseMakingVisibleTransactionRequest,
        TEXT("Whether server should wait for client to acknowledge visibility update before treating streaming levels as visible by the client.\n")
        TEXT("0: Disable, 1: Enable"),
        ECVF_Default);

Basically the server doesn't wait for the client's Ack, and yolos... what feels weird to me is that they only enabled it for Iris... like wtf
I ran some tests with the CVar enabled and it seems to fix the issue, but I have to yet run more tests.

fathom aspen
#

Pff turns out it doesn't really fix it although that's really what it is meant to be fixing 😮‍💨

abstract aspen
#

im just ask the question at the sake it sounds dumb..... does my quest system need to be replicated for a multiplayer game thats not sharing the quest with other payers?

quasi tide
#

It depends™️

#

Nothing wrong with replicating information if it makes it easier for you.

abstract aspen
# quasi tide It depends™️

it will be simple things just to go from starter area to next town or something nothing major just want to add a little interaction

quasi tide
#

You can do that entirely server side, sure. But the client has to have some way of knowing what quest they're doing and what objectives they have. As well as current progress of said quest.

sweet sage
#

Is there a way to maintain array order over network?

mystic marsh
sweet sage
#

It does not have rn

#

i`m trying to create a replicated inventory

mystic marsh
#

What’s your array property look like?

quasi tide
#

A little bit ago, siliex did a good job at explaining how things can fail in a real world scenario

sweet sage
#

Maybe i will need to use N serialized objects instead of array?

#

My array is fixed size anyway

mystic marsh
#

A UPROPERTY(Replicated) TArray<AActor*> will have the same order, eventually, BUT since not all the actors will be replicated at the same time it may initially have null entries in it on the client

#

Or for longer if they're not all relevant to that client, for example

sweet sage
mystic marsh
#

Yes

sweet sage
#

It is not, i`m not sure why :c

mystic marsh
#

Again, what does your property look like? Does it replicate at all?

sweet sage
#

Humm

#

This is not the problem

#

I found the problem

#

It is UI bug

#

Looks like i need to call SetListItems again

#

every time it changes?

mystic marsh
#

You definitely have to do something when it changes, yes

#

That isn't binding the list view to your array, it's setting the list view up with a copy of your array in it's current state

sweet sage
#

I see, ty

sweet sage
#

It is not replicating changes

#

When i reorder on server this OnRep_Items is not even called

mystic marsh
#

And you have a DOREPLIFETIME for it?

sweet sage
#

Yes, it works when i change containers

#

for example

#

Look

#

`When i change from slot index 0 to 1 on bag container it change order on server but no client

#

maybe FFastArraySerializer can fix this bug

mystic marsh
#

Seems unlikely, but maybe it'll help you track down what's really happening. What you've posted so far should be straightforward and should work.

sweet sage
#

"The tradeoff is you have to mark elements in the array as dirty when game code changes them. List order is also not guaranteed to be preserved between client/server in all cases."

#

List order is not guaranteed. I think the only way is using RPC

#
UItemContainer::UItemContainer(const FObjectInitializer& ObjectInitializer) :
    Super(ObjectInitializer){
    Items.SetNum(40);
}

void UItemContainer::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const {
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);

    DOREPLIFETIME(UItemContainer, Items);
}

UItemInstance* UItemContainer::GetItem(int SlotId) {
    if (SlotId >= 0 && SlotId < Items.Num()) {
        return Items[SlotId];
    }

    return nullptr;
}

bool UItemContainer::TrySetItem(int SlotId, UItemInstance* Instance) {
    if (SlotId >= 0 && SlotId < Items.Num()) {
        Items[SlotId] = Instance;

        return true;
    }

    return false;
}

bool UItemContainer::ReplicateSubobjects(class UActorChannel* Channel, class FOutBunch* Bunch, FReplicationFlags* RepFlags)
{
    bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);

    for (int32 Index = 0; Index < Items.Num(); ++Index) {
        WroteSomething |= Channel->ReplicateSubobject(Items[Index], *Bunch, *RepFlags);
    }

    return WroteSomething;
}

UFUNCTION(BlueprintPure)
TArray<UContainerItemModel*> UItemContainer::GetContainerItems() {
    TArray<UContainerItemModel*> Models;

    Models.SetNum(Items.Num());

    for (int32 Index = 0; Index < Items.Num(); ++Index) {
        Models[Index] = NewObject< UContainerItemModel>(this, UContainerItemModel::StaticClass());

        Models[Index]->Container = this;
        Models[Index]->SlotId = Index;
    }

    return Models;
}

This is my ItemContainer code

#

bool UItemContainerBase::TrySwapItem(int SlotId, UItemContainerBase* OtherContainer, int OtherSlotId) {
    if (IsValid(OtherContainer)) {
        if (OtherContainer == this && SlotId == OtherSlotId)
            return false;

        UItemInstance* SelfItem = GetItem(SlotId);
        UItemInstance* OtherItem = OtherContainer->GetItem(OtherSlotId);

        if (TrySetItem(SlotId, OtherItem))
        {
            if (!OtherContainer->TrySetItem(OtherSlotId, SelfItem)) {
                if (!TrySetItem(SlotId, SelfItem)) {
                    return true;
                }
            }
        }
    }

    return false;
}

this is the swapper code (called from client and run on server

#

chat gpt generated

#

40 items for me, much better

mystic marsh
sweet sage
#

Simple array is broken

#

I will repeat 40 properties

#

my inventory is fixed

mystic marsh
#

But horrifying

sweet sage
#

Look this shit

mystic marsh
#

no

hollow eagle
#

fast arrays do not guarantee order. But quite frankly that shouldn't matter, just make your own ordering property on your struct

#

you don't need to worry about the order of the array if that's not what you actually display anyway

hollow eagle
#

you don't though

#

you just swap the values of their "order" property

#

the actual position of the item in the array is irrelevant

sweet sage
#

I see

mystic marsh
#

This is what I've done for inventory too - there is no replicated array at all. Items know what container and slot they are in, and the client builds an array from that. The inventory has no replication at all other than existing, basically.

#

That said, what you were trying to do should work and is simpler to think about initially.

sweet sage
#

What

#

the 40 properties?

mystic marsh
#

No. No replicated properties in the inventory at all. Only in the items.

#

Is what I'm done. I'm still suggesting your original array should work.

sweet sage
#

I tried the 40 things and it is broken, maybe it is another code

#

I think it is the Outer object not changing

#

I fixed the bug

#
bool WroteSomething = Channel->ReplicateSubobject(Equipments, *Bunch, *RepFlags);

Channel->ReplicateSubobject(Bag, *Bunch, *RepFlags);

Replaced this with

bool WroteSomething = Channel->ReplicateSubobject(Equipments, *Bunch, *RepFlags);

WroteSomething |= Channel->ReplicateSubobject(Bag, *Bunch, *RepFlags);
#

and now it works

pseudo crest
#

I'm starting to think that when a client is playing an animation and he dies, it gets frozen when I execute the simulate physics node.

#

The function is multicasted and simple. I don't know yet why this happens

thin stratus
#

@pseudo crest Reliable multicast?

#

In theory this is all a state and should be handled via OnRep instead of Multicast

pseudo crest
#

It's not reliable but all my friends that are testing with me have low ping and good connection

pseudo crest
thin stratus
#

Yeah most tutorials also suck

#

And if they do it and it's important then it should at least be reliable

#

But OnRep would be better

pseudo crest
#

Well, I think I gonna change to OnRep and test to see if it stop the bug

#

@thin stratus thank you

summer tide
#

I'm trying to replicate BreakConstraint function. I was able to replicate SetContraint.

onyx jolt
#

Can we use playfab dedicated server for multiplayer mobile game only. Android and ios only. With features like matchmaking lobby etc (pubg like).
Does playfab support for both Android and ios?
And any other good service except playfab then please suggest also

thin stratus
raw thunder
#

Hello everyone,
I have a UI that is waiting for a valid player state. I was checking the OnPossessedPawn but sometimes on the client the pawn is changed before the player state is valid. What is the proper way to wait for the player state initialization?

#

for now the way I do it is like this but I don't like it...

sharp vigil
#

I notice when I run my game as a client->set team ID of player->then retrieve team ID-> I get a default value I coded instead of the one I set.
This is all happening in the beginplay portion of my blueprint. Everything is being executed in sequence.

If I retrieve the team ID after the beginplay event is finished then my team number is the value I set.

Am I just not accounting for latency in this case? Or is there something more going on?

raw thunder
sharp vigil
#

Yes

raw thunder
#

You can use OnRep function for cases like this

sharp vigil
#

It's on a component. The code works perfectly if I'm the listen server

raw thunder
#

And you are setting the variable on the server ?

sharp vigil
#

Yes

#

The code still functions properly if I'm the client and get the value after beginplay has ran through on my BP. So I think my code is correct for client/server

raw thunder
#

I suggest to use a OnRep Notify function, like this every time the value is changed you can run your code

sharp vigil
#

Yeah that's the thing too. I see it saying the team is changed on client and server with my onrepnotify as well

raw thunder
#

What is the issue then?

sharp vigil
#

Hang on.. screenshotting..

#

This is a part of my beginplay. The team ID is set. Then when I go to initialize my HUD I get the team ID. The team ID I'm retrieving is incorrect.

If I take that initialize function out of begin play and manually trigger it retrieves the correct team ID and everything is hunky dory.

raw thunder
#

Oh so in the intiialize function you need the teamID ?

#

Yes this will not be replicated directly since it needs time to go to the server and come back, What if you put the Initialize in the OnRep function?

sharp vigil
#

ah good point okay I think I see the path forward. This is due to latency then

#

Thanks!

raw thunder
#

Yes 🙂

sharp vigil
#

I'll have to do some on rep in my BP then. My code is mostly in C++ but I do the UI stuff in UMG

#

appreciate the help

raw thunder
#

No problem

onyx jolt
#

If we used Amazon gamelift dedicated server. Can we use Amazon online subsystem to connect it?

sharp vigil
fiery wadi
#

I just wanted to say Happy New Year to all and thanks to all the professionals and people in the "know", Who spend their time helping the rest of us with issues. 🙂

raw thunder
sharp vigil
#

My concern was if I had an event where it just triggered on the client being updated but someone was a listen server

#

like if I had on_rep->event triggered->populate HUD

raw thunder
#

I am not sure to follow

sharp vigil
#

I want to trigger an event after on_rep is finished. That event will populate my HUD. The only reason I'm having an event to populate my HUD is because the issue I was facing earlier where the client wasn't switching the variable fast enough when beginplay was called

#

but if I have an event on on_rep in just the client portion of it that wouldn't work for p2p multiplayer right?

#

Since someone is playing as the listen server

raw thunder
#

Why not call the HUD initialization directly in the OnRep?

sharp vigil
#

because that code is in my C++ while my HUD initialization is in my blueprint.

raw thunder
#

I'm not on my computer but can't you override the OnRep function in BP? Or yes you could create a function for this

sharp vigil
#

yeah I think that'd work

#

thank you

raw thunder
#

Great 😉

noble sentinel
#

Why clients cant apply damage to server? Im running it on server

raw thunder
noble sentinel
#

Isnt this running on server thing RPC?

#

I think I messed something

raw thunder
# noble sentinel Isnt this running on server thing RPC?

Where do you call bodyshot and headshot server? These functions are RPC to the server. I think the variable damaged actor will not be valid if you check it in these functions. You likely need to add this as a parameter in your function and pass it when you call the RPC.

noble sentinel
raw thunder
#

Great

fiery wadi
#

Any ideas why T1 Points is 0 when I have 4 Player Start objects with Tag's T1 in the map please

#

This is done within a Lobby Game Mode, I have a Lobby Map which uses this Game Mode and then a Player chooses a Team to be on T1 or T2 and then the game mode choose a random location out of the T1 or T2 Spawn Points but because theres no T1 spawn points being returned for some reason it cant place an actor in a random location

#

I tried getting all actors of Player Start then looping through their tags and it output So it;s recognising all the tags for the player starts so not sure why the array is still 0. :S

#

I decided to loop through all the player starts instead and filter them by their tags as that seemed to be working not sure why the othe way wasnt working

blazing spruce
#

Hi, I've got a spectating system set up so when the player dies they start speccing other players but i want the spectating player to be able to see any post processing effects that happens to the player they're spectating, right now im doing some post process fx when the player gets into low health states for example but the spectating player doesn't see them because I'm only running them on the owning client atm, how can I go about changing it so that the post processing fx are also replicated to any currently spectating players as well?

torpid lantern
#

So when my server spawns an actor, I need to create a widget and then store the actor's ref. on that widget.

For the sake of performance, would it be better to fire off an interface call to the local player's controller and have them create that widget - or create the widget and set variables on the server immediately after actor spawn? Or does it not matter?

quartz star
#

I'm trying to rotate my character when pressing 'a' or 'd'
The replication works fine except that my client only rotates with half the speed than the server does.
I printed out the new rotation yaw and it seems like the client is not increasing the yaw value every second function call.
Can someone help me with that?

Log:

LogBlueprintUserMessages: [DefaultMap] Client 0: 0.41667 
LogBlueprintUserMessages: [DefaultMap] Client 0: 0.83334 
LogBlueprintUserMessages: [DefaultMap] Client 0: 0.83334 
LogBlueprintUserMessages: [DefaultMap] Client 0: 1.25001 
LogBlueprintUserMessages: [DefaultMap] Client 0: 1.25001 
LogBlueprintUserMessages: [DefaultMap] Client 0: 1.66668 
LogBlueprintUserMessages: [DefaultMap] Client 0: 1.66668 
LogBlueprintUserMessages: [DefaultMap] Client 0: 2.08335 
LogBlueprintUserMessages: [DefaultMap] Client 0: 2.08335 
LogBlueprintUserMessages: [DefaultMap] Client 0: 2.6293
LogBlueprintUserMessages: [DefaultMap] Client 0: 2.56594
LogBlueprintUserMessages: [DefaultMap] Server: 0.41667 
LogBlueprintUserMessages: [DefaultMap] Server: 0.83334 
LogBlueprintUserMessages: [DefaultMap] Server: 1.25001 
LogBlueprintUserMessages: [DefaultMap] Server: 1.66668 
LogBlueprintUserMessages: [DefaultMap] Server: 2.08335 
LogBlueprintUserMessages: [DefaultMap] Server: 2.50002 
LogBlueprintUserMessages: [DefaultMap] Server: 2.91669 
LogBlueprintUserMessages: [DefaultMap] Server: 3.33336 
LogBlueprintUserMessages: [DefaultMap] Server: 3.75003 
LogBlueprintUserMessages: [DefaultMap] Server: 4.1667 
LogBlueprintUserMessages: [DefaultMap] Server: 4.58337 
LogBlueprintUserMessages: [DefaultMap] Server: 5.00004 
#

My Code:

void AOceanityPlayerController::TurnShip(const FInputActionValue& Value)
{
    float InputAxisValue = Value.Get<float>() * GetWorld()->GetDeltaSeconds() * 100.f * GeneralTurnSpeed;
    const FRotator ActorRotation(GetPawn()->GetActorRotation());
    const FRotator NewRotation(ActorRotation.Pitch, ActorRotation.Yaw + InputAxisValue, ActorRotation.Roll);
    GetPawn()->SetActorRotation(NewRotation);
    UKismetSystemLibrary::PrintString(GetWorld(), FString::SanitizeFloat(NewRotation.Yaw));
    Server_ReplicateShipRotation(NewRotation);
}
torpid lantern
# mystic marsh Servers can’t create widgets

I just double-checked and I did gate this behind a "Switch has authority = remote".

So would that mean all of my players are going to try and create this widget? I do have the intended player controller set as the "Owning Player" pin and the logic does work, but I don't want have player B try to create widgets for player A, if it's not needed. Likewise I don't want to be sending interface calls to the controller if it's not needed.

mystic marsh
#

Any client you want the widget to appear on needs to create the widget. Player controllers only exist on the server and the owning client. So if a controller opens the widget, only that client will open it.

torpid lantern
#

Thank you!

hushed sigil
#

I'm having this replication issue where the first time a player picks up an item it's not replicated (client side it's still sitting on table, with empty hand). But after putting it down subsequent pickups are replicated just fine.

#

After doing some research I'm wondering if this is some net dormancy issue (somehow not detecting the item needs to be replicated the first time it wakes up)

#

I could try and force replication but wondering if I'm missing some other underlying issues. Shouldn't every time an actor moves it should get replicated?

latent sapphire
#

so i have this code that suppost to move the items around when i press the interact key and it does that but when i try to replicate it is buggy and it only replicates to th client and not back to the server

limber yoke
#

Hey I just realized that there's a multiplayer chat and have been attempting to fix a problem over in #cpp . Does anyone who understands the UE socket system have a moment to help me with an unintended behavior?

#

To give context, I am attempting to create a socket for every character that is spawned. These sockets connect to an external python server that generates a unique socket for each one, processing the data, and sending back movement instructions to the character. This works great with a single character, but when I add 2+ characters, my python server sees the unique sockets that were created for each character, but UE abandons all sockets except one. It begins sending all character information through a singular socket and receives all data to that socket.

mystic marsh
#

You’ve only made one static socket. Right at the top. The second client will overwrite the first, etc. You’re losing track of all but the last socket created.

#

You need socket to be a member of the character or a component or something, not a static variable

limber yoke
#

OHHHHHHH I think you're right. That is so strange! So even though the class is instantiated independently in each character, it shares the memory for the static socket?

mystic marsh
#

“Static” means there’s only one for the entire application

limber yoke
#

You're a god send. This is huge and a dumb misunderstanding of how classes work on my end. Thank you!

#

If you don't mind, do you have any tips on implementing this better? I have this loop hooked up to the onplay

latent sapphire
#

how do you get an actor to replicate

#

or whats the best way to do it

quasi tide
#

Just check the "Replicates" box in the details panel

latent sapphire
quasi tide
#

Or in the constructor (in C++), set bReplicates = true;

quasi tide
#

You asked how to make it replicate

#

That is how you make it replicate.

latent sapphire
#

ok

latent sapphire
quasi tide
#

That's because replication only happens from server to client

latent sapphire
#

ok

quasi tide
#

"it jitters" means jack all without more context

#

Am I just to magically know what you're doing?

latent sapphire
#

my fault

#

i have a blueprint that allows me to pick up objects

#

but i need it to replicate the movement

#

how would one do this

hexed pewter
#

In a mutliplayer Arena FPS game scenario as a method to prevent Wall Hack cheats is it possible to not send information about other players positions to the client until that client is about to see them? Say there is some method of determining if Player A is going to see player B on the server in 300 ms and only then send the players positions to each other?

quasi tide
#

That's pretty much how Riot does it with Valorant

fossil spoke
#

I believe from memory the ShooterGame example project has something akin to this.

#

I could be misremembering though.

dark edge
#

You can't just check if visible, then replicate as that introduces delay

#

you need to check if about to be visible, which is a much harder problem

onyx jolt
#

Red point online subsystem is good for multiplayer?

fossil spoke
onyx jolt
#

U used it bro?

fossil spoke
#

I have and still do.

onyx jolt
#

You are using dedicated server or peer to peer?

fossil spoke
#

I use both

#

Also Peer 2 Peer is not what you probably think it is.

#

Your 2 options are Dedicated Server or Listen Server

quasi tide
#

I have their EOS one. I've only heard good things.

onyx jolt
#

which dedicated server should i use for easy setup with EOS red point?

quasi tide
#

Oh snap. I also have the Online Susbsystem one. Didn't even know that. lol

blazing spruce
fossil spoke
#

How you manage that is up to you I guess.

#

Personally, something like Health is typically information that everyone might want to know (although this can be untrue for certain games depending on their requirements).

#

If the Health was replicated to everyone, then the Spectator would have the information on hand to manage playing a PP effect when necessary.

blazing spruce
hollow eagle
#

World->GetNetMode()

mystic marsh
#

It matters a lot what kind of subsystem it is. If it’s a GameInstance subsystem the world and game mode won’t be initialized until after this subsystem.

#

Siliex is right anyway. Use GetNetMode instead

hollow eagle
#

almost nothing about the world will be ready

#

subsystems are initialized super early

#

that's why there's a separate begin play event from the usual initialize function on world subsystems.

#

but even if the gamemode was ready you still would be doing things the wrong way here, net mode tells you whether you're a server or not.

#

seeing if there's a gamemode or not is a very roundabout way of getting that same information.

#

and preprocessor directives for this purpose are strictly wrong, they are evaluated at compile time. The editor cannot change their result, nor can deciding to run a game build in server mode.

mystic marsh
#

Creating subsystems you don’t need isn’t really a big deal by itself either. The existence of one doesn’t have any meaningful cost. So you can just let it create it anyway and later, when everything is initialized, decide if it actually needs to do work or not.

hollow eagle
#

this has nothing to do with cheating

#

a subsystem existing or not will not do anything about cheating

mystic marsh
#

If you want code that’s only on your dedicated server, you can do that, but the right way is to put it in a separate server only module

hollow eagle
#

just do NetMode != NM_Client...

#

"authority" is also the wrong term for this

#

if MAX is passed in then something is very wrong

#

and you're likely about to crash anyway

#

you can also do < NM_Client if you really want

#

but it's the same thing in effect

mystic marsh
#

return !GetWorld()->IsNetMode(NM_Client);

hollow eagle
#

because it's wrong

#

authority is an abstraction away from client/server, and clients can have authority over some actors

#

there is no concept of authority over a world

#

or a subsystem, or whatever

#

when someone says "the authority" the implied bit is "the authority over this actor"

#

but that's not what you're checking here. You're just checking if you're a server or not.

#

don't call GetWorld

#

that's what the outer is for

#
const UWorld* World = Outer->GetWorld();
return World && !World->IsNetMode(NM_Client);
#

the instance of your subsystem that ShouldCreateSubsystem is being called on doesn't have access to the world. That's why Outer is passed in - if the subsystem gets created then that will be the object that owns the subsystem. But until that decision has been made your subsystem isn't "real".

#

it's not niche

#

how can you ask a subsystem whether it should be created... if it's already been created? Or the reverse - how can you ask something that doesn't exist whether it should exist?

#

the object that function is being called on therefore isn't the real subsystem (it's the CDO).

#

also, the documentation outright says (some) of this

#

you'd find out by running the code you originally posted

#

GetWorld would always return nullptr

mystic marsh
#

It’s niche insofar as most of the billions of people in the world don’t know it. However, as an Unreal developer, the idea that CDOs exist outside of any world is a fundamental concept. CDOs for native classes are all constructed during application startup. Running your code with a breakpoint in that method is indeed a great way to learn that. Yes I shouldn’t have said GetWorld, it’s fairly obvious in hindsight why that function is getting passed an Outer to use.

sharp plover
#

Is there any way to update both the skeletal mesh with animations from code? Right now I have the issue that the skeletal mesh gets updated with the Move RPC server side, which causes me to have a higher net tick rate, but can this be controlled manually and manually ticked?

#

I just want to manually tick it regardless of what, based on the data in the anim bp, no rollbacks or anything like that

latent nest
#

I know this isn’t a play fab support really but I have a few questions. I’m just doing development and I’m wondering if playfab is the best way to go for hosting, or is another type. And if it is, I know it’s free but it tells me to add a credit card. Will I be charged?

sinful tree
# latent nest I know this isn’t a play fab support really but I have a few questions. I’m just...

No one can answer for you if it's the best way to go for hosting. You'd have to figure out if it fits your requirements of cost, features, reliability, scaling, etc. and compare that with other hosting sites to see what fits you best.

A lot of the features in Playfab are "pay per use" in the free tiers so if you happen to use a feature that they charge separately for, then yeah, you're going to get charged. Going above 150k requests also seems to incur charges, so if you've coded something poorly you could potentially use up those 150k requests quickly depending on how many requests you're making. Finally, 750 compute hours hosting is free per month which is equivalent to having 1 server running 24/7 for 31 days (probably on their "cheapest" tier of server). If you happen to have more than 1 server running or request a more powerful server you could end up using more than those 750 hours and get charged.

fossil spoke
#

Niche is relative.

#

If you work with these things constantly you find out quickly what is and isnt niche.

latent nest
sinful tree
latent nest
sinful tree
#

I only ask as it may not be wise to focus on hosting if you've yet to complete larger portions of your project. It's good to figure it out, but unless you have a game to be hosted, why bother with trying to have it hosted at all.

Personally I've tinkered with Gamelift a bit and Braincloud though not the hosting aspect with Braincloud though they do offer it.

Still, I don't believe figuring out the hosting service you should use is something that anyone can really guide you on - it's heavily dependent on what you're expecting out of a backend service and what you need it to do, and how well you can work with what they offer to meet your goals.

#

I'm sure there's some barebones hosting service out there that gives you scalable servers, but gives you nothing else, like storage or leaderboards, and they may be dirt cheap, but that may not be what you actually want, and may be more difficult to try and integrate some other third party service to add those additional features.

latent sapphire
#

ive already tryed

#

i guess im doing something wrong

latent nest
latent sapphire
#

im using a physicshandle

summer tide
#

How do you save and load players in multiplayer? So I have simple project. I don't have a lobby. I start in editor with 1 server and 1 client. Save the game by iterating over all BP_Character then save their stats and location. When I load i load the save-game, but then what? Also when saving players what else need to be saved?

chrome bay
#

GetSafeNetMode() being the key part to look at

fathom aspen
chrome bay
#

Honestly it's such a horrible workaround I'd be amazed if they took it. It's borderline pure luck it works 😄

#

All just down to how the editor splits off game instances for PIE, the whole thing is such a mess

#

unsurprisingly

fathom aspen
#

works™️ > fancy

#

yup typical PIE

fathom aspen
#

Basically if you leave the streaming volume and re-enter it super fast, net startup actors will fail to load on client

chrome bay
#

Urgh :/

fathom aspen
#

There is a system that is meant to protect against that using transaction IDs with acks and what not but it fails miserably

#

What I can tell you though is that from last night's investigation is that Iris works flawlessly on 5.3 at least

chrome bay
#

I wonder if it's some kind of naming collision thing, since those net startup actors will all be identified by their path name

fathom aspen
#

Right. I assume it's just the server not caring really about these pending acks and yoloing replicating that actor

#

Will have to do more iterations to pinpoint the issue

chrome bay
#

I remember in HLL we had so many hard to repro issues with map-placed actors replicating (even though we didn't use streaming vols etc) - we ended up making everything dynamic with spawners. We only had a handful of them though, wouldn't have worked on a large scale for sure

#

But that was like pre 4.25 too

fathom aspen
#

That was a suggestion indeed, but I'm too stubborn to make it work this way.

chrome bay
#

Yeah definitely not an ideal solution

fathom aspen
#

Yeah dormant initial actors would lose their value for example

#

At least now I got an incentive to move to Iris xD

chrome bay
#

Yeah mind you that isn't free of it's own trials and tribulations 😄

fathom aspen
#

Indeed. Gotta evaluate what sucks less

#

But I feel that Iris is making its way to stability real fast

#

Fortnite is porting its RG infra to Iris

chrome bay
#

Yeah FN is gonna be on it asap, got a good hunch that Iris will be out of experimental come 5.4

whole iron
#

Whats the best way to get an FPS character? Not true FPS where the real world model is used for the player, but one where the hands and weapons are rendered ontop of the other objects in the scene (so they cant be clipped into the walls) and potentially adding legs/feet to make it so when you look down you can still see your legs and feet?

I've heard about using panini projection, but I also have heard that causes lighting issues
I've heard about using a scene capture to render the actors into a UI layer
I've heard about modifying the engine and adding render layers (so you can render certain objects on-top of other ones, which is sadly not a default feature of UE5...)

Thoughts?

chrome bay
#

Make the mesh tiny.

#

Literally the simplest way to do it

#

If the mesh is contained within the player capsule, no blocking collision will clip though it anyway.

whole iron
chrome bay
#

You need to make the mesh so small that nothing can do that, then just attach it to the camera. FPP mesh doesn't usually cast shadows on anything but itself.

#

Receiving shadows, well yeah - if the mesh is tiny, it'll be either in or out of shadow usually. Not much you can do about that

#

Obviously if they need to interact with in-world objects via animation etc accurately, then any kind of reprojection or shrinking is not gonna work

#

Lots of ways to approach it in general but it depends on the game really. For a generic FPS I'd just be shrinking the arms + attaching to the camera, and using some kind of material FOV reprojection to avoid them looking awful at different environment FOV or on ultrawide screens

bright summit
#

why am I getting same player reference? I try to check different players but "target" is always same object

alpine wave
#

Hello
I'm using console Command "Open"to connect to the server, will this command be available in shipping builds?

fathom aspen
#

Obviously not. OpenLevel does the same more or less

alpine wave
#

Thank you

errant veldt
#

I need some help regarding Multiplayer. In the game when the server instance is loaded there are 4 abilites which the player can overlap to take it.

So if a server takes an ability and the client connects at later time. the client does not know if the server (or any other client) has taken any ability already or not..... so what logic do i put where? (Game State, or Player state)

glacial zealot
#

Im trying to learn about multiplayer frameworks, and I nearly understood all about gamemode, gamestate,playerstate, gameinstance, but I have a doubt about a thing in particular.
I'll use the Mario party example: basically you have the board with each position of items, stars, coins, players and each player inventory informations, then at the end of the round you change lever and play there, then the winner info is passed to the board level again, the thing that I dont understand is that as I understood the only frameworks that persists on level change are playerstate and gameinstance but seems not to be safe to store informations there isnt it? Because keeping the informations about item on board position to load again when reopening the board level and when gamemode and gamestate are created again in gameinstance is easily manipulated by client and also gamemode and gamestate are created based on the level.
Where am I wrong?

somber jasper
#

Is there a way to switch from using EOS to NULL for LAN sessions, if Internet is not available ?

crisp shard
#

how would you do a function every 30 days in real time? as in, a player uses a certain currency or power but it regenerates every 30 days ?

fathom aspen
#

I think not. It's their duty to ensure that they get the net mode properly

#

But it's a nice addition regardless

crisp shard
#

lmao, so when they use the particular variable, i set a timestamp on the server? when you say backend, you mean just on server right? or is there a particular node/function you're saying that does this?

#

realtime basicaly effects the game, and the server should already know this based on the time

#

would this require some outside coding ? like a javascript or something basic?

#

ok dope that makes sense, yea i have one idea, but not efficeint , and yea dont know anything about javascript i just picked one that i knew of lol

fathom aspen
#

I would not eleminate them for this, but instead work my way around it. Something dirty you can always do is destroy the subsystem locally where you don't need it 😄

crisp shard
#

does this mean it's easily doable?

fathom aspen
crisp shard
#

dope yes, maybe i'd have it give a couple of calls to regenerate like 2-3 times during this 30 days, but yea that makes snese

fathom aspen
#

For example a client execution path that tries to get the subsystem silently is way worse than crashing to a non existent subsystem

#

(Where a server was only meant to do so)

#

Worst case scenario you will get a subsystem that you didn't care about, best case scenario you will crash 😄

#

Indeed, hence why I wouldn't care about fiddling with it

#

No, you're good. I actually have a "visual" use case, where I only hold back clients from initializing the world subsystem, but still use the subsystem in a way where I need it on clients

chrome bay
#

Yeah I wouldn't think so tbh, the only reason I've added it myself is just so I can have server/client only subsystems that might not be relevant to the other etc. Qite a rare case though and is usually MP specific

nocturne quail
#

the functions we call on beginplay don't need to have any Server or Multicast properties?

#

I mean if I call this function on beginplay,

    UFUNCTION(BlueprintCallable, Category = "Component Update")
    void UpdateMag(TSubclassOf<class UAccItem> MagAccObject);

does it need to be UFUNCTION(reliable, client) or UFUNCTION(reliable, server) ?

fathom aspen
#

You should never need to call a replicated function on beginplay

#

Because if teh actor exists on all then beginplay will be called on all

#

If anything you would change replicated properties on beginplay and that's typical

nocturne quail
fathom aspen
#

Kinda. If you call a server rpc on begin play, it might get called twice. Once locally on the server, and once when the real rpc fires on the server

nocturne quail
#

yeah logically

fathom aspen
#

It's just pointless to call rpcs on functions that would end up calling on server and client

#

That's a rule of thumb to remember when using rpcs

nocturne quail
#

BeginPlay calls functions as reliable or non-reliable?

fathom aspen
#

I'm not sure I understand the question

#

BeginPlay will reliably call functions if it executed in the first place

nocturne quail
#

great

#

Thank you for the lesson 😄

noble sentinel
#

Can anybody tell me why when I look from server player to client, bones are hidden, but client player can still see bones on server player.

noble sentinel
#

Also, the bird have a "set simulate physics" node when it die, client can trigger the event but cant see the result, and birds bp looks like this

fiery wadi
#

Can someone please clarify if im thinking correctly about this, If i had a Widget for T1 and T2 to select a character this OnClick would fire to the Controller then the Controller would send the relevant Team choice to the Server(GameMode) to spawm the relevant Charactr Class (T1 or T2) So order of logic Widget->Controller->Server

glacial zealot
#

Guys how can I add the enchanced input in multiplayer? Like this it works only for server, shouldnt begin play run both on server and client? i tried adding a branch with is locally controlled and wasnt working for both

quasi tide
glacial zealot
#

So basically onpossess?

#

And then i add that there might work

quasi tide
#

onpossess runs on server only if I recall

#

I can't remember exactly

quasi tide
torpid lantern
#

Is anybody here familiar with GameLift integration & OpenSSL? Trying to build the .dll files for GameLift, but my terminal is throwing an error:

Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)

I've double-checked my environment variables are set per the readme, but still no luck. Realize this might not be the correct community and I am open to suggestions on where else I can find support.

thin stratus
blazing spruce
#

Hi, I'm having some issues with replicating post process effects over to spectating players.. when a player dies they'll start spectating the next alive player but if the alive player has some post processing effects on screen, the spectating player cant see them because I'm only running them on owning client, any ideas how i can change this to get it working how i want? I originally was just gonna get the current pp settings of the alive player and apply them to the spectating player when they start spectating them but because im using Set View Target with Blend the spectating player doesn't have a camera to apply the pp settings too since their view target is now the alive player, so i'm a bit lost on how to do it since the spectating player doesn't have their own camera anymore, any ideas?

dusty void
#

Made a new project and copied over a bunch of code so I could have my game use UE 5.3.2 and have Enhanced Input be the default used input system, and my game is getting this error and it has smth to do with calling IsLocallyControlled() in my OnRep, I didn't have this issue at all in my last project and everything works well up until this point, ill give anything else you'd need, thank you for helping

dark edge
# noble sentinel

Put print strings in your code. Does the event any damage even run?

noble sentinel
dark edge
#

How far does the code get clientside?

noble sentinel
#

Client character can damage bird and kill it but after dying that ragdoll/Animation code only works for server

dark edge
#

Does the multicast make it to the client?

noble sentinel
#

no, only server player can see

dark edge
#

You really oughta be using replicated variables and RepNotify though

#

I wasn't asking what they see, does the multicast event fire on the client?

noble sentinel
#

I guess its because players dont own the bird actor, isnt it?

dark edge
#

First off you shouldn't have a run on server event here

#

detect damage serverside, then set a replicated bool, and in the onrep, set the ragdoll state

#

you can multicast the ragdolling for now but there should not be a run on server event here, it's redundant. Client can't call it anyways as they don't own the bird.

#

The run on server event should happen when the client shoots, not when they hit something

noble sentinel
#

I dont know much about that repnotify nodes

hidden lion
#

What causes an object to resolve to nullptr randomly during gameplay, after it was initially resolved to a valid pointer? in the debugger its valid, not marked pending kill and registered in actor subobjects list

TSharedPtr<FRepChangedPropertyTracker> UNetDriver::FindOrCreateRepChangedPropertyTracker(UObject* Obj)
{
    check(IsServer() || MaySendProperties());

    const FObjectKey ObjectKey = Obj;
    checkf(ObjectKey.ResolveObjectPtr() != nullptr, TEXT("Unresolveable object %s received in FindOrCreateRepChangedPropertyTracker"), *GetNameSafe(Obj));

    return UE::Net::Private::FNetPropertyConditionManager::Get().FindOrCreatePropertyTracker(ObjectKey);
}
noble sentinel
#

but same code dont work on bird actor

#

I really hate that owner thing...

dark edge
#

You shouldn't do it like that though

dark edge
dark edge
noble sentinel
dark edge
#

assuming the damage function gets called, the code is working serverside

#

check that first

#

make SURE the damage function is getting called when a client shoots a bird

blazing spruce
dark edge
#

First off, what actually runs the timeline?

blazing spruce
#

For the post processing FX i essentially wanted it so if they hit half health a heartbeat sound starts playing, when they hit quarter health range the heartbeat sound will slow down its BPM and play some post process FX and then same again when they hit low health range, which is working as i have it now but timelines are a bit of a bitch to make sure they account for all possible outcomes lol

#

But right now i'm trying to figure out how to make sure that the spectating players can see what the alive player sees on screen and hears the heartbeat sounds

dark edge
#

And yeah, runs on owning client

#

spectator isn't owning client

blazing spruce
# dark edge spectator isn't owning client

Yeah ik its run on owning client but I'm not too sure on how to change it to make it work for only the alive player and the spectators without replicating it to everyone else

dark edge
blazing spruce
dark edge
#

I would. Assuming HP isn't private and you already have it replicated

#

Then it's just up to the client as to what to do about it

blazing spruce
true stream
#

Is there a way to "know" (listen?) when the server spawns an actor on a client?. (so I can do stuff on the client)

dark edge
oblique arrow
#
void AItemInteractableBaseClass::SetVisiblityForWidget()
{
    float Radius = 200.0f;
    TArray<FHitResult> Hits;
    FCollisionShape Sphere = FCollisionShape::MakeSphere(Radius);

    FCollisionQueryParams Params;
    Params.AddIgnoredActor(this);

    if (GetWorld()->SweepMultiByChannel(Hits, GetActorLocation(), GetActorLocation(), FQuat::Identity, ECC_WorldStatic, Sphere, Params))
    {
        for (FHitResult Hit : Hits)
        {
            AActor* HitActor = Hit.GetActor();
            ASentinelCharacter* SentinelCharacter = Cast<ASentinelCharacter>(HitActor);

            if (SentinelCharacter)
            {
                InteractWidget->SetVisibility(true);
            }

            else
            {
                InteractWidget->SetVisibility(false);
            }
        }
    }
}

guys how i can call this function only locally that this will be changing only for a player that stepped into this item?

true stream
blazing spruce
blazing spruce
modern cipher
dark edge
#

Tick / Timer -> map HP to SomeFloat -> Smooth SomeFloat -> drive visuals with it

#

For instance we have a float representing combat intensity which smoothly interpolates from 0.0 (nothing goin on) to 3.0 (active combat in a boss battle)

#

and another represnting danger or low hp, which goes 0-1

#

the 2 combined are used to drive dynamic music mixing

round mist
#

I'm running into a weird timeout issue in my live Steam game. If a player's hardware is lower and loading into a server takes too long, Steam times them out and it fails to connect.

Is there any way to increase the amount of time a client is allowed to connect to a server thanks to the map load time? Or is there another solution here I'm not thinking of (besides better optimizing my load times. I'm working on that as well)

true stream
# dark edge begin play

Btw, tl;dr, I have a "board" that keeps track of all my units, and depending on the tile occupied X or Y should happen, that means that the board itself should probably be an actor spawned by the server and fully replicated?, or I can I keep it like a level instance.

dark edge
noble sentinel
true stream
dark edge
true stream
#

enemy actors find each other in the same tile, an encounter (fight) happens

#

so Im thinking the whole board should be replicated as just another actor

modern cipher
dark edge
round mist
dark edge
#

Every visible actor can just be local, doing stuff based on the board state

true stream
dark edge
#

Is Chess the closest analogy to what you're making?

true stream
#

and there is a board, there is that.

dark edge
true stream
#

yeh Im already building it that way, setting it up so each "tile" is only data, which contains my entities (pieces or units)

#

but so far I have the standard spawnActor method for all of them

true stream
dark edge
#

Yeah how to architect it is up to you, you could just as easily have some data like an array of units and some logic to spawn/despawn actors based on it

#

Might be simpler to just use replicated actors per unit though, really depends

blazing spruce
# dark edge Tick / Timer -> map HP to SomeFloat -> Smooth SomeFloat -> drive visuals with it

Interesting! How would I go about it in my case where I want it so nothing happens until the player is at half health, then at quarter health some PP fx happen, which then gets worse when in low health state, and all goes back to normal when the player heals (provided they're not in quarter or low health states)? would love to see some examples of how to set it up properly in the way you're talking about, find it harder to properly visualise how its set up

dark edge
#

Get it to output a float from 0 - MaxState based on hp

#

looks like 0-2 covers your bases

#

MapRangeClamped(HP/MaxHP, 0.5, 0, 0, 2)

#

that'll output a 0 at half hp, a 1 at 1/4 hp, and a 2 at 0 hp

#

then you can drive whatever with those

still path
#

Does updating a member variable in a replicated struct send the entire struct to clients or just the piece updated?

fathom aspen
#

Just the piece updated

upbeat basin
#

OnlineSessions and GameSessions are.. different things right?

fossil spoke
upbeat basin
# fossil spoke Where are you getting these terms from thats making you think they are different...
[2024.01.03-05.00.34:495][668]LogOnlineSession: Warning: OSS: Player Can-0EB13FF947C1298F5BD27E93C5E8193B is not part of session (GameSession)
[2024.01.03-05.00.34:495][668]LogOnlineSession: Warning: OSS: Player Can-0EB13FF947C1298F5BD27E93C5E8193B is not part of session (GameSession)

I mean, I want to say they are different things with different purposes. But getting these warning messages makes me think if they are the same thing or supposed to be used together

fossil spoke
#

So depending on how you want to interpret what youre saying.

upbeat basin
#

Ah, so GameSession is the name of my online session

fossil spoke
#

The answer to your question could be yes and no.

upbeat basin
#

Which is probably coming from NAME_GameSession macro, I believe

fossil spoke
#

Yes

#

You likely tried to unregister a player that wasnt registered to begin with

upbeat basin
#

I get this upon joining the session, sessionInterface->JoinSession(0, NAME_GameSession, result); this is how I tried to achieve it

#

Which returns EOnJoinSessionCompleteResult::Success though, so I'm a bit confused

fossil spoke
#

Try breakpointing through the code and try and understand the state the session and the player are in 🤷

upbeat basin
#

Well apparently it was casued by leaving the menu map, not exactly joining to the session. But changing the NAME_GameSession to something else makes the warning go away. I think I need to delve a bit deeper. Thanks for the pointer

dusty void
#

I'm having this issue with using IsLocallyControlled in my OnRep where it crashed the game when it's called (it's called at the beginning since i set the health variable in the beginning, the OnRep is called properly when I take away the LocallyControlled check and I never had this issue before, can anyone help? ill provide more of my code if necessary

#

So I put an Owner check just to see if that existed and it did, it's not registering it to be locallycontrolled tho, at least it's not crashing anymore

fossil spoke
#

@dusty void Always check your pointers before using them.

dusty void
#

Yeahhh, it wasn't an issue in my last project somehow, im redoing a project i was on in 5.3.2 just so i could get my defualt movements with the enhanced input system

dusty void
#

nvm my editor play settings was set as listen server and it was working for the client but not for the server, idk if that's supposed to be how it is buttttt

#

also forgot to put UMG in my build.cs file 🫠

#

Not sure about a few other things but everything at least works now

dapper arrow
#

I'm trying to do a multi sphere trace for objects on an AI during an attack, using the location of a component attached to the character's mesh. The idea is to apply damage when a player overlaps the sphere. However, I'm noticing the server and client are out of sync... the server doesn't seem to update the location beyond the first time it's called. Is there something off about calling this from a tick from an anim notify, or does the game not like updating positions that quickly?

#

... do I need to make sure the animation is playing on the server too?

thin stratus
#

@dapper arrow Is that a Listen Server or Dedicated?

thin stratus
#

Is the ListenServer looking at the Monster when it attacks?

#

In general, you will need to of course play the animation on everyone

#

Skeletal Mesh Components have a setting that controls when to update bones and tick poses, which is some drop down Enum which name I can't remember.
It's set to only do that when rendered iirc by default

#

That's why I'm asking if Dedi or Listen and if the Listen is seeing the enemy

dapper arrow
#

Hrmm interesting I'll look at the skeletla mesh settings. This is my current set up where an interface call happens to to the enemy, then it does an RPC up to the server then a multicast to do the animation

thin stratus
#

That should theoretically not work

#

The AI is server controlled and owned

#

The Server RPC should never make it

#

Unless there is something about this setup that I don't know

dapper arrow
#

I'm probably using the wrong terminology, this is being set down to the actor itself

#

and not the AI

thin stratus
#

It's a Character or not?

#

And it's controlled by an AIController of sorts or not?

dapper arrow
#

Yes it's a character with an AIController

thin stratus
#

Yeah then what I said still counts

#

You can't perform server RPCs on actors that aren't owned by the specific player that calls it

#

Also AI are server authoritative. So you shouldn't need to call anything from client side to begin with

#

The multicast is fine but the server rpc is wrong/redundant

#

This whole stuff should only be called by the server to begin eith

#

With*

#

If you for whatever reason need the client to tell the server the Montage, which I don't know why cause I don't know your game, then you need to do the Server RPC in the player's character, before calling the interface function

dapper arrow
#

I'm still in the early stages of figuring out how the networking works in unreal and where server authorities are, so that makes sense to cut out the RPC there as an unnecessary middle man and keep the multicast so the clients see the animation

#

this is supposed to really just be a basic, "enemy swings their arm and damages you if you're in the sphere trace"

dark edge
#

Of course it can get more complex if you want hit effects and not just "number go down"

#

but start there

dapper arrow
#

Yeah this is just a super basic "you get hit number goes down"

#

I've got the play montage, then a notify state in the montage that has an event tick to send an interface message to the character enemy to perform a sphere trace

#

in this case here the client prints out a loc that continuously updates but the server's print doesn't

#

even with these changes:

#

Hrm well it looks like getting rid of the RPC and setting the testing to be 2 players with a listen server instead of 2 with a client got it working, so I'm going to chalk it up to a combination of those two things. Thanks for the help!

dark edge
#

You need to opt in to updating bones on dedicated

dapper arrow
#

Ahhh that explains it, my plan is to have there be a listen server on here and not dedicated. I go back and forth between testing with a listen or a dedicated, didn't realize there were more issues between the two

#

out of curiosity how do you opt in to updating bones on dedicated?

#

(I'm only a week in to trying to translate single player unreal stuff over a few years to multiplayer)

dark edge
#

Option on the skelmesh I'm pretty sure, just search for refresh bones or something like that

dapper arrow
#

Sounds good, thanks!

dark parcel
#

Where in player controller can I run something but with condition that the object is already replicated?

#

I want to run something on client after the server already replicate the variables

#

Or if I can re-word it, when is it safe to run a function when a player joins?

#

thingking about BeginPlayingState? but I am just guessing at this point

dark parcel
#

maybe postLogin?

latent heart
#

There is no "safe" time. Stuff is replicated at random times. You need to set up a system of checks.

glacial zealot
#

I cant understand why it seems to run on owning client but still only the look works moving and jumping doesnt, even thought seems not to be replicated, dont know how to do it

glacial zealot
#

Somehow I found out that my character BeginPlay runs only on server instead of each client

keen thorn
#

Hi, anyone here adept at how Unreal character movement works? From the docs it seems like the server does not tick and only replay the received moves to check if it's correct. Neither the server nor client use fixed timestep. And the server does some magic with estimating deltatime since it cant use client's timestamp directly. My confusion is how can it estimate the deltatime correctly? Wont this cause the server and client be out of sync all the time since deltatime is never exact. Whats the reasoning behind this instead of fixed timestep solution (cus then server can assume client update at 60hz and can step the simulation to be in sync)?

dark parcel
#

Hmm so OnpostLogin is not reliable too... there is no valid controlled pawn yet at the time it's called

#

https://discord.gg/uQjhcJSsRG
In this video I am introducing a series I will be making which explores the character movement component and how you can extend it in depth.

0:00 Intro
1:00 What is the CMC?
2:00 Do you need a custom CMC?
5:35 What does the CMC provide?
7:10 Outro

▶ Play video
bright summit
#

can't get this to run only on client which is touching the water. What I noticed only setting water volume is happening on every player - don't know why. When I manually set movement mode to flying for e.x. it works perfectly. How to set water volume only for individual players. Or it is not possible?

keen thorn
noble sentinel
keen thorn
#

The core issue is i dont get how the server can sync with client or vice versa

dark parcel
# keen thorn The core issue is i dont get how the server can sync with client or vice versa

I don't think it's the server that sync with client, server is authority. There will always be small desync even in almost perfect network but if it isn't much, you won't really notice it.
When the difference is too big, server will correct client position because server is authority thus the rubber band. I might not catch your question fully, totally new to this my self.
Hopefully someone wise have answer

keen thorn
#

And i also wanna know the technique used to keep the deltatime in sync

noble sentinel
#

How can I run this hide bone node for clients? Client can still see bones in server

dark parcel
#

don't even need RPC or multiplayer concept to hide the FPS mesh

noble sentinel
#

So Im using a full FPS arms for first person and its only owner see, but other fps hands bones are invisible and only gun visible, which is attached to a full character models hand

dark parcel
#

doesn't look invisible to me 0o, I mean what you hightlight should be set to only owner see

noble sentinel
#

As I said, gun and arms are merged skeletal mesh with animations...

dark parcel
noble sentinel
#

Well I know that but Im not a good animator or modeller so Im using a free FPS arms model from sketchfab so

dark parcel
#

I don't do fps but I think even in the FPS template, you have 1st person Weapon and 3rd person weapon

#

you basically need two arms FP and TP and 2 weapons FP and TP

noble sentinel
#

problem is, to show the weapon of one fps arm, I should hide arm bones but weapon bone should be visible

dark parcel
#

I'm seeing 3 arms

noble sentinel
#

Body in back is a full character named FPSBody, only owner see with arm bones are hidden so player can see FPS arms and that body

#

FPS Arms is only owner see arms with gun

#

"Gun" is again an FPS arm but arm meshes are hidden and gun is attached to wrist bone of "mesh", its owner no see

#

"Mesh" is TPS character people see which is owner no see

#

So there is 2 characters and 2 fps arms

dark parcel
#

hmm can't help you here, kinda got confused. I don't think RPC gonna fix your problem though, especially if you have late joiners. It should just be a matter of ticking what owners can or can't see.
but if that route doesn't help then I am not sure what you can try

noble sentinel
#

Im not using animations for it anyways

dark parcel
#

deleting the polygon or if you don't care about performance just use a transparent material on the arm

dark parcel
#

a pistol that doesn't slide feels kinda dead tho 😛

noble sentinel
#

💀

#

My hours...

dark parcel
#

transparent material is kinda heavy but for small game, probably don't matter

noble sentinel
#

Is masked materials heavier than normal ones?

#

Thank you very much for help btw

dark parcel
noble sentinel
#

I guess it wont do anything bad just for an arm model right?

dark parcel
crisp shard
#

moved my issue to: #materials although, it is in a mutliplayer setting, but not exactly the issue im having

true stream
#

if spawning replicated actors should happen on servers, does it mean that destroying actors also should only be executed on servers then they would be destroyed automatically on clients?

chrome bay
#

Generally speaking, you only want to destroy something you have authority over.

true stream
chrome bay
#

There's not a completely strict one-size-fits-all answer because it sort of depends on the usage of the actor, but for 99% of the time this is the rule

true stream
#

btw, can I keep in sync 2 actors even if the original spawning of the actor wasnt triggered by the server?

chrome bay
#

For example an actor might have been spawned by the Server, replicated, but later torn off. In that case if the Server calls Destroy(), clients won't clean it up

#

Not really no

#

Well, you can spawn actors with deterministic names independently, and fool the engine into thinking they are network addressable to sync them together.

true stream
#

Right, Im building something like a RTS game, but simpler, and I have actors that spawn other actors, while at the same time having an array that keeps track of everything and should be in sync somehow, and Im getting into some shady problems.

#

so if I destroy an actor but the array needs to know, in both server and client, does it mean I should probably let the server take care of that too?

#

trying to understand what to delegate to the server and what could run on clients

#

so, for example, every frame my units move, should the position be replicated too?

#

those are the little things that complicate things

#

at least for me

chrome bay
#

If any of that is spawned client-side, then the Server can't destroy anything authoritatively

true stream
#

no, every actor is spawned by the server

#

but how they move so far is client

#

but recently I've found a problem where I was disposing (remove from arrays, do other stuff, destroy actor) and it was happening on both server and client

#

and I was getting errors because the client was trying to access something pending garbage collection

#

so it made me reconsider some things

chrome bay
#

Sounds like you were destroying the actors client-side not server-side (or both), but not really sure

true stream
#

yeah, both.

#

so I should probably in my case.. do something like, when the actor is destroyed then do the stuff.

chrome bay
#

Yeah, thats the issue then - the client is destroying a replicated actor. The client then receives an update about a replicated actor which no longer exists locally, hence the ensure

true stream
#

so basically on clients (and listen server) listen to the actor destruction, and go from there? or its too late by then

dark parcel
#

OnPostLogin doesn't guarantee that the controller posses a pawn yet. Should I just run my logic in the pawn's begin play?

chrome bay
#

If the actor is replicated from the Server, the Server is responsible for destroying it. If the Client destroys a replicated actor they don't have authority over, the engine will panic.

true stream
quasi tide
chrome bay
true stream
chrome bay
#

yeah

quasi tide
#

Could also do something in onposession in the pawn. But that is server side only I believe. I can't remember the pawn specifics. I just do my setup stuff in the acknowledgepossession function

true stream
#

at that point the actor is still intact?

#

I mean I can do things with it

chrome bay
#

Yeah, it fires before the actor is actually destroyed

#

Limited things yes

true stream
#

ah ok, then I will use that

#

btw, actors that are destroyed dont get automatically deleted from arrays right? I need to manually remove them otherwise I would have a null pointer there

dark parcel
#

gonna look at acknowledge possession

quasi tide
chrome bay
quasi tide
#

And inside of that just do a server rpc

dark parcel
true stream
chrome bay
#

The engine will only 'null' it when the object is fully destroyed, if it's a UPROPERTY and if you don't have the pending kill disabled.

#

Otherwise, it'll just be garbage essentially

#

If pending kill is disabled and you don't clean it up yourself, it'll never be GC'd AFAIK

chrome bay
quasi tide
#

You have to null out the references yourself and then it'll be GC'd

chrome bay
#

^ Yeah this, if PendingKill = disabled

#

If PendingKill is enabled, the engine will GC it anyway, then set any UPROPERTY references to it to null

#

I'm not sure what the default is anymore

quasi tide
#

Default is still the traditional one.

true stream
#

so far Im using BP only, is any of that applicable ?

quasi tide
#

Allegedly the pendingkill=0 is supposed to become the default in the future.

chrome bay
#

SInce we're dealing with Arrays in this case, you have to remove the entry yourself regardless

#

(unless you want the entries to be null)

true stream
#

Right, the problem I had I guess was that in che client my entity was valid, then the server put it to null pending kill

#

so my removal method did nothing because couldnt find it

#

something like that

#

fun stuff

dark parcel
#

@quasi tide ```cpp
UFUNCTION(reliable, server, WithValidation)
void ServerAcknowledgePossession(class APawn* P);

There is also this, I guess I can use this for the Listen server pawn?
chrome bay
#

Yeah, BP makes it less easy because any 'pending kill' object is just considered null essentially. In CPP you can still compare the 'dead' object pointer

dark parcel
#

actually client RPC will work on listen server too right 🤔 . Sorry to bombard with questions, I am just about to start doing MP stuff

chrome bay
#

But the actor destroy event should fire before the actor actually gets marked as garbage

cobalt pollen
#

Just went through Cedric's C++ session management and got to the point where I'd need to work my butt off to expose the session search results to Blueprints, back to advanced sessions plugin for me but I'm glad I went through it so I know what's going on under the hood 😅

true stream
#

meaning, the order in which I check matters

chrome bay
#

it happens immediatelly after the event is broadcast

nimble ibex
#

Hello! Im trying to implement multiplayer for the first time, the camera is ticked replicated but its only showing correctly on the client (right side) not the server (left side) it shows up correctly for a split second when i run the project but then just goes to what you see now. Thanks guys!

#

even if i set the camera rotation onbeginplay or on tick it just goes back to that same view after a split second

#

in standalone it works fine

dark edge
nimble ibex
#

gamemode default pawn class is the intended pawn, then ive put playerstart in level editor. is that what you mean

#

the camera is a camera component in the pawn

waxen harbor
#

Hey everyone! So I've got what I'm hoping to be a relatively straightforward replication problem (for those with more replication experience than me) that I'm having a tough time figuring out.

My situation is this:

  • There's only ever two players in a session. One is the server (client-server?) that hosts the session, and the other is the client that joins the session.
  • Each player has a floating UI (Tablet), which is an actor that follows each player and is set to replicate, but OnlyRelevantToOwner. This actor is supposed to be spawned when hosting/joining a session so that each user can control world properties. This UI controls a lot of functionality in the game, and it uses a widget component, so I don't even want to bother trying to replicate that to other players.
  • I've created a "dummy" version of this UI actor (DummyTablet), which is really just a mesh of the UI without any real functionality. The intent of this DummyTablet is for other clients to see where other clients' UIs are, without all of the complexity of actually replicating each client's UI. This DummyTablet actor is currently not set to replicate.

Where I'm at:

  • Currently, the session host can see joined client's dummy tablet (and updating transforms) just fine, but the client can't see the host's dummy tablet anywhere. Both the host and client can see their respective Tablet UIs fine as well.

I've attached an image of the current state of the key blueprints for the Tablet UI/DummyTablet UI logic, so hopefully that will help explain exactly what I'm doing at the moment.

dark edge
#

how many player starts?

nimble ibex
#

the pawns all spawn

#

ive tried 2 and 3 they spawn

dark edge
#

Show your pawn's code and components

#

camera stuff will not need to be replicated though, should just work locally

nimble ibex
#

youre right i didnt even think about that haha

#

i will send that now

final holly
#

Guyz In multiplayer how can i focus a Actor's Widget component . So I mean how widget component gets inputs from that player only interacted (or focus ) itself.

nimble ibex
dark edge
#

get player controller 0

nimble ibex
#

oh i should get the player controller relevent to the player

dark edge
#

I'd start by disconnecting all that and making sure the client and server see the same thing

#

just disconnect the 2 events

#

make sure they're all happy and looking through their own cameras

nimble ibex
#

would get controller (self) work as an alternative to get player controller?

dark edge
nimble ibex
#

its the same when i unplug it

dark edge
#

Then fix that, figure out why your camera isn't being used

#

you shouldn't have to tweak anything, just add a camera and adjust its position

#

Is it not being used or is its position not being updated?

nimble ibex
#

when i play it standalone the camera is as i inteded, what would change it when changing to multiplayer

dark edge
dark edge
#

Delete camera component and readd, test play, do both screens see the same thing?

#

adjusted by player start spot location of course

nimble ibex
#

no its still doing the same time, the whole time the server has got the camera right for a split second on start then changed

#

the same thing*

dark edge
#

Make a brand new pawn with just a camera and test with that

#

Something is fucky there

nimble ibex
#

it works with the new pawn. I guess i can just remake my player that might wokr

dark edge
#

yeah you got something borked

nimble ibex
#

thank you for your help mate

#

just copied and pasted only my components and its not working; so its something to do with them.

#

it works but only very high up

#

but my previous pawn (even with all the code unhooked) does not work. Im confused

scarlet seal
#

Hey guys, Im looking for some advice. Im trying to figure out how you do a pubg/fortnite style lobby/server setup.
The way I see it in my head is your lobby is a listen server that people join thru your friends list (I have this working with EOS) then when everyone readies you travel to the dedicated server.
First, is this the correct way to do it?

Second, if so, how do you communicate with the dedicated server that there is a team coming in and these players are on that team?
Do you do that thu playfab/aws? Is there a way to query the dedicated server before joining, getting a team ID to assign the players?
Its difficult to google this as it always just return info on how to setup a dedicated server (which I also already have working)
Any and all input would be appreciated 😄

quasi tide
#

Not even. Connect to a dedicated server, when X players are ready, teleport everyone into the bus/plane/way your game has them enter the actual map. Profit.

dark edge
#

party/group

quasi tide
#

I was reading the "lobby" part as the pre-game area where people are just running around goofin' off.

#

Not the menu part.

#

But yeah, beacons

nimble ibex
#

It works sometimes? why is this happening? thanks guys

dark edge
#

Is the side view the default camera transform or some broken thing?

nimble ibex
#

some broken thing

#

the camera is in the pawn its default top down like you see when it works

scarlet seal
quasi tide
#

It's how you keep teams together

#

Pretty sure there is a pinned resource here

prisma snow
#

Hi! I am working once again in multiplayer (yey haroldhaha ), and I am experiencing the beautiful world of race conditions on actor initialization - Basically some of our actors (placed on the map) depend on certain other actors (such as controllers etc) to exist (and be replicated) on their BeginPlay functions.

I've read something about controlling when the game starts using game mode or something like that, but not sure if it's the best approach.

Other options I am considering is using a timer to delay the execution of certain functions, but it's not ideal because if the timer ends too soon, we'll have the same crashes, or maybe not using begin play at all and call some substitute function manually. Ideas, recommendations?

violet jay
#

Hello everyone I am coming from the #cpp chat. Two users from over there were helping me but they recommended I come here for my question. I am trying to follow Lyra's design pattern. But I am also trying to do a grid based inventory. I am using a fast array serializer to keep track of inventory entries. They hold a pointer to a replicated Uobject iteminstance and then some other data about position, rotation, and count. When the client receives new members from the fast array I instantiate a local array of uobjects for each fast array item because I need them as an array of pointers. Is this a good design decision? It feels weird to have two arrays of the same data basically. I will attach my code too rn

#

Here is my conversation from the other chat too: #cpp message

#

So what I'm asking basically is it weird to instantiate a UHInventoryEntryWrapper for every FHInventoryEntry fast array item that the client receives?

bright tiger
#

What is the different between using a Multicast system to spawn bullets (projectiles) on each client against spawning the projectile in the server and replicating such actor to all clients copying its movement?

Moreover, in this simple projectile setup (image): What do I have to replicate? The base actor and all components or only a part of them?

sinful tree
nimble ibex
#

Can someone tell me why this isnt working please. On the client it says the hit mouse is giving accurate x,y coordinates but when i click it it just goes to 0,0

thorn turtle
#

So I've got 2 issues currently, something about replication I guess but after reading through the documents I'm not really understanding

  1. Animations, I have some animations that I added into a blendspace with a bool that is activated to cause the animation, however it only plays on the screen of the player holding it AND it shows the same animation on all characters
  2. Its probably a bool again but I have a function to toggle the visability of a spotlight on and off for a flashlight, it does play from the host but not from any clients, none of the different ways I've been trying to get it to work makes it work on the clients
    I'm guessing there is something I'm missing on how to replicate over variables
nimble ibex
#

On the details on the variavle have you put replication to RepNotify

bright tiger
thorn turtle
sinful tree
# nimble ibex Can someone tell me why this isnt working please. On the client it says the hit ...

Event Tick fires on server and clients.
What you're effectively doing here is having every client set their own value as they'd be getting their own player controller and getting the hit result, but then the server is also running that for the first player controller it knows about and setting the hit result which would replicate and do whatever.

Additionally, the hit result for the mouse cursor can only be captured client side. You'd need to send an RPC to the server with the hit result from the client then have the server set the variable with that result, then the OnRep should be able to do its thing.

I would also recommend against replicating the entire hit result on tick if all you need is the location.

sinful tree
# bright tiger Is there a way to “connect” a server object with a client object that were spawn...

You can look into how to make actors net addressable and that'll show you what is needed to at least make them referenced across the network - If I remember right, it'll require C++ to do. As far as synchronizing them, that's additional work too.
It's not so much a "risk" as even when you spawn a replicated actor they are not entirely synchronized on clients - there is always some latency in multiplayer games. Multicast just means you're having each client run the code separately, and in certain cirumstances that isn't what you actually want to be doing.

nimble ibex
#

work

#

i forgot to include this part

#

I had to run on owning client. Thanks!

sinful tree
#

Inputs only run on the client to begin with. If you want others to know the hit result of that click, you'd have to run on the server sending along the hit result that the client generates.

#

Click > Get Hit result > Send Server RPC > Server Sets Value > OnRep Fires clients can do what they want with the OnRep'd value.

#

If it's just a one off thing that you don't necessarily need to store a variable for:
Click > Get Hit Result > Send Server RPC > Server Multicasts the value to everyone > Clients that receive the mutlicast do what is needed with the mutlicasted value.

nimble ibex
#

Does (static mesh) component movement not automatically replicate when component replicates is ticked in bp details?

nimble ibex
nimble ibex
bright tiger
# sinful tree You can look into how to make actors net addressable and that'll show you what i...

Hello again!

I’m reading about it but still not getting it.

What is the process for creating an object pool inside a multiplayer environment? The only idea that comes to my mind is to share the exact same actor (object memory actor) between all clients so that everyone pick and return the same actors to the object pool. But then… what with array replication?

As soon as I want to desync that I get messed.

sinful tree
# nimble ibex which of these steps am i missing; looking at my code?

Currently all you've shown is that you're getting a hit result on tick which is attempting to get the local player controller on all instances of the actor and setting the HIt Mouse value, then you've shown a click that is calling a server RPC that then calls the "Clickk" function.

So you have a click.... you're sending a server RPC but you're not sending the hit result to the server through that RPC, and then you're attempting to use the hit result in the Clickk function.

sinful tree
nimble ibex
#

each client works individually but the movement doesnt replicate

sinful tree
#

But only the owning client actually can get the hit result.

#

The server overrides the value set by the clients.

#

The server doesn't necessarily have the hit result.

#

Use the click event to send the hit result in through the RPC.

nimble ibex
#

and is there a way to exclude the server from setting those variables

sinful tree
#

You don't need to be getting the hit result on tick.

nimble ibex
#

ok il try thanks

#

but by the way, the input action im using is 'triggered' which acts on tick, wont this have the same issue

sinful tree
#

No because it's not tick and it only fires on the client performing the click.

nimble ibex
#

tried to put here instead but didnt work

sinful tree
#

Click > Send RPC with Hit Result > Server Sets Value

nimble ibex
#

what are the nodes for that called. where do i put that. i dont understand sorry

sinful tree
#

You're using a click event already.
You already know how to get a hit result.
You know how to create a server RPC (an event marked to send to server). You add an input to that event to pass along the hits result like you would add an input to a function.
You know how to set a variable.

true stream
#

when the server destroys an actor, and consequently the client's actor also gets destroyed and doesn't pass the isValid check, can I then put it into an array or what kind of actions can I do with that object?

sinful tree
true stream
#

it did allow me to remove it from the array it was originally in

#

but I guess thats it?

sinful tree
#

If the reference wasn't valid then no, you didn't. If it's not valid that means it's not referencing anything.

true stream
#

I checked and my array indeed stop printing that it had an invalid object inside

#

only after removal

#

if I didnt do that it continues to exist inside the array indefinitely for what I see

sinful tree
#

All that does is remove the first instance of a nullptr from the array. It doesn't mean you're referencing the actual object.

true stream
#

I see, so in this case where the server kills the actor and the clients reacts to it, what would be a good way of handling it?

#

since both server and client have the reference inside arrays and do stuff.

sinful tree
true stream
#

usually what I do is to add it to a secondary array, then loop that one.

#

do I have time for that?

sinful tree
#

It's unlikely to be a problem. Most things can be thought of being executed instantly, including loops.

#

And it wouldn't matter anyway - if you have an invalid pointer, you shouldn't be using it within the loop.

true stream
#

do things like timers get deleted when the actor referencing them is destroyed?

sinful tree
#

I'm not 100% on this one, but I'm fairly certain that is the case.

true stream
#

so I might clear the timers just in case on destroyed too.

#

not sure about events I listen to, probably the same

nimble ibex
#

@sinful tree i tried to do what you said. It hasnt worked. Ive tried the set variable functions other places too. if i put just the code inside the function it works, just doest replicate. if i use the function it doesnt work at all

#

I have got the function to work but still it does not replicate

bright tiger
sinful tree
#

(Ideally you'd probably create a custom structure to contain both the hit location and hit component so they get their onrep fired at the same time)

sinful tree
bright tiger
sinful tree
#

BP_Bullet0
BP_Bullet1
etc...

bright tiger
cobalt pollen
# sinful tree

Unrelated but this screenshot made me realize there are settings for the BP graph lines I want to set now...

nimble ibex
#

When I run on owning client or multicast it works there is no replication. when i run on server it replicates but uses the servers cursor location. is there any way to make it use the clients cursor location

sinful tree
# nimble ibex When I run on owning client or multicast it works there is no replication. when ...

What I've sent should take the client making the click's cursor location and send it to the server and the server is then setting the value which replicates it to others.
If you're calling a "Run On Owning Client" or "Multicast" immediately after setting the values, there is no guarantee that the replicated values have been received on clients by the time these events are called, and that's typically why you use OnReps as it avoids that problem. If you just want to pass it along in the run on owning client or multicast without setting a value, that's fine to do as well.

nimble ibex
glacial zealot
#

Hey I’ve tried some multiplayer setup, found a way to make an equipping and equippable input system but im not sure its the right way… anyone can tell me if its fine design side since its SEEMS to work?

I've created a weapon equip system where I have two different classes, one for the first-person weapon (owning client) and one for the third-person weapon(what others see). When I equip a weapon, it triggers a RepNotify equippedWeapon variable that calls an event. This event checks if character's locally controlled, spawns the first-person weapon (which has no logic but is visual), then checks if it has authority. If it has authority, it calls a multicast to spawn the third-person weapon. The third-person weapon class is not visible to the owner through 'owner no see.' In the same multicast, it checks if the character it's locally controlled, and if so, it activates inputs on the weapon, binding the fire events to the player's left-click event dispatcher. Is what I've done correct?

I've also noticed that with this setup, if I set the third-person weapon class to replicate, the inputs no longer work on the clients but only on the server.

nimble ibex
lucid badger
#

I'm a bit confused by this interface, it sounds to me from descriptions, like Standalone and Listen Server do the same thing? But rationally and from testing it seems that Standalone causes you to open multiple, separate (not networked together) instances of the game? Thinkge

#

This page is one of the sources that makes it sound like Standalone is still networked

latent heart
#

It isn't.

lucid badger
#

Okay, thank you!

#

That makes everything that is happening make sense 😛

#

When I try in Standalone I Just get two wholly separate copies of the game where nothing syncs, that work fine. When I do Listen Server I get a crash that is consistent with my code not being written correctly for multiplayer, which makes sense 😛

#

Is Pawn BeginPlay too early to access Pawn's PlayerState on Client? Thinkge It works fine on Server but I get nullptr on Client Thinkge

latent heart
#

Objects can seemingly be replicated in random orders.

#

You can't rely on another object existing in teh begin play of any other object.

#

Networking, go

lucid badger
#

Thinkge so perhaps OnPosssessed is appropriate?

latent heart
#

What you can do is when each relevant object begins play, you check if each other relevant object exists. If it has, you do x. If it doesn't, you do nothing.

#

For a pawn and player state, you'd have to have them both check for each other and trigger the same specific method when they both exist.