#multiplayer
1 messages · Page 247 of 1
you are right 🙂 i think i originally thought it was just on the client but i think AcknowledgePossession is what i want
So this is what i did.(GameMode)
what works:
It counts how many spawned, and substract when someone died
only problem is what i dont get, when all clients die, then they go to level 0 immediately, but not level0, they go in the main menu somehow. When server dies, and clients dies, the server spawns normally in the playerstart of the level0. but the others not.
So if you confused let me explain:
Host and 1 client, if client dies, he gets open level 0 immediatelly. which means, that doesnt make any sense when the hoster is still alive and the client gets teleported to level0.
Is there a networking debug tool, or do I have to debug with log messages?
Also is there a way, for a c++ log message, can i print something like "Server", "Client 1", ... same as print string does automatically?
If you really want to know everything on your network Wireshark is the go to
I saw some code that turns a level into a listen server during run time and it works . Is there a way to turn listen server off during runtime?
Hi btw ^^
Also it's more about the network traffic UE5 related, wireshark is for sniffing raw packeges, thats a bit to low level for me 😅
Should be able to launch it from visual studio in debug mode
I just wondered if there is a tool i can see network traffic.
The raw packages, are just interesting if it's about the amount, but decoding them, just to check if a client gets something replicated, would be quit challenging, then I would definetly opt for debug messages.
Just was wondering if there are some built in tools like rewind or so, I can use to debug replication 🙂
this function on the game instance should help bool UGameInstance::EnableListenServer(bool bEnable, int32 PortOverride /*= 0*/)
Im getting an intermitent crash on 5.5 Client side when joining on server. Call stack points to
Chaos::FReadPhysicsObjectInterface<(Chaos::EThreadContext)1>::GetParticle
Has anyone faced this issue?
Why not just be a listen server all the time and handle not being a listen server by just not allowing connections.
Does anyone have an elegant solution to spawning items/equipment/weapons that are held by the player without (noticable) lag? Currently if I use a server RPC to spawn one the client that is equipping the item has to wait for the server to replicate the held item actor back to the client. Alternatively I've tried spawning a local version of the item on the client and then destroying it when the server finally spawns and replicates the item. But that's messy especially when the player might also start shooting or something in the mean time.
I could also create a pool of item actors ahead of time so the client could just grab one and start using it/equip it and hope the server uses the same one?
The best you can do is spawn it on the client with a deterministic FName, tell the server what the FName is and have the Server use that. You'll have to be absolutely certain the Server hasn't used that name for another object already or it will explode. You'll have to do some workarounds to convince the engine it's a stably-named object so it replicates properly. The most elegant solution honestly is just don't do it.
It goes without saying that telling the server to spawn actors/objects from a client is a security concern, if you care about such things.
When simulating a dedicated server, how noticeable would frame drop be for each player connected in editor up to 4? I see that when I each 4 my fps drops to 40
I'd have it exist already in some invisible/hidden state
Awesome thanks! Will try this out
This is something I’ve considered, I just didn’t know if there was going to be any issues I might run into by doing that method. I’ll test both out , ty!
that's more due to having 4 separate instances of the game open. nothing to do with the server itself operating
Trying to connect a client to a listen server via .bat files. The server hosts just fine, the client boots up to the menu but when i use open 127.0.0.1 I always end up with a connection timeout. I added ConnectionTimeout=600 and InitialConnectionTimeout=600 to the OnlineSubsystem in DefaultEngine.ini, and also /Script/OnlineSubsystemUtils.IpNetDriver, but i still time out at 60 seconds anyway.
I'm running into an interesting issue for some reason the hair meshes arent visible on only the server. But when ejecting from the player controller i can see them perfectly fine.
The code to replace the meshes is being called via a multicast - > run on client. Running the same exact code on the server yields no results
dont multicast for that
who should see who's hair meshes?
the hair you have selected is state
replicate it, and use repnotify to run a function (swap the mesh out) when it changes
a client choosing their hair would go like this:
Client -> i want this hair -> tell the server (run on server RPC passing over some data like the mesh ref or name or whatever)
Server -> ok they want this hair, change some replicated variable
Everyone -> OnRep_HairMesh -> ok change the mesh the hair component uses based on HairMesh
Client: "I want Hair A"
Server: "OK Hair = HairA"
Everyone: "Hair just changed, it's Hair A, lets update our visuals"
that's YOUR pawn on EVERYONEs machine, this runs completely independently for each pawn
bless you 3000 years of good fortune and fertility on you
I don't want kids though so make it 6k years of fortune plz
can i use app id 480 for my tiny alpha test or should i use my own app id
with steam online subsystem
I never make anything that i not replicated. Not part of my vision
What does this even mean.
And FYI, crouch is already handled out of the box. You don't need any rpc as that's done under the hood by character movement component.
You probably want to use started instead of triggered pin, as triggered runs every frame.
That i know. But I like to, separate the Rep. from the normal setup. Maybe sound weird, but I like to have at much overview, and understanding that I can have.
But you are using crouch function anyway which already handle the networking.
Also don't use multicast for anything stateful, read the pinned material 12 times for basic replication.
I didn't mean that
I asked for to not use rpc there
When developing a Multiplayer game, what Multiplayer options do you usually use?
depends on what game you make. if it will have dedicated server then last one. if it's listen server then the second one. but first can be beneficial to test some functionality for both game types.
also don't forget to setup latency emulation in advanced settings. so you don't only test your game with 0 ping. I always run at average atleast
As far as I get it, correct me if I'm wrong.
Playing as listen server, with two players is, is nice, because I have server and a client playing.
The downside is, first of all there is always the second window popping up while developing, also the server is also a client, which means, some things, that might not run on a dedicated server (like some animations) will run, which on a dedicated server will not work.
Now especially because of the first downside, I'm thinking of playing as client, where I would deal with the harshest conditions in regards to developing MP, where the only downside would be, that maybe I miss some issues, that would occur running as a listen server.
Is this correct so far?
ofc I would have to test it as stand alone and listen server as well, but I wonder from a development perspective, because now I was running in standalone, then trying it out I had an issue, with replication, but now I'm annoyed, by the second game window, which is sometimes overlapped by another window also the mouse always focuses on it first and ...
or is this just something I have to get comfortable with
Ohh wow good point, maybe i just do this per default then?
Oh, yes, I guess I'm wrong here. I guess when you develop listen server game, play as client still viable to you.
But you need to make sure that game works in all modes, as listen server and client. I just develop dedicated server game right now, so never run listen server myself.
I think I will focus on the client first, since fixing things for the listen server, is probably easier then the other way around.
Not to say, that testing in all applicate modes has to be done anyway, but just for developing purposes.
If i start the game 100x times ^^
Btw this should be good for latency right?
And don't forget to run PIE in different modes as well
like separate process and bla bla bla
Really can there be issues as well?
yea, sometimes, it plays out differently
and package game from time to time and test it 🙂
well, if you're close to that stage
if it's prototyping and you never shared it with anyone, then it's not first priority
Yea but fair point, at some point I tried to test build a project and had so many things to fix 😅
At the end of the day, for listen server model, you want to make sure that everything work in all scenario. Client to client, listen server to client and vice versa.
Best to test with 3 players, 1 server and 2 clients.
do it sooner than later
yes, I try to test with the "run under one process" unticked frequently as well
I probably will try getting in the habbit of it!
Will do! 🙂
I once had a project that worked fine in development mode when built, but broke in shipping mode due to subtle changes to the codebase. One example was a custom trace channel didn't work properly in shipping which I couldn't fix before the game jam deadline
Yup. Packaging itself can be tricky. Different platforms also
Haven't had to deal with that yet but am dreading it
Hi, is there a better way to handle client specific logic on actors owned by the server?
I feel like there should be a way to do this only on the relevant client
can someone help me about that?
Im trying when everyone dies, the level will reset. but somehow, when all client dies and hoster is alive, they get teleported to main menu instead of level0, so something is broken.
i think you need to use the "Server Travel" node instead of the Open Level node if you want clients to follow
alright, but i dont know if it fix the client deaths. Example: 1 host and 1 client, client dies, he immediatelly gets teleported, which doesnt make sense when host is alive, wenn all dead, then reset level etc
to count how many are spawned:
How can I make the best possible prediction for actions like destroying an actor or other operations in Unreal? For example, how can I ensure that a Replicated Destroy operation runs as smoothly as possible? I’ve noticed that no matter how cleanly I execute the process, the millisecond delay on the client side still annoys me. How can I write the best prediction system for this? Does anyone have any knowledge on this topic?
possibly the SetupLivingPlayers event is getting called before the host player state is in the player state array.. but you dont even need to use RPCs here do you? or a LivingPlayers counter really.. just make a custom Player State class with a boolean IsDead or something, and make OnDeath a normal non RPC event the server calls that sets that boolean to true and loops through the Player States and does an early return if a IsDead boolean is false, but if the loop completes successfully restart the map
i was thinking like, how many are spawned as exmaple like 4 (1 host and 3 clients), then when a death appear on a client or a host, it should substract form the livingsplayers variable. (4 alive minus 1 = 3 alive) So when it its at 0 alive, then normally it should reset the level. but i dont know. I deleted that SetupLivingPlayers which doesnt make sense to me about it.
instead of subtracting you could add 1 and just see if LivingPlayers == number of player states in the array
might wanna rename it to DeadPlayers though
although thats gonna break if someone leaves
I think this whole idea is the TOPIC not topic because smooth prediction is extremely hard to achieve.
You may want to read this first to decide if you even need this level of prediction in your game:
https://mas-bandwidth.com/choosing-the-right-network-model-for-your-multiplayer-game/
And this shows how overwatch's netcode works:
https://gdcvault.com/play/1024001/-Overwatch-Gameplay-Architecture-and
For quicker answer you could TRY to simulate destruction on client and wait for server confirmation, buuuut I don't think it's a good idea (nor I've ever tried it), could cause issues with Unreal's networking systems.
Hi, im trying to sort out my sewer system where the player can interact with it, choose a sewer they want to go to and it'll teleport them over to it.. everything is working correctly for the server player and almost everything is working when the client player interacts with the sewer except them teleporting over to their desired sewer, so for the client the Request Sewer Teleport event is being called.. both current and desired sewers open and close just fine, the widget is removed and input type set to character, but the player just never teleports over
Anyone have any ideas why?
On the top of my head maybe try Teleport To Sewer to Replicate on Owning Client as you did for Remove Sewer Widget
Hello, is there any way to see whether the client's replicated variable value is different from what the server has previously told it?
For instance, if I have a replicated health variable which I edit client-side to do some prediction, but the prediction ends up wrong for whatever reason, how can I correctly rollback to the previous health value the server told it about? Is that value saved anywhere, or is it simply discarded once applied on the variable?
The event needs to be run on server, the client shouldn't be the one teleporting itself or anything, only the server should be doing things like that
How will the client know to correct it at all? For prediction/rollback to work, you have to tell the server you made a prediction, and the server has to send back an answer.
I have that, but for now I only reset other things, like animations. I have a client RPC to tell the client that its request that it tried to predict was rejected
I could somehow store the what were the actors the character has deal damage to, and tell them to return to whatever last value the server has replicated
My question is why. You can predict health, but you can't predict death - so why do it.
Damage is also applied by the Server, usually at it's discretion, so implicitly it's not something a single client can predict
At best, you can store a local predicted delta from the servers' real value, which you remove after X amount of time has passed, but it's still not perfect
But IMO predicting damage and health is a bad idea for a multitude of reasons. Short latency is much more forgivable than misspredictions
Well, it makes sense, but still, is it possible to see what was the last replicated value out of the box, or are they simply discarded once applied?
You can't reliably access the shadow state no. The solution would be to store a separate local value and never overrule the replicated value client side
Alright, got it, thank you
Is there any way, I can ensure order of replicated variables?
I'm possessing a character, and dependent on something, I want the OnRep_PlayerState (of the Character/Pawn) do different things.
Initially I was thinking of setting a variable on the Character/Pawn, but since the possession happens on the server and he PlayerState then gets replicated to the client, I can't ensure that variable is set bevor the player state, since replication is not ordered (as far as I know).
What can I do about that?
You can't control the order, especially since the player state is it's own actor with it's own lifetime
You'd need to respond to either property changing by overriding both OnRep's
aka
{
UpdateX();
}
void OnRep_Value()
{
UpdateX();
}
void UpdateX()
{
// Check player state/my value, respond to changes to both
}```
So just to be very clear, I'm building on top of lyra, where in the lyra character this happens:
void ALyraCharacter::OnRep_PlayerState()
{
Super::OnRep_PlayerState();
PawnExtComponent->HandlePlayerStateReplicated();
}
I want to avoid the call to PawnExtComponent->HandlePlayerStateReplicated();, but only while possessing the character from my custom code:
// Disable PawnExtComponent->HandlePlayerStateReplicated(); HERE!
Controller->Possess(TargetCharacter);
So my challenge is, that ALyraCharacter::OnRep_PlayerState() is called on the client, while is called on the server Controller->Possess(TargetCharacter);.
Also I'm not sure if it will be as easy as just reacting to both replications, since PawnExtComponent->HandlePlayerStateReplicated(); does quite a lot of things, which I ideally want to avoid.
Ultimately you can't guarantee variable replication order, apart from one case - which is where you are using POD (no UObjects) and those properties form part of a USTRUCT which is serialized with NetSerialize. Then and only then do you get atomic replication of multiple values.
So basically I have to find another way around it?
I don't see a way around it
PawnExtComponent->HandlePlayerStateReplicated(); goes down to IGameFrameworkInitStateInterface, which I don't fully understand yet, my hope is, that maybe there I somehow can have a state or something, through which I can prevent it.
But I guess now the topic shifts away from a multiplayer problem, since I can't really do anything about it with replication.
But I appriciate your help! 🙂
There's nothing you can really do here on the client, but I don't really understand why you would want to. If you want to skip that call on the Server, that's easy
Just create a scope that sets a bool on the character for the Possess call, and skip the call if the bool is set.
I need to prevent it on the client, but not sure if you wanna jump into that rabbit hole ^^
The problem is that clients don't really care about how the pawn was possessed, or from what function call etc, so it's not like you can lock it within a single scope anyway
Yea, the issue is just, that PawnExtComponent->HandlePlayerStateReplicated(); does some things I need to prevent, but I guess I have to find another way around.
Hello, in blueprint OnComponentBeginOverlap triggers on both server and client, however in cpp when binding to OnComponentBeginOverlap, it only triggers on server. How do you detect overlaps on client as well without having to manually replicate?
void ARPGProjectile::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
ProjectileMovement->StopMovementImmediately();
}
Where is your binding code?
in beginplay ```void ARPGProjectile::BeginPlay()
{
Super::BeginPlay();
Sphere->OnComponentBeginOverlap.AddDynamic(this, &ARPGProjectile::OnSphereOverlap);
UE_LOG(LogTemp, Warning, TEXT("[%s] Bound (Role: %s)"),*GetName(),(HasAuthority() ? TEXT("Server") : TEXT("Client")));
}```
And the blueprint inherits from this class so they have the same replication settings etc
That's odd then. Should run fine on both. You do see that "Client" print?
yea i get both server and client print in beginplay, but then in overlap when doing the same print i get server only
Does anyone know what the Exponential Smoothing equation is?
that is used for replication?
Pinterp=Pcurrent+(Ptarget−Pcurrent)×e−λt?
Anybody know how to address this issue?
PlayerA creates a session as a listen server -> PlayerB finds sessions and that session is added to a server list UI -> PlayerA then destroys session -> PlayerB’s UI still references that now destroyed session and can still join it successfully.
I don’t want PlayerB to be able to join a session that has already been destroyed . I have implemented a workaround: When PlayerB clicks the join button , instead of immediately joining session I instead FindSessions again and if the referenced session is still found within the new list of found session I then join session.
The workaround works but now the players will have to wait for the find sessions to execute every time they join a session which seems kinda wrong lol and takes extra time to wait on that process
Should this work or am i missing something?
Is there a function called on a character post movement update on the server?
Usecase is getting movement state that's in the client move data replicated to simulated proxies from the server
Is there settings in the CMC I can adjust to migitate this correction?
Having an issue with the replay system (in a multiplayer game tho im testing in singleplayer): when I rewind a replicated object ref gets unset, causing an engine crash, any reason why this happens? The object being referenced exists at the start of the replay and is replicated
https://dev.epicgames.com/community/learning/knowledge-base/a3VO/unreal-engine-replay-scrubbing-overview I suspect this is related to step 5 where statically placed replicated actors are destroyed? The actors being dereferenced are created by the gamemode.
how would I be able to set a IsHost variable. I'm trying to make a 2 player lobby and I just can't seem to figure out what the node is that does that. 1 Player creates the session from the main menu, does a level transfer to the Lobby Level, and the same happens when a client joins the session.
Is it as simple as putting the variable in the player controller and then setting it depending on the node "Is Server"?
You can't just modify the host like that. In a listen-server setup, the host is the host. I suppose you could change it but it's not a simple variable change.
I don't want to change it, i just don't know how to identify the host
i have two text fields, one for the host's name and one for the client. How do i tell who goes where?
even checking if it has authority doesn't seem to work. both player's are still saying they are the client.
all that IsHost bool variable does is tell the text field where the username goes.
Show your code
it should be as simple as IsServer
the listen server would pass the check
Hey all, trying to port to multiplayer but can't figure out why movement is super jittery for the client. Just remade all the movement logic to work with Enhanced Inputs but that wasn't the issue, basic and works on the server fine.
Any ideas?
nevermind, i was setting max speed on begin play and that was messing with it.
guys, what's the best to read about EOS, lobbies and other stuff?
you're right, i had some code before hand to check if the it was a local controller. I moved that branch behind the Is Server Branch and it worked.
Why does this occur? Trying to use this function on client, the server processes the interaction which calls this function to get the key assigned to the input action. But it says Accessed None trying to read property CallFunc_GetLocalPlayerSubSystemFromPlayerController_ReturnValue
You sure this is called on the owning client?
its being called by server
Listen
And do you call this on the ListenServer's Pawn or on a Client's Pawn?
I call it on the pawn that is interacting with it, in this case of the error its being called on the client pawn. on the server pawn it works fine
Yeah that won't work.
Server has no ULocalPlayer of a Client. That Subsystem simply doesn't exist for Clients on the Server.
Server won't have any of the Input information.
ListenServer will only have it for itself.
by this you mean the server also has other players input information?
No, inputs are local
Hi ! Should we add the ? on this setting ?
yes
Could you explain "this"? What is your wished for behavior here?
Hey there, I am running into a problem with something and I'm wondering if anyone can help me troubleshoot this issue: I have a portion of my game which relies on the player character needing to know the player's mouse location in order to move a part of that character (the head) towards that direction. Other players should be able to (and do, from my testing) see the head change rotation in relation to mouse location. I have the logic set up for the most part, but I'm struggling to get smooth interpolation showing on the client's end. I'm using RInterp To to smoothly interpolate between previous and current rotations which works flawlessly on singleplayer mode and also locally on the client, if I disable executing the functionality on the server. However, when I hook up a server event to fire a server-side version of the logic (excluding the locally controlled pawn), the smooth interpolation becomes unsmooth. Perhaps this is the server somehow overriding the local client's values (or I am filtering the local client wrong, or something else entirely is happening). I'm also wondering, is it sane to allow this particular system to be client-side authoritative, since the client will always have authority/actual control over where their mouse is? I would assume it is, but I want to make a sanity check just in case.
Nevermind, seems I did indeed use a poor filter! using Get Local Role and filtering out Autonomous Proxy (NOT) and Is Server fixed it
So how would it be possible to even do this function? Can it only be run on owning client ?
What function? Say we are in a networked game. I will never know what you press unless you send me that information.
as inputs are local.
But what if the client has different binds?
not sure how that's related to what been discussed.
Inputs are local only, you are asking can another machine knows what other machine press? The answer is no, unless you send the input information via Rpc or variable replication.
The entire Enhanced Input subsystem only exist locally
so computer 1 won;'t know about Enhanced Input subsystem that exist in computer 2
Got it! Just got it fixed, thanks.
Perfect explanation
Hey everyone, are there resources out there on making a ranking system? Examples such as: overwatch, marvel’s rivals, Valorant. I tried looking online but nothing seemed to appear. It would suck to build it all from scratch 😭
Doubt it, the programming side of anything like that is trivial, all the work is in the rating calculations.
Just use Elo unless you have some other algorithm in mind.
We would need to build a database to keep track of each player right? So use golang and mysql?
Can the steam api keep track of it as well? Oh wait theres a leaderboard section. Maybe that could work too
I made this list for myself but perhaps someone else will find it useful or have corrections:
Actor Authority Checks:
HasAuthority() - True on Server OR for objects spawned by and only existing on the client. Note that PlayerController and PlayerPawn does NOT have authority on client. Example: Check before spawning networked actors (if(HasAuthority()) { SpawnActor(...); })
Actor.GetNetMode() - Returns the network mode: NM_Client/NM_DedicatedServer/NM_ListenServer
Actor.IsNetMode(NM_Client/NM_DedicatedServer/NM_ListenServer) - Convenience wrapper for GetNetMode() == Mode. Example: Call server RPC (if(IsNetMode(NM_Client)) { ServerRequestItem(); })
GetLocalRole() - Returns the actor's role on this machine (See roles below). Example: Implement prediction (if(GetLocalRole() == ROLE_AutonomousProxy) { PredictMovement(); })
GetRemoteRole() - Returns the actor's role on the remote machine. Example: (if(HasAuthority() && GetRemoteRole() == ROLE_AutonomousProxy) { ShowSecretUI_RPC() })
IsLocallyControlled() - Returns true if the actor is controlled by the local client. Example: Show first-person effects (if(IsLocallyControlled()) { PlayLocalSound(); })
Network Mode Checks:
World->GetNetMode() - Returns network mode for the world context
Server Status Checks:
IsServer() (Blueprint only) - Calls World->GetNetMode() != NM_Client. No direct C++ equivalent but HasAuthority() works for most cases.
IsRunningDedicatedServer() - Global function to check if running as a dedicated server. Example: Initialize server-only subsystems (if(IsRunningDedicatedServer()) { InitServerAnalytics(); })
IsDedicatedServer() (Blueprint only) - Blueprint wrapper for IsRunningDedicatedServer()
IsListenServer() - Returns true if this is a listen server (server + client together). Example: Apply special handling for host player (if(IsListenServer()) { CompensateForHostAdvantage(); })
Client Status Checks:
IsRunningClientOnly() - Returns true only for pure clients (not listen servers). Example: Optimize network code for pure clients (if(IsRunningClientOnly()) { ReduceNetUpdateFrequency(); })
Network Role Types:
ROLE_Authority – The server owns and controls the actor.
ROLE_AutonomousProxy – The client controls the actor (e.g., player pawn) but the server has final authority. Used for input lag compensation.
ROLE_SimulatedProxy – The client only receives updates and simulates movement (e.g., other players' pawns).
ROLE_None – The actor is not networked; used when replication is disabled or after an actor is removed from replication.
GetLocalRole vs GetRemoteRole: Often opposite, server might see local=authority, remote AutonomousProxy while the client sees the opposite for the same actor
Deprecated:
GIsServer - Deprecated and unreliable. Use World->GetNetMode() != NM_Client instead.
GIsClient - Deprecated. Use World->GetNetMode() == NM_Client, HasAuthority() or IsRunningClientOnly() instead.
Hello.
I have platform that goes up and down. It works fine in multiplayer (I have replicated value with platform height and location of platform is updated every tick based on that replicated value). Issue I have is that if I run it in PIE (two players on single computer) everything is smooth, but when I run packaged project on two computers, on client platform do not go smoothly up and down.
First question, is there any way to simulate that in PIE? I can't test game on two computers all time.
Second, is there any automated interpolation of platform location or something? Or maybe there is better way to cause simple movement of object that is smooth in multiplayer?
I think you can simulate as you want by running the test as standalone game
Assertion failed: BeaconHostListener->InitHost() [File:C:\Documents\Unreal Projects\LyraGame\Plugins\CommonUser\Source\CommonUser\Private\CommonSessionSubsystem.cpp] [Line: 1480]
UnrealEditor_CommonUser!UCommonSessionSubsystem::CreateHostReservationBeacon() [C:\Documents\Unreal Projects\LyraGame\Plugins\CommonUser\Source\CommonUser\Private\CommonSessionSubsystem.cpp:1480]
UnrealEditor_CommonUser!UCommonSessionSubsystem::FinishSessionCreation() [C:\Documents\Unreal Projects\LyraGame\Plugins\CommonUser\Source\CommonUser\Private\CommonSessionSubsystem.cpp:665]
UnrealEditor_CommonUser!UCommonSessionSubsystem::OnCreateSessionComplete() [C:\Documents\Unreal Projects\LyraGame\Plugins\CommonUser\Source\CommonUser\Private\CommonSessionSubsystem.cpp:633]
UnrealEditor_CommonUser!TBaseUObjectMethodDelegateInstance<0,UCommonSessionSubsystem,void __cdecl(FName,bool),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [C:\Program Files\Epic Games\UE_5.5\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:667]
Same issue does anyone know how to solve it
hello guys, excuse the intromission.
im trying to make a clone of the character replicate the exact same movements as the player, the object where the code in the first image is was quite literally, a duplicate of the third_person_character that the player moves, and now the issues.
-the data on the axis and vectors are being provided by the player (second image)
-on stand alone, and listen server, the clone behaves correctly
-if i put magic numbers (without the variables of the axis and vectors) on the "add move input", it also works,even on the clients
-but it dosent work on client, ive tried to use rpcs calls to call the events on a server then multicast, but is not working either
i fear this is something about an option on the pawn that is the clone that im missing, but im not sure where to look, what i am doing wrong here?
jesus christ the bots
Do you have replicate movement check?
i do belive it yes, let me double check it
because at the end, the clone was a duplicate, and the original had that check
yup, it was
I'm facing an issue, where if (on a StateTree) I'm setting the movement Speed and then posess the AI character and try to move, it really stuteres and I rubberband really hard, any isseus what that could be?
Do I have to replicate the movementspeed or something?
Also the StateTree is Stopped afterwards
Usually because there's disagreement with the max walk speed
Say it's set at 400 at server but you as client have it at 1000
So you think you can walk 1000 unit per second but on the server you only moving 400 unit per second
In the end the client will just keep getting corrected
Yea thats what it feels like, but I tought that it is only handled server sided?
Do I need to replicate it somehow?
what bit flag do you mean?
Movement need to be client predicted
Look at delgoodie cmc tutorial.
what i don't get, it should be controlled only by the server in first place how can there be a discrapency between client and server
not sure how to find
Youtube
yea but this guy only has a "NetTick, Animation, and Movement | Astro FPS Devlog" video
about movement
It looks like you're setting the variables only on client side, The second image
Is the issue clone gets teleported back?
nope, the clone dosent move at all if its on the client
and i leave the variables as they are, connected to the add move input
but now that you have mentioned this
they appear to be barren on the server?
but the clone moves when i play on listen server
oh, i should add one more thing, each player spawns their own clone when they want and they are the owners of said clone
so, to clarify, if i play on the listen server and i spawn the clone on the lsiten server, the clone does move like the player on the server, but that does not occur when doing the same thing on the client
I assume you're setting Axis value and forward vector on input events, and those events fire only on client
true, that was important, yes they are being setted on the input events
But it still should move on client and get teleport back afaik
nope, it stay still
dammit, should i try to like, make an rpc to establish the variables and see what happens?
gotta say, it just came to my mind the fact that the inputs are only on the client side, i knew this and i feel stupid now
Hello, I'm reading about deterministic vs sending state approaches, and I have a question (I could be just extremely naive in this case). Everywhere I can see that late connection is a bit*h to implement in deterministic env because you need to resimulate game with all the inputs, but why not just send current state of game and continue with inputs from there? Is the optimization you have to do to make the resimulation viable option, really easier than sending game state?
@glossy wigeon https://youtube.com/playlist?list=PLXJlkahwiwPmeABEhjwIALvxRSZkzoQpk&si=or2N23cHVGeiuHy2
Ok thats almost 10h of videos 😅
Do you maybe know, how it could happend that client and server are out of sync regarding the max walk speed?
But maybe I have a look if I find the time
Pretty sure Max walk speed is not replicated and I don't think it should.
Because all of the movement state needs to be in the bit flags.
Tldr can't do this in bp without a shitty workaround or giving up on some feature.
If you know cpp then you can follow along del goodies tutorial or look at how tranek GAS documentation implement sprinting.
why epic hates multiplayer bp 😢
Cuz you can only do soo much with it
yeah, i also watched the video about what happens if you try to add an state to a pawn outside the ones unreal provide
weird lag and stuff, and there is a 500€ asset on the marketplace that is suppose to fix it
You probably mean General movement component?
either that or cpp
yup
It's an entire new component
Not using character movement component
Pretty good apparently if you need custom shape
Since cmc only work with a capsule so gl trying to do a tank or dragon
so i guess if you cant use cpp, its a worth investment
Nah
Just learn cpp
You will hit another wall eventually
Learn what you gotta learn
true
i know an enough amount of cpp, but i always found the cpp of unreal to be... ehhh convoluted?
I never write anything outside console app outside unreal so dunnoe.
Don't really need to know a lot to get our hands dirty.
Like I still can't read what other people write but good enough to get some feature working.
like it has things that normal cpp does not have and for begginers, it makes learning harder
yeee, thats good enough
any 1 here that has worked on an mmo before? i have a few questions out of curiosity, please @me if you got the time/patience to chat.
Yea I don't understand, I've tried, when I set max walk speed with a server call and on client, it works.
But I'm not sure why I would even have to do this and how I could fix it.
"Works" this is not remotely acceptable in practice because delay exist.
What you are doing is what youtube bp multiplayer tutorial does which is a pure scam because your movement will never be responsive.
Say you want to sprint as client and you have 200 ms, are you okay to start sprinting .2 second after you press a button?
There's only one way to do this. Don't fight cmc and work with the given framework.
Extend the FSavedMove and add and toggle the bit flags as needed.
Use net.pktlag to simulate delay
I'm not really sure what you are getting at, but the max walk speed is just how fast a player can go and that is controllered by the movement component.
What I dont get, and as far as I understand, this is controlled server sided.
So I tought maybe after possession there is just an issue, where it is off, I'm trying to set it didn't change anything, then I tought ok maybe letts try syncing up on server and client, so I called set max walk speed on both, then I can normally move without rubberbanding.
But how can this be an issue, this should be in sync anyway right?
No, changing the walk speed only change for that machine.
You want to change the walk speed when the state of the movement changed.
E.g. sprinting, walking , crouching w.e
And that's done when the bits in the FSavedMove is received.
Not sure what you mean by controlled server side
It will be controlled by the player that possess the character
but why does it work when the movement for ai is changed on the character?
I'm not even sure I thought I don't have to replicated it and my assumption would be, that the server declares how fast a player is allowed to go, even though it might be client predicted
The client is allowed a degree of autonomy
They essentially move ahead into the future
Setting it like this works, but i really dont want that
Server then check if the move is valid and correct the player if the margin is too mjch
But if i do just the server call it does not work just the client call also does not work
Yeah nah it doesn't really work.
Unless you claimed that moving after X ping acceptable.
It would be frustrating that most people will just uninstall the game. I'm not attacking you btw, this is just a fact if you do the movement this way.
But just setting movementspeed in the StateTree works (which I would assume is executed server sided?)
Also setting the movementspeed via a callback on a GAS-Attribute works, I assume because this is executed on the server and client right?
It is not. Have you test with delay?
I'm currently playing with 30-60ms
If you look at GAS documentation tranek also work with CMC framework.
but the delay would just affect how fast you go from sprint to walk right?
Toggle the bit flags, there's nothing else you can do
Really?
Yes. I checked the code.
I did not know, that movement was such a huge pain in multiplayer would have assumed it works better out of the box
Sprinting in multiplayer is what drove me to learn cpp
And after reading and experiencing stuff
I wouldn't bother to do any real time multiplayer game in bp only project
Crazy
Because there's soo many things you can't do with bp alone
Yea C++ is not an issue at all
It's just crazy didn't know that this is such a big thing, crazy, also it took so long to figure out that this was the issue
But having some understanding on the workflow is a huge plus hence why I recommend delgoodie video
It is the most comprehensive cmc video available.
Yea but it's 10 hours on a already strained mind regarding this topic 😅
I also wonder that there is not much more about that topic when doing a quick google, that not more poeple having this issue.
but also explains some indie games with really hard rubberbanding in MP ^^
The whole video covers wall running, sliding, climbing etc.
Just take what you need
Start by watching the overview
Then you can just watch the sprinting part.
Or you can look for another way and still stuck for weeks or forever. Just saying
Yea totally undestand, but you think that a attbiuteset holding the max walk speed replicates to slow?
It doesn't work the way you think it does. All explained in the video which is probably 15 to 30 mins at best from memory.
Walkspeed shouldn't be replicated anyway
You changed it when your movement state changed
maybe I'll tkae a look at it the next couple of days if i find time.
I mean the time i repeated my self, you can listen for the explanation from the 1st video of delgoodie.
Yea but what about GE that enhance your movement speed?
The GE will toggle the bit flag
Again using the same and only workflow
A bit flag won't work in my case,
You can't fight against it, not if you use CMC
It might be 10% it might be 15% or 200% but I maybe there is another way
I'll look at the video and even though I don't understand it right now, I'm thankful for you are pushing it on me so I might avoid some more trouble down the road ^^
You can't say that without knowing the system.
Yeah I'm saying this is the only way.
It's just what it is
I don't even understand the blit flag as of now, but for me its only 0 or 1 meaning walk or sprint but you are probably right, since you seem pretty persistent on that issue, so I have to find some time to watch the video and understand this too ^^
Yeah good luck and watch the video.
excuse me again, just bumping this once more because i tried a couple more things, like establishing the variables outside the input axis too see if that would resolve the issue, but im still stuck
Try this
Ditch the variables thing entirely, And on clone's tick set the velocity and rotation values to the original copy's values
i can get this without using variables i assume then
If it works, I think you don't even have to check the "replicate movement" option for the clone
makes sense honestly, but then again, what i was doing made kinda sense too, ill try it
god i think its working
and i say think just because i have to check if it works on the other client, but atleast this time its moving on the client
it works on the other client
T_T
I believe it should work on other clients aswell as long the original copy is replicated
all i need is to add a isvalid because this is happening because of the server side i guess
but jesus christ the variables thing made sense and it was easier all along
But you might have an issue with this method, The clone position will probably get out of sync
it kinda does... like it has some lag
but honestly, is not that much of a problem
it might even be better
It will grow worse the longer you go
hmmm
ill see how "longer" it needs to be, because it supposed to be like a yoru clone, it dosent need to be alive for long
You could set the movement of the clone to replicate but set it's net update rate low and force net update every now and then to sync it
Even if it's alive for only 5 seconds, One lag for the original copy is enough to make all the copies of the clones on other machines to go out of sync
i guess you mean these two for the net update, but its on the general pawn, not the movement
havent considered the lag of other machines, true
Yes, I believe it applies to everything under the actor
im going to note everything you are saying because im dead sure i will find this problem again on the future
but hell, its working, at least for the moment
its an improvement over not moving at all
im still perplexed of why it wasent working with the variables thing, because funny enough, when i was watching the variables like these ones, they had the correct values
it was like they were refusing to get into the add movement input node
but astral
i cannot put into words the gratitude
Glad it worked
Yea sometimes you have to debug the f out of it
Hey folks! 👋
I'm working on a UE5 Blueprint-only multiplayer game (Using Steam AppID 480) and the Advanced Sessions and Advanced Sessions Steam and I'm currently stuck with a Steam session issue. When trying to create a session, I consistently get this warning in the log:
[2025.03.31-04.47.59:054][934]LogScript: Warning: Script Msg: Invalid Player controller when attempting to start a session
[2025.03.31-04.47.59:054][934]LogBlueprintUserMessages: [10Kerzen-Game-Instance_C_...] Fail
I have two separate buttons that trigger session creation (same logic):
One is located in my Menu PlayerController
The other one is in the GameInstance
I press them individually, with ~10 seconds delay between tests to make sure they don’t interfere.
Steam sockets are initialized fine (RelayNetworkStatus: OK, all relays valid).
Both trigger the exact same error: “Invalid PlayerController”
I'm using GetPlayerController(0) as the input for CreateSession
❗ What I suspect:
It seems like GetPlayerController(0) returns None at the time the session is started — even though I'm calling it after menus are fully loaded and with a working PlayerController in the world.
❓ Has anyone run into this before?
How do you ensure the PlayerController is valid when calling CreateSession?
Is there a better place/time to trigger it when working from GameInstance or a custom MenuController?
Any help, suggestions, or ideas would be super appreciated! 🙏
Hello guys, I suppose this is the best channel to ask this question in: let's say I am making a really basic multiplayer game with a backend that tracks player inventories (items are defined as data assets) and learned abilities (I am using GAS), how could I actually keep track of items and abilities via an external custom backend?
The thing I am trying to grasp my head around is actually how to reference said assets, for example to store information related to them in a database (say player X has 10 Healing Potions in their inventory).
Not sure if this is the best way, but you can either use the asset path which is kinda bleh, or you'd have to use some kind of ID system that you would use to look up the associated assets/abilities allowing you to store your inventories and granted abilities as the IDs. The IDs could be human readable like ABILITY_FIREBALL and ITEM_SMALLPOTION.... Then using something like Data Tables, look up the associated asset.
I would definitely use some ID system, the more automated the better
I thought of using UUIDs but hoped there were already some sort of unique identifier built into the assets already.
One more thing though, I have another problem related to having the assets on the UE side, which's essentially how can I actually get the data from the assets since some of these might be needed on the backend as well?
Initially I thought about serializing the assets into JSON so that the backend could read them
You kind of need to decide how you want the data flow to work. You can create your data asset items within Unreal, making the Data Assets themselves the source, then have some editor utility that exports the data assets as JSON which you can then have other applications use, but then you'd also need to make sure that is run any time you do update items so the other application has the updated JSON.
An alternative would be to work the other way around and use JSON as the source.... Unreal could generate Data Assets at run time based on the JSON data, and your other application can just use your JSON data. The trouble here is, you'd have to have some other tool to create the item JSON data and upload it wherever necessary, and include it with your packaged builds.
Yeah, this is probably the most important part.
I was thinking of using the first way you described since everything in the game should go according to UE, which already provides every tool, rather than having to make my own.
As you noted, should the items change, so shoul the resulting assets' JSON, but considering the assets themselves wouldn't change frequently, I suppose this is the way I will go
Thanks tho!
If anyone has other suggestions or has done something similar and would like to share, please, tag me 🙂
Hi Guys, I am facing some strange issue with the dedicated server where the bots are no moving, They are shooting but not moving means if enemy get in range bot start shooting standing still.
I am using an FPS 5 Template (https://www.fab.com/listings/29219f54-56aa-45bb-92f9-01ca45833fe5). I can replicate the same problem in editor as well just by selecting net mode "Play As Client". Does anyone know what could be the cause of this?
If there's an array of ustructs set to replicate, does it replicate the entire array when a value on one of those structs changes? Or just the individual property on the struct?
if you are using normal array replication I believe it replicates the entire array.
if you use fast replication, it only replicates the changed element
array replication is fugly
Anyone have experience with multiplayer root motion animations with dedicated server?
I have two root motion animations, one is a roll from ALS and it works perfectly fine when playing as client, the other is my own which just jitters the character in place when playing as client, presumably because the root motion isnt being applied on server.
I cant figure out why one works and the other doesnt, i checked all the montage and sequence settings and they are identical.
If i take the working montage and replace its sequence with the non working sequence then the working montage stops working, so the problem seems to be with the sequence
Anyone have any advice on what it might be?
Yeah. That was my fear, thank you!
Need better context on this. What do you mean when you say one is located in the player controller and one is in the game instance? I assume these are functions and the buttons are actually on a widget calling these two separate functions?
First I'd be concerned why you have no player controller from a UI input. In main menu even GetPlayerController(0) should be valid. Though it's worth a note that one of your functions is in the player controller itself, so you could just use Self as a reference.
probs you already know about it, but there's FFastArraySerializer that only replicates the items that changed. Setting it up is realatively easy and it's very performant
Yeah. We're already using it fro something else, was just curious!
ahh yeah understandable
Hey guys I wonder, if I want to change the max walk speed of a character in a multiplayer game, how would i achieve this?
I know there are (4 available) flags that one could use for sprinting, but I actually want to change the max walk speed.
Would I have to do this on client an server then?
im using a scope child actor on a gun that uses render target , PIP scope basically.
im having this weird issue where my clients scene capture is painting onto host's (Character's) scope
any idea why this is happening
https://www.youtube.com/watch?v=ixNGvOYkbno
This guy has a pretty good series on what is needed to implement a sprint that adjusts the Max Walk Speed using the CMC, C++ and the available flags.
I just watched 2-3 hours of delgoodie, doing the same thing, but I want to really adjust the MaxWalkSpeed, not only have a sprint.
As far as I would imagine now, I would have the FSaveMove_Character have the current MaxWalkSpeed and hope it doesn't diverge to far from the character, but I wonder if there is a better way.
This all just started, since I'm setting the max walk speed for a AI in a StateTree, which works fine, but then possess the character which does not.
It's likely either because you're utilizing the same rendertarget on the second character and it's overriding the first character's, or you're using some strange logic that happens to get the other character and renders the point of view from their gun. It's not really anything to do with replication but rather how you happen to be writing to the rendertarget locally since they're not replicated.
I mean for the player character itself, it more or less works, because the MaxWalkSpeed is in a AttributeSet and this is synced between server and client, at least I did not see any corrections there, also since the max walk speed does not change per frame and in comparisson spares, but I wonder how to handle that.
But since the max walk speed is influenced by attributes, it's not possible to do it with the 4 available flags.
i got this scope actor which has the skel mesh and the camera, the material on the scope is a mat inst that takes in render target as the param.
the child actor thats already on the gun is set to the class of the scope selected on an on rep function and thats it
Are you creating separate render targets for each scope? Are you constantly having all Cameras update the rendertargets even though they may only need to be seen by the local player?
well its like the render texture in the content browser and im just assigning that to the scene capture
and yes i have cameras drawing onto the render target constantly for now, ill change it to activate the camera only on owning client once i can fix this
and only when the clients aimin
Thats where the problem is then... If both scope cameras are writing to the same rendertarget, one of them will ultimately win out, which may not be the one you're actually trying to view.
for every scope type yes different render target. for every instance of the same scope im confused how it works
how would i make muiltiple render targets?
like as they replicate or work for their own instance
Rendertargets don't replicate.
If you want each scope to have its own rendertarget, construct one and save a reference to it and use that for that particular scope, and use it for your particular material instance.
However, the more SceneCaptureComponents you use, the worse performance you'll end up having overall.... You probably should only ever have the local player's scope capturing anything.
Or if you do want to have it visible for others, some optimizations will be needed like only capturing if the scope is in view of the local player 😛
wont it not make a difference if all of them are off and only the right one is on on the owning client, also cant i destroy all the scene caps that the local player doesnt own cus it wouldnt make a difference anyway
this actor shouldnt be of concern to other clients, its part of the weapon actor that is in the hand of the local players hands, for visual i just use skel mesh that mimmic the weapon
also shouldnt multiplayer minimaps have a similiar system or concept
i did not know createrendertarget was a node lol
There is no such thing as multiplayer minimaps. The minimap itself and the images it would be using would be created and presented entirely locally. A minimap could be used to represent replicated data, but that doesn't make it a "mutiplayer minimap" it's still a widget that is entirely local to the current machine. If you wanted each player to have some kind of overhead 3D view of their location as a minimap, then you would enable a SceneCaptureComponent over their controlled character which could write to a rendertarget, and that rendertarget could be fed into a material that could then be displayed by your UI. The moment you have more than 1 SceneCaptureComponent writing to the same RenderTarget you'd end up in the same problem you're having with your scope.
Multiplayer doesn't even really factor into the problem you're having as you would have the same problem if you placed a second scope in a single player game - since both scopes would be writing to the same rendertarget, one of them would win out over the other.
I have a question regarding the charater movement and the bit lags, I will be limited to 4 flags right?
So I should consider with care what I will put there, probably a sprint flag is a good idea, but some things might just not there right?
i see i see, this makes a lotta sense. thank you so much! i think i should be able to fix it w the create render target thing
{
}
void ATrash::BeginPlay()
{
Super::BeginPlay();
if (HasAuthority())
{
SphereTrigger->OnComponentBeginOverlap.AddDynamic(this, &ATrash::OnSphereOverlap);
SphereTrigger->OnComponentEndOverlap.AddDynamic(this, &ATrash::OnSphereEndOverlap);
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, TEXT("Binding"));
}
}
void ATrash::EndPlay(EEndPlayReason::Type EndPlayReason)
{
if (HasAuthority())
{
SphereTrigger->OnComponentBeginOverlap.RemoveDynamic(this, &ATrash::OnSphereOverlap);
SphereTrigger->OnComponentEndOverlap.RemoveDynamic(this, &ATrash::OnSphereEndOverlap);
}
Super::EndPlay(EndPlayReason);
}
void ATrash::OnSphereOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, TEXT("Player Detected"));
if (HasAuthority())
{
PlayerController = Cast<AAPlayerController>(OtherActor->GetInstigatorController());
if (PlayerController)
{
Client_SetWidgetVisibility(true);
}
}
//WorldItemWidget->SetVisibility(true);
}
void ATrash::Client_SetWidgetVisibility_Implementation(bool Visible)
{
WorldItemWidget->SetVisibility(Visible);
}``` how to make my interact ui toggle for the client overlapping, nothing happens when i overlap. Debug messages do print so overlap event is happening.
You can't ClientRPC in a random Actor. Only inside Client-owned Actors.
E.g. in the PlayerController.
I would however suggest to just remove the HasAuthority limit on the Overlay and check the OtherActor for being a Pawn that is LocallyControlled.
if (Pawn && Pawn->IsLocallyControlled())
{
Client_SetWidgetVisibility(true);
}``` writing this on overlap nothing happens still
removed authority check too
You can send whatever you want through cmc. You are not limited to the flags
https://docs.google.com/document/u/0/d/1UO6Ww6Lfpti3YElVdo9uioTUtQJQ9CoSLvd9kF8hvJo/mobilebasic#heading=h.irlzv6ukhpxb
Custom CMC Network Data Discord Permalink This document will cover how to use and send custom network data between the server and client through the Character Movement Component, beyond just custom flags. This could include sending additional compressed flags, additional input vectors, etc. No...
You need to remove the Authority check when binding and the CLient_setWidgetVisiblit thing shouldn't be an RPC.
thx it works now
Cool thanks gotta look at that! 🙂
Is it a viable option to use a pawn physic asset in a server side rewind context?
As of now i'm adding collision boxes to the character, tracking their position over time and moving them back to the requested timestamp.
I'm wondering if instead there is any performant way to use the physic asset instead
Why do timelines appear super jittery on clients screen, looks fine on the server screen?
If this is done on a replicated actor with location being replicated, then the server is setting the location as well as the clients.
I have implemented a FFastArraySerializer to replicate the inventory item structs on InventoryManager : ActorComponent which sit on some replicated Actors in the world (~100 Inventories).
However, for some reason only about half of those Inventories are actually replicated. The others are empty & and the FFastArraySerializer::PostReplicatedAdd hook is also not called for those inventories.
What could be the reason for this? How can I look up where the issue might occur? I have enabled LogNet, LogNetFastTArray, and LogRep and I cant see any error.
I can see however some cryptic Verbose messages, but those only happen on the Actors that actually get replicated, so those are probably not the issue.
ReceivedBunch: FieldCache->bIncompatible == true. Object: InventoryActorManager
I have also seen this, but I have since changed the value of net.MaxNumberOfAllowedTArrayChangesPerUpdate = 4096, now I get no warning but the replication issues still persist.
Warning: NumChanged > GetMaxNumberOfAllowedChangesPerUpdate: 3250 > 2048
Is there somewhere I can look further to see any possible replication errors? Im all out of ideas :(
Are those Actors network relevant? Are they being affected by Dormancy?
I'm not sure. Thank you! That's a starting point for some further research.
My gut feeling is yes, since another replicated UPROPERTY on the InventoryActorManager (Money) is being replicated correctly.
Mmm if other variables are being replicated then its likely not a relevancy or dormancy issue.
Are you making sure that you are calling MarkArrayDirty and MarkItemDirty correctly?
yeah, thats the exact reason
thanks
I think so, I'm doing it like this
void UInventoryActorManager::ServerAddItems_Implementation(const TArray<FInventoryItemInstance>& ItemsToAdd)
{
for(FInventoryItemInstance Item : ItemsToAdd)
{
if (InventoryItems.ItemInstances.Contains(Item))
{
continue;
}
InventoryItems.ItemInstances.Add(Item);
InventoryItems.MarkItemDirty(Item);
}
// This is the server call to update the slots and quick access, the client is subscribed to the delegate in the InventoryItems List (on replicated)
HandleItemsAdded(ItemsToAdd);
}
I currently have one struct per item instance (in some inventories up 3000) with a UPROPERTY() ItemDefinitionDataAsset *DA;. Could this be the reason, that it is simply too much data? Or that the reference to the DataAsset is the issue?
I planned to rewrite the item instance struct to use an integer for amount anyway in the next step.
Try using this instead for (FInventoryItemInstance& Item : ItemsToAdd)
Because MarkItemDirty needs a reference to the array element
This
https://www.fab.com/listings/d0230a24-d761-4078-a9d4-05b150df58b5 does any one use this can i make replicated stamina with jump with this
This is a simple plugin that will allow beginners to implement a stamina system into their games, with ease of use and expandable components. All you will need to do is add the Stamina Component to an actor that you want to be able to use Stamina. It deals with the decay and regeneration of stamina, using timers, as well as the authority checks ...
You should typically contact the author for questions like that.
I know, but generally, devs don’t respond to emails.
Then report them to Epic for not providing support.
It is a requirement of marketplace submissions to provide ongoing support.
I have an actor that is basically a chest, it is replicated and mostly works fine. However, when I interact via interface and call the RPC (server) event it doesn't get called (everything else gets called fine). The same code works fine in player controller/character or if the player is server in listed server. It also works fine if it is put in beginplay, how do I communicate so I can actually call the RPC event? I can just do the code in controller but it doesn't sound well at all
I got one step closer. I can't figure out why the multicast isn't firing for the Host when the client connects. I'm so close but this seems so inefficient..
https://www.reddit.com/r/unrealengine/comments/1jj5022/help_vehicle_turret_aimoffset_replication/
help me someone please you can reply here on the link
Clients cannot call RPCs on actors they do not own. If you want players to be able to request the server to do something, you'll have to call the RPC on an actor that they own like you discovered --- their player controller, character or playerstate or replicated components of these actors. Once running on the server you can then use your interface call.
Thanks for the clarification, I just really don't like the way it looks and was hoping there was something with less calls/easier.
Begin Play fires on both the client and server, so it's not really necessary to RPC to the client to tell it to create the HUD. You also shouldn't need to have double Server RPCs for setting the user name in the PlayerState. Just use the one RPC in the PlayerState.
Your problem stems from your OnRep - it's a bit complicated for what you need it to do.
Your UI shouldn't be updated from the GameCode. The UI should update itself based on events dispatchers it can listen to or by using bindings within the Widgets (which is less performant but it gets you to the point where it works faster).
There's a few things you need in order to display a list of Player Names:
- You need to know when a Player joins the game. To make things easy, create an Event Dispatcher that takes a PlayerState input in the GameState caled "OnPlayerJoined" and have your Begin Play of PlayerState call it and pass in a reference to "Self".
- You need to know when a Player leaves the game. Similar to the OnPlayerJoined, make an OnPlayerLeft dispatcher with a PlayerState input, and call it on the EndPlay of PlayerState.
- The current list of players in the game - luckily this is handled for you already - there is a PlayerArray in the GameState that contains a list of PlayerStates.
- When a Player name change is received. You have this using your OnRep in your PlayerState, now you just need another Event Dispatcher in your PlayerState called OnNameChanged.
For the UI part:
On Construct of your list UI:
- Bind to the OnPlayerJoined dispatcher in the GameState. Have the OnJoined create a "User Entry Widget" that represents a player and pass in a reference to the PlayerState that joined.
- Get the PlayerArray from the GameState, use a ForEach loop and generate the same "User Entry Widget" for each player.
On Construct of your "User Entry Widget":
- Get the passed in PlayerState reference read the current value of PlayerName and set the text display.
- Bind to OnPlayerLeft and have it remove itself from parent, thus removing it from the list.
- Bind to the OnNameChanged dispatcher in the PlayerState and again set the text display with the current name from the PlayerState.
Quick Question: Any idea why an animation would play perfectly fine (replciated) in PIE, but not standalone? I've added a turn in place system that works great in PIE (replicates as expected) but plays, what appears to be, slower in standalone or a built game?
without sharing anything about what your code actually does how can we answer this?
I assume you are trying to use onreps?
That would make sense to me because standalone would not trigger any onreps
Right now it's just a variable that gets set from the input value, passed to an RPC, picked up during the animation update (in the animBP), sets the appropriate animBP variable, and gets read during the appropriate animation in the state.
Why call an RPC when in standalone mode?
I'm not sure how else I would get the variable to be replicated to all clients.
"standalone" here being also multiplayer?
Correct.
I works fine in PIE - just not when I build it out and test it or through standalone mode.
And other replicated things work as expected?
Correct. THat's why I find it odd that this one thing doesn't.
With a true standalone game the big difference from the editor that will generally cause confusion is the fact the editor loads assets as a singleton manager
So in the standalone game it might not have assets loaded that you are assuming are loaded
If it makes more sense to ask in the animation channel, I apolgize, jsut figured it was something with my replication that was causing the issue, so I started here.
That's possible..
It's not unreasonable to ask here imo
I can see them play...they just seem to play at, what appears to be, almost half speed.
Definitely differently compared to PIE, anyhow.
"Any idea why an animation would play perfectly fine (replciated) in PIE, but not standalone" what part of this question is about the playrate? I assumed you meant nothing happened at all?
Just the 'perfectly fine' part. That's my bad.
Do you have animation budgeting in use?
I'm trying to think of things that would make the anim instance tick... less
I'm not familiar with animation budgeting, so I would assume, no.
...unless there's a default I'm anaware of.
I don't think so
But yeah I would say this kind of thing might be just unexpected ordering of things in standalone
Kind of hard to track down, might need to add some debug helping things to the running game
still no idea how you "play them" if they are montages or what
ah wait, you did describe it a bit
"picked up during the animation update (in the animBP), sets the appropriate animBP variable, and gets read during the appropriate animation in the state"
okay so the anim bp has to update at a certain timing for this to work?
I would verify it ticks as you expect in the runnin game especially if they are off-screen
I'll look into that - they are driven through the state machine with a check if the turn value (from the mouse X) is greater (or less then) 0 and then drives the appropriate left or right turn. IF the value is zero, I stop then and return to my idle pose.
I've been checking with two clients so I can visually see if it's working that when I noticed the discrepancy between the editor and a built game.
Sim proxies won't have input on them
Is the built game running a listen server as one of the clients? (well, they would be the auth now)
At the moment, yes.
okay well I guess "checking with two clients" to me would imply that it's running on dedicated
I guess you can have 2 clients and the listen server though
I had another team member log in through Steam after I had built it and am doing 2 clients in standalone mode from the editor for testing.
They noticed it before I did, that's when I started down this path.
I guess I should mention in-editor testing will send the rpc instantly the next frame
you need to emulate packet lag/loss/jitter in the editor to mimic the reality of a networked game
this is built in thankfully
this ones a longshot but has anyone encountered an issue where calling destroy actor with certain meshes from the client causes memory violations?
OK - I tested it with 'average' and set to 'everyone'' and the animation (in PIE) still plays as it should despite the simulated lag.
what actual network mode is PIE in?
Play as Client
Are you trying to delete server based actors as the client?
so you are mimicking a dedicated server to compare to a listen server?
I feel like I am missing something here
When I try to run it as 'Play as Listen Server' with 2 clients, one of them just spawns to the main menu instead of the test map.
That's why I was using client for both. The behavior I experienced was the same as when I was in the built game, however.
My issue involves an inventory system I built so Its alot to get into. but no
I feel like this is a larger problem than animations going slow... you are trying to test two different things?
You said they connected as a listen server in the built game, no?
Correct.
basically some items pickup fine and other crash the game SOMETIMES. ive narrowed it down to changing the mesh corrects the issue but only certain meshes
So you are comparing an entirely different netmode to NM_dedicated server
Listen servers are both playing clients and the authority and mixing things up here will get weird fast
I'm unsure to test with two clients in the editor, otherwise.
OTher than doing builds and testing through Steam for every iteration..
If the mesh is changed, it doesn't crash?
Yes, to elaborate i have two different meshes. Ones a flash light and ones a v8 engine . if I change the mesh of the flashlight object to use the engine mesh now when client picks up it crashes
How are the original meshes spawned in?
placed in world
boths these object are represented by the same parent class to
I can spam pick up flashlight all I want but with the engine it throws all zero memory violation
And the only difference between them is the mesh component?
yea
like if i just set the flashlight mesh to be the engine it has the same issue
I feel like is could be collision or maybe the rendering pipeline try to access it still?(i dont know much about rendering)
With all things being equal, I'm not sure how a static mesh would cause that particular issue. What makes you think it's a replication issue?
If something crashes, is there a log and callstack you could share?
do I need to install the 76 GB debug kit on my ue5 version to get that?
I think you'd only need that if the callstack shows a lot of engine dll lines
Your own code should still produce some readable callstack
Yeeeaaahh
You gotta install the symbols then, yes
ok thanks. Im gonna pick this up then tommorow
we dont be having fiber optic ova here
Yeah it's a bit of pita if you suddenly need the symbols
There is also a setting for downloading the source (not the GitHub one), I don't think you necessarily need to if you don't plan on looking at the actual code that crashed
Should be fine to get the symbols for now so we can have a look at the actual callstack
yeah that sucks honestly... hopefully you can get it downloaded eventually
im curious, how are class (UObjects and normal c++ classes) instance replicated from server to client or vice versa ?
i remember something like a net id,
if for example the server create a new actor/uobject and the object is set to replicated, the server will pack stuff like the UClass and net ID, that the client will use to spawn the "same" instance
Absolute newb question, but what steamworks SDK version do you need for 5.3.2?
Currently on 1.53 according to the steamworks.build.cs
can some one help me i have project thats using steam advance session and it all setup right and has a menu with a find session button. now it finds the session and in the editor it joins the session but when i compile the project and start it up with 2 pcs and 2 diffrent steam acounts its shows the session but when i press join it doesent do anythink. i know its working but it just wont join the session and i have no idear why. as you can see in the image the session is found and steam overlay is working but it just wont join
Anyone have any idea, at a high level, what would be the lyra-starter-project way of having a UMG terminal screen send a command with command-related data, to the server? I could just write an RPC on the player controller and be done with it, but I was just curious if there would be a way to achieve the same thing through an ability or something similar (using C++ or BP)
I have something so maybe you could try destroying the session first and I dont really know how do you get Search Result
wel just for testing am using the https://github.com/Risensy/Steam/ templet but i build it in my project too and i am having the same problem @mighty apex i can press join session but it just wont join.
Maybe you didnt enable all the necessary plugins?
i did but still am not able to join :S
Could you send the code/blueprint picture what happens when Join is clicked?
wel thats the https://github.com/Risensy/Steam/ am using for my project and if i build this project and try it i get the same problem.
It doesnt work when you package the project right?
these no diffrence between my project and the link i sent . yes it wont work but if i try it in the editor it does
Did you add this lines in DefaultEngine.ini
//
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
bInitServerOnClient=true
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
this is what i have in my ini.
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
bInitServerOnClient=true
bUsesPresence=true
bUseLobbiesIfAvailable=true
bUseSteamNetworking=true
bAllowP2PPacketRelay=true
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection" @mighty apex
Maybe try by commenting/disableing this lines
bUsesPresence=true
bUseLobbiesIfAvailable=true
bUseSteamNetworking=true
bAllowP2PPacketRelay=true
since I have to wait anyway for my build project to test something
@wild ivy
il have to give that a try tomorow i need to go to bed but thanks in advance. 😄
if its ok il send you a message tomorow
Ye sure Ill test some things now but I dont when Ill be able to answer tomorrow busy day
wel thanks in advance anyway
Does anyone know how to replicate chaos vehicles? Im trying to drive after packaging a game I made and its super laggy on client im rubber banding like crazy
hm for loops with spawning actor happens to fast for the server
what would be a workaround for it ?
Did you try a delay?
put the rpc earlier
why would call 1 rpc per actor when you're doing a loop with the same info, just say "hey spawn a bunch of them shits" and let the server do it
Instead of:
Entry -> for loop -> rpc -> spawn
do:
Entry -> rpc -> for loop -> spawn
HI, It's really simple question but my mind can't give me an answer idk why xd, I want to initialize the inventory, should I call Server RPC and wait when the server will initialize it or make it on the client-side (probably exposed for cheating)
what does initializing the inventory do, and why do you need an RPC involved?
the inventory's state should be controlled by the server, it's just replicated properties
What's in your inventory is 100% determined by the server. Transactions like Pickup, Drop, Trade, Give, etc, should be rpcs requesting the server to do things
I had lag for 30min, went to make tea and everything started to become clear 😂
In general, and not accounting for prediction, the general form for almost anything should be like this:
Server updates the state of things. Use replicated variables and repnotify when you need to respond to the state changing.
Clients call RPCs to make requests, like "Try shoot MyGun", or "Try pick up that item"
Hey guys, I had a question about something weird that happens in my multiplayer game. Sometimes when playing it in the editor or standalone, its like the server is still updating stuff and making calls (print string shows server calling stuff) but the client stops receiving events for a few seconds and then it all updates and catches up at the same time. Like enemies will walk off ledges (not supposed to) and my player will stop updating its animation. Basically things like rep notifys that are ran by the server will still work on the server but the client doesnt receive the event for a few seconds.
I guess I was wondering if this is normal with multiplayer stuff in the editor or if something I'm doing is causing it?
When this weird thing isnt happening, everything is running completely fine. I'm playing as client btw.
Did you accidentally enable the Network emulation that introduces Packet Loss?
not sure can i check that in project settings?
oh found it, its disabled
Ok well its not that then.
i dont think ive touched any network settings really
You might have just choked your network.
🤷
Check the Output Log.
See if its complaining about anything.
ok good idea ill try to check that
When u put it like that its obvious 😂 thanks
Does s listen server need to call destroy session for themselves when they stop hosting a game?
I’ve asked this before but has anyone ever tried to make a MP sports game in unreal ?
Any type really, but man I’d love to recreate a blitz the league or mlb sluggers
EA bought the rights of all of those games and shelved them btw (what a travesty)
That would be a good practice since they will need to destroy the session if they need to create another one if they haven't already destroy the last session.
Thank you. Second question on best practice. If you've got a replicated mesh and the mesh is changing based on some external input (say spawning a rock actor that's always a rock but you want it to have different rock meshes for variety instead of having 10 different rock_1, rock_2 classes etc you have 1 rock class and change the mesh) is it better to multicast change the mesh, or replicate the mesh component and have the server change the mesh?
you dont want to use multicast cause people joining later wont get that multicast
That, is an excellent point
one way it could work is to make an array variable of rock meshes you can set in a blueprint and then replicate the index as a uint8 (if you dont need more than 255 rock models)
and use an onrep for that uint8 index to set the mesh component
I'm trying to update this function from unreal tournament's code.
I'm having troubles finding a substitute for CreateChannel as it does not exist anymore
How do i manually create an actor channel?
I would assume it's something like this @twin vessel
code was taken from ReplicationGraph.cpp
It works, thanks!
In Unreal Engine, a single instance of dedicated server executable (MyGameDedicatedServer.exe) can manage only a single game session (or a single match) at a time. Is it correct?
In order to scale horizontally we need to instantiate the dedicate server executable multiple times, right? I am not sure my understanding is correct. 🙂
yes
OK. Thank you sir!
Hello
I am struggling to see the advantage of implementing logic inside GameMode, instead of GameState.
I did some reading, and people say that main logic should be inside GameMode, to ensure it is executed by the Server. But I can achieve the same in GameState by using a very simple IsServer check.
And given that for most games GameState Will have to have at least some functionality inside it, it is much more convenient to do All the game logic functionality inside it, instead of having to communicate between it and the GameMode.
Is there something I am not seeing?
well for a start you won't have to manually gate everything with a manual check
and since it's gamestate its usual purpose is just for replicating data about the game to the client
The "communicating" is usually nothing much more than GetGameState<AMyGameState>()->SetThing(ToWhatever)
this is basic separation of concerns
Hello!
Replication wise, is there a big difference by replicating a Primary Data asset (2 FNames basically) vs an object that is immutable (the Primary data asset object) ?
Is that fundamentally using more bandwitch etc ?
I have an array with asset ids, but I also need to keep the objects alive (loaded).
So I added a reference to the asset as a Uprop (so it won't be GC'd)
Once an asset path is replicated once between a server and client there is a much smaller ID that is used between them to reference that particular asset... First time can be something like 80 bytes but then goes down to like 4 bytes.
Not much of a difference @pine sage
Thank you, appreciated!
@sinful treehttps://blueprintue.com/blueprint/35k_s6cw/ is this how you would do it or in the rpc*
I'm not really sure what the goal is here... If you're on authority, you're already running on the server presumably, which means the RPC at the end wouldn't really be needed. If SpawnFireSpray_Server is an RPC itself, then you're going to be allowing clients to cheat and potentially crash the server as a client could spoof the RPC and say they want 1000000000 of them spawned, and they could spawn them anywhere in the world, and with whatever collision profile. When RPCing anything you should always RPC the absolute minimum amount and don't give the option for clients to dictate what is going to happen.
hi i downloaded Predicted movement cmc is posible to make jump decrase the stamina
@thin stratus sorry to disturb. can you confirm that these methods still work as you wrote them back in 2021?
for context this is about specifying dynamic (new) gamemode at runtime when opening a map using servertravel
I don't think that changed.
Pretty sure actually that still works as we have our lobby kit still doing it like that
@formal turtle
thanks for replying
Just a sanity check, the only benefit of the push model is that it skips the "did value changed" phase, right? Or is there any other hidden benefit?
Push Model puts that "check" in the hands of the programmer.
The property will never replicate a change in its value unless you mark it dirty.
You are correct in that it will be skipped until its marked dirty manually by code.
This saves CPU cycles
Thats the entire purpose of Push Model.
Gotcha, but that is the only advantage, right? There isn't any clever hidden feature, like oh it actually also "ensures structs are not split into multiple packets" type of deal.
Thanks for the sanity check
For a character, is the actor rotation the only rotation that is replicated by default? By chance is the mesh rotation replicated? I had a look through the code but didn't see anything so I wanted to double check.
No, the rotation of a component (like the Mesh) is derived as an offset from the rotation of the Actor.
The Characters Mesh is rotated and translated differently depending on the network context.
Since the Character class has more advanced features like client side prediction and networked smoothing added ontop.
Hi Devs,
I'm making a vehicle multiplayer combat game. I created a dedicated server, and connected my client with it.
Movement Replication is working fine. Although I get flooded with Warning that my PlayerController is over sending data.
These are the logs I get when I use net.debugRPC
LogNetTraffic: Warning: Sent RPC: VehiclePlayerControllerBP_C /Game/UEDPIE_1_TestGround.TestGround:PersistentLevel.VehiclePlayerControllerBP_C_0::ServerRecvClientInputFrame [7.4 bytes]
LogNetTraffic: Warning: Sent RPC: VehiclePlayerControllerBP_C /Game/UEDPIE_1_TestGround.TestGround:PersistentLevel.VehiclePlayerControllerBP_C_0::ServerRecvClientInputFrame [7.4 bytes]
LogNetTraffic: Warning: Sent RPC: VehiclePlayerControllerBP_C /Game/UEDPIE_1_TestGround.TestGround:PersistentLevel.VehiclePlayerControllerBP_C_0::ServerRecvClientInputFrame [7.4 bytes]
In this PlayerVehiclePawnBP Movement code RPC is fine, but the PlayerController is also sending an RPC which I'm not sure why is happening.
Any help in this area is helpful to me, I've no clue where to look for it. I don't have any replication code in my playercontroller class, still these RPC's are getting called.
Ok. I need to figure out a different way of what I am doing then. Thanks for your help
What makes you think you are "over sending data"?
You literally enabled the debugging of RPCs, so its just telling you what RPCs are being sent and how big they are.
@fossil spoke , I checked the warning in the dedicated server log,
[2025.04.02-14.31.44:026][484]LogPlayerController: Warning: ClientInput buffer overflow. VehiclePlayerControllerBP_C_0 [LightFury-AFA0C08747]. RecvFrame: 138. LastProcessInputFrame: 122.
[2025.04.02-14.31.45:186][555]LogPlayerController: Warning: ClientInput buffer overflow. VehiclePlayerControllerBP_C_0 [LightFury-AFA0C08747]. RecvFrame: 217. LastProcessInputFrame: 201.
[2025.04.02-14.31.45:837][595]LogTemp: Warning: Try Activating Ability
[2025.04.02-14.31.45:838][595]LogTemp: Warning: Spawning Bullet
[2025.04.02-14.31.46:330][625]LogPlayerController: Warning: ClientInput buffer overflow. VehiclePlayerControllerBP_C_0 [LightFury-AFA0C08747]. RecvFrame: 295. LastProcessInputFrame: 279.
[2025.04.02-14.31.47:116][673]LogPlayerController: Warning: ClientInput buffer overflow. VehiclePlayerControllerBP_C_0 [LightFury-AFA0C08747]. RecvFrame: 351. LastProcessInputFrame: 335.
[2025.04.02-14.31.47:852][718]LogTemp: Warning: Immune Flag Reset in Land Mine !
[2025.04.02-14.31.47:900][721]LogPlayerController: Warning: ClientInput buffer overflow. VehiclePlayerControllerBP_C_0 [LightFury-AFA0C08747]. RecvFrame: 407. LastProcessInputFrame: 391.
This data sent my PlayerController what I want to stop, however I don't have any code written to send RPC to server
Because of this warning , I use the debug command to check what all RPC are being sent, and that brought me to conclusion that VehiclePlayerController is sending data which is making ClientInput buffer overflow
If any one wants I can share the vehicleController class as well, its minimal, doesn't even have SetupInputComponent function.
Are you calling any RPCs in the Blueprint?
No I'm not calling any from Blueprint , added screenshot as well, most of the functionality is written in c++ only, BP is there to set few delegates and UI initialization
Intrestingly , chatgpt and deepseek indicated me that Enhanced Input System could be a issue here as it might be sending lot of input data from PlayerController,
which when I checked, I found, I only used Enhanced Input Component in Pawn class, not PlayerController class, still PlayerController is flooding Input RPC to server.
I need to stop this flooding , or else wont be able to continue work, as whole log of the server gets flooded with this message.
This is how it looks when Client Input is flooded from PlayerController, anybody has idea how to fix it ?
Ok so after a bit of looking at the source code.
It appears you are using either regular ChaosVehicles or the ModularVehicles?
I'm using ChaosVehicles
And im guessing you enabled bUsingNetworkPhysicsPrediction
Checking about this param, give me 2 mins
You must have enabled physics prediction in the Chaos settings
Unless its enabled by default.
It appears all of that seems really experimental still.
FPhysicsPredictionSettings::bEnablePhysicsPrediction
This is disabled by default
So you must have enabled it
Which is ultimately leading to that buffer overflow message.
I just checked, this PlysicsReplicated Mode is default on both PlayerControllerClass and Pawn class
Let me check again for phyiscs predection settings as you have mentioned .
Checked, this is how its looking like. The setting you mentioned, Prediction, its off
Well then I have no idea how its being handled.
Unless you added the UNetworkPhysicsComponent manually
Hey everyone, I've been trying to create a moving platform replicated for multiplayer with no success
I've notice there is almost no information about this.
Have anyone here created a simple moving platform for multiplayer so players can setp up on successfully?
@fossil spoke brother, your pointer helped me tweak few more settings, it seems the physics capture which was happening , was causing it
Now I turned it off and the logs are coming fine . 🙂
damn it, I still don't know much about event dispatchers. I tried hiring someone from Hire-a-Freelancer, but they claimed it was too simple for them to accept payment, I still offered to pay their full 1 hour rate (said it would take less than an hour) and they just stopped replying.
yeah I don't think anyone that isn't a scammer will take your money to help at this level
Event Dispatchers are a means of communicating from one blueprint to many and other blueprints can "subscribe" by binding to the dispatcher to then perform their own desired logic when that event dispatcher is triggered by the owning blueprint.
The first attached image shows how you would first call the OnPlayerJoined event dispatcher in the GameState from the BeginPlay of the PlayerState. The second image shows how some other object (in this case it's a widget I'm using) binds to that event dispatcher to listen for when it is called to perform some logic; the red "Player Joined" event is what happens when the GameState's OnPlayerJoined event dispatcher is called.
For a full blown example of how to make a widget that displays players in the game and update their names, here's an example I've made in the past that uses this same method: #multiplayer message
To create an event dispatcher, go to the blueprint where you want the dispatcher to exist, and look under the area where variables normally are, and you'll see a section labelled "Event Dispatchers" and you can click the + there to create them.
To add an input a dispatcher, first click on the dispatcher in the list on the left, and then on the far right you should have the details of the dispatcher, there will be a small + sign near the top right of the details that you can click which adds an input that you can then select the type and define the name as you wish.
Hello, how do I only run something only on the server? I have an "executes on server" RPC which spawns in an actor, but that actor is appearing in the client's level as well. So how do I spawn something in only on the server side?
By running the code on the server
If you don't want the actor to also show up on the client, make sure it isn't set to replicate.
Nothing is set to replicate. What did you mean by running the code on the server, and is there any way to do that through blueprints?
That's what a server RPC does.
I am using a server RPC to spawn in the actor
Unreal doesn't open up an actor channel unless you tell it to.
If an actor is set to replicate - it will also spawn on the client.
Check MCommand SB's replication boolean
Otherwise, show your complete setup and show what is happening.
which net mode are you testing in
PIE with Standalone net mode
standalone doesn't even have networking
That's single player
I dunno I'm using redpoint EOS and I think they told me to use standalone
in single player or as a listen server host, you are the "server" so it's gonna spawn
there isn't a separate client and server universe in this scenario
the only time you'll see it not spawn is as a client connected to a remote server
You right I went back to check and it was a misunderstanding on both sides. Whelp. I have to go back and fix all my multiplayer stuff
Hi, if I have a run on server event 'Request Ability' that calls another event 'Start Ability' which is just a normal event, because its called from the 'Request Ability' event ''Start Ability' will always run on the server.. now on my 'Start Ability' event I have a Set Timer by Function Name node with the function name 'End Ability' which will be called after 30 seconds, does the 'End Ability' function get called on the server?
The answer is yes, yes it is
for anybody thats having problems with the steam advance session plugin. update the plugin to 5.5.4 it worked for me
anyone know why character rotation smoothing isnt working? im using control rotation and when looking at a client character as a listen server host, it doesnt seem to interpolate its rotation, is this a bug?
All of my games are dedi server, I lack experience with listen server @quasi tide
But control rotation pitch is sent (as baseaimrotation) as a byte i.e. compressed to uint8, don't recall how yaw gets sent
So I retrieve the basis for aim offset as bSimProxy ? Character->GetBaseAimRotation() : Character->GetControlRotation() and if (bSimProxy) { AimOffSet.Yaw = FMath::FInterpTo... }
I imagine the clients send to listen server in a similar way, so you might want to check bSimProxy || bListenServer, but you should check that first
Also, listen server lacks extrapolation for mesh smoothing which may be contributing
ya if i use linear smoothing by default, it looks consistent all around but kinda janky, using exponential looks smooth from the client view, but not the host
its pretty awful that the solution is just writing our own interp like in your example
funny enough i did come acroos a post you made about this exact issue in ue4 just now
Just be aware that for the listen server itself it will always be exponential
Linear is shit, no one should ever use linear, use exponential
It will affects clients, but yeah, stay on exponential
Lyra promotes linear for rotation because it's garbage tier turn in place system rotates the mesh and exponential smoothing fights the rotate root bone node it relies on
So they make entire net interpolation decisions around something entirely insignificant
And Epic didn't have the foresight to separate it into translation/rotation, and they're so intertwined that doing it yourself is a huge task and prone to edge cases
They agreed with me on UDN that it should be separate but dunno if/when they will fix that
And either way, use exponential for both + don't use epic's TIP
Epic's comment regarding lack of extrapolation on listen server:
After some more discussion, there doesn't seem to be any easy way to support extrapolation on the listen server out of the box, so if you want to try this, you'll need to make some modifications to the character movement component.
You may be able to override ServerAutonomousProxyTick in order to extrapolate movement onto the character's mesh using the current velocity (in the case where IsNetMode(NM_ListenServer) is true). Like previously mentioned, this could work similarly to the path simulated proxies use (SimulateMovement -> MoveSmooth), but rather than actually moving the UpdatedComponent, this would just apply a new offset to the visual mesh.
If you do decide to pursue an approach like this, hopefully this information helps to provide a starting point. It's hard to say if there's more changes that would be needed or if there are any pitfalls to watch out for, as we haven't tried something like this internally. This extrapolation might also have its own visual impacts, as it could introduce small adjustments and rubberbanding on the mesh whenever the client changes velocity. However, this may be more acceptable in your project than the current lag you're seeing.
That comment is for translation but maybe you can do rotation too in the same way
For the aim offset tho, you will likely need to smooth that regardless, coz its a byte
fair enough, thank you for this info, this is all pretty insane though wow
Yeah its insane that they don't have listen server extrapolation out of the box coz the results are shit lol
That's because they don't use Listen Servers...like ever.
I swear, maybe Gears of War 1 used it.
Then Gears 2 switched to dedicated servers
i just dont get why they put in listen server smoothing settings but left listen servers broken
it frustrates me more leaving broken features
im more surprised that it functions differently on a listen server?
ya foresight shouldnt have had any bearing on designing their systems this way
is any of this actually going to be fixed with mover
@grand kestrel where you said here
...+ don't use epic's TIP
"TIP" is an acronym im not familiar with
Turn in place
ah makes more sense, thanks
Use mine instead, its free + not shit
https://github.com/Vaei/TurnInPlace
i just peeped your git and there's some nice stuff there. i noticed the soft collision one, and def will be trying this out
for the downloading zip vs clone, would it be fine to download zip if content that isn't included isn't required ?
Yeah its a git lfs thing, you don't get content with zips
If you don't want the content it doesn't matter
You should probably clone regardless tho lol
also just a generic Q, but is there a method for opening doors client side so you dont have to wait for latent server to open ? i'd "predict" it but the issue would then be if that were to be dropped and repnotify wouldn't fire for other clients. not sure if that's just part of the mp issue w fake predicting things in that manner but curious if there's a method for that
lol yea prob, i just never use git so kinda new to doing it
i also hate using xcode
Generally you want a local predicted interaction system to achieve that
yea that's what i thought, but im just thinking of senerio where server just drops that event for whatever reason
Yeah you would probably need to handle the server rejecting the prediction key
I don't have anything on hand to share tho
Actually maybe I do
I'll ping you later maybe, something came up with work
In your TIP system are you using root motion to orient the player? Is the player 'frozen' while the animation is playing?
@crisp shard In C++ you can FPredictionKey PredictionKey = GetPredictionKeyForNewAction();
Check it with if (PredictionKey.IsValidKey())
And respond to rejection PredictionKey.NewRejectedDelegate().BindUObject(this, &UMyAbilitySystemComponent::OnKeyRejected, SomeData);
See UAbilitySystemComponent::PlayMontage
In BP you can CurrentActivationInfo->ActivationMode and query against Rejection, but that won't let you send any data, such as the server's state... that's bound on client, so you're not getting server state either way, cache the pre-activate state then compare it with the state post-rejection and potentially revert
This should only be used for the interactor, there should be additional replication to control the overall state
It doesn't use root motion, no
It has a lot in the way of root motion handling for the sake of montages that want to override the behaviour, so you can decide what happens at that time
Interesting.. I don't know if mine is set up correctly tbf but I'm calling this Calculate Delta Yaw function on Tick and then I'm just playing montages based on ranges that the player can turn too and then ofc the opposite for the other way too
The problem i have is that the when playing the animation to TIP the player is completely frozen and input does nothing while its playing
I think its because its using Root Motion but it wont orientate correctly without it enabled
Would your system fix this problem?
My system doesn't have that problem
However I have no knowledge of GMC in general
Is yours tied to CMC in any way?
Not really, but it is specifically built for it, it probably won't be easy to support a different system
This is covered in wiki: https://github.com/Vaei/TurnInPlace/wiki/APawn-Support
I also just added a dedicated wiki on montage handling: https://github.com/Vaei/TurnInPlace/wiki/Montage-Handling
void AJumpPadBase::BeginPlay()
{
Super::BeginPlay();
if(HasAuthority())
{
BoxComponent->OnComponentBeginOverlap.AddDynamic(this, &AJumpPadBase::OnObstacleOverlapped);
}
}
void AJumpPadBase::Multicast_LaunchPlayer_Implementation(AActor* OtherActor)
{
if(AMyCharacter* MyCharacter= Cast<AMyCharacter>(OtherActor))
{
MyCharacter->LaunchCharacter(FVector::UpVector * Force, false, true);
}
}
void AJumpPadBase::OnObstacleOverlapped(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if(HasAuthority())
{
Multicast_LaunchPlayer_Implementation(OtherActor);
}
}
This works on server side with no problem, however on client side, it looks like client teleports to end location instead smooth movement.
How could I fix that issue ?
ahh ok very cool, i've never really done that in bp using current activtion info / activation mode or using rejection etc. didn't even know about them to be honest, i suppose there's a bit of a learning i need to do on that
This shouldn't be a Multicast.
Remove all the HasAuthority checks and the Multicast
And then just call the Launch Character in the BeginOverlap function.
got a strange issue with my camera / spring arm
Client 1 seems ok .. but the second client in the viewport camera dont work at all?
does this look correct ?
oops cut off the end
calling the server RPC don't do anything on client, but on server it sets the character speed, what i am doing wrong?
void RequestMove(float Axis){
if(!HasAuthority()){
ActualRequestMove();
}
}
void ActualRequestMoveForward(){
ServerRequestMoveForward();
}
void ServerRequestMove(){
#if UE_SERVER
CharacterSpeed = GenerateRandomSpeed(/*min*/550, /*max*/600);
OnRepCharacterSpeed();
#endif
}
void OnRepCharacterSpeed(){
CharacterMovement->MovementSpeed = CharacterSpeed;
AddForwardMovementInput(1.0f);
}
I've been looking into FFastArraySerializerItem / FFastArraySerializer, i was under the impression that it offers better bandwith for arrays by only replicating the delta, as opposed to the entire thing.
However when I look at FastArrayDeltaSerialize it has the following function comment:
* This method relies more on the INetSerializeCB interface and custom logic and sends all properties
* that aren't marked as SkipRep, regardless of whether or not they've changed.
* This will be less CPU intensive,but require more bandwidth.
The comment suggests it uses more bandwith, could someone clarify this?
all arrays send deltas, just FYI
FastArray persistently tracks per-item deltas even as items are moved around the array, which is where it might improve performance/bandwidth.
on the network you mean ?
Even struct arrays? Really for my purposes Im just looking to replicate an array of struct items but i obviously dont want to replicate the entire thing every time.
I was under the impression that if i dont use FFastArraySerializer it will send the entire thing. But it seems more like a performance thing for large arrays the closer i look. It's a little confusing.
My array wont be very large or anything. So im really wondering if its worth the hassle if in the end i only get a CPU boost and not the bandwith decrease i was looking for.
I think that the benefit of the fast array serializer is that it doesn't check every frame if the array has changed, it just keeps track of dirty items. So it's a CPU save. Not sure why bandwidth usage should increase
Yep TArray/static array still send deltas, they don't send the whole struct/array. Structs send per-property deltas too
TArray deltas work by index, which is why if you remove/swap items from the middle of the array, you can create larger deltas
FastArray deltas work by assigning a persistent ID per-item, so as items move around, you still get per-item deltas.
So for example, we were going to use a ffastarray serializer proxy to replicate gas attributes: It would be similar to have one array of structs with all properties, than having several serializers each with one property?
If the array rarely/never changes size and you aren't moving items, there's little to no benefit using Fast Array unless it's also gigantic for some reason
Or unless you want the extra callbacks/API that fast array provides etc
It's all trade offs
And do you happen to know if Unreal batches RPCs when replicating fast arrays?
So for example if I have a large array (some hundreds up to couple thousands items) and a few items are marked as dirty (let's say, 10 items), will Unreal send 10 rpcs for each item or a single one with the changes?
It never sends RPCs
Ohh, I was under the impression that replication used RPCs under the hood
IIRC the maximum number of changed elements is 2048, but realistically you will hit the bunch size limit way before that most likely
Yeah and we won't have so many items changing at the same time. This attributes change very infrequently, the only one that might change more is unit health, but even then attack speeds are slow (1/2 seconds) and not every unit fights at the same time
obvs the other issue is fast array doesn't preserve order, so if that matters, it's fairly useless
You can sort elements ofc, but you have to be extremely careful about where and when you do said sorting
nope, we'll have persistent unit IDs together with the data so that we can apply the changes regardless of the order
You can fuck things up if you do it mid-serialization
perfect thanks for the tip
You can also use the fast array ReplicationID as your persistent ID too, so you don't need to pay more cost for your own
I do that for inventory for instance
No point adding my own ID when a stable one already exists
ohh cool, I'll check that out. We have unit ids as int16 for other stuff (custom movement replication) but if array already provides that, then it should be ok
Keep in mind you are already paying the cost of a 32-bit ID for each item either way
Since every change needs to identify the item
yeah cheers @chrome bay, that helps clarify things a lot
and last question in case you know, if struct properties are already delta, I could just have a FFastArray with a struct that holds all GAS attributes, and if I send only one attribute change it would only replicate that one, not the whole set?
It would simplify the setup a lot
yeah, but it'd be the same with TArray too
oki thanks a lot. I think given the potential size of the arrays we'll still go for the serializer over regular tarray
FStructA
{
TArray<FStructB>
}
TArray<FStructA> Data;```
^ Even in that case, you'd still send deltas
wow awesome. I don't think we'll have nested arrays, it's mostly floats or some bitmasks for the gameplay tags
Also bear in mind every UPROPERTY incurs it's own 16-bit header too, which is kind of a hidden cost
ok good to know
But TArray will even compress the element indices if it can
perfect
e.g, elements 0-127 will only have a single byte to address their index
that's so convenient
Since it uses SerializeIntPacked
UE replication is pretty smart generaly
If there are savings to be had, Epic usually already found them
yeah for me it's funny because (specially a few years ago) there was a lot of frowning if you attempted to build an RTS in Unreal. And working on it I keep finding ways to optimise the network setup, if you're willing to dig a bit (and have support from experts like you hehe)
UE replication system is pretty flexible once you learn how it goes
imagine having to code all that from scratch
dealing with Ack etc
tbh the biggest issue replication has is that it's very linear and single-threaded, so large games usually end up being bottlenecked by server CPU time more than actual bandwidth
yeah I know
that's why Iris is a thing probs
dealing with an RTS my biggest concern is bandwidth always, but modern internet connections are pretty decent for that
you'd be surprised how much you can get away with
but yeah CPU time on Server always seems to be the bottleneck in the end
unless you're doing something dumb ofc
yeah I was worried about our movement bandwidth setup, did some tests and worked well. Then I played another Unreal game and on the net stats I saw that they used x10 times more bandwidth no problem, was a big relief lol
also since we barely need prediction that's also a huge win, we don't need to deal with desyncs as much
Hello, would someone be able to help me with Replication? I have a vehicle that multiple people can use, when the client hops into the turret of the vehicle and moves it around, it jitters for them but the movement is smooth for the server. When the server enters the turret and moves around, it's fine for the server. I'm not sure where the best place to replicate the movement is. The movement uses an AimOffset that's part of the Vehicle Animation Blueprint and the float for that AimOffset is set in the vehicle blueprint using the clients InputAxisLookRight which is being sent from the Player Character BP to the Vehicle BP. The movement works, it's just jittery for the client when they're in the turret
did you try with reliable on / off?
I got some good little bits of info from this .. also a new at replication stuff
https://www.youtube.com/watch?v=bBK8A-mFH-s&t=123s
In this Unreal Engine 5 blueprints tutorial, MizzoFrizzo will give you a basic introduction to replication and how to make a multiplayer game, including how to set up to test multiplayer in the editor, replicate movement of physics objects, spawn actors on the server and for all clients, replicated variables, using a rep notify variable to make ...
Thank you, turns out my OnClient function wasn't set to reliable. You've saved me from a mind melt xD
I've done a fair amount of replication but some things still elude me
yeah they frown on reliable a little bit because it does cost a bit more bandwidth
but what else can you do 🤷♂️
Exactly, I've seen some many ways on how to do stuff. If there's one thing I've learnt in game dev, it's: There's no wrong way of doing something, just less efficient ways
I'm having another issue with players failing to join the server. They can see it in the browser but when they join, they get an error. But that's another can of worms 😄
to simplyfy life i was wondering if making it only so its clients and dedicated server
then you only need to multicast
and dont have to create extra server logic for every thing
Currently players can create servers from the server browser. I need to investigate how I want players to run servers, whether I do just dedicated servers or allow them to host from game
It wouldn't be too bad If I knew what I was doing but I'm struggling to find any information about it online
yeah thats the thing if you do every single thing then has to be considered for the server hosters logic
but yeah too keep the development pipeline simple it might be a good idea then later you can come in and add the local server option .. still sounds like a chore not mater how you try and phrase it 😅
Yeah, networking is just a pain however it's setup. I've followed countless tutorials, each telling me different things and ended up crawling through game logs to figure out what's going on, only to google the answer and find nothing about it 😂
yeah googles a bit crazy when it comes to unreal .. + the Ai's .. some times i just found a simple solution in rededit 😂
but yeah man having to add SRV_DO_X and MC_DO_X and abruptly mash them into every graph that needs them isnt that pritty
I dont mind doing it for MC_DO_X but perhaps just my own weirdness
Yo mates, I have an issue which I cant seem to figure out
I am using Physics Handle to pick up an actor
When Server picks the actor up and moves it around movement is smooth for the server but laggy/rubberbanding for client,
and when client picks the actor up actor is again laggy/rubberbanding but for server is smooth
I assume the tick function could be at fault because of physics replication or something I just can wrap my head around it
picking and dropping the actor work nicely on both server and client
void AMyCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (PhysicsHandle->GrabbedComponent)
{
FVector CameraLocation = CameraComponent->GetComponentLocation();
FRotator CameraRotation = CameraComponent->GetComponentRotation();
FVector ForwardVector = CameraRotation.Vector();
FVector TargetLocation = CameraLocation + (ForwardVector * 300.f);
// Smooth interpolation for network correction
FVector CurrentLocation = PhysicsHandle->GrabbedComponent->GetComponentLocation();
FVector NewLocation = FMath::VInterpTo(CurrentLocation, TargetLocation, DeltaTime, 10.0f);
if (PhysicsHandle)
{
PhysicsHandle->SetTargetLocationAndRotation(NewLocation, CameraRotation);
}
}
}
Hi all, hopefully a simple question - I am having difficulty with the following. I am trying to print a message ONLY for my local player. I currently get multiple messages when I connect clients. I tried a few variations of checking if my player is the local one but I always get those multiple messages - any ideas? thank you, I am running 2 clients via the PIE
not sure why but it didnt let me see every one before that is every one looking at every one else some how
so yeah just for the character/movement replication you dont need a single thing even for server hosted
is there any way, to make BlueprintAuthorityOnly throw an error or crash, if not called with authority?
surely that is possible
Sure? ^^
but i dont think that is a good idea maybe a ingame error if its not super serious
So it's better trying to figure out for a few hours whats wrong, banging your head against a wall, until you realize it's a BlueprintAuthorityOnly function, that just has the wrong annotation?
like "Server had a fault" we might have to restart the server or something
No I mean I don't want to check it myself if I have authority or not, I want the engine to crash!
oh ok yeah then just assert that shit
But how to do it if I don't know? ^^
C++ litterally has assert
post the output
No I mean how to assert something you don't know is an issue?
then its a unhandled exception isnt it?
I was literrally now wasting hours, trying to figure out whats wrong, since the function, if called in a BP with not authority, will just return null, not calling the function at all.
It is impossible to track that issue down, except if out of luck you realize, it is the BlueprintAuthorityOnly annotation.
well its a exeption .. if theres one available you either handle it or you dont
THERE IS NOT EXCEPTION
thats not how BlueprintAuthorityOnly works
it just does nothing
it just returns null
but if you are not aware of that, you probably wont ever realize it
Because I'm calling the function, and it is not called
I assume you don't understand how BlueprintAuthorityOnly works right?
i just watched a little intro vid so i have a rough idea
but i know how null works in basically any programming language in the known world
so thats why you don't get what I'm saying right now.
If you call a function that has the BlueprintAuthorityOnly annotation, without authority, there so no error nothing, it appears as if the function is called, but you are just getting a null pointer returned.
IT IS EXTREMLY HARD TO TRACK DOWN the function should not have had BlueprintAuthorityOnly in the first place and you get no nothing about that fact, that it was called without authority.
oh i get ya man
so only ever null
i guessing theres probably node similar to to getlasterror or something
There might be a reason it is implemented like this, I just wonder why or there is a setting or something, so in editor/development I can let the editor crash, I feel like there is no reason to let a authority function being called without authority, it's good it is not called but also it's probably an implementation error in 99% I would say, hence it's crazy to me it's not possible to track that down.
or you can just find out more about what went wrong if your in C++ some way
use
ensure(yourPtr);
if you need to crash on nullptr
Until you didn't save something and your editor crashes due to a small oversight.
Ensure is probably fine, but don't throw around checks
Or rather checkfs
Just to be clear now, I'm not asking for how to implement it or whatever, it's more a fundamental issue and I wonder if it is just that bad or if I'm overseeing something.
I'm calling a function GetItems via a BP (that does not have authority):
The functions in C++ though has the BlueprintAuthorityOnly Annotation.
It appears as if everything works, the function is called, no error nothing.
While implementing the function, I did not really think about me maybe wanting to call this without authority.
But now weeks later, I'm calling that function, I assume it is called and I do have an error somewhere, so that the item is not properly replicated:
There is no indication nothing, that au BlueprintAuthorityOnly function was called without Authority.
It is extremly hard to track this down.
There is in theory only one reason to crash and that's when your app can't continue past that point in the code without failing.
Any other case should be an ensure and no test at all fwiw.
Yea I know what you are saying, it's more about, give me something so I know that there was an error, I would have prevered a crash an lose a few hours of work instead of trying to track this down for even more hours.
IsValid should also only be used if it's expected to be invalid in some cases and you want to filter it.
Otherwise, you are introducing silent fails.
And if (ptr) is only correct if you deal with non-UObjects.
yeah ok
Otherwise, please use if (IsValid(Ptr))
ah fair enough
I just want to get some notice in anyway that a BlueprintAuthorityOnly function was called without authority.
A nullpointer check changes nothing in regards to that.
but in essence is what i was illuding to not so unreal specific 😄
As far as I can tell, UE handles the function callspace as "absored" if a client tried to call such an event.
You can add some warning stuff in your own Actors and Components, if you want, but I don't see any logging by default.
Yea I mean probably I have to accept that it is like that, probably now one I'll look for that way faster.
The documentation also says:
This function will only execute from Blueprint code if running on a machine with network authority (a server, dedicated server, or single-player game).
Yea I mean it's probably more performant, you can eliminate a HasAuthority check, but if you are not aware if it, it is extremly hard to track down.
I don't even know if anyone (including Epic) even use those specifiers anymore anyway. I tend to use them to show intent personally. IE - this function is meant to only execute on the authority/client.
Not that it will only do as such.
Yea I would have assumed it like this, I kind of adopted it from Lyra.
So I wouldn't be surprised if it used to work but broke along the way and no one even knows.
It is the second time now, and this time it was really bad, really spent hours now trying to figure it out.
Using advanced sessions, here codes for creating and joining session.
I have print string nodes on beginplays of chars, once a client joins that listen server, the beginplay is triggered again on host and 2 times for the joining client.
and
I get pings of players through game state > player array > get ping in milliseconds. However pings are different at each client and host. Waiting suggestions
/// Header of your ASomeActor
virtual int32 GetFunctionCallspace(UFunction* Function, FFrame* Stack) override;
/// Cpp of your ASomeActor
int32 ASomeActor::GetFunctionCallspace(UFunction* Function, FFrame* Stack)
{
const int32 SuperCallspace = Super::GetFunctionCallspace(Function, Stack);
ensureMsgf(Function->HasAllFunctionFlags(FUNC_BlueprintAuthorityOnly) && GetLocalRole() == ROLE_Authority, TEXT("[%s] Function [%s] was called on non-Authority, but is marked as BlueprintAuthorityOnly"), *GetNameSafe(this), *Function->GetFName()->ToString());
return SuperCallspace;
}
But I would assume, if it is called without authority, that there would at least be a log message 😅
Something like that. Written just here, so no clue about typos, etc.
ensureMsgf is the same as ensure, and should create a breakpoint there right? 😅
@glossy wigeon r we sure that u answered for me?
Ohh this is your implementation right?
In thoery, if you don't want to have a catch all like that, you can also just do:
void ASomeActor::SomeFunction(...)
{
if (!ensureMsgf(GetLocalRole() == ROLE_Authority, TEXT("[%s] Function [%hs] was called on non-Authority, but is marked as BlueprintAuthorityOnly"), *GetNameSafe(this), __FUNCTION__))
{
return;
}
}
Yea, I mean it adds a if check to the function or every function dependent, but it still won't help me to not waste hours, if I'm calling a function with BlueprintAuthorityOnly without authority, that I'm unaware of. :/
No was not answering for you
The PrintStrings are probably correct.
Not sure what your question is.
The Pings are also a bit depending on Framerate fwiw.
Yeah, unless you inherit from that custom actor class I guess.
Probably just have to live with it being like that, but if you ever run into a issue, it's crazy hard to track down, but might be more performant, I would assume.
Is it normal for a client to fire beginplay 2 times when jonining server? It is breaking my system.
Yeah I can imagine.
This is a Client joining a ListenServer, right?
yep
Yeah, then that's totally normal
The Server's Pawn/Character also replicates to the Client and will trigger BeginPlay.
Any Actor that is replicated and relevant will do that.
And of course local ones.
As a no-code alternative - GetFunctionCallspaces() debugs all the results into LogNet VeryVerbose. In case you're trying to debug something like this, you could increase the log verbosity for it, and see whether it absorbs anything
If it breaks stuff, then you coded something with lack of knowledge.
I stand corrected, there is a way to debug this.
This is where this happens.
DEBUG_CALLSPACE is defined like this: #define DEBUG_CALLSPACE(Format, ...) UE_LOG(LogNet, VeryVerbose, Format, __VA_ARGS__);
In other words, you could see it if you would set LogNet to VeryVerbose.
Which means it won't be an error, but it will be visible among all the other spam.
Ohh okk
now I see that probably breaks nothing 🙂 thank u
Ok so I technically can't complain about it not being logged 😅
It will print a casual GetFunctionCallspace Not Net: FunctionName Absorbed :D
Yeah just have to know that you need to set the log level to VeryVerbose
Which you wouldn#t really do unless you suspected this already.
Yea and then just checking the function might be easier ^^
But maybe next time, I may just set the log level to VeryVerbose, might also give other good hints as well.
It's weird that some things require zero effort to replicate and others require the most in-depth and archaic knowledge known to man. Me toggling Replicate Movement: "Hehe, replication is easy" V.S Me, 3 months into figuring out how to replicate anything else: "Why are the scrolls of knowledge so bare on a topic that's so prevalent"
You are just toggling a boolean that use pre-existing system which already replicate the movement.
Toogling that doesn't give you the knowledge to actually replicate your self.
Read the pinned material then start from replicating variable across all machines.
Knowing Local/Remote Roles, Authority, Is Locally Controlled
RPCs
Variable replication
Is necessary to translate communication between server and clients.
Try some simple exercise, like opening / closing a door. Then move forward from there.
Thank you, I was just making a silly joke. I've done a fair amount of replication, it's just some things are a bit more finicky than others. I've read the documentation and a few tutorials but a lot of the time it doesn't cover some of the stuff I'm trying to do so there's a lot of trial and error with some of it. Same thing with creating joinable servers. There's a bunch of tutorials on how to set them up but none on issues or errors you can encounter. Googling the issue has just lead me to other tutorials that end up giving me a different issue.
When I open a level through host, other clients in thew server are being disconnected from server, is it normal?
should I use load level instance instead of open levvel?
the curse
Why are you pinging Cedric?
That's just rude and bad Discord etiquette. He helped you with a different question unrelated to your current one.
To answer your question - they're being disconnected because you are doing a hard travel. You need to do a seamless travel.
thx, sorry for that
you rang 😂
yeah its a bit crazy .. but yeah i hope my approach pays off in a way because if you do this with interfaces you can kind of just say look i dont care about local server... because its disconnected from the rest of the game interface .. i do care about dedicated server mode so every thing that maters is being automatically handled through that interface initially
literally turn local server active into a boolean
How do you have a server and a client disconnect from each other BUT both those players remain in the same level (Their own instance of the level)?
When I destroy session for both the server and client , they are still both connected.
I am using a listen Server, steamonline susbystem and advanced sessions plugins
I have found that the players don't fully "disconnect" until a player changes the level
Hello! I am relatively new to networked multiplayer. I'm playing with a listen server and one client. I have a character that I am deactivating collision for. However, collision is only deactivated on the server, the client still collides with the capsule and then glitches as the server sends the "proper" location for them to stand. How can I best diagnose what's happening? The collision is being deactivated inside an Ability, and I'm setting the collider's collision settings to IgnoreAllDynamic.
By Ability, do you mean GAS?
Yes.
The change is happening on ActivateAbility, which I thought was automatically replicated.
I'm also interested in how I can view the state of an object in client instead of server.
Hey everyone! How to solve an issue of Anim Notify Triggers for both?
Lets assume I play a montage on Server..
It waits for Hit Notify Event.. As you can guess,
Client plays the animation on Server & Client, And i only listen Notify on Server.
So even though Client sends a notify, My server's client instance is also sending notify event, because ITS Happening on server,
So let me summarize.
Client I -> Plays a montage, and receives Notify on Server.
Server -> Also took the notification from the other instance even if he didnt swing, because other instance also swinged, meaning duplicate Notifies.
So if Client Swings, and send notify on the server, I want to happen only on the "clients own instance on the server."
But since In Server Instance, we can see other client swing, it also send a notify for the anim.
Is Locally Controlled wont work, because the Server Instance of a client is not locally controlled ,meaning never sending it.
Animation stuff is entirely local only. It doesn't replicate at all.
If you have notifies in your animations, then they will execute locally on any clients when that notify is triggered when that animation is played back.
If you want, you can use "IsServer" to determine whether or not something is executing on the server.
Hmm. But I play that montage on Server & Client with GAS. So i checked for "Has Authority." for the character, But seems like it keeps printing two times.
It would... You're executing once on the client and once on the server. Authority would only be on the server.
1- Play Montage, on the server & client.
2- On Anim Notify, I check if owner has authority, shouldnt it supposed to print only once? Which means It should only send notify for the server
Where are you putting the print?
Here is how I check on Received Notify.
Even if this Received Notify is called on Both server & client, I want to execute it for only the server.
So that it trace only on the server.
All possibilities:
Server Controlled, Running on Server: IsLocallyControlled = true, IsServer = true (Server seeing its own actor's animation)
Client Controlled, Running on Server: IsLocallyControlled = false, IsServer = true (Server seeing a client's actor's animation)
Client Controlled, Running on Client: IsLocallyControlled = true, IsServer = false (Client seeing its own animation)
Not-Client Controlled, Running on Client: IsLocallyControlled = false, IsServer = false (Client seeing other client actor's animation)
Here, I cant see the reason why Server printed Received Notify 2 times.
you print it before you check if it has authority
Because animation notifies are all run locally on each instance. if you're calling to play a montage in a gameplay ability, that ability will end up calling on both the executing client that started the ability and on the server, which each end up triggering their own separate animnotifies
Yes, thats the problem actually. But still, There should not be second Anim Notify?
Hmm. Can you give an example on that step by step. I feel like I'm totally confused on that.
i dont know about GAS but animation notifies will play on client and server
so in the notify function you need to check if it has authority
Yes, Thats what I expect, But as you see, Server has 2 times printing.
PIE stuff probably
If its called on Server and Client, It should be logged as Client and Server, not 2 times Server?
oh i didnt look at the bottom pictures lol
what does it do in standalone
It prints one time.
Btw, When I start the ability in the server instance, It prints only on the server.
But inside Client, Even if I check Authority, It prints 2 times in the server. And not in the client as expected behaviour of not printing in the client, but printing in server 2 times?! IDK.
This is how I simply activate, I became sure this is called on Server & Client.
But as soon as I get Notify, It prints 2 times in the server, even if I check authority.
Btw, Even if I play as Client with Number of Players "1". It also prints two times.
LMAO.