#multiplayer
1 messages · Page 28 of 1
I have no idea what's that
This is a cropped image
Of code that I have no idea what it does
Ahh yea I found the other in source, it's the entry and exit of the function logs I see
OK yea so HandleSeamlessTravelPlayer is called 3 times when it should be called 4 times
Being fully dependent on logs isn't something you will want to stick to on the long run
So not all 4 players are travelling it seems
Am I able to debug this retroactively though? Like if I don't have a repro and it only happens now and then how could I debug it?
I mean it should happen again ofc for you to be able to debug it
But it seems that my fears are true
There is a bug that occurs in UE5 when seamless traveling that occurs if a client beats the server in loading the next level. There’s a race condition that causes the server to never see that client as having loaded the new level, therefore never transitions it’s player controller over to the new level, and the server and all the clients hang. ...
Oh UE5 related
You are probably being faced by this nasty bug
That makes sense, it happens since we upgraded
Yes exactly! 😆
This the bug that I will be trying to PR because it doesn't seem that anyone have reported it yet
I was having trouble
Well that's good to know at least!
And it's UE5 related. Didn't happen in the UE4 days
The Unreal experience™️
Thanks so much for your help walking me through that
I was fearing a week of being confused and stressed
No worries, you gained some traveling knowledge along the way
Make sure to read that compendium
Oh for sure I will, that looks like a brilliant write up
It's so so nice to find good resources for unreal which is often such a mystery
It's not hard to fix it, as they walk you through fixing it
I see a few people mentioning it seems to be fixed in 5.1, do we think it's worth just going to 5.1 for it?
But it would be much far better if Epic provided their own version of fixing it
No it isn't
Or where do you see that?
In the thread you linked it was an edit
I haven't paid any attention to 5.1 till now though, is it somewhat unstable since it's preview?
Hmm, ok I have missed that, but still not quite sure if that fixes it, as that code somehow already exists (not in this form ofc) in 5.0.3
I will take a look at their github branch
I'd love to know what you find
I think given we're alpha we can probably go 5.1 preview just fine until the proper release since the biggest issue we're facing at the moment is definitely this bug
soo need help i can create instanses/server and i can join with another instance/client to the server but another client can not move and ik its a code issue but i have no idea how to make it work lol im in 5.0.3
Heh, yeah that fixes it xD
Wow, that saved some few precocious hours
What's weird though is that they did it all silently... good one Epic
And fwiw there's another bug that is travel-related that they fixed in 5.1
Oh hell yea
Classic, I searched the preview page and found nothing related to travel and thought that was weird not to mention too haha
That is a very broad problem that you should highly expect not getting help unless you provide more info.
like what info ? idk what to go out from new to this
This question usually goes to the OP. Of course this happened after you did something something that I'm not aware of
welp fuck
well there is no error im pretty sure the clients have no way to move because it cant talk to the server
just idk how to do that
RPC is what...?
Remote Procedure Call
A function that is executed async and is called in one space and executed in another
Listen-server it's called
That's not useful info to me
You can't expect me to magically tell you what's going on with trivial description to your problem
ik...
but i also have slighly no idea what i have to do/What working lol
sorry for being so inexpersience..
I already told you where to look, but you didn't get the time to look there
And you are being determined that they have no errors
well... i cant find anything called rpc or listen-server
i dont even know where to look to find it
ik networking/servering is not magic and its hard and i was the only one that said sure ill dab in to it to try to understand.. its slight pain
Ok this gets you one step closer to finding the problem. The logs can either be found in the Output Log window or in /Saved/Logs
To mitigate this pain you should read this: #multiplayer message
Along with the other useful resources in this channel pins
thanks ill do that tommoro when i have a brain..
welp i think i figured out why it cant move
will remember the /saved/logs
And that is probably being logged because you have a PlayerStart that is encroaching geometry
Make sure you have enough PlayerStarts and they are placed well in the level (nothing encroaches them whatsoever)
wait so it matter how many players starts i have?
If you only have one then most likely all your clients will spawn in that one
So yes it matters
oh well so far that wasnt my least issue
but stange its not in any geometry...
if it doesnt count the original start position of the player..
Oh that's actually a question I have, is there a way to turn off the requirement for player starts? Our logs always have a warning for no player start found but we spawn all our stuff differently anyway.
That was a pure guess, you should be able to breakpoint that log warning and trace your way up @vernal gorge
I have no idea how the warning looks like to answer your question
LogGameMode: FindPlayerStart: PATHS NOT DEFINED or NO PLAYERSTART with positive rating
Though now I'm thinking I should probably go look through the game mode code as maybe there is a flag
Then override RestartPlayer in your GameMode class and make sure FindPlayerStart isn't being called
I'm not sure how your spawning logic works, but if you don't use PlayerStarts then ResartPlayer shouldn't be calling FindPlayerStart
Interesting, I'll take a look into it. Cheers!
This is an example of an overridden RestartPlayer
void AMyGameMode::RestartPlayer(AController* NewPlayer)
{
if (NewPlayer == nullptr || NewPlayer->IsPendingKillPending())
{
return;
}
const AMyPlayerState* PS = NewPlayer->GetPlayerState<AMyPlayerState>();
if(PS && PS->IsReconnecting())
{
RestartPlayerAtTransform(NewPlayer, PS->DisconnectedHeroData.Transform);
}
else
{
AActor* StartSpot = FindPlayerStart(NewPlayer);
// If a start spot wasn't found,
if (StartSpot == nullptr)
{
// Check for a previously assigned spot
if (NewPlayer->StartSpot != nullptr)
{
StartSpot = NewPlayer->StartSpot.Get();
UE_LOG(LogGameMode, Warning, TEXT("RestartPlayer: Player start not found, using last start spot"));
}
}
RestartPlayerAtPlayerStart(NewPlayer, StartSpot);
}
}
For example if the player is reconnecting I restart player at old transform instead of PlayerStart
You can find the full context in the compendium I pointed you to earlier
a quick question, if I create a session with bUseLobbiesIfAvailable set to True, do I need to change it to false when I want to start game? otherwise how does FOnlineSessionSearch know if a session is no longer a lobby?
or do i need to create another session and set bUseLobbiesIfAvailable to false?
but I don't think one user can create more than a single session at a time.
correct me if i'm wrong, but what I understood, bUseLobbiesIfAvailable is a way to know if the game is started, if it is not (still in the lobby) other players can join the session.
oh there is UpdateSession, i think i got my answer
how can save the highest record with some data of players for a multiplayer game in game? does Steam provide a data base for us?
Does GetUniqueNetId not exist on the local player anymore?
some data , like the highest kill , what weapons players achieved ,etc
Help my client successfully joined server but it wont travel through levels
what code should i add?
Traveling in the Editor doesnt work in a multiplayer setup.
Also make sure you have enabled Seamless Travel on the GameMode.
You need to test level transitions in a Standalone build.
where can i enable this?
and i have to build the game and test the game outside the editor right?
yes , travel to level not work in editor, you need package the project and test it there
@mortal tusk or create a .bat file and run it multiple times
Start "" "[PATH]\UE_5.0\Engine\Binaries\Win64\UnrealEditor.exe" "[PATH]\[PROJECT]\[PROJECT].uproject" -game -log
so you don't need to package it every time you make changes
100% no need to package it every time. You can even just right-click the uproject file and press launch game
I'm building a more data-driven game framework for quick load times. Using a lot of soft refs in data tables and such. I had a thought: I could make it so the dedicated server frontloads everything in the game, all hard refs, so I don't have to worry about it attempting to use soft refs or make wasted loading calls, since initial game load times don't matter for a dedicated server.
Is this a dumb way to think about it, or am I onto something?
Depends what it is. The Server doesn't load a lot of stuff, textures, sound, particles etc.
Presumably you wouldn't want to load all assets in your game either - but if you can preload things, you generally should.
i have some pawn swap behaviour, when i change pawn with the client player everything works fine, but when i do with the host i crash when using GetLocalViewingPlayerController()->SetShowMouseCursor(true);
inside the Restart method, can someone help me understand why?
i'm even checking IsLocallyControlled before calling that
Callstack + Log should show why. Best guess, it's not controlled by a player controller
Hello, I have a weird problem. I have a multiplayer game all working correctly, but when I crouch, sprint or jump (effectively when changing speed) the client can see a noticeable jitter. Has anyone encountered a similar problem? May it be a problem with the movement component? I am using ue5 blueprints and am changing movement speed on client, and then on rpc server
post pic of the RPC
If you want higher speeds, usually you also need to set the distance error check thing larger as well. And I would encourage you to simplify your system a little.
You don't really need a crouching system. Character already handles that for you.
And your sprint can be nothing but a replicated float. For instance, if you add a third player to your game right now or even sprint on the listenserver pawn while watching it as the client screen, it's going to break. You're not telling anyone except the player controlling the pawn and the server to increase the speed. You should have a single Reliable RPC with a boolean input that RPCS control intentions to the server. Send True for Pressed, false for released. On True, set a replicated float to 800 speed, in it's RepNotify you do the actual CMC movement speed change there. On Release, you set the same float back to 450.
Once this is all working correctly for three players total, then and only then should you start doing local prediction.
Why wouldn't I want to load all assets in my game on the server? Seems like the last 2 things you said are contradictory.
Is there any downside to doing it this way?
Lets say the game is massive, with thousands of items with static meshes
It depends, you might not need them all straight away - and you need to have enough memory to load them all at once in the first place
You wouldn't load assets for the map you aren't currently in, for instance
Let's say it's one large map. I think I got the answer though - memory limitations on the server
Ty!
Just download more RAM™️
I created my own crouch code, so that it can be a smooth transition and that crouch jumps work
Now the sprint works fine on server and other players see it correctly but its super choppy on client
Should i set the movement component to replicated?
Try to up the NetworkNoSmoothUpdateDistance in the CMC to a maybe 80% of your max speed.
Thank you, it seems to work very well now, but a problem persists that if i spam the sprint button it gets unbelievably laggy for the client
That's because the CMC doesn't really work well with it this way. The logic it runs is probably very often desynced from what you're doing, but this can't be fixed with Blueprints as that code is all C++, hence why Authaer is suggesting to just make the server allow more of the weirdness that comes from it.
Would it work fine if I made it using the movement flags in c++?
You need to extent the CMC to include the speed into its process. There's a video pinned in this channel that goes over it.
I have noticed this too for me, but in my case its only on crouch and only when the player's ping is spiking, it feels like sometimes the CMC's client side prediction for crouching is not being done or maybe its just due to the inconsistent player ping
it works very well for me as long as the ping is consistent, but if you have connection problems and your ping has random spkes (even small ones), I get jitter when spamming crouch
At least extending the CMC is much easier in 5. 😄 Create a subclass, and just change it in the Dropdown in your BP class.
so the value of NetworkNoSmoothUpdateDistance should be close to the running speed? I'm not familiar with this property
and are there docs about it? what does it do specifically?
ok I just checked the source
That's what usually causes the snappy lagging look. If a character runs outside of this distance on a client, and server sends current position. If you're outside of it at that point, it'll just snap you to server location.
seems like theres a comment
ah I see
so I guess a higher value would allow for a more smoother/client authoritative gameplay experience but probably more open to possible cheating
Not so much cheating. Server still holds the real position. But larger values can eventually lead to a larger desync of where client thinks it is versus where server says it is at times.
"Lol wtf, that tank just ran me over. I WASN'T EVEN STANDING THERE"
hmmm I see
HI, i try to implement Interfaces.. so in the end the BP is printing received on Client... but doesnt do the Customevent. IS there something i miss? IT DOESNT PRINT ON SERVER :X
thast how the event is replicated.. if i call it normal without interface it works on client and server...
What is the object you are posting these pictures from?
i figured it out
just now
in the player whos causing it i need to replicate the dang interaction to
thast really inconvinient
its from the BP which i call the action in
but works now
rpc hell
or do i not need to?
guys do you have idea why nothing of this is called when I run game as listen client?
I am calling server function in game mode
I believe game mode is only on the server and cant multicast
this is in third person character BP and server name is called from game mode
Can you show us how the SetServerName is called?
Game Mode is not replicated. Only replicated actors can call Multicast events.
Multicasts have to be called from the server by replicated actors.
its here but actually I added 10 sec delay after post login so I get print after successfull cast and then calling server name event
Maybe its trying to run it before the character exists, i suppose you want it to run as soon as the game starts
in game mode
but I am just calling in game mode event set server names , this function itself exists in player character
and is executed there
I would put it in actor beginplay instead of game mode, then it should work
Ok, I see.
Ok, I think I know. Check the tooltip.
I'm not 100% sure, but I think Server events have to be called from Net Owning Clients. That would explain why this one can't be called like this from the server (Game Mode).
Try setting the Set Server Name event as Not Replicated. It should be called on the server anyway, as it's called from the Game Mode.
i have server custom event is called on server and then another event is called as multicast
i know how to replicate everything this worked for me in ue4
and here I'm ue5 same way not working
is there anyway to have a varible local or am i thinking wrong? im currently using this to get a smooth rotation added but im pretty sure that "Rotation" is making it not work but i need it there to have a smooth because im using it as a position to mesure distance and then lerp
trying to find the problem but cant find only work on server/host
and in the thing
So now I am trying to implement light switch in my UE5 C++ multiplayer test project. It has replicated property SwitchState. For now I wrote code handling it normally (meaning as if it was owned by player).
// Client reacts on State change caused by server here.
UFUNCTION(Category = "Switch")
void OnRep_SwitchState();
// Flips switch.
UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Switch")
void FlipSwitch();
void FlipSwitch_Implementation();
// Response to SwitchState being updated. Called on the server immediately after modification, and on clients in OnRep_SwitchState().
UFUNCTION(BlueprintCallable, Category = "Switch")
void OnSwitchStateUpdate();
...
// True - turned on, false - turned off.
UPROPERTY(ReplicatedUsing = OnRep_SwitchState, BlueprintReadWrite, EditAnywhere, Category = "Data")
bool SwitchState;
Problem here is that light switch actor is not owned by anyone (being part of level and any player could use light), so trying to use it has no effect multiplayer-wise (only works on host and even then it is not replicated to client, and client cannot use it at all). What to do in this kind of situation?
There might be better answers to this question but as to my knowledge, you either need to assign an owner to the switch actor (which would make only the owner interact it over server RPC) or make your players send an RPC to server via something they own (character/controller/state) and update the switch state from there (which would make any player be able to interact with it)
So it kind of depends on what kind of control you want your players to have over the switch
That roundabout way sounds like utter pain in ass. I mean, I would have to implement it for every interactable thing in level.
I don't think that's a roundabout. If you want all your players to be able to change a state in server, then RPC should happen from something they own (I would personally use Controller)
So you need a generic interact RPC on your controller and then do the interaction on the server
yeeeah looks like I will have to do something like that. sigh
Or you can pass the actor that you want to interact on that RPC as well but that might cause security issues
my game is intended to be single or coop, so security is not as problematic as it could be in competitive deathmath
Design of that part (where the checks should be) totally depends on your requirements. But if you want any of the coop players to be able to switch the light then you're required to implement the RPC on one of your owned actors
yes, my requirement is that any player can use switch
so basically I need to call server using RPC from something I own (like player controller) and with information which object is subjected to interaction
I don't know if that's the only solution to your question, but that would be my way to do it
thanks for help
You basically have 2 ways to do it. The first is more accurate, the 2nd is more secure. You can do it in PlayerController or Pawn, I prefer the pawn.
Input -> Choose Actor to interact with -> RPC -> Call Interact on it
or
Input -> RPC -> Choose Actor to Interact with -> Call Interact on it
You can only RPC (Run on Server Event) in an actor that YOU own as client. THat's your pawn, playercontroller, playerstate, or anything that you're set as owner of.
interaction component (that I already have) on player character should qualify
so pretty much I will be doing it on pawn
Do you have components on things you're trying to interact with or an interface?
interface
interaction component traces stuff in front of player and checks if any detected object implements interaction interface
Ya that's a good and common way to do it
Is PostLogin executes after the client has loaded all replicated actors on the level or before?
PostLogin is simply called on the GameMode for a playercontroller after that playercontroller has been created. You can expect that the player controller is ready for play at that point, has a valid UPlayer, etc. Doesn't have anything to do with client replication status.
Yep. That's why Lyra has a system in-place to check if things are properly replicated before handing control over to the user
Guys, is it possible for an actor to do something on BeginPlay depending on which players computer it has just been loaded? Like check if player has something
is it necessary to do the port forwarding to create a multiplayer game, someone help me im a beginner
No, not if you're using an #online-subsystems
Yes, if you're not
whats online subsystem?
Can replicated variables be changed (and replicate successfully) when called from normal UFUNCTION (without Server/Client etc parameters)?
If changed on server, they replicate out.
hmmm
That's kind of the point
Yes. As long as that function is ran on the server.
Oh, hi lag spike. O.o
Didn't see Adriel's reply. 😄
and it is fine if was called on server in different place? My chain is like this:
InteractionComponent.Interact() (called from keyboard input in local player character) -> InteractionComponent.ActuallyInteract() (this is Server RPC, component knows what actor should be interacted with) -> InteracteeActor.TriggerInteraction() (this is interaction interface) -> InteracteeActor.FlipSwitch() (this is where replicated variable - state of light - changes)
currently it works only on host... it does not seem to replicate to client
in fact client can interact with light and it will light up on server but not on client!
What is InteractionComponent on?
Seems fine. You're using an OnRep?
UPROPERTY(ReplicatedUsing = OnRep_SwitchState, BlueprintReadWrite, EditAnywhere, Category = "Data|Net")
bool SwitchState;```
Is Switch an actor or component?
LightSwitch is actor
And the actor itself is replicated?
Make sure to check the instance in the level as well if it was preplaced.
actually I must check that! thanks
Is player controller 0 always the Host pc on a Listen server? If not how can I determine which one is?
PlayerController0 will return the first player controller created on a machine. This is "Usually" the listenserver controller, but you cannot promise it in some cases.
Do you have C++ access?
Yeah
GetWorld()->GetGameInstance()->GetFirstLocalPlayerController()
That will safely get you the actual local controller regardless of creation time differences.
I'll give this a try, thanks!
Hi, I'm having an issue getting a widget to display correctly.. I have a base class (bottom image) which all of my interactable actors are children of, in the base class it has 2 overlaps, a sphere overlap where, when inside, a widget is displayed indicating that something can be interacted with, then a box overlap that when inside, will display the interaction key (E key) widget
There are certain doors in the game that can be locked, so if the player holds the interaction key it'll lock the door, this is where the widget with a padlock should appear indicating that its locked, the issue im having is that the padlock widget doesn't display immediately to all players who are within the box overlap at the time of locking the door, I do however have it set up with my overlaps.. because the padlock should only be visible to players who are within the box overlap of the door, based on the if check in my interaction base BP it'll display the widget fine for all players properly when they enter the box overlap and remove itself when they leave but I need it to display when the player actually locks the door.. right now if you lock the door you have to leave the overlap box and re-enter to see the locked icon
I tried calling the LockedWidgetFadeIn event after locking the door but that made the widget display only to the server player if they were the one to lock the door or if the client player locks the door the widget only displays to the server regardless of if they were in the overlap or not.. I also tried adding it into the IsLocked rep notify but that displays it to all players regardless of if they were in the overlap or not as well
Any ideas on how I can get the padlock icon to appear immediately for players who are within the overlap at the time the door is locked without displaying it to everyone else?
Use your ONRep function, loop through overlapping actors and basically do this whole bit again.
and do what's needed based on what the IsLocked boolean currently is.
Make an UpdateVisualState event or something like that. You should call that anytime any state changes (enter,exit,lock,unlock)
lock and unlock can be repnotified but enter/exit should be local
Thank you!
yo what protocol sub/pub would have the least latency for a c&c program and its clients? (making a game where u can have bot networks, yes i know its sus)
Nice one cheers mate!
how can I get Steam username on unreal engine game?I want use it for lobby menu
does it work? APlayerState::PlayerName
Hey guys. Quick question about PlayerControllers in multiplayer. Is it going to cause any problems if I have a menu player controller which is technically the controller which would be connecting to a session... and then loading the playable map where the default player controller is the gameplay pc?
No. That's pretty normal use case.
Ok. I just wondered if that would cause problems . I'm in the process of setting up player deregistration and I'm doing it from the player controller.
Player Controllers, like all other Actors are destroyed when you hard travel. You are required to hard travel when joining a server. The new map or your project defaults will dictate the next controller spawned for play. You can technically have thousands of different controller classes, one per map if you really cared to. It won't make any difference in that regard.
Ok thanks. I knew that at one point but my memory didn't keep that one. I appreciate the refresher.
I guess by brain hard traveled
It happens. 😄
do IOS devs still need to edit the source code in 4.27 to fix the issue of IOS not being able to connect to dedicated servers?
I dont see a fix but it only points to a thread https://forums.unrealengine.com/t/ios-devices-arm64-and-dedicated-server-connection-issues/388596
Hi guys, our team is working in a multiplayer project with compatibility with Android and iOS devices and we’re found a problem. The issue is related with the ARMV7 / ARM64 architectures, we noticed that is not a new thing as is described next: Issue with IOS Shipping on 4.6.0 - Mobile - Unreal Engine Forums Some iOS Devices Can't connect to ...
and in the thread it said to edit the engine....please help
Can I join a session without level travel?
Thank you both Authaer and Thom, I managed to get it smooth by extending the movement component in c++
I wonder here.. could this ever cause a race condition?
since these variables are replicated, that would mean only the server could set them, which means that theoretically, on a client the first 2 nodes here might execute after the third node
but I might be completely wrong
If they're replicated variables, you shouldn't need to set them with a multicast.
I know, but it just happened to be very convenient to do it here in this very specific case, I don't usually do it
I guess maybe not replicating them might actually somehow fix the race condition tho
and just changing them in multicasts
Sounds like a horrible idea. If it's a replicated actor, then those values should just be set on the server. If the value of them changing is to drive something else, then you should be using OnReps and using the OnRep functions to do whatever it is you need to do with that particular value - this guarantees the server and any clients have the correct state - if you don't, then when the actor drops out and back in of relevancy the changes on the actor may not exist.
Multicasts should only be used for fire and forget kinda things. Like playing sound effects or spawning VFX.
If you're needing to replicate two values and you want to guarantee both of them come through with a single onrep, then you may want to use a structure that contains the value types you need and create a replicated variable of that type on your actor and use it to drive the state..
k
so how is it horrible
I understand it's not the correct way in terms of state sync and might be a pain to manage
...if you don't, then when the actor drops out and back in of relevancy the changes on the actor may not exist.
That's what makes it horrible.
Yea, I suppose I did, as most people are either unaware of it, or don't use it to ensure that only required actors are replicating.
But yes, that is normally correct
if its state the variable needs to be replicated
if its for transient stuff then... sure thing.
how can i make openlevel host from adress and a port?
and somehow i can only get a server to work in the engine and not when i launch the game ps idk if i should be here or in oss
Version: 2.0.3
Last Login: <t:1667054543> • <t:1667054543:R>
Heartbeat: 77ms
Memory Usage: 74.29 MB
—
Source Code • Report a Bug • Contribute
Version: 1.1.1
Last Login: <t:1666721482> • <t:1666721482:R>
Heartbeat: 79ms
Memory Usage: 41.6 MB
—
Source Code • Report a Bug • Contribute
Is it possible to test multiplayer features like joining same session using steam subsytem using only 1 PC with virtual machine or do you need multiple PC's?
Why does the client creates the replicated actors before creating its player controller on server connect? I've tried to use the local player controller on a replicated actor's BeginPlay event but it does crash because it was null so I am assuming it wasn't created yet.
The replication order is not guaranteed. The client will get the data eventually, but it is not guaranteed that PC will be replicated before Pawn. Yes, I know the pain, but the only way to approach this is to keep this in mind and write replication order agnostic system.
Thank you!
Design question, I have a pawn with HP which is replicated to owner only. Upon death, the PC detaches from the pawn and starts spectating.
But that means, the client usually doesn't get the HP update that said the HP updated to 0. So the death plays on client, but the HP is greater than 0.
One option was set the HP to 0 upon bIsDead = true (which replicates to everyone), but then I cannot check if the died character is the one I was just controlling (without any weird pawn caching on the PC).
I ended up with client call on PC ControlledPawnDied(APawn* DeadPawn); which then sets the hp to 0, but it feels like a weird workaround.
Any tips?
EZ mode is to set the pawns owner back to the controller after un-possessing it.
By default the possession logic also changes the owner, you can just overrule it
Does someone know why my Dedicated Server executable still tries to make a local player while loading server map?
A ULocalPlayer or a PlayerController?
Yeah, that makes sense! Thanks
Say Login failed: error
Player Controller so
the engine gave this error when I try to host the server in editor TravelFailure: ServerTravelFailure, Reason for Failure: ''. Shutting down PIE.
I saw some people can host the server in editor
why I can not ?
I put the subsystem on Null for now
Let's say I would like to call a client or a server function from my PlayerController on an Actor Component. Would it make any difference if I would call the server function directly or call a regular function which in turn calls the serverfunction? Is there a best practice here or coding standard?
You can't call it on the component unless that component is in some way owned by the player.
So a component of their character would suffice.
Great, it's a component on their PC
If that isn't the case, then an "InteractWith" function taking a UObject, Actor or Component as a parameter would be the way to go, which you can put in your player controller
Then it should work.
I would still test to make sure - and not from a listen server.
Listen server Server calls will always trigger.
(from the server)
Daekesh, would you mind clearify this for me. The InteractWith function you're talking about, I do not really follow what you mean it would do for me? From my PC I want to do a couple of server and client calls on my actor component attached to my playercontroller, thinking of it I do not see where this function fits in.
These here are the functions I'm talking about. Right now I'm calling the Server/Client function directly from the PC insteed of the other way around where I would call "ToggleBuildMode" which in turn calls the Client function.
Show your header too
You shouldn't need to do anything with the player controller as long as that component is owned by the player and replicated.
Actually only have the PC to GetPawn()
The PC counts as being owned by the player too if it's on the PC.
On the player's pawn is fine too.
Or their player state.
It's all good.
Marking a function called from a client as UFUNCTION(Server) should mean it only gets executed on the server, right? For some reason when I call it I get a null pointer dereference on the client, presumably because it's trying to dereference the Game Session which only exists on the server, which I don't understand because I thought the function was only going to run on the server anyway.
[2022.11.02-19.48.54:783][734]LogWindows: Error: === Critical error: ===
[2022.11.02-19.48.54:783][734]LogWindows: Error:
[2022.11.02-19.48.54:783][734]LogWindows: Error: Fatal error!
[2022.11.02-19.48.54:783][734]LogWindows: Error:
[2022.11.02-19.48.54:783][734]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000428
[2022.11.02-19.48.54:783][734]LogWindows: Error:
[2022.11.02-19.48.54:783][734]LogWindows: Error: [Callstack] 0x00007ffc90b8bf81 UnrealEditor-MyGame-Win64-DebugGame.dll!ResolveObjectHandleNoRead() [E:\ArchViz\Projets\MyGameAB\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectHandle.h:300]
[2022.11.02-19.48.54:783][734]LogWindows: Error: [Callstack] 0x00007ffc90b9a28d UnrealEditor-MyGame-Win64-DebugGame.dll!UMyGameGISubsystem::KickPlayer_Implementation() [E:\ArchViz\Projets\MyGameAB\MyGame\Source\MyGame\MyGameGISubsystem.cpp:118]
.h
UFUNCTION(Server, Reliable)
void KickPlayer(int Index);
.cpp
void UMyGameGISubsystem::KickPlayer_Implementation(int Index)
{
if (auto* Controller = GetWorld()->GetGameState()->PlayerArray[Index]->GetPlayerController())
{
FText KickReason = FText::FromString(TEXT("Test"));
// Null pointer dereference here:
Cast<AMyGameGameSession>(GetWorld()->GetAuthGameMode()->GameSession)->KickPlayer(Controller, KickReason);
}
}
Yeah to my knowledge that shouldn't run on client at all. Are you 100% sure it's on client and/or GameSession isn't null on server?
The crash is occurring on the client, the server is running just fine.
Maybe it's because I was trying in the editor?
Let me try in a packaged game.
(To be clear, what I'm trying to do is have a client on a dedicated server who has an admin role and can kick other players, so I'm calling this function that is in a Game Instance Subsystem.)
RPC call on the replicated actor don't they? Game Instances aren't replicated, so I imagine their subsystems won't be either.
Ah, I was wondering about what exactly was meant by the ownership stuff. So how would I go about solving this?
Game State is replicated, so you could have the RPC on the Game State and have the GIS call the RPC on your game state nvm not for client->server
I think, I haven't touched multiplayer in quite a while 😅
Just don't try to RPC from client to server on the Game State
Why not?
Beecause it's not owned by the client.
Player contorller, state and character/pawn is what you can use for client to server rpcs
Game state is good for broadcasting things to all clients. That's about it.
But a client doesn't have direct access to another client's pawn, right?
Because that's what I'd like to do, have a client kick another client.
But presumably they can't directly, since they don't own them.
So if I can't call an RPC in the Game State, where can I?
Line 1 is what I'm trying to do. Sorry, this multiplayer stuff is all new to me. 😅
Won't GetPlayerController() return null on a remote client?
That's what the comment says, so I thought that was the case.
Ah okay, but I'm worried about this bit:
If the RPC is being called from client to be executed on the server, the client must own the Actor that the RPC is being called on.
Something like
// AYourController
UFUNCTION(Server)
void KickPlayer_Server();
AYourController::SomeFunctionRunningOnOwningClient() {
KickPlayer_Server();
}
AYourController::KickPlayer_Server() {
// do your code for kicking the player, since you're now on server
// GameGISubsystem->KickPlayer() maybe
}
Since in this case the client doesn't own the PC that's being kicked, right?
I get it now.
Thank you both! And Dakaesh.
Just to check, in the UFUNCTION(Server) RPC that I've put in my PC class, the admin can directly ask the server's Game Session for the kick like this, right?
if (auto* Controller = GetWorld()->GetGameState()->PlayerArray[Index]->GetPlayerController())
{
FText KickReason = FText::FromString(TEXT("Test"));
Cast<AMyGameGameSession>(GetWorld()->GetAuthGameMode()->GameSession)->KickPlayer(Controller, KickReason);
}
(Sorry for asking again but I just want to be sure.)
@dapper obsidian how is your request saying which player you want to kick?
You don't have their player controller. PlayerState?
The admin picks from a list of players generated from the Game State's Player Array.
Yeah so those are player States I'm pretty sure.
That looks good to me since you are running on the server at that point.
Thank you. If this works I owe you all one.
whats the point of this check if (GetLocalRole() == ROLE_Authority) if youre doing it within an RPC anyway?
wont a method tagged server always run on the server anyway?
It's pointless. Clients calling server RPCs will never run locally. Not like a Multicast. It just won't run if ran on a non owned actor.
@whole grove @sinful marlin @latent heart Thank you so much, got the kicking mechanism working. Now just have to sort out the fact that, as it turns out, the PlayerArray indices aren't necessarily the same on the server and the clients because currently I have my clients kicking themselves by accident. 😅 But I see the Player State has GetUniqueId() so that's fine.
I have a simple blueprint method, which spawns an actor. In single-player, I don't have any issues, but with a dedicated server and two clients, multiple actors are spawned at the same time. It seems like sometimes only one spawns, sometimes two spawn, and it slowly increases over time.
Here's the method.
Is a Switch Has Authority needed so that only the server calls the Spawn Actor node?
Why are you mixing child actor component and manually spawned actors?
What's the gameplay mechanic you're trying to do here
The child actor is a weird necessity because of how physics constraints work. I don't fully understand it; it's copied from the VRE Example Project
No it isn't. Child actor components are gross and break easily
If it works then no problem, but there's probably a way more elegant approach to whatever you're trying to do
The door is "repaired" after holding it in place in the frame it was originally in. I couldn't easily recreate the broken physics constraint, so I just decided to destroy the door and create a new door.
There's a "Break Constraint" method, but no easy way to recreate it
Explain more. Is this a broken actor repair system or what
The door has a TakeDamage method that accepts a direction vector (the direction of the attack). If the door has been attacked three times, the constraint is broken, physics simulated, etc., then an impulse is added.
I want players to be able to repair the door by just holding it arbitrarily close to its original position and orientation inside the door frame for a couple of seconds.
Is door + frame one actor or two?
Two actors, but the frame is the ChildActor
ya that's pretty gross
Yeah, I don't think the blueprint was meant to be built off of, just a quick example
I'd do it in one of 3 ways
DoorFrame which spawns Door at runtime and attaches it
or
DoorFrame with childactorcomponent with a Door
or
DoorActor which contains both components (I'd do this one)
Is net.UseAdaptiveNetUpdateFrequency still disabled by default? Says so in the documentation
Pretty sure it is, it has big issues if you don't ever plan to force net updates
Hi, I'm looking for a bit of advice with a project I'm trying to create. I've been following a few Steam and Advanced Sessions tutorials to connect between two devices. The two sessions can connect but when the next scene is loaded the two sessions only show the client without the other player being replicated. Is there anything glaring that might be causing that?
After adding item to FFastArraySerializer , and also making itemDirty in the array, do i have to do something else so that it also goes to server and then replicated to clients.
or adding and Updating needs to happen on Server ?
The server has auth on your replicated properties, so you need to ask the server to add smth by a server RPC, if your local player is the Owning client for the actor, otherwise the server has to initiate the addition.
so all the additions needs to happen on server. My case is i have this array which has MorphTarget data, and these values will change alot, so do i have to send each individual item for array as separate RPC or i can add everything to Array, then either send the whole Array or ask Server to do get the latest from client and then Replicate, if it is possible.
for some reason i thought makeItemDirty will do that automatically on client.
but it seems like it has done on server, but sending RPC for each Morph Value seems problematic to me ?
What do you say @marble gazelle
As said, replication goes from Server to Client.
You can create RPCs that that have an Array as parameter.
But maybe ask your self: do you really need to replicate all this data, or can it be calculated deterministically based on a given context?
the problem is this data is coming from FaceTracking, i dont see any other way to do it on simulated Proxies, by just sending the whole data.
do you see anyother way ?
@marble gazelle
well, reduce the data to the minimum you need to reconstruct it on other peers and send it per RPC, property replication is not reliable and can miss some frames. but it will have some impact on your bandwidth, so you should monitor it \o/
If I use a Client RPC to spawn an actor, is it the client that owns that actor?
Actor will be purely client-side
(won't exist anywhere else)
When attacking, zombie can play either right or left hand swing. Is using an atomic ustruct the correct approach to ensure I transmit both bIsAttacking and bAttackingLeftHand together? (I could do bitwise ops on uint8, but ustruct seems a bit cleaner). Just wanted to check if this is the best approach
And OnRep I play the correct anim montage on clients
I don't know if the atomic keyword affects net serialization, worth testing.. can't see anything in code that suggests it does
Why not make it an enum or something instead?
Seems there is a bit of redundancy having two properties
Make it a bit set.
Add enum for all possible bools, then it's uint |= (1 << EnumValue); to set, uint &= (0 << EnumValue); to clear, uint & (1 << EnumValue) to test
Perfectly efficient, no replication shenanigans
Unreal might even have a bitset type
I am pretty sure I will need to package a float and ptr in the future, so I wanted to avoid enum. I was told atomic ensures the replication would never be separated into multiple packets and wanted to ensure I was using it correctly on this example
(It does, it's FBitSet)
Thanks @bitter oriole for the suggestion
I have this issue where I UWorld::ServerTravel to some map url with ?listen param, and everything works fine in editor, but in standalone and shipping something weird happens.
The game moves to destined map for split second, and then moves back to my lobby map (map from which I server travelled to new map)
Does that sound familiar? I'm using ue5
did you actually package the map in your build?
That might be it, but I'm not quite sure how to do that. Last time I tried adding maps in project settings (different issue) it would not work and someone mentioned it might be broken. Any other way to make sure the map is properly packaged?
edit: okay i think i got it, I found this in log
[2022.11.03-10.10.21:785][566]LogNet: Connection failed; returning to Entry
Just repinging this
What do you mean by > the next scene is loaded?
When a session is created, I load a level for the host. When a player joins, they do the same.
I've got seamless travel enabled and I've got the host opening the level like so
Still got Unity terms in my head haha
In my component I have a reference to another component which I intend to spawn. When and if I need to destroy and nullptr that value I guess that should be done on the server. I know the destroy propagates but setting the reference to nullptr do I need to replicate that down to clients somehow?
You will find the section: Travelling in Multiplayer helpful
Thanks, I'll take a look
No. Just make sure to mark that pointer as UPROPERTY and you don't even need to explicitly set it to nullptr anywhere anymore
Does any one have any resources/tutorial links/videos for working with or using an AI Character and Controller using an empty remote follow character. I've got the setup like this for use in a multiplayer click to move scenario but curious as to how to do damage across the characters and displaying a healthbar widget
I don't have any of them but I have a suggestion to do it yourself
You can use this channel's search tool with smart keywords. You might find something useful
you don't damage controllers, you damage Pawns typically
and putting a widget component on PlayerState, then attaching the PS to currently controlled Pawn works well
How do I switch level for all players (that are on the same session)
ServerTravel
like that?
Hello, i'm trying to get started with multiplayer, i made a simple RPC with a SimpleMoveToLocation, and it lags ONLY in the client who is doing the action as show in the video, the other clients see a smooth movement, anyone knows why? code for reference: https://pastebin.com/wRFrMknP. My actor has the replication and movement replication flag set to true.
Hey folks - I've been hearing it's best practices for multiplayer to put commands for controlled characters in PlayerControllers and responses to those commands in the controlled CharacterBlueprints. Am I approaching it correctly with this diagram?
I have a paranoia about casts being too expensive (just from reading stuff online), but if this is best practices perhaps that feeling is unfounded
Casts are very, very cheap.
I believe, with characters, you use the Add Movement Input node when you press keys.
Whatever that is found on, use it.
thank you @latent heart ❤️ . I'll do all my output from my character controller then 🙂
Instead of calling a ServerRPC to make the server instantiate an object and replicate it to all clients, is it possible to have one Client do NewObject<UMyObject>(..) and then later pass it on and transferring it to the server, which will then replicate it? If so, how, and when is this recommended?
Video for reference
It doesn't really matter where you put the inputs, but generally speaking, inputs for a character should probably be in the character itself, just in case you have a variety of different input schemes based upon what character is being controlled, and it saves you from having to do any casting or using an interface. All input commands are routed from the playercontroller to their controlled pawn automatically. So that being said, you're usually better to put generic inputs in the player controller, think things like menu inputs or inputs that would be used the same regardless of controlled character, and any character specific inputs (movement, attacks, etc.) in the character.
Further to this, movement may be something that all your controlled characters use similarly, so then you would probably have a parent class that has the movement code and then child classes for specific characters that may have different actions based upon the input used.
I haven't tried either implementation, but I was considering this because I'm concerned that network delay may make the implementation feel sluggish. It's UI-related, clicking a place on a 2D map to create a marker, and I'd like for that marker to appear immediately locally (sharing with everyone is secondary). But I guess I could make a "shadow marker" locally while waiting for the server-created marker.. But that could also create a brain injury for me if I do something fancy with it locally before receiving the server-owned marker.. oyh
Is there some limiter for markers or can they just be put anywhere?
Fantastic reply! Additionally, I'm using GAS and Enhanced Input if that makes a difference here. For the sake of replication, should I just make the input to the playercontroller more generic like this first image, or are you saying I should go straight to this second image?
What I would do, I wouldn't even use an object. Unless you're literally creating a physical object in the world.
Second. One reason I can think of using the first is if you were attempting to control multiple characters since your playercontroller can only possess one character at a time.
Have an array of markers for each player on the player state. When you create a marker for the player, just add a location to that array. Send an RPC to the server with the new location and then either wait for it to replicate the array to everyone or just broadcast the new location.
To be honest, I'm not familiar with Enhanced Input, but I imagine it would work similarly.
Thanks - I'll go with the second one then
That's a clever idea, but I was planning on having a few properties along with the marker, in addition to the location. Name, color, icon, creation time. Perhaps grouping them by "type", or some sort of filtering system etc.
And it's very practical to have it as a UObject because I can bind these properties directly in the Widgets that show them.
And no, there's no limitation. It's completely client-authoritative on that part.
But I haven't tried the "normal approach" by creating it via a ServerRPC, maybe my fear of network delay isn't justified.
So have an array of structs with that data and send the struct to the server.
You can bind them to functions in your widget which access the player state and then an individual index on the array there
Maybe.. The initial plan was structs, because it makes more sense for normal markers and for networking. But I figured some markers need some active logic as well, such as dynamic markers that are continuously updating, like for a vehicle etc. But those markers would never be stored on server as "marker data", they're just generated locally based on already-server-owned actors that are replicated (or at least have location-info replicated). Since these "dynamic" markers are generated as UObjects, I made the "static markers" UObjects as well, for reusability of widget-code.. But yeah maybe I should make a struct "DTO" for server-owned static markers, and just convert them to locally instantiated map-owned UObjects to put in my map-system.
But then I guess it would be slightly harder to automatically update properties based on the structs' replication after the locally created UObject-version is currently showing.
I guess I'll sleep on it.
@static flareWhat's the use case? You want markers on a map for..... what
like 3d markers in world for navigation WoW or GTA style?
So, lets say I have two values that needs to be replicated at the same time, triggering the same repnotify. How would one go about doing this? As I understand it after some research a USTRUCT isn't the answer since only changes are being sent over and if the values aren't set within the same frame it won't be synced.
Why not set them within the same frame?
You want to pause replication until triggered later?
How can I make sure they get set in the same frame? Might be a stupid question, I'm new to game dev so bare with me.
What's the use case? What are you trying to do here
It's to store location and rotation for an actor i'll be moving. I want to move the actor locally, serverRPC the values which in turn repnotify other clients.
So the USTRUCT is just a container for a location and a rotation.
Why not just use a transform
it's a struct that already has location and rotation
Either RPC a location and rotation or a transform and you're golden
I did not know transforms existed. The more you learn. Can I break out location and rotation from a Transform? (ATransform.Location/Rotation) so I can use it calling SetActorLocationAndRotation().
Very much appreciated!
SetActorTransform works too
Transform is just Location, Rotation, Scale
Every scene component has one
and implicitly every? actor. Some weird actors don't really use them but that's not an issue here.
This helped a bunch, made my day, thanks!
I'm having some trouble with this workaround. I have two different player controller sub classes for before and after the travel. Should I need this workaround in the one before, after or both? I tried it in the one after because I was on autopilot and it did nothing so then I tried it in the base class for both of them which I could see ran in standalone but it looked like it got stuck on something which may or may not be a real problem when cooked since standalone travel is weird anyway.
I'm testing before only now but just to double check should this only be on the "before travel" player controller?
Oh I think it's because of the transition map...
We don't use a transition map so that's probably breaking the "fix"
Also @fathom aspen It seems like this link on the word transition map is broken
Oh unless I'm hitting the github not logged in thing..
I had the biggest revelation...
I spent MONTHS trying to solve jitter in my multiplayer game thinking it was down to ping fiddling endlessly with character movement replication variables, rescaling levels
Turns out it is mostly to do with camera lag not replicating well
Idk how long this will take to fix but I feel I made huge progress now at least
I have pretty annoying issues with rubber banding (Character Movement Component, moving with AddMovementInput), testing with 2 clients, where GOOD player has good internet connection, and strong hardware, meanwhile second BAD player has poor wifi connection, and weak hardware.
If GOOD player is hosting a game, BAD player that connects to it almost cannot even move, he just gets teleported back to his position or he just starts sliding arround even after he doesn't hold any key.
If BAD player is hosting a game, he can move without any issues, GOOD player that connects to the game has very little rubber banding issues.
I don't fully understand why when BAD player is a client, he can't move, but as soon as he is the server everything is fine (I thought that the whole replication would just be broken)
I've been stuck on this for a very long time and I have no idea how to fix it.. In the terms of network profiling my average bandwith is 3Kb/s which should be more than fine.
Show your code path from inputs to AddMovementInput
I pretty much kept it default from ThirdPersonGame template
guys can I ask if I am using dedicated server and I am making changes on client like new replicated values etc do I need again package dedicated server? to see changes and if its working or not?
Hey guys! I have a question, basically i'm trying to randomly select an actor and spawn it but when I run it on the server its a different one for each user. I've been trying to figure out how to replicate it right but havent got any luck, any help will be great (Blueprints)
Show your code
Right now it's kind of everywhere but here is my logic
Game Start >>> Select Random Class from Array >>> Spawn actor from class (random from array)
I can get it to you in a minute just gotta redo everything
That's server only right?
I'm having a hard time figuring that out
Probably isn't. Show the code when you can.
this is what i'm working on
I can revert to what I had when i asked the question
Ok, here we go
This is what I'm wondering how to replicate without it being different on each client
Is there a way for a blueprint to be on the server by default? So what ever it does automatically replicates to the clients
That random will be different on different machines
either replicate the actor itself OR some seed to spawn them the same everywhere
probbaly just replicate the actor itself
How would I do that? And do you mean replicate the random value selected?
Is anyone able to explain how this workaround fixes this bug? https://forums.unrealengine.com/t/ue5-seamless-travel-bug-found-we-found-the-cause-and-also-have-a-workaround/583652/16
I need to edit the code to fit my scenario since I don't use an explicit transition map but I don't understand exactly the condition I want to be setting the CompletedSeamlessTravelCount under.
Just trying to still figure that out, is there any quick way of doing it?
Just spawn the actor on SERVER ONLY
have the actor be replicated
read up on replication
If you intend that "everyone else sees what the server sees" then you usually just wanna spawn a replicated actor on server
Should I just spawn the actor with the grid spawner blueprint through the server only?
Read the compendium
You need to replicate the data you want to be the same everywhere too
I'm just not understanding how I do that
Would something like this be good?
Probably. Best you know is if you breakpoint and check classes.
Even if you don't, a default one will be created for you
Like it's mentioned here: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Travelling/#:~:text=To enable seamless travel%2C you,created for the transition map.
This is the link until I fix it ^
Right, but what if it the PlayerState wasn't owned by the time you RPCed. IIRC the first safe point is APlayerState::PostNetInit
Alright, i'm having an issue now where my buildings get generated on my server but not on each client even though the spawner replicated multicast
You don't want to multicast to spawn them
You probably just want to tick replicates in your building
And then spawn on server and it'll replicate to client
I'm having trouble understanding what's happening because the bug is hard to replicate. I don't know how to set it up in order to breakpoint it.
Could you help me understand why the fix works exactly? I guess I don't understand what the problem is that well.
It seems like I need to find a condition when I need to set the seamlesstravel count to match the completedTravelCount
But at the moment my transition map name is just empty
So the condition in the workaround is just always true which seems not right
Like this?
And yea I understand this is because it will be the automatically created one. I found my way to that transition map link by copying it out of the URL. Just wanted to give you a heads up in case you weren't aware it was fixed.
Maybe, did you tick replicates in the building and is it working? Otherwise, not sure.
I deleted the method being called where it was running on the client and still havent had any luck
You don't have to able to replicate it to be able to breakpoint functions.
The bug and workaround are explained well in that forum thread
You're still executing on all
read up on replicated actors
He means within the building actors themselves - you need to mark them as replicated if you're looking to spawn them on the server and have a replicated copy appear on clients.
Thank you so fucking much
I didn't think about enabling replicates on the building actor itself
I just didnt understand
Yeah what you had above is marking the variable of "Building" which contains an "Actor Class" as replicated.
So if you changed the variable, then the variable itself would replicate to clients so they'd have the new value.
Thank you guys for the help, I'll definitely be back but ima take a further look into the documents to see what other stuff I need replicated to be fixed.
Would something like a projectile need to be ticked replicated as well or is it a whole different story
If the intention is to have it spawned on the server and then that actor appears on clients, then yes, you'd mark it as replicated.
Ohhhhhh, okay i understand
I read it just now really trying to understand and think I have a better grasp on it. Given WorldPackageName inside ServerNotifyLoadedWorld seems to be the new level that was travelled to, is there a variable that stores the level that was travelled from at all?
I am having an issue with FastTArray
LogNetFastTArray: Warning: OldMap size (0) does not match item count (63)
I think i know the problem, so i add the items to Array on Client Side and also make array dirty on client side, I think i have to do this on Server Side. Let me know if this is correct or there is something else i am missing.
Once i have created the array on client side, I RPC the whole array to Server, where it just copies it to the Replicated Property, without calling anything dirty.
So In order to add or change on the fast array, Do i have to call MarkItemDirty on individual index, which mean each RPC for one Update or I can send the whole array at once ?
You do need to do this on the server. You need to mark the Array dirty when you remove an index from the array. You mark the item dirty after adding or changing the item.
so I will have to send RPC to change or add Single item ?
A FastArray acts identical to any other replicated property.
It simply replicates slightly different, and gives per item callbacks.
The thing is i have to send Facial Tracked Information from a device to other clients, and It gives me 54 morphs, as they are constantly changing, so they are pretty consistent.
and I just wanted to see how can i send them without creating an overhead on my bandwidth.
so should I rpc the whole array or should i RPC individual Item.. In the individual case, it is going to be lots of RPC's ?
@kindred widget
How heavy is each item?
just a float and an index
Hard to say. That's not a ton of data in a broad scope. Depends on how compact this needs to be, if it's going to be part of a much larger game with a ton of other networking stuff. If not it probably doesn't really need optimized.
Could also cut them down by 50 to 75 percent too. Compressing them to uint8 or uint16. Indexes too if they're never over 255
so i should not do FastArray, just structs with NetSerialize ?
Do you need the per item callback?
I am not sure what that is ? yet.
You mean PostReplicatedAdd , PostReplicatedChange ?
Yeah.
yeah i dont need those,
Probably not worth it then. A normal replicated TArray can sometimes be better if you don't need those callbacks.
okay i will try that then, thanks, I just wanted to compare the bandwidth Difference.
I will do it some other time then.
If you're going to have constant array sizes at the 54 size. Definitely a normal TArray.
100% constant.
I am using UE5.0.3 and I am facing the well known problem of poor movement replication in vehicles controlled by clients. Server is fine but clients are not replicated well. Has anybody found any work around ? Does 5.1 solve this ? I did not see it mentioned in the fixed section, but might have missed it.
It's not a problem, AFAIK the engine just doesn't have network vehicles
There are various plugins on the marketplace that try to provide them
There are two competing approaches for that, neither perfect (server-authoritative vs client)
As an update to this, turns out internet connection wasn't the issue, but low FPS is. When joined client has poor FPS, because of rubber banding he isn't able to move. But unfortunately I'm still not sure how I should go about fixing this issue.
Yeah I was also thinking of using "smooth sync" as an alternative, by disabling UE's movement replication and have the plugin handle it.
You can try to up your CMC's NetworkNoSmoothUpdateDistance some. Usually it should be fine around 80%ish of your max move speed. Maybe try 90%. No real way to fully fix that without just better FPS.
Can also up the smooth update distance as well to like 50%.
Been fighting with my build system implementation for three days now and decided to recreate everything from the ground up. I think I have the right approach, does this make sense?
1.) Server RPC Spawn build pieace
2.) If LocallyControlled, move build piece setting a Transform variable (ReplicatedUsing and skip owner).
3.) ServerRPC set transform call own Repnotify
4.) In the OnRep_Transform move actor for server and other clients.
Feels like there is one last puzzle pieace before it all "clicks" for me.
What's the easiest way to see if a function is natively called server- or client-side? Like AGameMode::PostLogin. I assume it's on server, but how can I tell without having to test it? It has a comment in the header saying
Called after a successful login. This is the first place it is safe to call replicated functions on the PlayerController.
You can't tell really, just need general knowledge of the engine. Since it's AGameMode however, it'll only ever be Server or Standalone
are actors suppose to disappear for clients when a player leaves the cull distance? Because that doesn't seem to be happening 🤔
this is the network settings
https://gyazo.com/384e8d7b6734752b1ce2bc449a1d064c
I'm spawning these actors at runtime
they don't seem to disappear for me wut
Yeah then eventually they should despawn, usually takes a few seconds
If there's a Has Authority switch right at the beginning of something, will it compile to also exist in the client as well vs a function that's set to only run on the server?
Hey guys, I've scratching my head this for a while and I still cant a solution for this. Basically, I'm making a invisibility ability where the player will be visible to teammate but but invisible to enemies. I have a bool variable to control that but how would I only set it to true on the enemies client but not teammate client?
yes
The only way to exclude code from a client build is with the various , preprocessor macros, e.g. UE_SERVER etc.
Yeah, I assumed so cause for some games authority doesn't come from a dedicated server
Also HasAuthority() can still be true client-side anyway
Clients have authority over non-replicated actors, for instance.
Or if a replicated actor is "torn off"
So if you have some sort of top-secret server code for like security or whatever it should be put in an exclusively server function?
Yeah, and wrap that code with if UE_SERVER or somesuch
And of course, make sure you never ship a dedicated server build by accident
Yeah lol
Not much you can do about it if you want listen server support ofc, or any kind of offline play usually
Depending on what it is
How should I check if a PlayerState is my own? I have an OnRep that is triggered on all clients, and if it's my own PlayerState I'd like to do some extra stuff. Just check if this == World->FirstPlayerController->PlayerState, or is there some better way with authority/role etc?
Cast the owner to a player controller and check if it's locally controlled
Is casting the owner not enough?
Might be, depends if it's also meant to run on Server, or split-screen etc.
I'd rather be safe though
Server shouldn't receive OnRep function, isn't that right? That's why I asked if casting isn't enough itself. I didn't know about the split screen part though, are splitscreen games also considered as online/uses using replication?
Smart!
True, I should add that this is supporting ListenServer, and that I therefore call the OnRep manually from there..
I'm looking over APlayerController::IsLocalController, but it doesn't explicitly check for ENetMode for ListenServer, so I'm not sure what it actually would return for me in that case.. But from the name I assume it should be correct..?
A controller being local doesn't depend on the netmode really
it means "controlled by the local instance"
Hi, i'm creating a TCP Client to connect to my TCP Server.
I want to create a class to connect and handle data of the TCP, so i create actor for that. But this actor is destoy on level change... so.... what is the best way to do this?
Guys I have this problem with names when I print names of logged users both will see same name even I am replicating it. here is widget added on player character and in widget I am just getting Name variable from third person character i dont understand why its printing same name
Also I have this widget as replicated but i dont see him on another player until I press F too which is totally unlogical and I shall see it whole time above player
Deriving your class from a subsystem that supports the lifetime that you need instead of an Actor might solve this issue
Hey there guys. Noob question but can you explain me how does unreal decide which client to send the rpc on a client function? Does he get the controller from the owner of that instance and send to him or another way?
Cuz the other way arround seems easy, like the clients know that there's only one server but for the server there are a lot of clients with reference to that class, so I'm wondering if it's by ownership
Taken from the network compendium in the pins 🙂
If the RPC is being called from Server to be executed on a Client, only the Client who actually owns that Actor will
execute the function.
So essentially the server just sends through the connection "Hey client X! Actor Y has message Z for you."
Except it doesn't really send the Y part.
Unless you explicitly pass it as a parameter.
It was more the idea.
🙂
Although to be fair I never exactly looked at how they work. But wouldn't it need to specify in some way what actor it is? You can't magically guess what actor should execute what RPC 🤔
I have a fun one for those of you who either know or want a challenge:
Some info upfront: The actual issue is a runtime spawned, replicated AbilitySystemComponent, which has SubObjects. Those Objects seem to reach the client before the Component does. In this specific scenario the Objects have an OnRep which require the Component to be valid. So it crashes basically instantly.
Now the more generalized problem would be: Why do the SubObjects of a runtime spawned replicated component reach the client before the component itself does? And is there a way to fix this.
The component eventually becomes valid on the client, just not in time.
I'll have to look into this over the weekend I guess
I do believe it might be intentional
That all subobjects of an object are guaranted to be replicated before the object itself?
Maybe.
okay thank you guys! I just found out i can't call the a client rpc from the server to the server, which is sad if he is the one owning the actor
Had to call the implementation directly in that case
Sure you can.
It may not work if a client doesn't own the actor, though, even if that client is the server.
So it has to belond to a player controller/player state/player character belonging to the server.
(and that would have to be a listen server)
You shouldn't need to. Set it true and in an OnRep you can check the team of the character compared against the team of the local player. If they match, do nothing. If they don't match, then hide the character.
Hey! Is the order of elements guaranteed with the fast array serializer?
how do i fix this?
Between server and client? No.
nope, nvm
yeaaaaa
guess i'm serializing an id 
Ez mode
wanted to keep it as lightweight as possible but it's fine tbh
you'll never get all elements updating at the same time heh
TMaps replicated when?
Add a & after the data-type
Blueprint support for int16 when
World owns Level, so it's not that hard to figure that in the debug menus.
Now back to your previous questions. Ideally you should have a PlayerControllerBase class that has the workaround functionality and any other common base functionality that should be shared among the different PC classes, which they inherit from.
As I stated earlier this bug is fixed in 5.1, you can see how they fixed it and fix it yourself already: https://github.com/EpicGames/UnrealEngine/commit/503690c293cbfa284611c2d1e58abf79fa9b97bc
This is not the sole travel-related bug in ue5, but there is another one that is related to listen-server and hard travel that was also fixed in 5.1: https://issues.unrealengine.com/issue/UE-151220
That said, I would instantly update to 5.1 when it's stable.
I 'member back in the day I added support for them all to 4.0
Well, limited support.
Heck, the good ol' days
😄
any smart way to replicate this XD? because i currently have 3 for one thing
Just RPC WantsToBoost and Onrep Boost or whatever the server-decided result is
No need to check if you're on server, you can just do the RPC there too if you're host
Input -> Rpc
Rpc -> Set Variable
Maybe. Would be best to know for sure. I thought about just changing the checkf that crashes to an if, and saving the callbacks, then redoing them when the component replicated
But that's working around the problem
Yeah.
I think it's on the documentation for replication somewhere and I asked an Epic guy once, I think.
I honestly don't understand why that would be the chosen way
Having the outer replicate first sounds more logical to me
But well
I think at the time I was wondering whether a player state would be replicated before a controller or something.
what if im doing a client host?
or does that not matter ?
Perhaps not replicate, but become net addressable.
Well they are both actors
Doesn't matter
Not the same situation):
Same code will work
hmm alright
Maybe maybe!

I will try working around it on Monday by caching the OnRep calls as said. Not happy about it but I need the runtime spawning of the asc
To be fair, I don't think you should expect it to happen one way or the other and you should be robust in the way you do your events.
_Is happy he isn't working on mp right now 😄 _
Maybe but we are talking about a replicated object replicating other objects. There must the some rule
Anyway, will report back :D
I think subobjects use the actor's replication channel, don't they?
So the actor should be there first, you would think...
It's not actor
Oh.
It's UAbilitySystemComponent replicating UAttributeSet
With the sets replicating first
They are active returned as SubObjects by the component
And those are added to it in the same frame as the component is created by the server
I just don't expect the sets to replicate first.
Maybe they don't
And the package sends all of it at once
But it unpacks it in the "wrong" order
Don't know how that all works
can I call an rpc from another rpc_implementation?
i'm seding a client rpc and on the implementation sending a server one as answer and the server one isn't hitting on the server idk why. Could it be the reason?
What are you RPCing through?
I mean actor class.
struct
ah it's from within an actor yeah
but the information i'm sending is a custom struct
What actor class?
my custom actor class 😅 it derives from AActor
Is the client RPC running on the client?
yep
Wondering if it's an issue with being set in the same frame.
I can double check tho, it's a nice question
Not sure if the Owner pointer needs to replicate before the client can RPC back.
hmm didn't you ever need to do something like that to respond to the server?
How can i do it other way? Delegate?
What you're doing is perfectly fine probably. I know we do some stuff like that for initialization, I'm not aware of the details though.
I can't come up with a reason it wouldn't be able to RPC back though.
If you mistakenly called it on an actor that wasn't owned the ClientRPC would run on the server.. and the ServerRPC would still run on server. So that's out.
If it can reach the client through a client RPC, clearly the server thinks the client owns it. But if the RPC was sent too early, the client might not realize it owns it yet, so it might not be able to RPC back. You could try a basic delay/timer to test. If that's the case, you could override the OnRep for that actor's Owner, and start the chain with a ServerRPC to request the initial ClientRPC you're already sending.
I'm assuming here though. Not sure if client needs the owner set to RPC.
How about the case the client RPC was sent from client though?
is that possible?
It is depending where you call it.
but no, i have 2 visual studios to avoid those mistakes
If you did it then yes it is possible
That's promising
ClientRPC called on anything on a client will still run, even unowned actors.
unowned actors? oh shit insane
I find it arbitrary, but that is a good point to know that it's legit to fire server RPCs
but yeah i'm sure someone owns it cuz i can see the beakpoints hitting on the different project solutions
It's the client's machine. It's no different than calling a local function on them. There's no networking involved.
And delegates are not networked so ofc no
Where are you calling the ClientRPC from?
I was saying a delegate on the implementation to call the server rpc
Server same actor
What event though?
it's just a method to call some serialization on the client
But what is the native engine hook?
can it be because i'm sending a custom struct on the rpc ? That's the thing that worries me the most. I had to do some cheating to bypass the networking on the struct and that's what i really wanted to test but the server doesn't even receive it cuz rpc is not working
didn't understand, what do you mean?
Beginplay, PostInitializeComponents, Tick, etc. What starts this chain of events?
ooooof it's way beyond any of those, no idea
in the real beggining probably it's a tick
but has a lot of stuff in between
Have you server gated the call?
Might try that to make sure it isn't the client calling it.
what does that mean? Sorry i can be missing some terminology
{
}
the client rpc is called by the server yeah
Or HasAuthority(). Either way.
well i'm certain that that class only does stud server side
as i'm saying i have 2 visual studio solutions ahaha i can see which is server or client
When you break in the ClientRPC does "this" have it's Owner proeprty set?
Actually I'm curious about that. Going to test if that's a requirement.
Fire a server RPC from APlayerState::PostNetInit. Prolly Owner hasn't replicated at that time and you can fire serve RPCs just fine. But yeah I'm curious too 😄
Already running a new actor class. 😄 Gonna spawn and set Owner, and RPC in same frame.
Hmm. Owner seems to replicate immediately.
Lowers NetUpdateFrequency
Ah. My mistake. Setting Owner makes it send with the same bunch when the actor itself replicates. 0.2 delay before setting owner and RPCing gets me a nullptr.
Aaand.. Nullptr Owner means no ServerRPC. Tested with it null and not. No ServerRPC with it null.
Probably if owner had a low net update and owned had a high one, that won't the case
Amazing
Has a net update of 3 at the moment.
Still seems to send with the first bunch when set on the same frame as spawning.
Owner's NetUpdate shouldn't matter. It's a pointer on the actor itself. But since it's set to replicate that same frame it's spawned, it just probably sends everything it has replicated already.
Hmm, that's weird. The only gurantee I know of about different objects replicating at the same time (initial bunch in this case) is if you spawn a replicated actor and attach replicated subobjects at the same frame
The owner was already replicated. Since it's a Controller.
Just the pointer to it needed to replicate on the AActor.
Right, that's it. The pointer will replicate regardless, the deal is if it the net guid was resolved
Yeah seems to have replicated
Neat little thing to keep in mind when trying to ServerRPC though. 😄 Make sure Owner is set on the client before you try it. Wasn't aware of that little tidbit before.
Yeah I thought that was arbitrary tbh. Pretty damn sure Zlo said it a few times it's safe to start server RPCing from APlayerState::PostNetInit
But I get it now
PS's net update is low compared to its owner, so it makes sense
I would love to know 10% of the things he's forgotten. 😂
The answer lies in AActor::ReplicateSubobjects implementation
(Thanks for the challenge, you're welcome for the help)
No idea why they chose to do it that way
But doesn't that still mean it would happen in the same frame?
I will play around with it a bit
Maybe I can put a custom case for the ASC into it
And thanks!
Maybe I missed that part, what do you mean by that?
I had two assumptions:
- The AbilitySystemComponent replicates 1 or more frames later than its Subobjects.
- The ASC replicates in the same frame, but the order in which it replicates, and "unpacks" on the Client, makes the AttributeSets call their functions first.
If it's 1., then I need the ASC to replicate first. If it's 2. then I need the order to "unpack" the ASC first, so it's valid when the AttributeSets call their functions.
Because the AttributeSet instantly calls its OnRep functions, which require a valid ASC
(AttributeSet is a Suboject of the ASC)
Yeah any UPROPERTY replication you do that isn't an RPC will be sent across the network at the end of the frame, but RPC's are immediate for sending it before the end of the frame
Yeah it's not about RPC vs property
I see. I guess it's the same frame considering they are all subobjects and yet has no NetUpdateFrequency (but their owner actor). I might be wrong though, so worth checking. Anyways I wouldn't rely on any of these and instead have/tie to OnReps and listen to things when they replicate
It's about UActorComponent vs its Subobjects
Yeah that's the solution I will try. Just listen to ASC being valid and stopping the AttributeSets from checkf my project (that's native code..)
Wasn't there a way to change which variables get replicated in a native class? One from Epic that is
I was playing around with these values, but strangely enough no matter how high I set them, weirdly enough, client immediately gets teleported back to his position (even if I just tap forward key and he moves 1 inch forward he gets teleported back, which If I understand this vars correctly, he should be teleported if it's within smoothing range)
so question im guessing i should worry about tick speed/framerate/updates? Like this what could be causing this? jittering?
Aren't you running in Standalone? IE not a client?
im running both in selected view port/as it sais standalone at the top and connectiong
to the other
the jitter also happens in an online test already tested
?^
:/
Guys I have this problem with names when I print names of logged users both will see same name even I am replicating it. here is widget added on player character and in widget I am just getting Name variable from third person character i dont understand why its printing same name Also I have this widget as replicated but i dont see him on another player until I press F too which is totally unlogical and I shall see it whole time above player
Because you're Getting PlayerCharacter 0 in your name function - This will almost always return the local player character.
This will also only set the value locally, you won't see it on other clients unless you send an RPC to the server, and set the value in a replicated variable.
Game Instances are also not replicated, so anything you set in the Game Instance will only ever be visible to the instance itself. Nothing replicates at all in them.
but why I need do RPC when value itself is replicated
Because replication is from Server -> Clients
also I first tried it via playerstate but there were problems with casting
Not from clients -> server. The RPC to the server is the means of telling the server you want it to do something.
okay maybe another questiion how to secure that names will be set after we will be spawned on map? because I tried print Text after begin play in third person character and my character was automatically created after first window in game even before login
aight but its confusing also because I have set my widget in player mesh as replicated and even there is default value i dont see it when I turn on it on player and then later join with another
Widgets also do not replicate.
i mean newly joined dont see it
but its set "replicated" in options
Just because you click replicated doesn't mean it will replicate. Widgets do not have any replication built into them.
omggg so why it is then called REPLICATED in options:/
😦
so how to replicate widget with name then
rpc for set in viewport?
You can't replicate a widget. You can replicate variables on actors and have them drive the widgets.
jo but then will be other players able to see "widgets" above heads? when I replicate only value
yea gonna try again player state, but last time i had problem my player state cast always failed
it was like this
and failed everytime
First, create a function in the widget blueprint that takes the string input and sets the value of your text box for your name. You do not want to use widget bindings for dealing with this as each character / player would have a different name, thus the binding can't reference a specific character unless you feed in a reference to the specific character to the widget so it can use it.
Secondly, you'll want to create a "Name" variable either on the character or on the playerstate (playerstate is probably better) that is set to replicated w/notify as this will then create an OnRep function that fires when any name updates come through.
When you want to change a player's name, you need to RPC to Server with a string Name Input. This event can be called on the Player Controller, the Player State, or the Player Character.
You're now running on server. Set the "Name" variable I mentioned earlier that you created. Once that is set on the server, the OnRep will trigger on clients.
Use the generated OnRep Function, you would need to get the character of the player. If you're in playerstate you can use "Get Pawn Private" and then cast to your character class. From your cast, Get the Widget Component and from that Get the User widget, cast to your widget class. Once you're into your widget class, call the function that sets your text value.
wow thx
just was trying first step but when I get instance of name (my widget) with normal text and then try make set text getting this error
thanks, much appreciated
Can I set my null struct members to not to net serialize? Its crashing if I left them empty with UPROPERTY
You should put them as UPROPERTY first
i do not rly understand your issue sorry, what are you trying to achieve ?
Well, if I put them as uproperty, they are being net serialised, but they are set to nullptr, so its causing crash
Try NotReplicated
It worked, ty
anyone here using advanced steam sessions for ue5?
Hey, hope everyone is doing well!
We are developing a fighting game on UE5 for mobile, and we are looking for someone to work with us to create the Multiplayer part,
Kindly send me a dm if you want to know more, I will send you the Trailer of the game and give you more details. This a really cool opportunity 🙂
this is not the place to recruit, see #instructions
The multiplayer part is 10x the work of the singleplayer part btw.
oh sorry, Im gonna post my job offer here, thanks! 🙂
I'm just using the PlayerMovement component and its built-in networked capabilities; there is a certain person on my team who is from Pakistan (and his internet connection isn't particularly stable), and when running the game, he always gets a ton of rubber-banding whenever he tries to move (and the other players can see him rubber-banding too).
His internet connection is good enough to play the vast majority of other games without such major issues (eg. Valorant, etc.) so I'm wondering if this is a common problem and if it can be solved in a straightforward way (eg. config)?
weird stuff for my fps game
everytime someone hosts as soon as they load the world they go straight to the menu
But without 10x the pay
when i create a session and then call open level. Do i have to put in the options: "listen" or "?listen"
Probably?
im just asking if the ? does make a difference
i do this currently lol
tho dont think this works with other integrations not sure
The proper level uri should be mapname?listen?otheroption?option3=7?etc
It doesn't as they ignore any leading ? signs, but preferably don't as they already add one for you
👍 ⬆️
Updated the list with one more article, it's a very recurrent topic I've seen many people ask, including myself XD
And I already read it and it gets my recommendation 😈
Quick question, I have an actor the server spawns, when debugging, does not matter where I put the breakpoint Owner always seems to be nullptr. My solution is working, I'm just curious, why could it be null?
how can I deactivate Steam for my game? I want when the player goes to the LAN section from the main menu, Steam be deactivated so the player can try to search for LAN sessions
Did you specifically set the Owner property?
No, I did not, just assumed server would be set as owner. Question is if it is important for it to have an owner?
The only real thing that Ownership affects is Client and Server RPCs.
Client can't ServerRPC if it isn't through an owned Actor. Calling a ClientRPC from server on a non owned actor will just run it on the server.
Ok, I do not intend to do any sort of RPC in that actor. Though, I have one OnRep which do seem to work in that actor.
So it's only RPC effected by ownership and not OnReps?
Oh. And the SkipOwner and OwnerOnly replication settings.
Normal replication is not. Most other replication settings are not.
Can even Multicast RPC just fine without an owner.
Awesome, this clears up alot of stuff.
why is a vpn needed to connect players across different networks?
It isn't?
Is it just me or does PIE server under same process ignore the Server Default Map setting?
how do people with serious projects test client/server flows? PIE or nah?
if you are testing your game on steam, its region locked. Normally you'd change your download region inside of steam, but i guess a vpn will do too?👀
They didn't mention steam. 😛
Having a weird issue where the collision of an object doesn't move for the clients even though the mesh does, using complex collision. The server/host works correctly, but the client can 'step up' on an invisible mesh, even though the mesh looks like it's in the correct position
isnt it 100% critical information to tell UE programmers that on actor regain net relevancy the begin play for that actor fires again
i've searched far and wide and found no mention/documentation of this anywhere, the only places ive seen it is on 1 non official youtube video and another programmer
I wouldn't say it's critical but it is important to know. From what I can tell, the official documentation doesn't even tell you that actors are destroyed when they are no longer relevant, and that when they become relevant they are spawned.
The Actor Lifecycle graph does indicate that whenever an actor is spawned, BeginPlay will end up being called, and that BeginPlay is only being called on the client when they see an actor become relevant as the client is locally spawning a copy of that actor - the server would only ever spawn the actor once, and thus, the begin play only ever fires once on the server.
So knowing that whenever an actor is spawned, including by becoming relevant over the network, BeginPlay will be called wherever the copy of the actor happens to be spawned.
its a feature of relevancy
but yes, this is critical
and imo it should be written somewhere
I actually got impressed today to know this wasn't common knowledge
Is the network prediction plugin a good choice for handling predictions ? I saw GAS was using something else
Lets pretend it resurrected 🤫
Not sure if it belongs here, but after enabling RVOAvoidance, I get a huge amount of network corrections on clients, like they themselves are colliding into their own RVOAvoidance radius, so they can't even move forward.
Is it normal? How can I use RVOAvoidance, because I like the mechanic of characters just sliding around other characters, so they can't block themselves.
So this plugin is dead ?
Last I heard that they are planning to keep it going but no ETA on when that is going to happen
Ok, so all predictions should be done manually i guess :p I heard about Iris but it seems to be in early version
theres no correlation between iris and prediction
iris will simply handle better sending and processing data to connections
NPP is good but its hard to use
you can do prediction on sim proxies.. something that gas doesn't support out of the box
you need to be doing custom logic to have sim proxies do prediction
ie: writing your own anim tasks...
Mhh, are you using it ?
NPP? not directly but I'm in contact with people that's using it on a daily basis
I've been meaning to pick it up at some point
but I have some other priorities I'd like to tackle first
Ok, i will take a look then, thanks !
Hey, I am currently trying to figure out multiplayer and got a very simple question I guess. I didnt really understand the difference between replicated variables and a multicast. As far as I got it: I think if I cast to the server and set a variable that is replicated, it will set the variable on the server and then be replicated to all clients. where as a multicast from the server will tell all clients to set the variable themselves. Correct?
I am kind of struggling if I understood this correctly.
cast to the server
You probably meant to say RPC to the server. "Cast" isn't a valid word in this context.
And what you said is correct with a grain of salt
Read it so you know better (it's found in this channel pins)
hey, thanks a lot
Hi guys
I want to spawn projectile (game logic) in specific time during character animation and want to use anim notify for that
Does relying on anim notify safe for multiplayer logic? (Does animations play on server and replicate notify correctly for all clients)
go for it
you can trust in anim notifies for gameplay logic, however projectile spawning should be done in authority
ty
How do you guys go about adding admin/dev controls (e.g noclip around, change the game flow, give/remove weapons etc) in multiplayer games? I see that the cheat manager class offers a bunch of functionality for this purpose, is it actually useful in a multiplayer/dedicated server environment?
Hi Gus may i ask ... How would you handle this: Client Player activates something.. ok.. then the Server Player shows a Hat on is head. The Question: How can i manage to do so that only the CLient who activates something sees the Hat on the Server Player? (Means Server can see or not doesnt matter, Client activates can see, other Clients not)
It is
Spawn it client-side for that locally controlled client
Hey all! I've been using unreal for a time now, knows the basics with blueprints. I'm planning to test out multiplayer, are you able to use blueprints or do you have to use C++? What do you guys recommend to learn and do you know any good tutorials?
You can do basic multiplayer with either option, but BP lacks 90% of the multiplayer tools.
In this channel pins you can find the networking compendium with some other starter friendly resources which you can utilize
Okay, thx for the tips. Better learn c++ then
Ah we lost another #multiplayer soul for the sake of #cpp today
😔
Lmao. Can you go back to#cpp now?
#cpp raid by MP peeps soon™️
Anyone know of good forum or video regarding local multiplayer for VR? I want to use 2 VR headsets in one computer like when setting up a regular splitscreen multiplayer for regular controllers. If anyone has any info on this, I'd appreciate it 
lol, yea its simple.. ws overthinking it, thanks
Is it possible to know when actors in an array of actors are replicated ?
Yes, if you tie that array to OnRep
got you
If connecting mid way through a current game, to get current state of vars on the server is event onPostLogin the best node? (e.g. playing a turnbased game that you connected to on turn 7)
There is no such "best node", you get data on demand
You may need that data further on when HandleStartingNewPlayer is called
is there an order in which that would be performed or should i check through the docs?
This is the connection process explained in docs: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Server/#connectionprocess
thank you
Does the PlayerController replicates with its copy on the client where it exists?
Define "with its copy"
Counterpart I mean. The matching controller.
PC replicates to owning client only if that's what you meant
Yes exactly.
Because it's bOnlyRelevantToOwner
But isReplicated is false, which is what puzzles me. Anyway, thank you for your answer and help.
IIRC bOnlyRelevantToOwner implicitly sets bReplicates to true, but let me check that up
They do it dynamically
Inside UWorld::SpawnPlayActor
👀
hey guys I am placing a static mesh in level but when I hit play on client I find root and scale different, any suggestion?
There are no good tutorials.
Whether or not BP only is viable for your project depends on the game design.
Chess, sure.
Civilization, maybe.
Quake, nope.
Minecraft, nope.
And I do the same and I get the same scale and root the server has. That can't happen without the client changing them explicitly
Doing 3rd person over-the-shoulder game. Want movement to be based on the direction the camera is facing. So W should rotate the character to point towards the forward vector of the camera and then move the character forward. A should cause the player to strafe left and S should cause them to back peddle.
Is there something already in that I can use to get another player's camera forward? Or do I have to replicate that myself? Or should I just set client's rotation directly? So client will tell server the direction and that info will be replicated to everyone else.
Just seeing if there are other options out there for this situation
Why do you need other players camera?
The style of movement relies on the direction the camera is facing.
Correct, movement is done on the autonomous proxy level, then it's the CMC's responsibility to apply that to simulated proxies
Yes. I'm aware.
I mean, you press that W button, then check what direction that camera facing (this is all done locally) and apply movement in that direction.
I want to execute something on an actor both on the server and on the owning client (not on all clients like a multicast, just on the owning client).
I call two RPCs from the server, one Client and one Server/Unannotated.
It works great, but when playing on Listen Server, function obviously gets called twice (once because it's server, once because it's also the client). Is there an elegant way to check for that specific case and avoid calling both functions? Currently I check if it is locally controlled.
By the way, I don't understand why there is no annotation "On Server and On Owning Client" in Unreal.
Simulated proxies will have that movement applied for them
I am already doing that.
The issue is when I am going backwards.
Or sideways
Because it still rotates the character when it should not. Because everything is based off the vectors of the camera.
(I'm using both orientate towards movement and control rotation, just depends on the state of the character)
I have overridden the ComputeOrientToMovementRotation method as well.
So I could have this style of movement more easily.
The issue isn't the movement being applied. That is happening correctly. The issue is the non-local machines rotating when they shouldn't.
This makes me understand that going sideways/backwards doesn't make the pawn move in the correct direction relative to the camera.
While this makes me believe that things are working correctly, until that part of the sentence that doesn't compile for me.
It moves fine because what already gets replicated with the CMC
You got a footage? 😛