#multiplayer

1 messages · Page 202 of 1

silk abyss
#

was wondering if there is even something that handles things like input buffer of past couple frames if your frame rate is really high, and which part of the doc/stat I should be looking for to monitor those. ie. rocket league have a input buffer graph thing, but they are using a heavily modified UE3.

glass crescent
#

the client disconnects automatically , when joining from windows build but not happening when joining from editor

#

happening after 10-15 seconds

crisp shard
#

when you build your project from the source engine for a dedicated server build, can you still use the editor the same way and make changes to the project with this new source engine as the engine version?

sharp hamlet
#

I have a signIn level which is loaded on game start. When sign in is success, it uses open level function to open the mainmenu level. I m using AWS GameLift. When i use my command to connect to the server map from mainmenu level, the input is disabled, but if I use my command to connect to server map from the signin level, everything works fine. I m unsure as to maybe the problem is using the open level node? Both signin level and mainmenu uses the same gamemode. Can anyone help?

elder quartz
#

I'm running into an issue where anim notifies on replicated enemies do not trigger if the host is far away from them (it triggers for clients but not the host). The enemies are still replicated (always relevant) and can move, but no longer receive the anim notifies like usual. As soon as the host moves closer everything starts working again. Is there some kind of net relevancy distance for anim notifies? (UE 4.27)
Edit: Found the setting on the mesh: "Visibility Based Anim Tick Option"

silk abyss
#

so, by changing the pawn actor rotation doesn't change the actual viewing direction when client possess the pawn again?

#

say, I put pawn into a car after unpossess, client then possess the car. When client exit the car, I turn the pawn away from car's door and then unpossess car and then possess the pawn.

#

but somehow the client still facing toward the car. If I do this on the listening serve window then it works fine btw.

#

I did try run the SetControlRotation on the server side player controller, but got the same result.

opaque forge
#

What's the actual criteria for which actors can be passed in an RPC param? What happens if, say, you target a non-replicated actor that is known to exist on both the server and client, like a map trigger

tiny saddle
#

is the correct way to set a RepNotify blueprint variable with a reliable RPC?

tiny saddle
#

ok, but to set the value on the server it has to be done with a server reliable rpc right?

#

you could checkout VR Expansion plugin. The vr character in the plugin is setup to replicate out of the box

ruby crown
#

Hi folks,

I would like to have an actor mode that is not replicated, but multiple children that are in a multiplayer session. The intent is that each player can move this parent independently, but the children are synced relative to the parent for each player.

Is this possible without recreating “replicate movement” myself to use a non-world origin?

Thanks! I’m fairly new to Unreal engine.

(Copied from my Reddit post when the bot suggested I come here 🙂 )

short arrow
ruby crown
# short arrow So you want to replicate some actors without using unreal engines built in repli...

I’m hoping to use the built in replication system. If I understand right though, “replicate movement” will replicate things relative to the world, rather than relative to the actor parent. That’s what I’m hoping to switch

It’s an XR application, and a similar use case would be if each player had a handheld 3d map they can move sub-actors on, with each other player having the map contents synced but moving the map itself independently

compact flame
#

This isnt replicateing right what could I do to make it work better?

modest crater
#

a lot, in the nicest way possible

#

Client>Server>Multicast for an interaction thats going to then call interact locally for each is bad, what happens if your client is lagging and on client B his view isnt facing the thing so the interaction fails but on client A it worked?

short arrow
#

Character movement component is replicated and is super mega hard coded to work a specific way

#

So much so that I look for every opportunity to not use it

honest bloom
#

I'm using forces to handle movement for my game .. but the movement is very stuttery .. is there any resource I could start with to learn how to deal with this ? My assumption is that this has smth to do with prediction but I don't know where to start

glass crescent
#

now on client side the Multicast Hello is not printing , is there aything wronf in this blueprint

#

on button click

#

it is multi-casting fine , when clicking the button on host side , but on client side , it is not sending call to server

tardy fossil
#

sounds like that actor isn't owned by the client's PlayerController

glass crescent
tardy fossil
#

you need to assign ownership but dont use player controller at index 0 node, since if its a listen server, that will actually be the server hosts player client

#

or if its a dedicated server it will be the first player that joins

glass crescent
#

its a listen server not dedicated

distant mortar
#

In C++ Unreal Engine: By default, a non-RPC function already gets called in the Server. If inside that function a Server RPC is called, will the logic inside that Server RPC be affected by network delay, or will it be instantaneous since the non-RPC function was already called in the Server-side?

Based on my testing inside the editor, they seem to be the same and unaffected if I set the testing ping high, like instantaneous. However, I am unsure what's the behavior in an actual networked environment.

Anyone can shed some light on this?

Thank you very much.

tardy fossil
#

a server calling a server RPC will be instant, like a normal function

scenic cradle
#
float AFirstPersonCharacter::TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
{
    Health -= DamageAmount;
    ClientUpdateHealth(this, Health);
}

This function is getting called on server and I am calling the client to change the health variable for client too, so i wanted to ask if this is the way how we do it? also i have marked health to replicated and this function

void AFirstPersonCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps)
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);
    DOREPLIFETIME(AFirstPersonCharacter, Health);
}```
glass crescent
#

@tardy fossil i m new to this unreal , multiplayer , can you share any good reference for this ownership and RPC related thing

distant mortar
# tardy fossil a server calling a server RPC will be instant, like a normal function

Thanks for the clarification. I assume non-RPC function (called from Client) that also calls a Client RPC follows the same logic, such that it's instant as well?

Therefore, delay will only exist if it's non-RPC function (called from Client) that calls Server RPC. Likewise, non-RPC function (called from Server) that calls Client RPC.

Is my understanding correct? Thank you.

tardy fossil
#

having a client call a client rpc is not something i usually do, so im not 100% sure but i have no reason to think it'd be different than a server calling a server RPC since data doesn't actually need to be sent over the network

tardy fossil
# glass crescent <@251746269012295690> i m new to this unreal , multiplayer , can you share any...

https://www.youtube.com/watch?v=JOJP0CvpB8w a bit of an oldie but still relevant

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

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

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

▶ Play video
tardy fossil
#

and make ClientUpdateHealth a class member function so you dont need to pass a "this" pointer or the health value

scenic cradle
scenic cradle
scenic cradle
#

its working now

vital furnace
#

Hi, I would like you to help me solve a bug in my game made with Unreal Engine 5. I declared a variable inside my GameState, which I retrieve and display in a widget, but the bug is that on the server the correct value is displayed, whereas on the client it repeatedly shows the value 0

short arrow
vital furnace
lost inlet
#

well actually show your work

compact flame
honest bloom
#

Hi,
I'm using forces to handle movement for my game .. but the movement is very stuttery .. is there any resource I could start with to learn how to deal with this ? My assumption is that this has smth to do with prediction but I don't know where to start about that if you could guide me towards smth

storm zealot
#

Question about replication and inventory: how to properly spawn a character's weapon in hand in multiplayer?

(Listen server, ping 30-60)

I think you need to spawn from the host, and then make a multicast to everyone except the hostfor the same thing.

Because if you repeat the logic on the server, duplicate weapons will be spawned

In my inventory structure, there is a reference to the spawned weapon, so this creates some difficulties

or convince me that it is very difficult and unnecessary to do predications on the inventory))0

dark edge
silent valley
proven pagoda
honest bloom
# proven pagoda I think there's further specific options inside the character movement component...

Thx for answering my question, actually using an RPC to add the force seems to make things work as intended .. I just noticed very recently that the server never got the information which is why it was correcting the player back to the original position constantly.
With InputVector .. the RPC is handled by unreal
I'll also look for the options you mentioned, that should help me deal with better latency, thx !

proven pagoda
clear copper
#

If the GameMode only exists on the server, why are my PrintStrings in the GameMode displaying to the server and all clients?

wary flare
#

Hey guys, i have An question does anybody know how to replicate horror engine (its na aseet) bcz i Heard that you can replicate IT but i tried by best and its kind of broken

#

Like player is allways sprinting and crouching doesnt slow down

lost inlet
#

I don't know what that is, but if it wasn't made with networking in mind then you'd basically be remaking it from scratch

storm zealot
modest crater
hollow raven
#

Is multiplayer replication easier with C++?

short arrow
#

I don't think there's an easier or harder they both accomplish the same goal with the same amount of setup. The answer to this question will always be subjective though

#

perhaps you can ask a more specific question and we could tell you which choice might be better for what you're looking to do?

stable grotto
#

instead of ticking replicate movement its better to use repnotify to set the location of actors that are most of the time static right?

short arrow
#

I'd take it a step further and also make the actor dormant if you don't think it's necessary to replicate them every frame

fossil spoke
#

BP has limited feature set when it comes to Replication

#

You are able to achieve more with C++

little pumice
#

Replication is easier in a singleplayer Jokerge

hollow raven
#

My game also uses a text-based communication system

hollow raven
fossil spoke
hollow raven
fossil spoke
#

PushModel is a good example

#

You miss out on stuff like FastArraySerializer

#

Thats just tip of the iceburg stuff

hollow raven
#

So in this case you mean Network Managers and Optimization?

fossil spoke
#

PushModel is a CPU Optimization

#

FastArraySerializer is a Container

hollow eagle
#

actually, push model is one of the few "advanced" features supported in blueprint (it's automatic for blueprint set nodes if enabled).
The rest, yeah.

#

Any time you need any form of custom serialization, C++ is your only way. Need more control over how a property is sent, or to change the condition under which a property is sent? C++ only.

fossil spoke
#

The point is, C++ is much better for managing Replication.

#

Generally speaking, you want to build any multiplayer game with C++ (and BP)

eternal dune
#

In blueprints, how do I determine is my game is running multiplayer or standalone? I'm writing a library that needs to support both mode and I just realized that I've been ignoring the standalone side and some stuff is not working right there

#

I see the Get Local Role node, but it's return value is undocumented. 😦

#

It just says "enum". Well dug, but what are the values and what do they mean?

#

This is in my UI code, for what it's worth. I don't want to create UI widgets on a server, obviously, so I need a check for either I am remote or I am standalone

#

Never mind I figured it out. I can do a HasAuthority or IsStandalone

dark parcel
#

there is instance where Client can have Authority. E.g on the actors they spawn locally

eternal dune
#

I've got it working now

chilly haven
#

Hi,
I have some diagnostic variables that I want to replicate in development build but not in shipping.
I want to be able to netprofile without those variables.
What's the usual way?
To include them with UE_BUILD_DEVELOPMENT - but does netprofiler work with test build? Doesn't seem to work with shipping.
Or need I use DOREPLIFETIME_CONDITION with COND_Custom? Which would be less performant.
What do you guys do?
Thx

chilly haven
#

Found this:
#define USE_NETWORK_PROFILER !(UE_BUILD_SHIPPING || UE_BUILD_TEST)

upbeat basin
#

Is it logical to give actors as parameters to GameState events that would be broadcasted in multicast or onrep functions? There is a possibility that given actor is not relevant and received as null on some clients right? What's the best approach on design here to notifying all clients that a specific actor has gotten into an action, like notifying a door has opened by giving which door it is

bitter robin
#

If the actor isn't relevant why would they need to know about it? Any open state would just be a part of the actor itself. And if it were like a global message then I could be just that?

modest crater
upbeat basin
# modest crater The best practices it to make it state based and not event based, that way when ...

I'm not asking for states or how to make the door look opened when they get relevant again though, I'm talking about events that would have specific cosmetic changes on the clients. Let's say I have 4 doors in game and 4 widgets that represent their status, whether they are open or not. Making them stored in a replicated array in gamestate

If the doors are not always relevant, listening to their OnRep event won't work when I'm distant to them. But it also doesn't feel logical to make them always relevant just because of this? If gamestate has a custom event that notifies a door is opened or closed, it'll still be null if door is not relevant.

So what would be the approach here? Or is this already some kind of a bad design? I'm not trying to solve a specific problem but rather discussing to learn how this kind of a partial relativity problems could be solved

sinful tree
# upbeat basin I'm not asking for states or how to make the door look opened when they get rele...

You don't use RPCs/Multicasts for communicating state.
You can either mark the doors as always relevant and just replicate their variables as needed or use replicated variables on the GameState. The trouble with the latter is that you basically have to predefine the variables for specific doors and there's no good way to link a particular variable to a certain door on clients since the door wouldn't be replicated if it's not relevant, so it's slightly less scalable and a bit of a pain if you decide to add more doors later on.

zinc lodge
#

Hi everyone! I have a physics based vehicle which I apply forces to to move. The server works exactly as I want it to, but the client seems to have more forces applied to it. My theory is that the client calls the force methods more frequently, but I dont know why.

Also it seems that delta time for the client is higher than the server, which is also a problem since I use timers dependent on delta time.

upbeat basin
proven pagoda
#

I'm bamboozled here. I have these functions for an inventory system and if this is on server this works perfectly, however if I'm on a client in BP it shows it calling the Storage ServerAddItem but when I put a breakpoint in C++ it never hits. It hits for adding the item to the player inventory, but the storage not. Only on clients tho.

proven pagoda
kindred widget
# proven pagoda I'm bamboozled here. I have these functions for an inventory system and if this ...

I would change your calls here, honestly. Making scripters care about networking is bad form. You should have a simple AddItem. AddItem should internally call ServerAddItem. If this is a server instance it'll just work, if it's a client instance it'll RPC. that way your widget here simply calls AddItem and doesn't have complex logic switching.

That said. Also your client probably doesn't own the storage. So your PlayerInventory needs to be your gateway to affecting other inventories from a client.

proven pagoda
proven pagoda
proven pagoda
#

It cut down the widget logic to this one function like this

#

Thank you for the help

kindred widget
#

Nice. 😄 Yeah makes for much easier UI handling too.

proven pagoda
#

So it's an inventory component system that uses a TMap<FGameplayTag, int32> as an inventory tracker. I have a filter function that filters by tag through to the right data table, then breaks the tag name down to find data table row and returns that. In order to get the map across the network I break it down into a replicated struct of 2 arrays, TArray<FGameplayTag> and TArray<int32> and then when it calls OnRep, I send it back to my controller to filter by weight and match tags to inventory item definitions and reconstruct the map. Idk I made it without following a tutorial and it's GAS so I like it huzzah

modest crater
#

RPC's also don't fire if a thing isn't relevant so you arent saving anything.

dry gust
#

Please explain to me how replication is handled for the montage asset here. Is there some replicated TSoftObjectPtr<UAnimMontage>? I'm trying to convert this function to C++

#

I tried doing this:

.h:
`UPROPERTY(Replicated)
TSoftObjectPtr<UAnimMontage> CachedAnimMontage = nullptr;

void PlayAnimMontageMultiplayer(UAnimMontage* AnimMontage);

UFUNCTION(NetMulticast, Reliable)
void Multicast_PlayMontage();`

.cpp:
`void AMCharacter::PlayAnimMontageMultiplayer(UAnimMontage* AnimMontage)
{
CachedAnimMontage = AnimMontage;
Multicast_PlayMontage();
}

void AMCharacter::Multicast_PlayMontage_Implementation()
{
PlayAnimMontage(CachedAnimMontage.Get());
}`
But every time the first function call has CachedAnimMontage as null.
Probably because variable is replicated later than the function gets called. Every other call is fine, but I guess that's only because I'm using the same montage

lost inlet
#

A soft ptr would just network as a string

#

You'd have to load the asset

#

though this doesn't make a lot of sense

#

why is it relying on a multicast AND a replicated variable?

dry gust
#

I need a parameter, montage is gonna be different

lost inlet
#

yes and multicasts can have parameters

dry gust
#

Oh that's cool! I also need to call a server RPC playing the montage if an action was done on client side, does it also support parameters?

lost inlet
#

yes, I'm not sure where that idea came from because all RPC types support parameters in C++ and BP

dark parcel
#

must have missed the compedium

dry gust
dark parcel
#

how do you connect return type and input param

dry gust
#

In no way, this is just my false association

dark parcel
dry gust
#

nice, thanks

latent heart
#

Damn wizard pretenders!

clear copper
#

I'm using the ThirdPersonTemplate project. When I open 2 editors with netmod ListenServer, the server and client can move their characters just fine. But if I open two netmod StandAlone instances, setup a listen server, and then connect the client, only the Host can move their character. The connected client's character stutter-steps and moves 1cm at a time. Why would this happen?

clear copper
kindred widget
#

Would anyone happen to be aware if there are issues replicating Instanced UObjects in packaged builds?

#

EG this. It of course seems to exist on the client because it should be created when the owning actor is created. But it isn't replicating it's internal properties. But this works fine in PIE and Standalone. It only breaks in a packaged game.

TObjectPtr<UMyThingType> MyThing = nullptr;```
hollow eagle
#

Is it, though? Is this on an actor? An asset? Is that object properly added to the subobject replication list (or the legacy subobject replication function)?

#

Seems more likely that in the editor you're not actually replicating it, you're modifying the exact same object in memory in single-process mode.

kindred widget
#

"PIE and Standalone"

#

That's a fair question about the replicated subobject list.

#

I mean it is added in PostInitializeComponents. But I guess I need to double check that in packaged.

willow gale
#

Does anyone have a clue why I can't connect to a server in PIE (after 5.4) upgrade. Working fine in builds but tring to connect in PIE, I get this error and the client disconnects:
[2024.07.31-18.43.10:537][409]LogNetTraffic: VeryVerbose: SetChannelActor: ChIndex: 5, Actor: BP_Locke_C /Game/Wildcard/Maps/Arenas/FrostBurn/UEDPIE_1_FrostBurn.FrostBurn:PersistentLevel.BP_Locke_C_0, NetGUID: 22
[2024.07.31-18.43.10:537][409]LogNetTraffic: CreateReplicator - creating new replicator for (0x00000481B6BED800) BP_Locke_C_0 - Replicator (0x00000481BA55FDC0)
[2024.07.31-18.43.10:537][409]LogOutputDevice: Warning:

Script Stack (0 frames) :

[2024.07.31-18.43.10:538][409]LogOutputDevice: Error: Ensure condition failed: false [File:D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Serialization\BitReader.cpp] [Line: 276]
FBitReader::SetOverflowed() called! (ReadLen: 100, Remaining: 43, Max: 264)

[2024.07.31-18.43.10:538][409]LogStats: FDebug::EnsureFailed - 0.000 s
[2024.07.31-18.43.28:905][409]LogNet: Error: ReadFieldHeaderAndPayload: Error reading payload. Object: BP_Locke_C /Game/Wildcard/Maps/Arenas/FrostBurn/UEDPIE_1_FrostBurn.FrostBurn:PersistentLevel.BP_Locke_C_0, OutField: bReplicateMovement
[2024.07.31-18.43.28:905][409]LogNetTraffic: CreateReplicator - creating new replicator for (0x00000481B3A52800) CharMoveComp - Replicator (0x00000481BA55FCE0)
[2024.07.31-18.43.28:906][409]LogNetTraffic: CreateReplicator - creating new replicator for (0x00000481B3A51400) CharacterMesh0 - Replicator (0x00000481BA55AC60)
[2024.07.31-18.43.28:906][409]LogNetTraffic: CreateReplicator - creating new replicator for (0x00000481BCD81880) MyForceFeedback - Replicator (0x00000481BA55B6E0)
[2024.07.31-18.43.28:906][409]LogNetTraffic: CreateReplicator - creating new replicator for (0x00000481BCBC9300) MeleeBox - Replicator (0x00000481BA55B980)

lost inlet
#

well what is this actor doing

#

and is like every component marked as replicated too?

#

even when it makes no sense to?

willow gale
#

This is on connect when I'm spawning the character. The weird thing is it says it has too much data for bReplicateMovement.

#

Well, not login but after server travel from lobby to the map

gleaming kite
#

Im getting strange issue in 5.4 where players (mostly on poor hardware/connections) never get any replication updates after a seamless travel. They are spawned in, but frozen in place. Their VOIP works though.

The only thing i have to go off of is that the log gets spammed with:
LogNetTraffic: Error: UActorChannel::ProcessBunch: New actor channel received non-open packet. bOpen: 0, bClose: 0, bReliable: 0, bPartial: 0, bPartialInitial: 0, bPartialFinal: 0, ChName: Actor, ChIndex: 7, Closing: 0, OpenedLocally: 0, OpenAcked: 1, NetGUID: 0

This is being logged in DataChannel.cpp, line 3116.

    FReplicationFlags RepFlags;

    // ------------------------------------------------------------
    // Initialize client if first time through.
    // ------------------------------------------------------------
    bool bSpawnedNewActor = false;    // If this turns to true, we know an actor was spawned (rather than found)
    if( Actor == NULL )
    {
        if( !Bunch.bOpen )
        {
            // This absolutely shouldn't happen anymore, since we no longer process packets until channel is fully open early on
            UE_LOG(LogNetTraffic, Error, TEXT( "UActorChannel::ProcessBunch: New actor channel received non-open packet. bOpen: %i, bClose: %i, bReliable: %i, bPartial: %i, bPartialInitial: %i, bPartialFinal: %i, ChName: %s, ChIndex: %i, Closing: %i, OpenedLocally: %i, OpenAcked: %i, NetGUID: %s" ), (int)Bunch.bOpen, (int)Bunch.bClose, (int)Bunch.bReliable, (int)Bunch.bPartial, (int)Bunch.bPartialInitial, (int)Bunch.bPartialFinal, *ChName.ToString(), ChIndex, (int)Closing, (int)OpenedLocally, (int)OpenAcked, *ActorNetGUID.ToString() );
            return;
        }

        UE_NET_TRACE_SCOPE(NewActor, Bunch, Connection->GetInTraceCollector(), ENetTraceVerbosity::Trace);

I find the comment "This absolutely shouldn't happen anymore, since we no longer process packets until channel is fully open early on" hilarious... its definitely happening lol

gleaming kite
#

Sorry for the ping, but this is exactly what is happening. It happens after a few seamless servertravels. Is there a good solution? I saw someone say net.ResetAckStatePostSeamlessTravel=1 may fix it.

#

Looking at the previous reports, the common denomitor seems to be lyra. Im not using lyra, but stole these cvars from their default engine ini. Could one of these be the issue? net.AllowAsyncLoading=1 and net.DelayUnmappedRPCs=1 seem like they could cause issues, also explaining the hardware cause. I would like to use those though.

net.MaxRPCPerNetUpdate=10
net.PingExcludeFrameTime=1
net.AllowAsyncLoading=1
net.DelayUnmappedRPCs=1```
twin juniper
#

Hi, I have a question. I'm working on loading screens. I'm using seamless travel so that the connection doesn't get interrupted. I've already made the level transition map, although I'm not sure what its role is. Is there a way to know when a level finishes loading? So I can create a "loading" widget. Thanks!

willow gale
#

there's
virtual void PostSeamlessTravel() override;
on AGameModeBase and AGamemode

#

I use the CommonLoadingScreen.

twin juniper
#

thanks very much!

#

does that function exist in blueprint?

willow gale
#

Not exposed to BPs

short arrow
#

it's super easy

#

you can do it

twin juniper
#

yes, i already did it friend, thanks

gray sparrow
#

why all my new levels i create get automatically """smartobjectcollection""" and i cant even delete this -.-

#

how can i stop that all levels get smartobjectcollection?

twin juniper
# short arrow just expose it yourself, take the leap

bro what I did was override the postseamlesstravel function of gamemodebase, and to that override function I set the blueprint calleable property but isn't the function supposed to be called when the server travel ends?

hollow eagle
gray sparrow
#

thnaks it works

sterile plaza
#

Starting on a multiplayer card game. Given there's no pawn, is the player state the appropriate place to hang player stuff? Seems weird as it wouldn't be associated with the PC.

hollow eagle
#

sure it is

#

the player state is owned by the player controller, and they reference each other in a 1-to-1 relationship.

sterile plaza
#

is player state owned by the PC so it gets all the same networking properties?

#

well then

#

thank you

frozen palm
#

Hi! I placed this set of nodes inside the character BP so that even clients would have permission to throw the sounds via server. But it's not working. Even if I set the first node as run on server and simplify the nodes to just throw a multicast right away, it's still not working. The "au.visualize3d.Enabled 1" console command does show that the audio is playing for all but I still can't hear anything. The weird thing is that if I just replace the first node with a random key like "4" it works just fine.

#

So to simplify it even more...

#

The first one works, the second one doesn't. The only difference it that the second one is made to be a reusable event while the first one is "hard coded" to just play the same sound over and over.

#

Anyone have any ideas why this is the case?

sinful tree
# frozen palm Anyone have any ideas why this is the case?

Don't take pins across execution paths. The only way to communicate those values across the network is to add inputs to the RPCs and pass the values through, but that seems like a lot of extra data to pass through as you're effectively giving a way for clients to play any sound at any position in the game.

frozen palm
#

I do appreciate any tips that could be given.

neon summit
frozen palm
#

Yeah.

neon summit
#

Is the interface event run on server or client?

frozen palm
#

Server to ease up couple systems that I have going on.

#

This is what the trace looks like inside any interactable.

#

It brings in some information that I can use inside the interactable objects.

dark edge
#

@frozen palmYou can just multicast the fact that the thing was interacted with and have it play whatever sound or do whatever else

#

do you want everyone to hear a sound when something is interacted with?

#

Think about the minimum set of state that everyone needs to agree on.
If you

frozen palm
#

So multicast would probably be ideal here.

sinful tree
#

You now have variables that store those values. Each item actor class could have its own default values set in those variables.

#

Or you could look them up somewhere and set them.. However you want to handle it.

dark edge
#

Either way the minimum amount of data is just the fact that the thing got interacted with and possibly the interator (the character fiddling with it)

frozen palm
#

Would this Multicast Event be best to be inside the character or inside each interactable?

#

Because if I try go with something like this...

#

The client2 was interacting with the soap bar but only the server got the sound.

neon summit
#

You need to pass the location through the mc

frozen palm
#

Oh shit... It actually works now.

sinful tree
#

You can't do this as the data doesn't get passed through the network.

frozen palm
#

What @sinful tree said right in the beginning was the thing. I had no idea the pins can't go "thru everything".

#

I'm gonna need to make this pretty and nice but yeah... It works now.

#

Thank you so much @sinful tree , @neon summit and @dark edge for helping me out with this.

#

Was testing every possible thing for many hours and always got it working but then when I tried to introduce any events in between it always stopped working (as seen in my first images). This was a very helpful nice lesson. Thank you once again and have a nice day! 🙂

dark parcel
#

I much prefer to not use montage for an idle animation but how can I sync these properties accross all machines?

#

For short animation, it doesn't really matter but what if it's a long idle animations and I need late joiners to at least start at the same time as the server.

formal turtle
#

to update players timer for an example on their screen, which is controlled in the gamemode, how would i access all available connected players with the ?listen server param

#

to then gain access to each of their existing widget

dark parcel
#

You don't gain access to their widget as a server or listen server

#

widgets are local to each machine. Their job is to read stuff.

#

any variables that is replicated needs to be stored else where

#

The time can simply be a replicated float or int

#

Game state sounds like a good place to create the variable

karmic venture
#

Use repnotif on gamestate. Inside reptotif function put code you want to run on clients

#

For example send message to interface

quiet pulsar
#

Hi everyone
this is my player controller blueprint. i made a seperate custom event for setting input contexts. this works for the host but it doesnt work for the clients. what am i doing wrong here

thanks in advance

twin juniper
#

Hey guys, i keep getting 1 frame correction from the server, correcting my UseControllerRotationYaw. My actual GA is a little more complicated, but the core logic is just like in this screenshot.

I didn't found a way to identify the bug, but based on timing of network emulation and some eye checking, it looked like the bugged frame happen 2x the network delay, if i have 200ms, it would happen 400ms after the GA activated. This lead to my assumtion of: Yaw set to true on client first, then 200ms later, Yaw will be set to true on server, but right before that, Yaw is false on server, and it would send a 1 frame correction to client, which took another 200ms, 200+200=400.

If only there is a way to COND_SkipOwner for Yaw, that would be nice. So do you guys ever meet this bug, any way to fix it?

jolly sphinx
#

Hey, i have a little question. When playing in the Editor with multiple Clients, my Performance drops A LOT, and if i run more than 9 at a time UE crashes, is this just the limit Unreal can do, and if i have my own Dedicated Server it’ll allow much more Clients(my theory) Or is my game just optimised horribly?

dark parcel
#

like how many battlefield can your computer alone handle?

jolly sphinx
#

Oh RIGHT im dumb hahah

#

Thanks

dark parcel
#

My FPS already got butchered with 2 clients and 1 server

jolly sphinx
#

Well my pc is pretty good soo

tardy fossil
#

probably need like 128gb of ram to run 9 instances of UE at once lol

kindred oyster
#

Hey, I have a WorldItemActor that holds Item Object (UObject). I work with Uobject replication manager plugin. And in both scenarios my item objects are replicated.

The WorldItemActor Load the Basic Mesh as soft Ref from Item Object. For this i Setup the ItemObject to repNotify, on this I load the mesh.

  1. Items that are spawned runtime (harvesting object, spawn item) are shown and can be lootet
  2. Items that are prespawnd (with Editor) doesnt load. I think this is because the client connects a bit later so ne repNotify doesnt run on client.

So I think about set the Item Object to Replicate.

  1. Runtime Spawned Items arent shown anymore (because the repNotify doesnt run any more and the mesh are not loaded)
  2. Prespawnd (editor) items are now shown 🙂

Maybe someone has an idea, how can I solve this?

silk abyss
#

so on the github NPP readme it mentioned this part:

    After a long road and many attempts, we are dropping support for the async version of Network Prediction. We felt
    the complications it introduced into the physics system were too much to maintain and performance was still too
    poor in the worst/degenerate cases that it wasn't going to be a viable system for enough games to warrant the 
    complexities.
    
    The original single threaded version of Network Prediction is preserved and unchanged. We still hope to use it to
    build a new character moverment system with it. Physics support could come back into this version but it would be
    strictly opt-in and only applicable to games with small number of objects and players.```

And for physics now we have the async physics tick check box on every mesh component(basically any comp that can sim physics). 
Then how does Lego fortnite do such massive amount of constraint graph and multiplayer physics ?  I probably need to rewatch the GDC talk again and check the prediction part. 

A very loaded question would be, why is it very hard to do player input/physics/network predictions all in async manner.
formal turtle
#

does game instance have some type of node which can be used to retrieve the controlling instance of player controller.

formal turtle
# silk abyss game mode definitely has.

okay but gamemode is inaccessible for clients. i just cant wrap my head around the idea of multiplayer. if you cannot specifically get the controller of the client without specifying an index number, what is there left? how can I target specific clients instead of the goddamn server?

#

get controller node only exists in player blueprint and it returns generic controller

#

it doesnt return specific controller class even, you have to cast to it

silk abyss
#

so does player controller, since every client only have it's own controller replicated. only server have the "receiver end" of all player controllers.

#

imagine this:

  • every player have remote control with buttons, and server have the receivers(server side player controllers)
  • player press those buttons and send signals to server (RPC calls)
  • server gets those event and inputs and then sets everything on server(like pawn velocity) then it broadcast those changes back to player
  • players gets those broadcast replication(some are targeted so only 1 player gets that), and every player trying to react to what's broadcasted and then push their buttons
#

And yes, you have to cast to your player controller type, that's why game mode has all reference to those class types. as only server should have decision making to all events, player are only "watching" the result of what server did.

formal turtle
#

it still doesnt make sense with widgets. when you create widget and add it to viewport you cannot just simply add it for client because it wants a playercontroller but you can get playercontroller by using 'getplayercontroller(0); which returns pc at index 0, index 0 is always server, unless you manually set it to 1 but then server or any other instances of clients wouldnt see the widget still

#

why is there no automatic setup when it comes to widgets and multiplayer

#

i could have 10 client instances and only 1 of them gets the widget displayed and added to viewport

#

it doesnt make sense

silk abyss
#

widget should be local only.

#

if you want to have say, player name and health bar for example, you can still fetch all the pawns etc and get those if server set the game states. (where you can track like player kills/score/health etc)

formal turtle
#

should be, except when you preview multiplayer with listen server (2 slots) in editor then only server gets the widget displayed

silk abyss
#

you can also just fetch those value and location from the replicated pawns.

#

oh, that. well, because there is only 1 controller.

formal turtle
#

realistically there isnt tho?

silk abyss
#

when you PIE, unless you have say, another controller(actual game pad) and you assign different index during the game start join part.

formal turtle
#

each player has their own instance of pc

silk abyss
#

did you test the PIE with standalone process? or run everything under one process?

formal turtle
#

i am using editor with network settings of 2 player

silk abyss
#

go to advanced settings, make sure you are not running under one process.

#

I mean it's possible to do all those, but much easier to emulate if you run each client as it's own process.

#

cause that way your player controller (0) is always gonna be the locally owned.

#

BUTTTT, if you ever are going to implement couch coop that joins other server, then don't do that, make your gamemode etc does those properly.

formal turtle
#

the widget still opens only on server

#

and funny is that if i use packaged build then the widget opens normally

#

why is editor like that

silk abyss
#

like I said you need to make each client their own process.

#

if they share the state process, the player 0 is also shared, and that depends on who gets 0, which is usually the server since you need to start server first and then the client can join.

#

doesn't matter which window you set as client or listen server.

kindred oyster
silk abyss
#

it doesn't not show the widget thing, but you already know widget is client only since it gets added to the hud owned by client player controller(listen server also has a local player controller it just happen to also be server)

formal turtle
#

it shows one thing but in reality its totally different

silk abyss
# formal turtle it shows one thing but in reality its totally different

not exactly but it does encourage you to test properly. as editor is more for making new things, and not for testing your thing. you can also do it not with listen server and spawn actual dedicated server now, so that's a plus. (back in old time you can't even test with dedicated server unless you build one, it's pita.)

#

the editor build has those WITH_EDITOR marco if you checked the C++ code, then you wouldn't be surprised if the build clients/server aren't exactly the same as the editor.

quasi knoll
#

what's the best method to spawn characters (both NPC and enemy) for multiplayer? Is it done like object pooling for actors? I have an open world map that bogs down when new areas load with characters.

sinful tree
# formal turtle

What class holds this function, and what event are you using to actually end up calling it?

silk abyss
quasi knoll
silk abyss
#

I used to do a vr tower defense prototype and I keep the char pooling on game mode. I basically prespawn any pawns/ai controller ahead of the wave and make it so it only spawn like low enough amount before it hits game thread too hard and the dead pawns/ai controllers are deactivated and move to somewhere like z=-100k and just park them there. say if next wave I need to spawn up to 70 pawns, then say I already have 40 currently running, I just spawn like 3 at a time until I get total of 70 to my pool.

#

the heavier your pawn is then the more you need to pre-spawn. and see if there are ways to async load without hard refs for your pawn related assets.

#

If you are talking about over 100 pawns then you need special solution as for character movement component + skeletal mesh, around 100 char pawns are about where you start to get really heavy with default settings. so you need like rep graph/light weight movement component and other optimization method thrown in.

quasi knoll
gray sparrow
#

penguinTD i added you can you take a look? ^^

quaint sparrow
#

Can I extract audio from .uasset file with javascript?

silk abyss
quaint sparrow
#

Can u know me in detail?

kindred oyster
#

Hey, I have an UI and want to pass data from server on it (chest inventory)

#

Some Ideas how I can handle this?

#

my first approach is this:

#

its basicly a box where I can put items on it

#

the box has an inventory ac

#

on server this works as a charm

#

on client all works expect the items in box showed

#

ok maybe I got it

#

the box actor was not replicated

#

but does this also work without replicate it?

silk abyss
oak pond
#

Ive gotten hosting and joining working in my game (at least LAN) but when I send an invite to my other account, it works but accepting does nothing. I found this guide and I did what it said, but where do I even put the event invite accepted node? https://forums.unrealengine.com/t/advanced-sessions-plugin-accepting-steam-invitation/416571/2

#

it seems no one in this thread mentioned where that node is actually being placed

oak pond
#

I guess its in the game instance its self, but where do I even find that? clicking the 🔍 does nothing

#

hmm I guess I can create my own

oak pond
#

yep got it working with my own 2 steam accounts but once again none of my friends can join even from an invite

oak pond
#

yeah got it all working now, my other friend tried and Ive been able to join him, pretty awesome to finally see this

#

although if hes already run around the map killing enemies theyre completely bugged when I join, how do I deal with things that have already happened? I know most games would just have everyone start at the same time from a lobby though

#

also, why do these settings keep disabling themselves? I need them on

fossil spoke
#

Meaning, you can only change them when the game is running.

#

They wont save in Editor

oak pond
#

oh thats weird, whys that? I assume I can change it within the server though?

glass crescent
#

this is the server and client , is that fine and will the Client to Server RPC will work?

fossil spoke
#

Its probably because its a pretty important feature for most games to leave as it is.

oak pond
#

yeah thats understandable, in this case though its a silly co op game so the players own experience is definitely the priority

glass crescent
#

the issue is that the client one is not spawning on server , so i am trying to send the Run on Server RPC from client but it is not working

nova wasp
#

the object must be owned by the client for client->server rpcs to run on the server

#

pawn, player controller etc generally

#

and replicated objects owned by those (actor components on them generally)

glass crescent
#

Replication is on

#

See BP_SendTOServer in my Actor class , which there in the scene bydefault

#

so on joining client has two , which seems correct as one is of server and another is of itself.

#

but when i trigger the command , is it necessary that server should also contains 2 instances of it , one of client and one of itself

#

this what i m getting in logs

#

please suggest is there anything i m doing wrong

dark parcel
#

Why are you doing server rpc on server?

#

You use server RPC as a mean to tell server to do something as client.

#

Also look up ownership if this is an actor that isn't owned by the calling client

#

Your rpc will just get dropped if you don't understand the concept.

glass crescent
#

so basically what i want to do is on selection of slot the client will send the details to Server that i m selecting this slot and then server will check whether this can be assigned or not and then will replicate it to all other clients

dark parcel
#

Well for a start you don't want to touch multicast in that case

#

The slot can be a variable that is stored in replicated actor. Use repnotify to reflect any changes to the variable.

glass crescent
#

okay , thats is fine but two players can select it at same time ,thatswhy wanted to do it using RPC and want to understand RPC flow for other processes

#

can you share the simple example of the blueprint with the ownership for RPC

dark parcel
#

Exi compendium and wizard tips and trick

#

@glass crescent 2 people clicking at the same time is fine, you just run on the server. Who ever get there first, get the slot.

You cannot use multicast on anything stateful because multicast can be dropped and it also don't run on players that have yet to join the game.

#

You should try to sync a boolean across all machine, have the client able to request the server to toggle the value.

Don't use multicast for anything like this, they are used for something that doesn't neccesarily have to be in sync. E.g special effects, or fire and forget entities.

glass crescent
#

Ohkay , Thank You @dark parcel for the insights. 🙂

glass crescent
#

@dark parcel is Getplayercontroller at 0 index will give the owning client one or the host

dark parcel
#

clients are only aware of their own controller

#

but server have their own controller and a copy of other player's controller

glass crescent
#

ohkie

dark parcel
#

the index isn't guaranteed on server I think. e.g when client loads the world faster than server

glass crescent
#

okay

peak lintel
#

Hello guys. I have a question.
I'm spawning some NPCs and each character has a widget component which I want to show their name.
I'm spawning from game mode the NPCs, set the default controller (which is set in the character) -> Init the PC -> Init the character and from here I'm calling a multicast function which sets the name in the widget. Multicast is not working on NPCs? If it's not controlled by a player because the names are not visible to me, the player? If I'm printing something in the multicast, it's only called on the server. Nothing on the clients.

I'm using repnotify. This is working, but why is that? Multicast is not the exact same thing?

twin juniper
#

Hey guys, i am having the weirdest bug ever. My client character is basically having a timejump, back into the past 200ms, then back to normal. I have a video in slow motion, i draw arrow on character location and rotation, blue is server and red is client.

It doesn't look like correction, but the fact it only happen on clients, with network delay only, it should be correction.

Any help is appreciated.

#

I think it's a CMC problem when working with montages. I may have to custom the CMC code

tardy fossil
#

pretty sure the only way a montage could effect movement is if it had root motion

dark parcel
#

even take root motion

#

root motion drives the capsule comp

twin juniper
#

it does but CMC doesn't support root motion while adding user rotation i guess

last storm
#

I'd like to rotate the player depending on the input.
But if i do it in the Controller/ClientSide, it don't rotate on the server.
if I do it on server, jit doesn't rotate on the client.
To make it rotate on all client and server i need to put in a multiccast function called by the server.
But it seems a bit too much so I was wondering if there is a betterway to do it since it RPCs gonna be called all frame the input is used:

here's my code:

void AArisePlayerController::HandleMoveRight(const FInputActionValue& Value) //Bind to Input component
{
    const float MoveRightValue = Value.Get<float>();

    if (AcfmovementComponent && shouldAllowMovementInput && bMoveRotation && MoveRightValue)
    {
        MoveRight(MoveRightValue);
    } else if (AcfmovementComponent && !bMoveRotation)
    {
        ServerTurnRight(MoveRightValue, PlayerCharacter->GetActorRotation());
    }
}

void AArisePlayerController::ServerTurnRight_Implementation(const float MoveRightValue, FRotator CurrentRot)
{
    MulticastTurnRight(MoveRightValue, CurrentRot);
}

void AArisePlayerController::MulticastTurnRight_Implementation(const float MoveRightValue, FRotator CurrentRot)
{
    FRotator Rot = PlayerCharacter->GetActorRotation();
    PlayerCharacter->SetActorRotation(FRotator(Rot.Pitch, Rot.Yaw + (MoveRightValue > 0 ? RotationRate : -RotationRate), Rot.Roll), ETeleportType::ResetPhysics);
}
sweet sage
#

Do Iris has culling?

dark parcel
#

Why multicast?

#

You can have rotation value just be a replicated variable

twin juniper
dark parcel
#

on Tick-> Interpolate to target rotation

sweet sage
#

How do i use NetCullDistanceSquared with Iris networking?

last storm
dark parcel
#

why not? input is local

#

set rotation on the client locally

#

you don't need to take updates from server for the character you are controlling

#

can use Skip_Owner for the variable

last storm
carmine ember
#

Does anyone know if there is an established pattern for notifying clients when a player joins/leaves a match?

I initially thought having a NetMulticast in the GameState, which can invoke a multicast delegate. However, the issue with this is if the PlayerState which is sent via the multicast hasn't been replicated to the client yet, the client cannot know which player has joined

dark parcel
#

Client Press Input -> Client rotate it's character -> Client Send RPC to Server with the Target Rotation

#

Server receive Target Rotation and replicate it to all clients except the one that is pressing the input

#

All other receiving clients, Interpolate towards the target rotation on tick

last storm
#

Gonna try that, thanks

tardy fossil
#

that gets called on clients

carmine ember
tardy fossil
#

they do eventually get GC'd though im pretty sure

chrome bay
#

They go into the inactive players list to handle rejoins

tardy fossil
#

or that lol

chrome bay
#

Add and Remove still get called when they join/leave though

sweet sage
#

How do i use NetCullDistanceSquared with Iris networking?

carmine ember
#

Ah yeah i'm just reading the AddInactivePlayer in game mode. That makes more sense now. Thank you both!

rustic sable
#

should it be possible to use a UObject singleton as a multicast sound player?

#

just to hold the actual UGameplayStatics::PlaySoundAtLocation functionality that will be called from the server. The singleton exists on both client and server but currently I can't get the multicast to play on the client

chrome bay
#

no

#

Only actors can route network calls

rustic sable
#

I really want to keep this functionality out of my player actor

formal turtle
#

is there a function inside gamemode blueprint that gets called when session is created. I dont remember the name but it was there iirc.

rustic sable
#

just like an actor I can send sound and niagara requests to

weary tapir
#

Hey guys, i need help with an unknown class when going from my game mode to the clients. I have a simple lobby system, where i want to display the list of players in the lobby to all players. I'm doing this from the game mode on the OnPostLogin and OnLogout events (screenshot 1):

The issue is, when I'm calling the method UpdateLobbyHUD on each player controller, the array contains unknown classes once the method on each controller is called. Screenshot 2 is debugging once a client joins a game with a player that acts a listen server. Here you can see two player controllers while we are still in the game mode. But in screenshot 3, you can see once the clients receives the call from the game mode, one of the player controllers is uknown.

Does anyone have an idea?

Thanks in advance.

sinful tree
#

Keeping an array of playercontrollers on the GameMode is also not necessary - the GameState has a "PlayerArray" which is an array of PlayerStates in the game, and from the PlayerStates you can access the associated PlayerController if needed.

gray sparrow
#

hey how can i replicate homing projectile??

sinful tree
#

Mark the actor as replicated, set to replicate its movement. Move the actor on the server. Profit.

gray sparrow
#

ok do you know how can i make swarm projectile

#

for example... 5 projectiles spawn at same point then the follow target... but every projectile has a other way

#

each projectile has a different trajectory

sinful tree
#

Spawn 5 different projectiles, have them move on different trajectories on the server.

gray sparrow
#

yeah but i can do do that every projectile ha its own way? and it not fly not straight ahead but in a curve

weary tapir
dark edge
oak pond
#

funnily enough I’m gonna be doing that soon. I would just have it move in the direction of its target on tick, and all you replicate is it’s target (although let me know if that’s wrong but it’s similar to what I do for enemies that aim at the player)

knotty bane
#

Hey folks, i can't find any horror related multiplayer setup does someone know/have some things i can work wich such as documentation or tutorials that can help, i've already have a host and join setup and working chracter but need to figure out all the other stuff

finite yacht
#

Theoretically, can Network checksum mismatch happen for cases where some variables / codes are wrapped with #if WITH_EDTORONLY_DATA / #if WITH_EDITOR, and trying to join from Editor to a packaged dedicated server would fail because the two instances have generated different network checksum?

I'm searching for answer similar to this issue, but it happens for a replicated actor component
https://forums.unrealengine.com/t/unreal-5-4-problem-with-a-packaged-game-server-spawns-the-character-and-client-disconnecting-with-failed-to-load-package-error/1841350/3

What are the fundamental factors that would affect a finalized network checksum?

Epic Developer Community Forums

Having the same problem. I upgraded from UE5.1 to UE5.4, wasn’t getting this issue before. Network checksum mismatch. FullNetGUIDPath: [126]BP_PlayerState_C_2147481901.[134]AbilitySystemComponent This is on an entirely new PC so I have no idea how there could be a mismatch… rebuilt and re-validated files. Hmm…

strong hazel
#

Hey all, hoping someone might be able to help/advise me on this issue.

Fairly new to multiplayer, so started with a simple turn based prototype. The alternating turns is working ok, but one thing I tried adding was UI which either says "it's your turn" or "its player [n]'s turn" (the n being 1 or 2 - 2 player game etc).

I'm running this locally on my laptop, netmode set to listen server with two players, debugging from Visual Studio, game running from the editor.

My GameState replicates the turn state, and my PlayerState makes use of the PlayerId, PlayerName, and I added a "bCanTakeTurn" variable, set on the server and replicated.

In the PlayerController, when I update the UI text, I iterate over GameState->PlayerArray to access the PlayerStates. A cast is required to cast to my own type of PlayerState. I then check whether bCanTakeTurn is true, if it is, "its your turn" is displayed, if not, then "its player [n]'s turn" should be displayed.

The problem I'm having is that, the client player (e.g. not the player on the listen server) never seems to be able to access the PlayerController associated with the PlayerState.

I've tried GetOwner() / GetOwningController() and under the hood I see all of these seem to be returning the "owner", as such, my cast always fails.

I don't understand why the Owner wouldn't be available for this player. During the GameMode->PlayerStates iteration, when its the listen server player's turn, it works fine. But this code is being run under a IsLocallyControlled() check, so it shouldn't really be making any difference that its the listen server player or not.

Utterly stuck/confused with this and would really appreciate any help / gotchas / info that might help shed some light.

Thanks in advance.

deep shore
strong hazel
# deep shore I may not be understanding your question correctly, but I think the issue is tha...

Hi, thanks so much for the reply.

My apologies if the query was a bit all over the place, its kinda hard to explain the problem more succinctly. You were however spot on, about 5 minutes ago I ran into the realisation that I can't access the other player controllers.

I've managed to get the player name from the other PlayerState now by comparing the PlayerId's, so I've got a bit of progress at least, and now now try to simplify this monster mess of a function!

Thanks again @deep shore, I appreciate you taking the time to reply and having the spot-on answer 🙂

deep shore
#

you’re welcome!

loud lynx
#

Is it normal that movement replication through UDP is so unreliable? I update it every 0.05sec. I'm writing my own network system, so I'm not using the built-in replications and such. Should I use TCP for movement replication as well?

kindred oyster
#

Hey, last days I sometimes got EditorCrash after Joining another Client on Runtime

#

[2024.08.05-21.10.36:383][872]LogWindows: Error: appError called: Assertion failed: IsValid(Object) [File:D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\PackageMapClient.cpp] [Line: 3050]

#

somebody run into this?

#

or have similar problems

echo snow
#

I have a pathfinding actor that contains the grid that AI agents navigate within. I want to place this actor into the world in the editor and generate a grid that would later be used during gameplay. I want this to be only on the server. How can I achieve this?

limber yacht
#

I'm working on Steam integration for session hosting/searching. I've cracked that part, however now when clients join the server they immediately crash due to accessing a nullptr.

Fixing the crash itself shouldn't be difficult, but this only presents in a packaged build connecting via Steam.

Are there any console commands/emulation steps that might help test this without needing to package/distribute the build to use Steam? Emulated pktlag doesn't do the job and that's about the extent of my knowledge.

After typing out the above I found that clients can join if they host a game first, which implies to me it's something to do with the loading of primary data assets. Still throwing the question out there in case anybody has a suggestion.

lost inlet
#

"crash due to accessing a nullptr" is extremely vague

quiet fjord
#

Guys, I have a question about replication regarding colliders in multiplayer

#

Can somebody help me?

lost inlet
#

don't ask to ask, just ask

quiet fjord
#

I have a problem when collecting the actors from a begin overlap box of my weapon. The problem I have is that it only detects collisions correctly when the authority is the remote. But I understand that the server is in charge of managing collisions.

#

The problem I have is that on my server the collisions of my attacks fail

#

Is this correct or should I do it remotely so that the client is in charge of checking if my weapon hit a player and then telling the server to apply the damage?

lost inlet
#

sure you could do that if your game has no competitive element whatsoever

quiet fjord
#

My game is a multiplayer arpg video game

lost inlet
#

that doesn't tell me if it's competitive. being able to tell the server you hit someone is easily cheatable

#

I don't know anything about what's going on here other than there's a collider

quiet fjord
#

The problem that is happening is that only on my client does the collisions work correctly. On my server the collisions are impressive.

lost inlet
#

"impressive"?

limber yacht
# lost inlet "crash due to accessing a nullptr" is extremely vague
[2024.08.03-05.32.41:067][479]LogWindows: Error: === Critical error: ===
[2024.08.03-05.32.41:067][479]LogWindows: Error: 
[2024.08.03-05.32.41:067][479]LogWindows: Error: Fatal error!
[2024.08.03-05.32.41:067][479]LogWindows: Error: 
[2024.08.03-05.32.41:067][479]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000000
[2024.08.03-05.32.41:067][479]LogWindows: Error: 
[2024.08.03-05.32.41:067][479]LogWindows: Error: [Callstack] 0x00007ff7c6db3876 LyraGame.exe!ALyraCharacter::GetRelevantCharacterMesh()

Just the old actor isn't yet initialized on the client I suspect. My issue isn't with fixing that, was just hoping for steps to pick these issues up without packaging -> distributing -> connecting multiplayer via Steam.

If it is related to primary data assets I suspect that's not possible without packaging since they'll loaded when the editor references them right?

quiet fjord
#

As a rule, the server should handle collisions to avoid backdoors.

lost inlet
#

yes I get a BP tutorial told you that

#

but I don't know how this collider is setup

quiet fjord
#

my server is imprecise

lost inlet
#

yes? it will be

#

there's latency

#

it won't always match up with the client framerate

#

is this for a melee system or something?

lost inlet
#

I don't know what your ALyraCharacter::GetRelevantCharacterMesh() function does

limber yacht
#

Yeah I know, I've done something dumb in here somewhere that doesn't trigger a crash when testing multiplayer via PIE but does using Steam.

That function is just returning which skeletal mesh that the weapon should be attached to, but the Character is a nullptr at this point. Doubt the function itself is relevant.

I'm more confused that hosting the game on the client, then joining the server will get around the crash.

lost inlet
#

can I have a crumb of context?

#

what does GetRelevantCharacterMesh do, what calls it?

lost inlet
#

as a client, you shouldn't assume that dependencies exist immediately

limber yacht
# lost inlet what does GetRelevantCharacterMesh do, what calls it?

I appreciate that, and I appreciate you offering your help.

I am not looking for a spoonfed code fix, I am curious if there might be any network emulation commands to help pick up these issues in a PIE environment.

Nevertheless, here is the code. Yes, if the ACorsicanWeapon is replicated before the ALyraCharacter exists on the client it is going to crash as a result of the BeginPlay implementation.

void ACorsicanWeapon::BeginPlay()
{
    Super::BeginPlay();

    USkeletalMeshComponent* TargetMesh = OwningCharacter->GetRelevantCharacterMesh();
}
USkeletalMeshComponent* ALyraCharacter::GetRelevantCharacterMesh()
{
    if (IsLocallyControlled() && IsPlayerControlled())
    {
        return FirstPersonMesh;
    }
    
    return GetMesh();
}
lost inlet
#

you can emulate late joining and such

#

and yes, it's very likely that OwningCharacter isn't initialised in BeginPlay

#

like you could get it in the initial bunch but that's not always a guarantee

limber yacht
#

Thank you, I will have a look at emulating late joining.

And also fix the weapon spawn cycle. For real this time. I promise you, future me.

primal summit
#

Hello, I am relatively new to some of the more advanced work dealing with multi-player game creation (i was thrown into it unfortunately since the indie studio i work with lost their server setup guy).

My current dilemma is I am trying to build both a dedicated server and a client that gets directed to said server. There are a lot of guides out there, but none seem to reliably answer my particular situation.

My goals are this:

Build a dedicated server for a Linux operating system (we have a Linux server to use)

Build a windows client that can find and locate said server, while being able to select a character

Have both of these able to be scaled up for other dedicated servers

This is all completely new to me and I have been struggling to find a solid solution to this. I have managed to successfully compile a source Build of UE5.3.2, install advanced sessions plug-in and steam sessions plug-in. I just need to build the ability to connect to a server as well as the server itself.

Thank you for any assistance. I have been on the struggle bus big time dealing with this as I was just supposed to be the "build mechanics with nodes" guy

woeful sky
#

If my game is peer to peer multiplayer, does it mean that the server (the player hosting) has about 0 latency? Meaning that Clients Only as emulation target is the most accurate form of emulation? I ask because my game works on "Everyone", but there is alot of correction happening so it feels bad. On Clients only it works well.

dark parcel
#

There is no "server" in p2p

#

Every machine run its own instance and talk to each other.

woeful sky
#

wait i should rephrase think like valheim multiplayer

#

where 1 person hosts the server

dark parcel
#

On the contrary server to client model, the client never directly talk to another client.

#

I don't really play valheim

#

But p2p is like old diablo

woeful sky
#

1 person who is hosting is the server

#

your other friends connecting to you are clients

#

should there be no latency on the server in this case?

dark parcel
#

Maybe the term you are seeking is server to client model

#

Which what unreal use by default

woeful sky
#

maybe, I dont know much

#

just not sure what form of emulation is most accurate

dark parcel
#

In that case yes, server have 0 latency

woeful sky
#

ok cool, I found a couple bugs with server latency that I fixed anyways, but it just feels shit to play when everyone is enabled

dark parcel
#

Imo latency is why multiplayer isn't soo easy.

#

Doesn't matter when you don't need to care about it. Like turn based game or chess

woeful sky
#

yeah i got action combat 😭

dark parcel
#

But for any fast packed game, the difficulty rose quickly

fossil spoke
#

Peer 2 Peer in Unreal is a misnomer and entirely impossible

#

There is always a type of Server in Unreal

#

Either Listen or Dedicated.

#

Using P2P to describe network architecture within Unreal is just simply wrong.

woeful sky
#

Yes makes sense, I dont know shit 😂

#

So what im talking about is a listen server basically

fossil spoke
#

The Host is the Server (Listen Server)

#

They have 0 Ping to the Server because they are the Server.

silent valley
# primal summit Hello, I am relatively new to some of the more advanced work dealing with multi-...

That's a lot of questions all together. I don't know where you're upto with this but here's a rough outline.

  1. Dedicated server package requires building Unreal from source, but you can emulate in PIE quite well till youre ready for that step.

  2. Discovering a server from a client requires use of an #online-subsystems the specifics and choice of which depends on your platform and architecture (steam, playfab, game lift, etc).

  3. Scaling servers. As above, Steam is fine for connecting to servers you spin up yourself, but if you're session based and you want servers to start and stop with demand, then you'll probably want to use playfab/gamelift/etc rather than Steam matchmaking.

formal turtle
#

question

#

if a player dies and the pawn gets destroyed in MP, I asssume you need to spawn a new pawn obviously but how would you possess it and assign it a new player controller?

#

better yet, how can you use HasAuthority if pawn is dead and there is only the client instance/server instance left?

modest crater
#

First question

  • What substitutes dying? You can have the player respawn with the same pawn if you wanted to, it'd be a simple set actor location and some logic on your behalf to "restart"
    If you mean unpossessing a pawn then yes, you would need to have the server then possess a new pawn, your controller stays with you for the entire game until you move worlds
formal turtle
#

i did it both ways now or kind of figured out a way to, but im more talking about spawning a new pawn when character falls into the void

#

spawning it will work but for some reason the input itself is messed up. e.g i can use mouse input and rotate camera, but keyboard controls are not working

#

even when controller is set to 'game only'

#

i am guessing that you would use gamestate or gamemode to keep track of playercontrollers and check whether they have a pawn, periodically

modern cipher
#

You probably don't need to create a new pawn unless you want to do that; you can simply disable collision and movement, hide the pawn, and then reset it for reuse.

formal turtle
#

i mean if player falls into the void

#

they get automatically destroyed unless there is a way to suppress that

modern cipher
#

Override FellOutOfWorld to customize that behavior.

formal turtle
#

is that a c++ function? I cannot see it in pawn class in blueprint

real ridge
#

guys why i see 2 line traces printed when I am using server call + authority should not be there just one line trace printed?

#

if are 2 it means it is one for client one for server nah?

raw drift
#

Hey guys, someone know how to display a widget on a specific player that overlap a box ? I have a Big box zone where if someone enter it create a widget that display a message on screen. However i can't figure out how to only display this on the person who walks in, right now it does display on every player... do you have any advice ? Thanks !

dark parcel
real ridge
dark parcel
tardy fossil
#

i think the blueprint print node prints messages on all running processess, even if that specific instance didnt call the print node

dark parcel
#

so at least, we can still tell whos printing

dark parcel
#

So from the event, do a switch has authority

#

Then from there, other actor -> Cast to Player Character -> Get controller -> Run a client RPC function that display the widget
_

#

the idea is when an actor overlap with the box in the server machine,
you check if the actor is your player character type, if it is, get it's controller
then tell the controller to run a function (in the owning client)

raw drift
#

Hmmm

#

I'm not quite sure how to use the switch has authority node

dark parcel
raw drift
#

Wow what is that

dark parcel
#

read it and find out

raw drift
#

i sure will thanks

dark parcel
#

especially section 5, it goes over the switch has authority nodes

#

but everything written there is essential

raw drift
#

It looks likle that 6.1 is exactly what i need lol

lost inlet
#

you know that it has a _Implementation function and that can be virtual right?

real ridge
raw drift
#

@dark parcel This works as intended, do you see something wrong in what i did ? even if it works

dark parcel
#

because what you are doing here is you allow client to test the overlap

#

so in other word, there's more vulnerability

#

you can also do drag OtherActor -> Cast to BP_Character-> IsLocally Controlled, that will be shorter than what you have atm

#

@raw drift actually you are just displaying widget, doing the check locally is totally fine imo

odd iron
#

Hello guys ,
How can I send the partyID from client to server ..
I've tried everything idk what i'm missing
The partyID I want send
attached in photo

raw drift
thin stratus
odd iron
quiet fjord
#

Guys how can I correctly replicate the location of my weapon socket that is on my character. It only replicates it correctly for a second but when I do an animation with my weapon the weapon socket is not replicated on the server

still saddle
#

Hello guys, can you recommend any tutorials for replicating enemy behavior in BP?

quasi tide
#

What do you mean?

#

That is extremely vague

#

AI logic doesn't really replicate by default. It is all ran on the server.

solid fractal
#

Hey, so I made a reddit post about this but also want to check here. Does anyone know if there's anything special or extra beyond the standard local multiplayer setup when doing cross-platform LAN applications? I host a listen server on my PC, but the android and VR builds cannot find any sessions

still saddle
solid fractal
#

Also for context: I'm using this crete dev tutorial for what I'm considering standard local multiplayer setup, but excluding all the onlinesubsystemsteam elements and only using null
https://www.youtube.com/watch?v=jc0COamYRm4

Wishlist CRETE on Steam or join the next playtest here:
https://store.steampowered.com/app/2022610/CRETE/

If you want to see how CRETE looks now, consider subscribing to the channel, checking our latest videos, or joining our Discord server to follow the development:
https://discord.gg/tRbEH2Cscp Since Advanced Sessions Plugin won't work anymor...

▶ Play video
quasi tide
buoyant basin
#

got a little bit of a weird problem here
currently making an online multiplayer game and each player has a few movement abilities. The server host can use all abilities fine but any joined players arent able to. This is because each player reads from a TXT file to choose which abilities they have, the server can read the host's TXT file so it assigns that player their abilities, but the server cant read any other players's TXT files meaning that it thinks they are all empty and have no abilites. The non host players can read thier own files though, meaning that they think they can use abilities. When a non host player uses a movement ability, they are rubber banded by the server back to their original location.

anyone have any ideas on how to fix this? is there a way to attach the TXT to each player so that the server has access to it? or anything else im not thinking of

using the AdvancedSessionsSteam plugin btw

#

#online-subsystems message
@silent valley what do you recommend me do in this situation? I have the file in place so that players can make a loadout before they join a server, if the server just assigns them something it wont be the same as whatever they had just saved (also i designed this system before i implemented multiplayer so i had no idea it would be a problem)

#

whats a good way of telling the server what each player should have and how should the players retrieve that information from the server?

silent valley
prisma steeple
#

I'm a multiplayer noobie, trying to hack together Lyra and the Game Animation Sample, was curious where to start looking to understand what possibly make the animation replication behave so strangely, it looks like the standard lyra animations are used for replication, I think that's a clue, I also have no idea why the second player traversal simply fails, any clue might help -

bitter robin
#

Traversal needs to happen on both client and server. If you are the server, it should happen on the clients so the other clients can see it. And if you are the client your traversal simply fails because the server isn't doing it, and the server is authoritive over the pawns location.

primal summit
hidden pine
#

Quick question: Multicast RPCs vs RepNotify. Is there difference in terms of performance? Let's say we have a tick event and do an RPC at every tick. Versus modifying a replicated variable in (nearly) every tick and thus causing the OnRepNotify function executed on clients. Is there a performance benefit from one over the other?

buoyant basin
# silent valley Usually the only way a client can talk to the server is via RPC from Playercontr...

so turns out im just really stupid and was entirely wrong about my entire problem. the player reads their own txt and sets their abilities just fine. i just dont know jack shit about replication and RPC's. All of my events are called locally through the player pawn and dont communicate with the server at all, so all they can do is basic wasd and jump movement. Ive spent the last like 2 hours looking into rpc's and replication but i still dont quite understand it.
So say i have some series of things that are supposed to execute from an EnhancedInputAction, that function has no replication settings in its details, so how do i make it happen on the server and on the client?

#

am i gonna have to rewrite all of my abilities onto the gamemode or something handled by the server? idk while ive been doing unreal for quite a while now im quite new to multiplayer development and i dont quite understand the server to client communication

silent valley
buoyant basin
#

no, its just a bunch of spaghetti code
also half of it is attached to a movement component

#

ive got a very complex system in place
on the movement component i have things like wallrunning and sliding and quite a bit more
on the player pawn i have grappling hooks and special movement abilities

#

just a bunch of when button pressed, do this

#

but like none of it works as a client

sinful tree
cedar lagoon
#

Hi, is there any way to spawn an actor on the server (non controllable one) and set its role on clients to be ROLE_AutonomousProxy so that I could somehow perform some client prediction on this actor? While still being replicated for other players.

quasi tide
fathom aspen
# lost inlet you know that it has a _Implementation function and that can be virtual right?

Of course, and it was mentioned literally before the section you screenshotted. But many people don't know that, and chat history in this discord proves that overriding RPCs that way is grounds for being shot. At least if you wanna screenshot and mock people here about something, investigate the case fully, and take proper full screenshots that disprove your point

fathom aspen
quasi tide
sinful tree
#

Dur-ox-cigar

fathom aspen
#

Duro the invincible

hidden pine
buoyant basin
silent valley
buoyant basin
silent valley
cedar lagoon
#

Hi, is there any way to spawn an actor on the server (non controllable one) and set its role on clients to be ROLE_AutonomousProxy so that I could somehow perform some client prediction on this actor? While still being replicated for other players.

bitter robin
#

RemoteRole?

buoyant basin
lost inlet
buoyant basin
bitter robin
#

rewrite it or not you are still gonna need to understand network code, and if you do you could porbably fix this as well :P

lost inlet
#

That's usually for the best for multiplayer stuff

#

It's hell to convert stuff that's assuming single player

lament flax
#

im getting a dumb moment

i got a custom struct thats marked ReplicatingUsing, ive setup the DOREPLIFETIME and the OnRep functions
i update the value of the struct on server but i never get a call to the OnRep on my client
the actor is set to replicated

vivid seal
#

ReplicatedUsing

#

Are the struct properties you want to replicate (within the struct itself) marked UPROPERTY

nova wasp
lament flax
#

Ill try that tomorrow morning

oak pond
#

how do you properly replicate something like the player aiming their weapon around? currently I do it every frame which cant be good at all, but if I interp it it would look pretty bad, and Ive noticed in multiplayer games when you see the player do quick movements with their mouse, such as "nodding", it looks completely accurate. maybe the rate it updates it needs to be based on cursor movement or something?

#

like Id assume slower mouse movements = less frequent updates and more interp, and fast movements are more updates and less interp, but idk how to set that up

lost inlet
#

You can rate limit it to make it a tad predictable since otherwise it's sending at the client's framerate

#

And that's probably overkill

oak pond
#

true yeah, I guess a timer would be fine? then I could change the delay in runtime if needed

lost inlet
#

Yeah probably at 15/30Hz, whatever you can get away with before the effect is noticeable

#

Any simulated proxies would just forever interp towards whatever the latest value is

twin juniper
#

Does this graph look good for when a player shoot in a coop multi-shooter game?

  1. Client Clicks

Detect the player's input (e.g., mouse click)

  1. Show Visuals (Client Only)

Display gun explosion and trace 2D image effects on the client

  1. Client Trace

Perform a trace (raycast) on the client to detect if the shot hit a target

  1. If the Trace Hits (if it doesn't, we got to 6.1 directly with the Server RPC)

Send a Server RPC (Remote Procedure Call) to notify the server

  1. Server Validates Trace (only if the first trace actually hit something)

Perform a trace on the server to ensure the shot is valid

  1. If the Server Trace Hits

Apply damage accordingly
Show visual effects (gun explosion, trace 2D image) for all players, except the client who initiated the shot
Visual hit effect -> Everyone

6.1. If the Server Trace didn't Hit

Show visual effects (gun explosion, trace 2D image) for all players, except the client who initiated the shot

fossil spoke
#

You want to be careful predicting damage effects on the Client though, what if the Server rejects it and applies no damage?

twin juniper
#

Then the client thinks he damaged the enemy but didn't actually..
What would be the best way over this?

fossil spoke
twin juniper
#

So dont predict the visual hit but still predict the gun explosion visual?

fossil spoke
#

The gun still fired, so you can predict all that.

#

But for example if you have a Crosshair flash indicator for Hits that deal damage, you might not want to predict that.

#

Since it could be rejected by the server and you are giving incorrect information

twin juniper
#

That's right

hollow bridge
#

I personally think that visuals should actually be predicted in the client, to give the player a proper response to the shot.
Also, for the server validation you could rewind the character locations for a more accurate validation

fossil spoke
#

A damage effect is something which indicates the application of damage.

hollow bridge
#

Showing the Crosshair flash only after the server acceptance would be a bad player experience.

fossil spoke
#

The only time that would be a bad experience is in a high ping scenario.

#

The worse experience would be thinking you dealt damage, when you didnt.

hollow bridge
#

If you have a proper rewindable server validation that would'nt happen in 99.9% of the times (unless the player is a cheater)

little pumice
fossil spoke
#

The context he provided mentioned nothing about rewind, you shifted the goal post by adding that in.

#

He might not want rewind

#

He might not be able to implement it

little pumice
#

whatever you implement Players will always complain, haha Jokerge

fossil spoke
#

There is only so much you can do to workaround the limitations of physics

modest crater
fossil spoke
#

But I would also want to know if I dealt damage to enemies accurately.

#

So in that scenario you have no choice.

kindred widget
#

On the other hand, if you're a lobbyist for peripheral hardware, you should indeed lie to the player. Broken hardware means more sales.

sonic obsidian
#

Hey looking for some advice i want to client side predict building idea is spawn the build on client generate a UID for it put it in a TMap<FString, AActor*> ActorMap; with the ref of the build send the UID to the server the server spawns the build then send a RPC to the client passing the UID client searches the map finds the proxy actor and destroys it

#

heard theres a better solution im probally wrong but from what i understand when the server spawns the build it will use the build just spawned on client as the actor it would have spawned when replicating down? also i think theres a whole bunch of stuff like stably named and all that but not sure if actors that are spawned at runtime are stably named?

stone shuttle
#

I have the same exact problem with almost the same exact set up, is there a better way to do this. They are saying this is worse on performance, since it's a server action i want to be lightweight. I want to move a topdown character from the server after the client has given a location of where to go. It works on standalone or on the server instance but not on client. I have enabled allow client side navigation (this shouldnt matter since i'm trying to move from server) Thoughts?

stone shuttle
sonic obsidian
dark parcel
#

Are there delegates that I can use when something ( I assumed game mode ) finishes iterating begin play of actors in the level?

#

I want to create a window to sync animation for joining clients

#

Actually I would need something to fire on client side

dark parcel
#

On predicting client, I spawn locally

#

At the same time telling server to spawn a replicated actor.

#

Other clients will spawn a copy but on predicting client, it stay hidden

#

You can sort of "replace" your locally spawned client on predicting client when it receives the actor. I would just destroy the locally spawned actor then make the incoming actor visible.

For less headache, you probably don't need to predict building placement.

tardy fossil
#

whoa i had no idea you could do that

#

lurking pays off

modest crater
#

These are my old Obsidian notes on it if it helps lol

Stably Named Objects

Stably named objects are simply objects that will exist on both the server and the client, and have exactly the same name.
Actors are stably named if they were loaded directly from packages (not spawned during gameplay).

Components are stably named if they were:

  • Loaded directly from a package
  • Added via simple construction scripts
  • Manually marked (via UActorComponent::SetNetAddressable )
    • This should only be used when you know you are manually naming the component so that it has the same name on the server and client (a good example are components added in an AActor C++ constructor)

You can also force stably named actors as demonstrated here

To have a client pre-emptively spawn an AActor that is also suppose to be server authoritative and owned, we must ensure we have the same name for the actor on the server and client as well as mark it as NetAddressable before spawning it and the outers must match.

void SomeClientFunction()
{
    FActorSpawnParameters p;
    p.Name = FName( FString{"FooBoo" + GetName() + FString::FromInt(FMath::RandRange(0, 1000))} );
    p.Owner = this;
    p.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined;
    p.TransformScaleMethod = ESpawnActorScaleMethod::MultiplyWithRoot;
    p.bDeferConstruction = true;
    auto* a = GetWorld()->SpawnActor(cubeClass, &GetActorTransform(), p);
    a->SetNetAddressable();
    a->FinishSpawning(GetActorTransform(), true);

    // Server RCP
    Server_SomeServerFunc(p.Name);
}


void Server_SomeServerFunc(FName actorName)
{
    FActorSpawnParameters p;
    p.Name = actorName;
    p.Owner = this;
    p.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined;
    p.TransformScaleMethod = ESpawnActorScaleMethod::MultiplyWithRoot;
    p.bDeferConstruction = true;
    auto* a = GetWorld()->SpawnActor(cubeClass, &GetActorTransform(), p);
    a->SetNetAddressable();
    a->FinishSpawning(GetActorTransform(), true);
}

Note : Spawn actor deferred (which is what we need to SetNetAddressable before spawning) is not able to be used here since we lose the ability to pass FActorSpawnParams and set the name/owner, so instead we are doing what deferred does but ourselves.

#

(it was a while a go that I did it)

tardy fossil
#

if a client creates a predicted object in that way, will any RPC's called on it by that client be dropped until it exists on the server?

modest crater
#

I'd assume it'd be the same logic for when a client joins and gets some RPC from the server about an actor it doesn't know about yet peeposhrug

chrome bay
#

FYI, that actor should also be replicated

molten vine
#

Same problem

untold rose
#

I'm not sure if this is the best place to ask this but I'm working on a project and thought I would see how much is currently replicated. When testing with 2 players as a listen server. The focused window (PIE) changes making it sort of possible to control characters in both the PIE windows. Does anyone know what sort of thing can cause this type of behavior?

untold rose
# dark parcel can't switch with alt tab?

For more context, when the client looks at something that would show a widget, it opens on the listen server instead which then gives that window the focus which is odd as I've not done anything the replicate the UI. o.O

dark parcel
#

Ahh because the code gets run on the server machine too

#

big part of multiplayer is filtering codes

#

to make sure something run on server and something run on client

#

in some cases, they can run on both if not addressed

untold rose
dark parcel
#

Think of a collision box that adds widget to the viewport

#

every machine will do the collision check if you don't filter the code

untold rose
#

Yea that makes sense now as the widget sets the input mode and focus which because it's ran on the server causes the switch.

dark parcel
#

mind sharing the code?

#

the switch is normally what filters the code

untold rose
dark parcel
untold rose
quiet fjord
#

Does anyone know how to replicate the physics of a weapon?

untold rose
dark parcel
#

also what the server sees and the client sees is not always guaranteed to be the same because well, latency

#

normally in networking, clients are favoured with certain treshold

bitter robin
#

There is no point in tracing on the server to begin with. If its an interactable any visual feedback will be client side only, and once you interact with it that action will go from client to server.

dark parcel
#

Doing RPC on every tick for something like a trace when the client can trace locally, I would not encourage it but maybe other people can give second opinion.

thin stratus
#

I mean, all that aside, these two screenshots are still really redundant?

#

Tick calls on everyone, so why even that RPC

untold rose
dark parcel
#

So I think you just want to entirely make sure that the focus node runs on targeted machine

#

e.g. for interacting player

#

@thin stratus I'm trying to sync animation for players that just join the world for the first time. (Animation players and montage) in anim instance.
Was called perfectionist but I thought it's kind of necessary?

Does the projects you worked on sync anim at the start?

untold rose
# thin stratus Tick calls on everyone, so why even that RPC

It just makes the server tell the owning client to perform the trace so the client doesn't have x amount of characters performing the trace, as they only care about their own character. But yea, it's not the best way to handle it. I need to find some time to tear the whole system down to handle the replication properly.

dark parcel
#

Event tick ->Is locally controlled -> Trace

#

@untold rose

#

Try that and test the game 🙂 with debug line trace

thin stratus
thin stratus
untold rose
dark parcel
untold rose
thin stratus
#

That is dangerous

#

Cause BeginPlay is often too early for that.

#

Pawn itself has a function called OnControllerReceived or something like that.

dark parcel
#

I barely start on my project, but have nothing on Begin Play soo far.
Some gotchas when it comes to MP like eXi mentioned

thin stratus
#

That calls for Server and Owning Client when the Pawn gets possessed

#

BeginPlay is too early, as the Pawn would replicate, call BeginPlay and only afterwards get the Controller replicated if you are unlucky.

#

If you need to react to the Pawn being possessed and then use IsLocallyControlled, you'd need to use that OnController function in the Pawn and notify the Component in whatever way you find best.

untold rose
#

So something like this. Wait until the pawn is possessed and then check if locally controlled?

thin stratus
#

Yes. The only edge case you could run into is that the Pawn is in fact already locally controlled when BeginPlay calls and the ReceivedControlledChanged won't call again until possession changes

#

So you might want to do both.

untold rose
# thin stratus So you might want to do both.

I assume this should handle it? If it has a controller already then the bound event won't fire until it's repossed so I should just call the function to check if it's locally controlled.

thin stratus
#

Yeah, that should be fine.

untold rose
#

Thanks for the help guys. 🙂

thin stratus
#

Also, for your own sanity, get used to calling Parent versions of BP Events/Functions. E.g. BeginPlay and Tick

loud lynx
#

If anyone is familiar with C++/C# and the TCP protocol, could you help me find the error in my code? It’s too extensive to post here, but I'd be happy to send it via PM or another method to brainstorm on it a little bit and share the results if it’s fixed.

sonic obsidian
#

why cant i destroy a client only proxie build? nothing happens the actor is never destroyed despite it being valid?

#

the actor is set to replicates but is spawned on client

dark parcel
#

I reckon the server wouldn't even know of the actor that the client spawn locally

#

nvm, should be fine

#

you grabbing variable from the client

#

try to debug Imo, print the actor being destroyed

sonic obsidian
#

i am trying to client side predict spawning builds so a spawn build on client then genraete a UID add it to the map send that to server sever spawns real build then that 'real' buidl replicates down and spawns on the client then server sends the UID back to the client to destroy that 'fake proxie' build

sonic obsidian
#

actor is valid and it is the right actor i am trying to destroy as i checked the location

dark parcel
#

well no way to verivy from here or without seeing

sonic obsidian
#

ill send pics this is on client add prxie build adds the UID and the actor to the map

#

send UID to the server

dark parcel
#

where exactly do you spawn locally?

sonic obsidian
#

server sends UID to client and calls this func

dark parcel
#

looks like you are spawning on server

sonic obsidian
#

its hard to explain but i am spawning a 'fake' /proxie build on the client only then i want to destroy it later but i cant

cyan bane
#

I’m trying to do Find Sessions over a WiFi network with a null subsystem but it’s failing. Is there something special you have to do? Or will this not work at all since it’s not hardwired LAN?

dark parcel
#

second picture is after I pressed C

sonic obsidian
#

im doing it similar to that try spawning locally fire a server RPC to spawn another cube in the exact same loc and the rpc back to the clien to destroy the locally spawned cube cube

dark parcel
#

I am aware

#

gave example above X_X

#

but I can';t go thru your system

#

for my abilities, I also made a proxy projectile for the firing client

#

because I can't wait for the server to spawn the fireball

swift bay
#

Hey there, I have a question regarding ownership and some workflows with it:

I have written an actor, lets call it DataManager, that is responsible to import/convert json files to my data structure and store this data in an array. That actor and the array are replicated.

For each entry in that array, a world presentation in form of a replicated actor is spawned. I got to the point, where I want to give the client the option to locally import jsons as well.

So he presses a button, the file browser opens and he can select a file. After the conversion, I wanted to use the local instance of the DataManager
to invoke a server rpc to tell the server, "Hey, here is new data I have converted, put that into the array and replicate it alongside its representation to all other clients".

Because the local instance is still owned by the server, the Server RPC fails silently. Therefore, I rerouted the Server RPC through my PlayerController, which worked, but left me wondering:

Is there a better workflow so that I can prevent bloating the PlayerController with RPC functions? I have read that I could set ownership when spawning the DataManager, but can't really get
my head around how that works with multiple clients, as the server can only set one client as owner?

Or would it maybe be better to let each individual client playercontroller request the ownership of the local instance of the DataManager after initialization?

Thanks!

sonic obsidian
#

this sorry

dark parcel
#

have you tested it? that should work

#

make sure to change the spawning rule to always spawn

sonic obsidian
dark parcel
#

try to do it inside your character

sonic obsidian
dark parcel
#

if the actor is not owned by the client, your RPC will get dropped

sonic obsidian
#

right

dark parcel
#

well I never do any networking with an actor component yet so I have no idea if it work or not

sonic obsidian
dark parcel
#

One that you spawn locally

#

and the other one that comes from the server

sonic obsidian
#

yes i know but im testing a edge case where the server denys the spawn and tells the client to destroy that actor

#

and it destroys and then magically spawns agian

dark parcel
#

In your Spawn Server Function -> Validate (If True) -> Spawn actor -> Client Destroy Build
if false -> Client Destroy build

sonic obsidian
#

captured here it gets destroyed then is back somehow and all its data has changed like health and all that

dark parcel
#

gotta sleep, gl with it

sonic obsidian
stark nova
#

Hey Everyone - I feel like my logic is correct here but its not working so wanted to run by you guys.

I want to store some data in the PlayerState. I have a variable X which is set to replicate. From the client I call a server RPC from blueprints to modify X. However after this function is called I do not see changes to X being replicated to all clients, or even the owning client who called the RPC.

Is there something I am missing? I am not sure why the changes to the variable are not replicating to all the clients.

Edit: Apparently I was calling the server RPC for the game state from the client which was not working. Calling an RPC to my player controller on the server which then modified the GameState did the trick

charred crane
#

For multiplayer games, do they use two servers? One for logging in and one for actually connecting to the game?

graceful lynx
#

For future reference, this might be a great tactic to make sure stuff is happening in the right order without a custom event rpc

stark nova
#

I'm just making the variable visible from the editor so I can see when it is modified

#

So I can see if it is changed when another client sent the RPC

graceful lynx
#

got it, I'd really advise using rep-notifies + a print statement to validate, as that will also tell you where it's being replicated

#

of course, but order of operations can mess you up later with that test method, so it's good to have more tools

stark nova
#

Rep notifies are fine but I'm hesitant with them because they wont be called if a client hasnt connected to the server yet

graceful lynx
#

I'm not saying you're doing anything wrong for the record

stark nova
#

Yeah I see the benefit of rep notifies for understanding when a variable is changed for sure.

graceful lynx
#

That's 100% true, it hadn't occured to me there was a possibility you hadn't connected

stark nova
#

I appreciate the advice 🙂

graceful lynx
#

Of course! Good luck, multiplayer is hard!

graceful lynx
charred crane
graceful lynx
#

Yeah so for friends and such, it's REALLY best to use an API, I think Playfab has that

charred crane
#

So you’re offline but making api calls?

#

“Offline” being not connected to a server

graceful lynx
#

So "offline" is a weird thing... You don't need to be TCP handshake connected to a server to request stuff from an api at intervals

charred crane
#

for something like league or fortnite where you invite a player to your party to queue for a match, then joining your party is really just their data being sent from an api?

graceful lynx
#

You can always ping it at intervals and get your status without needing to be connected, it's just a "Hey what info do you have"->"Returns info"
"Hey where should I connected"-> returns servers you can get to

#

yeah and then the players being represented in your party is probably a listen server or something

#

Otherwise cost would be obscene

#

for lobbies

#

At least that's what I'd do, there's a million ways to do this

charred crane
#

So a functional flow could be launch game->”offline” login map->enter credentials->logged in listen server map->api calls for friend list status and invites->party formed->queue for match via api call->connect to game server

graceful lynx
#

correct

#

Listen server map can be your default lobby map anyway

blazing bear
#

Anyone here made the setup of FPS Arms and a TPS body mesh to show to other players? I want to know how do you handle picking up an item, say a flashlight, you can't attach it to both meshes at once, so do you spawn another flashlight, one attached to the fps arms, and one to the tps body mesh? or how?

bitter robin
#

I'm assuming that others cant see your FPS arms, so it would just attach to FPS arms for you and to TPS for all others. Not sure what the difficulty is here?

blazing bear
#

Yes your assumption is right, but I can't attach one item to both meshes at the same time, can I?

bitter robin
#

That said, often the FPS arms\weapons are completely separate items. What do you mean? the attachment is purely visual and local so its not attached to more then one.

blazing bear
#

for example, in my code, when I pick something up, I'll attach it to the mesh like this:
Interactable->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetIncludingScale, ItemHeldStruct.Socket);

okay now it's attached to the fps arms, now we need to attach it to the tps body, I can't do another AttachToComponent to the tps mesh because then it will be detached from the fps arms, am I missing something here?

#

which made me think I should spawn another item that will not be seen by the owner, that will be attached to the tps mesh

bitter robin
#

Hmm, well FPS arms only need to exist on the owning client, so attaching would be purely client side for the owning client. It's probably easiest to attach a copy locally, it may be possible to attach the same one, to the FPS arms, locally only.

blazing bear
#

Yeah that might be a thing, I'm just not experienced enough to think of a way to do it yet, but I'll keep what you said in mind

#

Thank you

waxen apex
#

Question: I have created a Death Event for a character class that is binded via a Delegate that activates when the player's health reaches zero (a Gameplay Attributes thing from GAS).

I have the Event run on the server using ServerRPC, as originally this binding of the delegate and event was on the GameMode class but I moved it to the character class.

I wanted to ask if this way of doing things is secure enough for multiplayer (as in, players can't somehow manipulate this).

oblique condor
#

I'm using the following to restart the match after a game is complete:
GetWorld()->ServerTravel("?Restart");
When this happens I get this crash:
AActor::CallPreReplication (this=0x7fd117c352a0, NetDriver=0x7fd11dbe75e0) at .\Runtime/Engine/Private/Actor.cpp:1578
Is this the proper way to restart the match? I took it from the AGameMode class RestartGame function.

odd iron
#

Goodday guys , I have a small issue.
When I'm packaging the dedicated server from source engine .
and trying to join from launcher version as a client its failed

PendingNetDriver[OutdatedClient]: The match you are trying to join is running an incompatible version of the game.  Please try upgrading your game version

Same code and same build but only difference is Engine Source / launcher

solar stirrup
#

You can't do that

#

You have to have the same engine

odd iron
#

So I have to keep working with Source engine ...
Because the other devs using launcher version I thought maybe we can avoid this issue @solar stirrup 😦

solar stirrup
#

Package the client using the source engine version as well

#

You don't have to work using the source engine assuming you didn't modify the engine at all

#

But when you package your game, use the source one

odd iron
#

I'm testing the Party / Team System so I have to travel between local to lobby ( Dedicated server ) thats why i'm packaging the server using source code

#

and letting other devs joining for testing purpose .
Also I'm using Edgegap Plugin for Deployment so i have to package it using Source Engine

#
  • yes i've modified nothing in engine no need yet
oak pond
#

is there a way to reliably deal with things that have already changed before a player joined? like if one player kills some enemies, then another player joins after that, they should be dead already, would a simple begin play event work for updating them? I know most games would use a lobby before the actual level starts so that everyone gets in at the same time but Im wondering if thats the only way

loud lynx
#

So I started to write my own network segment and using UE only as a client. I think movement replication can be done easily through TCP, like sending every 0.05 sec to smoothly replicate other players around our player. Then I made a decision to pass the data in binary protocol. It is working fine (partly), I'm sending the TCP package to the C# server that listens to that TCP port, but there is a catch. The first package arrives without any error, but from the second package, the data is kinda corrupted, there are missing parts in it. I can't figure out why. This is how I serialize the data before sending to the server: ```c++

void AConnectedCharacter::SerializePlayerState(const FString& Context, const FString& PlayerName, float x, float y, float z, float rx, float ry, float rz, float vx, float vy, float vz, TArray<uint8>& Buffer)
{
uint8 MessageType = 1;
uint32 DataLength = 1 + 4 + 1 + Context.Len() + 1 + PlayerName.Len() + (9 * sizeof(float));

Buffer.Add(MessageType);
Buffer.Add((DataLength >> 24) & 0xFF);
Buffer.Add((DataLength >> 16) & 0xFF);
Buffer.Add((DataLength >> 8) & 0xFF);
Buffer.Add(DataLength & 0xFF);

Buffer.Add(Context.Len());
Buffer.Append(reinterpret_cast<const uint8>(TCHAR_TO_UTF8(Context)), Context.Len());

Buffer.Add(PlayerName.Len());
Buffer.Append(reinterpret_cast<const uint8>(TCHAR_TO_UTF8(PlayerName)), PlayerName.Len());

Buffer.Append(reinterpret_cast<uint8>(&x), sizeof(float));
Buffer.Append(reinterpret_cast<uint8>(&y), sizeof(float));
Buffer.Append(reinterpret_cast<uint8>(&z), sizeof(float));

Buffer.Append(reinterpret_cast<uint8>(&rx), sizeof(float));
Buffer.Append(reinterpret_cast<uint8>(&ry), sizeof(float));
Buffer.Append(reinterpret_cast<uint8>(&rz), sizeof(float));

Buffer.Append(reinterpret_cast<uint8>(&vx), sizeof(float));
Buffer.Append(reinterpret_cast<uint8>(&vy), sizeof(float));
Buffer.Append(reinterpret_cast<uint8*>(&vz), sizeof(float));

}```

#

And this is how the server processes the data: ```c#
private void ProcessBinaryMessages(List<byte> messageBuffer)
{
while (messageBuffer.Count >= 5)
{
byte messageType = messageBuffer[0];

  int dataLength = (messageBuffer[1] << 24) | (messageBuffer[2] << 16) | (messageBuffer[3] << 8) | messageBuffer[4];
  int fullMessageLength = 1 + dataLength;

  if (messageBuffer.Count >= fullMessageLength)
  {
      byte[] message = messageBuffer.Take(fullMessageLength).ToArray();
      messageBuffer.RemoveRange(0, fullMessageLength);
      ProcessMessage(message);
  }
  else
  {
      break;
  }

}
}```

#
private void ProcessMessage(byte[] message)
{
    using (MemoryStream stream = new MemoryStream(message))
    using (BinaryReader reader = new BinaryReader(stream))
    {
        byte messageType = reader.ReadByte();
        int dataLength = reader.ReadInt32();

        Console.WriteLine($"Processed MessageType: {messageType}");
        Console.WriteLine($"Processed DataLength: {dataLength}");

        int contextLength = reader.ReadByte();
        string context = Encoding.UTF8.GetString(reader.ReadBytes(contextLength));

        int playerNameLength = reader.ReadByte();
        string playerName = Encoding.UTF8.GetString(reader.ReadBytes(playerNameLength));

        float x = reader.ReadSingle();
        float y = reader.ReadSingle();
        float z = reader.ReadSingle();
        float rx = reader.ReadSingle();
        float ry = reader.ReadSingle();
        float rz = reader.ReadSingle();
        float vx = reader.ReadSingle();
        float vy = reader.ReadSingle();
        float vz = reader.ReadSingle();

        PlayerState playerState = new PlayerState
        {
            PlayerName = playerName,
            Position = new Vector3(x, y, z),
            Rotation = new Vector3(rx, ry, rz),
            Velocity = new Vector3(vx, vy, vz)
        };

        Console.WriteLine($"Received CONTEXT: {context} for PLAYER: {playerName} and POSITION: {playerState.Position}");
    }
}```
#

(refactoring is on the way after I successfully implement the whole TCP system 🤣 )

bitter robin
#

I'm curious why you dont just use unreal networking?

loud lynx
#

That's why like Fortnite can handle only like a couple of 10 players (100 perhaps) inside a single session. At least I know this way.

bitter robin
#

Hmm, well, I don't know how well it works at scale, but it's pretty good, and what you are doing.. is not really. There is a reason UDP is generally used (that being TCP is always ordered and reliable, which isn't always needed, especially for moment replication, where old packets can just be discarded). Making it terrible for bad connections. (extra terrible)

loud lynx
#

Yeah, but to do that with UDP, interpolation is well needed to avoid false movement. And most of the MMOs out there use TCP for movement replication as well.

#

And yeah, my solution might not be the best, that's why I take the time to experience the best possibilities 😄 But hard to track down, since there are lack of information/example on custom networking build.

bitter robin
#

by the way, why is only one of the parts cast to a pointer? pretty sure they all need to be

    Buffer.Append(reinterpret_cast<uint8>(&vy), sizeof(float));
    Buffer.Append(reinterpret_cast<uint8*>(&vz), sizeof(float));
loud lynx
#

That's strange, for some reason, discord took them out 😄

bitter robin
#

ah I suppose that makes sense, *makes things italic* and would need to be escaped, I suppose that is what is happening, but cpp formatting is overwriting the italic. (Probably what is happening)

loud lynx
#

Yeah might be 🙂

bitter robin
#

Personally I'd write it into a struct and then serialize that, less prone to failure, and typing mistakes. Like uint32 DataLength = 1 + 4 + 1 + Context.Len() + 1 + PlayerName.Len() + (9 * sizeof(float));

loud lynx
#

Yeah, basically the whole part needs to be reworked, I just want to make it work and once it's working, I'll refactor it 😄

bitter robin
#

Still if the first packet goes right but the rest goes wrong the issue is likely not here. But elsewhere in sending or receiving, at least I don't see any clear error, something that would just need to be debugged. Also I feel your message buffer thing is not really done right, you are removing elements from the array, that is just slow and unnecessary, same with copying the elements to parse a part of it, unnessarily slow.

loud lynx
#

This is the listening part on the server: ```c#
private void StartListening()
{
try
{
listenSocket.Bind(ipEndpoint);
listenSocket.Listen(10);

    Console.ForegroundColor = ConsoleColor.Green;
    Console.WriteLine("--> [PlayerDisplay TCP Server] is running...");

    while (true)
    {
        Socket clientSocket = listenSocket.Accept();
        _ = Task.Run(() => ProcessClientAsync(clientSocket));
    }
}
catch (Exception ex) {
    Console.WriteLine(ex.Message);
}

}

private async Task ProcessClientAsync(Socket clientSocket)
{
try
{
byte[] buffer = new byte[4096];
List<byte> messageBuffer = new List<byte>();

    while (true)
    {
        int bytesRead = await Task.Factory.FromAsync(clientSocket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, null, clientSocket), clientSocket.EndReceive);

        if (bytesRead > 0)
        {
            messageBuffer.AddRange(buffer.Take(bytesRead));
            ProcessBinaryMessages(messageBuffer);
        }
        else
        {
            break;
        }
    }
}
catch (Exception ex)
{
    Console.WriteLine($"Exception handling client: {ex.Message}");
}
finally
{
    clientSocket.Shutdown(SocketShutdown.Both);
    clientSocket.Close();
}

}```

#

Just to give an example for this part: c# Console.WriteLine($"Received CONTEXT: {context} for PLAYER: {playerName} and POSITION: {playerState.Position}");

#
1st package: 
Processed MessageType: 1
Processed DataLength: 1526726656
Received CONTEXT: UpdatePlayerLocationOnServer for PLAYER: Szabii-E361A3E9492AA and POSITION: <900  1110  92,0126>

2nd package:
Processed MessageType: 0
Processed DataLength: 475725824
Received CONTEXT: pdatePlayerLocationOnServerSzabii-E361A3E9492AAaD??Dt?B for PLAYER:  and POSITION: <7,246102E-22  2,63372E+20  1,0077427E+27> ```
bitter robin
#

The initial data length clearly isn't right

loud lynx
#

Now that I see this high number, I agree xd

#

Don't really understand the cause of it, this is how the dataLengh is calculated: c# int dataLength = (messageBuffer[1] << 24) | (messageBuffer[2] << 16) | (messageBuffer[3] << 8) | messageBuffer[4]; int fullMessageLength = 1 + dataLength;

bitter robin
#

Endianness?

loud lynx
#

Tried with the reverse order but that was a bigger mess 😄

bitter robin
#

That message you display doesnt use that calculation

#

int dataLength = reader.ReadInt32();

loud lynx
#

I can try that

bitter robin
#

That is what you are doing

loud lynx
#

I mean the conversion from big-endian to the host’s little-endian format.

oak pond
bitter robin
# oak pond in fact would that even work? if a variable is changed on the server, is it even...

What type of scenario are you talking about here? because any actor that the server has authority over will be spawned by the server and replicated, if it is the destroyed it simply wont be spawned for new joining players. And if you want to create things like dead bodies then you'd either have a seperate dead body actor, or the same actor that simply has a replicated variable that says isDead or something, and have a repnotify on that sets it to ragdoll or whatever/

oak pond
#

yeah, Im doing some more testing and it seems most things like enemies health replicates fine in this case, so it could just be that I havent replicated the death events properly. seemed ok since they die correctly for both players when theyre in the server, but I guess I havent updated any variables that would let it know after the fact

dark parcel
#

Maybe you are using multicast

oak pond
#

but are there any other problems with joining an in progress game that I should know about?

dark parcel
#

Also only server should call destroy actor

#

If the server destroyed the replicated actor, the client copy will eventually be destroyed

#

Ofc late joiners won't see it either because it no longer exist in the server

oak pond
#

yeah, noticed it works fine with my health/ammo pickups

dark parcel
#

Just be aware to not use multicast on any stateful behavior

oak pond
#

so right now Im testing with setting "dead" to true on the server when an enemy dies, and then when the player joins, I have begin play on the enemy to check if theyre dead and then just destroy actor for now, but Im getting 2 different results on the dead variable

dark parcel
#

Hmm I never experience with placed actor in the editor, will find out after work.

#

Though I do expect the enemy to not spawn at all if you already destroy it

#

Make sure the actor is replicated

#

And toggle client load or something and see the results

#

Net load on client*

oak pond
#

yeah destroying works fine, but the enemy is supposed to ragdoll, however I wouldnt mind if it just didnt spawn in the first place if it was already dead when the other player joins

dark parcel
#

Ragdoll can be a state imo.

bRagdoll on rep. If true, do your Ragdoll logic

#

Not sure how to sync them tho (having client and server see the same thing)

bitter robin
#

synching them is pretty hard, and is pretty much never done, ragdolls are 90% purely client side and different per client, its just that people dont notice.

oak pond
#

I mean like the first player would see the ragdoll as normal, then the second player to join just doesnt see the enemy at all because they died so its not important. Im certainly not gonna try to accurately replicate ragdolls themselves lol

dark parcel
#

I think randomly result is more or less the same when players are in the game

#

For late joiners, that do be tricky to get the initial state the same

#

Like when you play in game your character might get catapulted by a force but when late joiners join, they just face plant to the floor

#

Not worth the problem anyway imo

#

Pretty sure in counter strike they just rag doll locally

oak pond
#

yeah I noticed in tf2 as well, Im not worried about it

#

I do have a thing that kinda drags players ragdolls into place but its a bit jank looking, kinda funny though

dark parcel
#

Meshes are easier I guess, you can get the current velocity. Skeletal mesh ragdoll, I have no idea

oak pond
#

I tried a thing with having a fake ragdoll on the other end thats updated in its anim blueprint, which I could get 100% accurate but only by making this big horrible script that replicated way too many variables to be usable

#

this was a different project just for a test

dark parcel
#

@bitter robin I'm trying to learn seriliazation, what sort of exercise or examples I can look at as a complete beginner?

dark parcel
rose egret
#

OnRep_ is called before BeginPlay ?

oak pond
bitter robin
#

You'd probably want to look for a tutorial for you specific usecase 🤷

dark parcel
#

Ty for the insight

oak pond
#

hmm so yeah it seems whatever I do, setting "dead" variable wont be on the enemy on the players end if they joined after it was set

#

variable is replicated, tried setting on server event and multicast, but just comes up false

dark parcel
#

Don't use multicast

#

Only server should handle dead event

#

And only server should set the bDead replicated variable

#

Server RPC is used by client to tell server to do something. In case of death why is client telling server hey this enemy is dead?

A.I is server bussiness

#

Changing a variable on client will only propagate the change locally.

For something to be replicated, the server has to set it. It will then update clients version eventually (or on net update, not sure)

oak pond
#

yeah Im mostly used to that but for some reason things like playing montages has only worked on multicast on enemies

dark parcel
#

Rep notify

#

Though I would just say use GAS

#

Just started my project but I have 0 thing on multicast

#

Only use it if you know what you are doing imo. Is something need to be in sync? Yes? Don't use multicast. Period.

oak pond
#

but enemy montages and other effects literally didnt work with server events

#

other than that all my players events are appropriately multicasted only where needed

dark parcel
#

Hence use repnotify

#

You will need a variable that drive those montages

#

To make your life easier, use GAS it already handle playing montages.

#

There's even a dev that have published a game that says he has 0 multicast in his game.

#

While multicast has it uses, I can see that you are using it for the wrong reasons. Eg playing montages when you want the montage to be seen by everyone.

#

Just imagine you play dancing montage with multicast. What happend to the late joiners or player outside relevancy?

The character won't dance in their machine.

oak pond
#

in that case, whats the variable thats being set? are you treating the variables like events at that point?

#

instead of activate event, set variable with notify

#

oh thats so weird, making the dead variable notify makes it automatically kill them when you join, thats pretty funny but I can see why thats happening

dark parcel
#

If u have it on replicated only, the value will still sync. Bdead is true

#

But you are not doing anything meaningful with the variable?

#

That's why repnotify exist. Basically can be translated to, when the value change or when the server update this variable on my machine, do this function.

oak pond
#

yeah, it mostly works now, although they die at their starting location and not where they were killed by the other player, and with these functions its a little inconvenient not being able to use any delays/latent actions

dark parcel
#

Try to avoid delays

#

Well I shouldn't say that but

#

Know when to use it

#

Especially in multiplayer, latency exist. Order is not guaranteed too

oak pond
#

actually on the subject of that, I often have to use tiny delays for things like applying velocity to a ragdoll for example, if it happens when the enemy is alive, it will throw up an error because in that frame theyre alive (and not simulating physics), but if this is the hit that kills them, one frame later theyre dead, so I have to add the tiny delay to then check if theyre dead then apply the velocity. is there any proper way to check for like the next frame? not sure if Im describing it right

dark parcel
#

Delay until next tick?

#

Sounds like you just want to check if the component is simulating physich or not tho

#

Not that I ever touch physich stuff

oak pond
#

this is just an example, but its a very annoying little thing because in the frame a bullet hits, the enemy is not ragdoll. in the next frame they are. sometimes I just need something to activate as soon as its able to do so

oak pond
oak pond
#

even though their location updates fine if you join after theyve moved

#

but triggering the death when you join, well that STOPS them from moving, so they wont even go to the location they were actually at, just die where they spawn

#

this is another thing that I would ideally delay so that it at least gets a chance to update their location, but I cant delay that because its a function and it has to only delay for the player who just joined

#

the point is I clearly need something different to happen between players, but how am I supposed to do that when its a serverside enemy

cunning mesa
#

Hi all -- I am designing a system where a player can mount a cannon, which lets them aim and shoot it.

I'm wondering how to approach the rotation of the cannon when a client player takes control of it. If the cannon is owned by the server, I don't think the client can rotate it without the server correcting it back.

I was thinking the client might need to send RPCs on a timer to tell the server where the cannon is aiming. Does that sound right?
And for the client, it might need to somehow prevent the server from trying to correct it.

Any guidance is appreciated! Thanks!

bitter robin
#

attach playerpawn to the cannon, and possess the cannon, maybe?

cunning mesa
#

I'm trying to avoid possession as it creates some other issues. I'm doing input forwarding instead.

twin juniper
#

Hey guys, a question... is there a way to make nearby clients in a game with a dedicated server see the animation I'm running without having to use multicast? Because I have a notify inside the animation that spawns an actor and it spawns me an actor for each client, it also adds to the server, for example if I'm testing the game with 3 clients it spawns me 4 actors, why does it also count to the server? Thanks

modest crater
# twin juniper Hey guys, a question... is there a way to make nearby clients in a game with a d...

Whats the montage? Usually montages are things that get piggy backed but happenstance, not usually needing an explicit RPC.

Taking shooting or hitting with a knife, you would do an attack function that does a whole lot and just but "attacking" you play the montages and then it would normally (if its something common) be paired with a replicated value that represents the state, like bIsShooting will start the loop animation on other proxy clients

oak pond
#

you know what I think Ill just duplicate the entire script and activate separately somehow

oak pond
#

EVERYTHING I TRY causes a problem in something else

#

even when I find a way that should logically work it then just breaks for one client somehow even though its a serverside enemy so that makes literally no sense

#

I keep getting this damn thing where the enemies "ragdoll" BUT STILL IN THEIR ANIMATION? they just fall over like a statue and I have no idea how the hell thats even happening, its not their capsule simulating physics I have that set to show in game

#

why can ONE player activate all the death events properly and not the other

#

ridiculous

oak pond
#

put it back to a multicast like before and it works again

fickle seal
#

Hello Guys,
I need your help with understanding multiplayer concept, I am not sure why this is happening.

Note I am Using 5.3 Engine

What I need to do - I want to control an AI in Multiplayer setup, where player select a destination for AI to Move using widget.

What I have done -
I have created a AI which is set with replicated movement and replicated as true.
I have create a UI, a combo box and AI is Waiting for player to select a Destination where a Ai will move,

As AI is Controlled by Server and Widget are spawn for Particular Player Screen, I need to send selected location details to server,

I am using Event which is run on the server to send the data Server

When I am testing it in multiplayer, for some reason, I am not sure, "Client Sending data to server" is printing for client, but "Server Received Data" is not printing for server (Event not getting called).

Please help me understand this, Thanks for your support

fossil spoke
fickle seal
# fickle seal Hello Guys, I need your help with understanding multiplayer concept, I am not s...

With this I have also found this with unreal 5.3 , 5.4 and 5.2

Testing - a simple thirdperson template, where on a input press "Q" I am print Hello, test is done for multiplayer with 4 client
For Unreal Engine 5.3 and 5.4
when input is press - print string always happens for client 0 for some reason,

For Unreal Engine 5.2
When input is press - Print string happens for the Client for which the input is pressed.

Please let know, If there is a setting that needs to be changed

fickle seal
fossil spoke
#

Since the AI Actor is not owned by the PlayerController, it cant send an RPC to the Server.

#

Your PlayerController should be responsible for sending information to the Server about commands you want to give independant AIs.

dark parcel
#

The only fix is to dive into cpp and edit the source code. Changing the part where it get the client Id

fickle seal
fossil spoke
#

Doesnt really matter what you do, the point is, the PlayerController needs to send the RPC to the Server.

#

WidgetEvent->PlayerController->RPC->(Server)->AICommand (something like, MoveToLocation 🤷 )

fickle seal
fickle seal
dark parcel
fickle seal
#

Thanks Guys, it's working 👍

swift bay
#

Hey there, I have a question regarding ownership and some workflows with it:

I have written an actor, lets call it DataManager, that is responsible to import/convert json files to my data structure and store this data in an array. That actor and the array are replicated.

For each entry in that array, a world presentation in form of a replicated actor is spawned. I got to the point, where I want to give the client the option to locally import jsons as well.

So he presses a button, the file browser opens and he can select a file. After the conversion, I wanted to use the local instance of the DataManager to invoke a server rpc to tell the server, "Hey, here is new data I have converted, put that into the array and replicate it alongside its representation to all other clients".

Because the local instance is still owned by the server, the Server RPC fails silently. Therefore, I rerouted the Server RPC through my PlayerController, which worked, but left me wondering:

Is there a better workflow so that I can prevent bloating the PlayerController with RPC functions? I have read that I could set ownership when spawning the DataManager, but can't really get
my head around how that works with multiple clients, as the server can only set one client as owner?

Or would it maybe be better to let each individual client playercontroller request the ownership of the local instance of the DataManager after initialization? Any hints would be appreciated!

dark parcel
#

_
From my understanding PostLogin only get called once when clients join.
Is there any callback I can use when a player loads the level?
I would need one to work at the start of the level regardless using Hard or Server travel

compact flame
#

How would I give each player a different tag for instance player ones tag would be player 1, And player two`s tag would be player 2 and so on

dark parcel
#

or do it based on slots in the lobby

#

really depend on the context, I guess.

spark otter
#

Hiya, when using the server travel node with advanced steam sessions, is there a way to add Options like you would with the Open Level node?

fickle seal
#

Hello Guys,

I have a question regarding Gameplay Ability System,
Can we use Replication RPC Event inside Ability Class,

For my Ability Class, I am using "Wait Gameplay Event" to trigger, Once Trigger, I am creating a widget for the owning player, Once the player select option form widget, I need to send that data to the Server as well as Other Client.

Is it possible to do all in Ability Class or Do I have to send the info the player character/ player controller to handle the RPC Event

hallow dagger
#

Hey!

I have a question regarding networking, and how I'm doing some things. I'd like to know if my approach is correct, and if not, how to improve my setup.

The idea is to have player pickup items from the floor, and have this items move to their model (like carring it on the back or their hips). I created a component that defines what the player is carrying, which just has 4 different actor references: hands, back, left and right. When an item is picked up, a reference to this item is assigned to the slot the item is stored.

When a player press the pickup item button, a call is made to this component, which runs only in the server, and after some logic (like detecting which item to pick, and where to store it), the item in question is assigned to one of the slots.

This assingment is done with RepNotify, and inside the OnRep_{slot} I attach the item to that player's socket

This is working fine, but I have~~ 1 issue, and~~ 1 worry.

The issue: the inventory components and its slots are only updated in the server. Which makes sense since the function that assigns items to slots, is set as "Run on Server". But I though the RepNotify also propagated the value assigned to the clients, but it seems its not the case. I don't know if this is by design, or that I missed some configuration. This means the inventory component is only updated on the server, and the clients see their (logic) inventories as empty, even if they see the items attached properly on the players' models. I was replicating the items, but I was not replicating the inventory component!

And my worry is that since this all runs on the server, it can make item pickup and switching kind of sluggish for clients if there is lag, since AFAIK there is no prediction in this setup. How could I improve this?

bitter robin
#

I personally wouldn't worry too much about that, it's not like you are playing with 500ms, and even if you are if you do prediction with that much latency the chance of it going wrong is much larger as well, so if you were to instantly display it on clients then find out it failed it will probably result in much more janky looking effects then the small delay.

#

Of course you can play around and see which works best, I also don't know how you equip things, if they are just you touch them and its auto equip? meaning its instigated from the server side, or if you are like equiping someting on an inventory screen (in which case directly doing it client side and then replicating the same action will probably feel much more responsive)

hallow dagger
#

currently, you pick up items by looking at them and pressing E
if your hands are free, it goes to your hands, it not it fills one of the other 3 slots
if all slots are filled, it swaps the item in your hands

#

i still have to implemente switching between items, and that really needs to be responsive

#

is there any tutorial/documentation about handling prediction? I have no idea how to implement it on UE

bitter robin
#

Prediction in this case just means you do on the client right away what you expect to happen, like equipping in hand or in one of the slots. Then proceed to replicate it normally

hallow dagger
#

mmmm, i just do it in the client, then call the same logic on the server? when the server updates the client, the client will already be in the state the server notified right?

blazing spruce
#

Hi, are overlaps supposed to be called on every single player? ive got a box overlap used for interaction but when any player steps into it, it prints out for every player in the game? That seems odd...?

#

and it says client 0 twice.. shouldn't it be client 0 and client 1?

sinful tree
sinful tree
blazing spruce
#

I am still having an issue tho, I've got my interactable base class which has 3 different overlaps, one that when entered will display an indicator widget indicating the thing can be interacted with, the other 2 are pressed interaction or hold interaction as the widgets displayed are different

I was having all this timer code pretty much running on the characters tick before but decided to do it as a timer on the interactable base class instead so it wasn't running constantly on tick all the time, but now the widgets wont display for clients anymore, how should i be handling starting the timer so that it works properly for everyone? Works on the server of course lol

blazing spruce
spark otter
#

Is there a way where I can make the variables I set in the gamestate persist when server travelling?

#

They seem to be changing fine in my lobby map, but then are reset when I change level

blazing spruce
#

Im not sure about the game state

spark otter
#

Oh interesting, I'm staying away from the game instance because I need to replicate it to everyone else, but I would have figured the game state would have been fine :/

thin stratus
#

GameState doesn't persist. So yeah, put it somewhere else.

spark otter
#

Is there anything that does persist other than the game instance?

thin stratus
#

If you SeamlessTravel, you usually only get the chance to persist data between PlayerControllers and PlayerStates.

#

You can persist your own actors too, but that needs C++

spark otter
#

Gotcha, basically i'm allowing a host to change the match length in the lobby, so that's probably better in a player state than PlayerController* right?

thin stratus
#

How do you travel to the Gameplay Map?

spark otter
#

I'm using the Steam Advanced Sessions server travel node

thin stratus
#

Does that allow options to be specified?

spark otter
#

Sadly just the level URL, Absolute, or should skip game notify

thin stratus
#

Use an APPEND node for the InURL

#

And do

#
  • Test_Level
  • ?GameLength=
  • <your gamelength variable>
#

Then in your GameMode BP, on BeginPlay, get OptionsString and grab the GameLength via ParseOption and set it back on the GameState.

spark otter
#

Oh wow alrighty, i'll give that a shot

#

tysm