#multiplayer
1 messages · Page 117 of 1
Yeah indeed
And have that option as a CVar
I would like to look at how doable that is some time soon™️
Couldnt we just check DORM_Initial? If it is DORM_Initial - dont BeginPlay?
The problem here is not dormancy. Awake actors have the exact same problem
/** This actor is initially dormant for all connection if it was placed in map. */
DORM_Initial UMETA(DisplayName = "Initial"),
but it only applies to Net startup actors?
so if it is DORM_Initial - it is a net startup actor that is not yet replicated?
But that will be part of the solution indeed. If we don't take dormancy into account, BeginPlay for example will never get called for such initial dormant actors, and we might want to assess if it's good to starve our actors BeginPlay
How else do you have DORM_Initial?
no, a net startup actor is any actor that has been preplaced in the level
dormancy is just an optimization setting
but all net startup actors start as DORM_Initial according to that comment?
so it is only DORM_Initial until it knows its actual dormancy?
no, all DORM_Initial net startup actors start dormant
so you have to explicitly set that setting in the actor
so just set that client side only, and check for that, which means it was replicated, and do that?
so server knows it is not dorminent, replicates, begin play
no
dorm initial is a replication optimization setting
net startup actors arent necessarily dormant initial
you can opt in for dormancy as an optimization
but thats not part of the problem here
in fact, by default they arent
now i have to go!
why is that happening
hello gyus,
I am trying to test my multiplayer game. I have a lobby gamemode and level by the name of Lobby where I execute the command "open MYIPADDRESS" for local gameplay. My default server map is Lobby as well and once lobby has at least 2 players, it is supposed to move to another level called Teams. I do this by calling ServerTravel(FString("Game/Maps/Team")) but the nothing happens.
I am doing alll this on dedicated server jbtw. Any help"
Yo dudes for some reason my clients have all super low fps, someone knows how to fix that?
My game has no lobby for some reason, I need the PlayAgain button.
Before destroying the current session, I want to save their Steam information to Instance. After Create Session, I want to show Invitation on the screen of these users, if they accept, they will connect to this Session.
Does anyone have any idea how I can do this?
Someone pls tell me if he knows how to fix that, im not finding anything in the internet
its really just the client, the server sees everything in normal fps
PIE?
wym?
play in editor
Editor Preferences => General => Performance => Use Less CPU when in Background
Check that
Hi, has anyone got any idea on how to approach multiplayer animation pose rewind for lag compensation? Normally rewind of player capsule is enough, bu Valorant rewinds also the pose which seems quite tricky.
And they say they dont brute force track pose each frame
I assume they did something similar to the replay system
But idk 😐
They do not, they basically rewrote animgraph to record the input to every node every frame, and then feed that info back in as necessary.
The "easy" way is to just iterate relevant bones every frame and record their positions. Valorant doesn't do that because processing animations every tick on the server is slow and they only want to do so when necessary.
Ah so they really onle evaluate animations for the updates when it matters (something got shot)?
yes
that's pretty slick
When I change the size of my character capsule it appears correctly on the server and on other clients. When I move though the character goes under the ground a little. When I stop it goes back up on the ground. Anyone know what could be the issue? I am using a replicated int and when it changes, the capsule sizes should change.
I'm having an issue with setting a death respawn widget screen on character death. Every time I have one client kill another, I want a death screen pop to request for respawn. It seems that every time I do this, there are 2 issues (because of 2 different ways I was trying to do it):
- The screen pops up for both the client and server and then on destruction only the server's screen gets destructed.
- When I use a ClientDeath() function for setting the screen, it gets the controller of the server and sets the screen for the client controller, but when I try to delete the screen for the client controller, it gives a "Only Local Player Controllers can be assigned to widgets"
How should I properly be doing this?
Omg i didnt see that im gonna try that out soon
Thanks my man ❤️
Btw does someone know how i can make a pickup allways get send to the server? as example i pick up an item that hasnt spawned for host or client but i still wanna pick it up on the one end and get it replicated to the otehr
how has it not spawned for host?
the host says what's spawned
Wait
so what i did before was that every enemy drops an item that you can pick up but that did lead so some desyc bcz the items dropped in diffrent directions on everyones screen, wich is okay but it only picks it up for himself
So i made it an even that is beeing called in the game instance whenever a enemy dies
Think of charge as some kind of XP
You mean run only on sevrer?
So when you kill enemys they dropped charges
Problem is that they dropped in random directions so when someone picked it up it might be somewhere else for the other player
wich caused the problem that the one picked it up only on his screen
So i made it an event
Yeah so do it like this:
DroppedChargeThingBP:
Overlap -> switch HasAuthority -> cast otheractor to YourPawnClass -> update its Charge count
When an actor dies he calls this function
Ohh okay i try this real fast
Do you want them to get a charge when they overlap the dropped thing or when they kill the thing?
Overlap
The actor that dies drops an orb
you overlap and get it in your inv
as i saied it gets launched in random directions so its on diffrent places on both screens
and replicating movement eiter doesnt work 100% of the time or is just to inconsistent
So i just wanna make it add up no matter where i pick it up XD
what do you mean by "switch has authority?"
So first that
now the part on Charge should be on sevrer?
now i did this
Immediately after the overlap event, put has "Has Authority" node. Connect the rest to the "Authority" path provided.
Make sure this actor is spawned by the server and mark it as replicated.
Any movement that occurs should be happening only on the server and its location would be replicated to clients.
There should be 0 need to have any Run On Server or Run On Client RPCs for an actor that would not be owned by a client.
You're allowing the client to spawn the actor?
Huh waht?
That's what this means. Allow a client to call this function.
Which will then execute on the server.
It says "Run On Server", but it's a means of allowing a client to call to the server to run it.
Actors can exist on the server and the client at the same time.
Start simple... When your player character gets spawned "Begin Play" fires on the server. When the actor replicates to the client "Begin Play" then fires on the client.
Overlap events like you're looking at, can happen on both as well.
The Has Authority that you just put in will mean it'll execute on whichever instance has authority over the actor (typically whichever instance of the game actually spawned the actor)
I imagine your "Event Death" would already be getting executed on the server.
Umm
wait
This leads to the death event
Real spagethi my man
Nw thats something else xD
Simplify...
Let's say you're trying to make an attack...
Client Input > Run On Server > Server checks if player can attack and if so > Executes attack, checking for hit targets etc. > (Still running on server here) > Enemy is hit, enemies dies > Enemy spawns Charge Pickup (All this was running on the server since the original call from the client)
Yea correct
the Orb spawns on both ends aswell
It launches in random directions to make it kinda look like minecraft xp kinda
Like h
the input is run on server -> multicast
Why multicast?
and the dmg taking by the enemy is done on multicast aswell
Bcz otherwise it doest play the animations and all of that
I mean the attacking and dealing dmg works
You can multicast the animations, but the logic behind the attack should be done on the server.
and the enemy dies on both screens similar
Oh
Hm okay
Like the line traces and all?
If you're multicasting everything, you're basically asking everyone else to also do those things. So if you're spawning an actor in a multicast, then clients could be spawning their own copies of actors that they shouldn't be.
Technically anything relating to values would normally need to be done on the server.
Hmm okay okay
So yes, even line traces to make sure if a client hits something.
What if i do just the spawning on the server?
or doesnt that work if dealing dmg is done on multicast?
You shouldn't be dealing damage on a multicast.
It doesn't make sense to.
You can use a replicated variable to represent the health.
The damage can be applied to the health on the server.
Yea i might have to change that soon
If you need updates when the value gets changed on clients, you use "Replicated W/ Notify" and then use the OnRep function to drive UI changes or what have you.
Other than that there is no way to spawn the orb only on the server? without removing the multicast on my attacks i mean
U wanna see in a discord stream real fast so i can explain?
if youre down
U dont need to talk
The simple answer is, you should be spawning the orb actor only on the server when the server has calculated that the actor was killed. That means your server needs to be the one doing the calculation to know it was killed, which means that your server needs to know when damage was dealt to know that the actor was killed.
Anyone ran into issue with simulated proxy going into the ground when changing capsule size?
@sinful tree thanks allot man it works, big love my man ❤️
guys is it normal when I have widgets on my player ( Crosshair and aim circle ) that other players who join game see widgets of everyone ? it's not replicated I didn't tick it
how to hide them?
it's not relevant for other
Who/what is supposed to signal that a client died and that client's UI should now be something else? I think trying to broadcast my character death from my BaseCharacter.cpp and binding the delegate to a function in my PlayerState/PlayerController is giving me an error on only local controllers can assign widgets
quick question, does increasing the number of RPC definitions in a class increase its network bandwidth somehow?
because i occasionally think about this example:
UFUNCTION(Client, Reliable)
void SendClientAnIntegerThatsInBetween1And3(int TheInteger)
// Versus:
UFUNCTION(Client, Reliable)
void SendClientAnIntegerButItKnowsIts1()
UFUNCTION(Client, Reliable)
void SendClientAnIntegerButItKnowsIts2()
UFUNCTION(Client, Reliable)
void SendClientAnIntegerButItKnowsIts3()
no, why would it
in the first RPC, SendClientAnIntegerThatsInBetween1And3 will need to send extra bandwidth to network TheInteger arg, while the SendClientAnIntegerButItKnowsItsX RPCs don't need to send anything, so did I just gain free bandwidth?
(obviously not a very practical example, but its to get the idea of my question across)
it's not free bandwidth, why would an RPC that doesn't have any arguments take up extra room just because another rpc does
okay so, this doesn't make sense to me network-theory-wise
what is preventing me from defining an RPC literally for every possible event x argument permuation in the game, and then I wouldn't have to spend bandwidth sending args at all?
because the possible set of arguments for most RPCs go far beyond the possibilities of anything you could write?
what if i have a magical machine that can generate those RPC definitions for me
a really really fancy macro
something isn't adding up
no, you're asking a nonsensical question
What consititutes as "death" for a Pawn can be managed in many ways.
Unreal Tournament for example uses Tear Off as its mechanism for determining if the Character is dead.
How you choose to manage it is up to you
Having a Delegate on something like the PlayerState which the Pawn broadcasts on when it has Died isn't a bad idea.
Allowing external systems to know about that event in an easy way is a good approach.
A single int32 is 4 billion different possibilities. If RPCs were sent by name (and they're not) then you'd lose any potential bandwidth savings by simply having to write out the names of the RPCs over the wire.
If RPCs are sent by id (which they are) then you simply hit the limit of how many things that id could hold and what you're asking isn't even possible.
You can't magically make the data disappear, at best you can compress it and the engine already has support for oodle network compression out of the box. You'd never even remotely want to do what you're describing because there's zero point to it.
gotcha, thanks for clarifying. it was mainly hypothetical, I just found myself wondering about this more often recently and needed some straightening out
So, if I wanted to broadcast a death, would it be better to broadcast from the APlayerState class instead of an ACharacter class? I am currently trying to do it in a ACharacter class and it's giving me an error about the controller not being locally owned
Or will I run into the same issue because I messed up something with replication?
How are you handling death of the Character right now?
What does death mean to your Character and what is the process it goes through?
I am using a HealthChanged delegate with an ability system component in the Player State class. When the character's health reaches 0, it will check if it is alive and if it isn't, it will call a function from my ACharacter class that will rag doll the character, broadcast it's death and then start a respawn timer. I aso remove character abilities, stop them and stop movement immediately. Currently the whole death and respawn process works as intended, but I wanted to create a widget on the player controller that died, giving the controller the option to respawn manually, but I get that error when I try to do that
So you are listening for an Attribute change on the ASC?
To trigger the death sequence?
Make sure that whatever you are trying to do with the Widget is being called on the Client
The error is telling you that you may not being doing that
If I was to guess, you are trying to spawn a Widget on the Server
I am currently sending a uint8 as custom data in the CMC. Right now the server is getting the value and storing it in a local variable in the MoveAutonomous(). I want to do something based on if this variable has changed. I feel like MoveAutonomous() isn't the place to do it and was wondering if there is a better place?
Yes to the first 2 questions. I did however do a ClientDeathHUD() that was called during my Death() function, and it still gave the error. Does it matter if I try to spawn from the ACharacter class vs. the APlayerState class?
Can you post the exact error you are seeing?
Paraphrasing errors is not very helpful.
And can be misleading if you phrase it incorrectly.
Best to just post it as it is
I’m struggling to get a physics constraint object that a user can manipulate to replicate properly. It technically has physics on it, which is probably why it’s a pain… does anyone have some general suggestions to try? It typically fails when it doesn’t register a client ending its interaction at the same time as they actually did and therefore will stop sooner/later than other clients. If I turn on replicate movement, it just gets super jittery cause one client will think it should be stopped and the server will tell it to keep moving
PIE: Error: Only Local Player Controllers can be assigned to widgets. BP_BasePlayerController_C_2 is not a Local Player Controller.
To this day I don't get it
why could my play montage not work on Server
but work on client
when it executes on server, anim instance is valid, animation is valid, skeletal mesh is valid
but nothing happens
Multicasts to other clients work, it displays
the server can see clients do the animation
furthermore, in a multicast the clients can see the server perform the animation
it just literally does not work for the listen server
and standalone
what's more, the on interrupted pin fires when I interrupt the montage to play another one as well
so the play montage is playing a montage theoretically
the error literally explains it
I have been working on Multiplayer Lobby all day, and about a minute ago I found out that my code wasn't working because NetMulticast doesn't work with Player Controllers.
My thought process was that the PC would be a client owned actor, and I was calling the multicast RPC at the end of a server RPC so, it was being called from server, and referring to the below image it should have been called on all the clients.
Could someone please help me understand what I am missing here?
what, multicast, controllers? what are you actually trying to do
Without your attempt I cannot tell you what you're doing wrong
Controllers do not exist on other clients, a multicast cannot run on clients that an actor does not exist on.
Yes, I can read that. The issue is that I believe it's being called by the client
Was sending it to someone else as he asked for the error
well you believe, did u make sure that it actually runs on owning client
is there code that ensures it
u can get local role to check
You would want "is locally controlled" rather than local role.
yup
When I try to check the IsLocallyControlled(), it returns error, so I was asking above what the reason for my issue could be. I even have a UFUNCTION(Client...) to call it on the client and yet it still fails
is the controller even valid
What error
I was trying to implement a lobby where all the clients would connect and it would update the UI for all the players about who has joined and who all are ready.
The way I have implemented it is using a listen server that would host the session and others would join that session. Once they join the session, through HandleStartingNewPlayer on GameMode, it calls a client RPC to show the Lobby UI.
On the Client side, it gathers the data about player(name, ready status etc) and calls a server RPC to update that data on server. In that RPC it updates the server copy of the player data and adds it to game mode and here I wanted to call that multicast to let all the connected players know about this new player and update their UI.
But now I have to spearately call the update ui client RPC on each PC. It works but I wanted to check if my understanding was correct
Again, a player controller exists only on the owning client and the server. As such a multicast on a PC will run only for the owning client and server.
If you want something to run on all clients that's related to a specific player, use the player state instead as that exists everywhere.
Just a ulog error I set
Got this graphic that explains it! Thanks
Which tells you... what
that your code is running on the server? Which is what the original error originally implied, yes.
If you want help, maybe post your code
Yeah, I can set UI on each individual one through a button press directly on the PlayerControllers
since ur basically telling us nothing
You need to be creating a widget only on the owning client. You're apparently trying to create it on the server for a controller that isn't local.
The solution is to not create the widget on the server. Anything beyond that requires more information than you've posted.
Yeah, I can in a sec. Not near my PC
I did try reading about this and I could find that the player states can be accessed from AGameState::PlayerArray, but is there any OnRep function that could tell me when a new player has joined?
Just make a custom playerstate class and do whatever you need on BeginPlay
void ABaseCharacter::Death() {
NetMulticastDeath();
ClientDeathHUD();
}
void ABaseCharacter::ClientDeathHUD_Implementation() {
ABasePlayerController* PC = Cast<ABasePlayerController>(GetController());
if (PC)
{
PC->SetDeathScreen(5.f, true);
}
}
void ABaseCharacter::NetMulticastDeath_Implementation() {
GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
Mesh1P->SetCollisionProfileName(TEXT("Ragdoll"));
Mesh1P->SetAllBodiesSimulatePhysics(true);
Mesh1P->SetSimulatePhysics(true);
GetMovementComponent()->StopMovementImmediately();
bIsDead = true;
CharacterDiedDelegate.Broadcast(this);
GetWorldTimerManager().SetTimer(
ElimTimer,
this,
&ABaseCharacter::Respawn,
ElimDelay
);
}
APlayerController:
void ABasePlayerController::SetDeathScreen(float RespawnTimer, bool bIsDeath) {
if (!UIDeathDisplayScreenWidgetClass) {
UE_LOG(LogTemp, Error, TEXT("%s() Missing UIDeathDisplayScreenWidgetClass. Please fill in on the Blueprint of the PlayerController."), *FString(__FUNCTION__));
return;
}
if(!IsLocalPlayerController()) {
UE_LOG(LogTemp, Error, TEXT("Not a local player controller"));
return;
}
if (UIDeathDisplayScreenWidget == nullptr) {
UIDeathDisplayScreenWidget = CreateWidget<UDeathDisplayScreen>(this, UIDeathDisplayScreenWidgetClass);
}
if (UIDeathDisplayScreenWidget) {
if (bIsDeath) {
UIDeathDisplayScreenWidget->DeathMenuSetup(RespawnTimer);
} else {
UIDeathDisplayScreenWidget->DeathMenuTearDown();
}
}
}
APlayerState:
void ABasePlayerState::HealthChanged(const FOnAttributeChangeData & Data) {
float Health = Data.NewValue;
// Update floating status bar
BaseCharacter = Cast<ABaseCharacter>(GetPawn());
// If the player died, handle death
ABasePlayerController* PC = Cast<ABasePlayerController>(GetOwner());
if (!IsAlive() && !AbilitySystemComponent->HasMatchingGameplayTag(DeadTag)) {
if (BaseCharacter && BaseCharacter->HasAuthority()) {
BaseCharacter->Death();
bWasDead = true;
}
}
Hi, once an AI has died I want to destroy it in all clients, stop replicate it and just keep it in the server until it respawned. How can I do it? Should I override IsNetRelevantFor?
Hey all, this is my first time messing with multiplayer. For some reason, the rotation info (pitch, yaw, and roll) aren't updating when I play on the client. However, when I play on the Server, the info is updated to the server and client. I'm not sure why, since I have replication for my x and y mouse functions, which control the pitch and yaw...
looks sound
I'd check the stupidest things
like the UFUNCTION( Client ) preceeding the function
whether u didn't accidentally set it to something else
since it should be local player controller with ur code unless u made that specific mistake
Big sad. I've been looking at it all day lol. I even tried to Broadcast the CharacterDiedDelegate.Broadcast(this); and bind to a function in the PlayerController and it's still not a local controller, so maybe it's just something really really stupid
I mean ur code is simple and if the RPC to client happens it should be the local player controller
there should be no way it fails as long as it actually does run on client
worst case throw it into BP temporarily lmao
lolol
nvm solved it, had to replicate "add local rotation" for the xyz
I managed to finally figure it out. I think the original error was coming from the server controller. Needless to say, it works and I decided to bind a delegate to a function in the player controller to handle all the HUD related tasks instead of keeping it in the ACharacter class
guys is it normal when I have widgets on my player ( Crosshair and aim circle ) that other players who join game see widgets of everyone ? it's not replicated I didn't tick it how to hide them? it's not relevant for other
it has no code it is just in plane hierarchy in viewport
Are you adding that widget from the character class?
I would consider seperate AI and Spawner into two actor class.
And? I don't want to destroy actor that should be respawned
why
You can just set actor hidden
Since the spawner and Ai are two actors you can destroy AI and save the info for respawning in spawner.
Otherwise , you can just hidden the actor.
Keeping an actor sometimes on server sometimes on both server and clients make things complicated and weird.
what do you mean?
character class
they are added like this
That is a default component.
It's the same as using a StaticMesh. You don't replicate StaticMesh components either but everyone can still see them.
so I have to turn off visibility of them for others in code?
Hm do u have link to video or blogs where they mentioned this? But ye i also assumed they would do this, they would replicate the animgraph itself and then re-evaluate the logic backward when needed.
This way they can get high temporal resolution, since brute force capture bone transforms would require lots of data for high fps
we have a pretty nasty crash that happens very frequent whenever the client tries to leave the match. This only happens on maps that are using world partition though.
It seems like the client fails when checking the world settings here
{
if (bChecked)
{
checkf( WorldSettings != nullptr, TEXT("%s"), *GetPathName() );
}
return WorldSettings;
}
Engine Version?
You should have Warnings in your Log that the WorldSettings couldn't be properly replicated.
Had a bunch of peeps with that already.
5.2
alright lemme check
5.3 changes something about the AWorldSettings of these partial maps from World Partition being replicated. They don't replicate them anymore now iirc.
So 5.3 might solve your problem.
i have a bunch of these warning:
[2023.09.18-10.13.36:279][910]LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: BP_AI_BaseCharacter_C /Game/Maps/Gameplay/LVL_Quarry/_Generated_/LVL_Quarry_MainGrid_L0_X-5_Y-7.LVL_Quarry:PersistentLevel.BP_AI_BaseCharacter_C_UAID_74563C37599FD9A801_1758789905, Channel: 181
[2023.09.18-10.13.36:313][912]LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: WorldSettings /Game/Maps/Gameplay/LVL_Quarry/_Generated_/LVL_Quarry_MainGrid_L0_X-5_Y-7.LVL_Quarry:PersistentLevel.WorldSettings, Channel: 182
[2023.09.18-10.13.36:313][912]LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: WorldSettings /Game/Maps/Gameplay/LVL_Quarry/_Generated_/LVL_Quarry_MainGrid_L1_X-3_Y-4.LVL_Quarry:PersistentLevel.WorldSettings, Channel: 183
Yop
so that would eventually be fixed with 5.3?
I haven't heard back from anyone yet that had the issue and updated, but I got told there is something in the patch notes that touches this
Not directly saying if that's fixing any bugs though
hello guys, for some reason, dedicated server (my local network on my windows machine) is running smoothly for windows clients but when I try to load the game on my android device, it seems like it is not loading the level
interesting, is there anything i can do in 5.2, since we need to wait for some plugins to be updated to 5.3 (wwise mainly)
Not to my knowledge
damn.. but thanks for the help anyway!
Please don't spam in capslock. You just posted your question. Be patient and wait.
logs
Log looks fine
Any logs about the connection attempt from the Android one?
Both server and client side
thank you for ur response. How do I get that?
The Server logs are on your screenshot I assume.
The Android ones not sure. Haven't worked with Android in a while. There must be some folder they are in
Given you deployed DevEditor and not Shipping
This log is project server package in Win64
I did the same thing with a test project and it worked perfectly well
Also please note the level loads when i open it on my windows machine
Those mean that either client didnt have the packaged replicated Actor loaded but server tried to replicate one anyways, or the class of Actor to spaen was unknown to thd client, which could happen if client unloaded the class but didnt notify server, so server still had its NetGUID in list of Ack'ed guids for that clients connection
Seing WorldSettings actor there is a little odd
Anyhow, those warnings are not hoing to crash the client
yeah that's odd indeed
Its also what holds your world partition config
and well it doesn't crash the client, but @thin stratus suggested that these warning could eventually lead to the final crash that occurs once the client tries to leave the match
and there the client fails when checking the world setting..
At this point
You could change that function to pull the world settimgs from outer level
If first read fails
That's an Engine Internal function
I would just check if 5.3 fixes it
Before doctoring around
After all they address this partially in their patch notes
Could also check what they do with the WorldSettings to stop them from replicating for this case and mimic that change if one can make a custom WorldSettings class maybe
Has anyone ran into an issue where your character on your client and server appear normal but on another client as a simulated proxy your character mesh goes into the ground?
yeah same, we are not using source engine atm..
still super annyoing, but thanks for the help, really appreciate it 🙏🏻
No, but you are probably doing stuff with the capsule
Yeah I am changing the size of the capsule but I am also adjusting the mesh location.
Can i use On Initialized event in widget on a multiplayer game?
Because when i use on initialized event with Hello print on a client, all clients print Hello for all other clients
As example while there are 3 clients, each of them print 3 times (Total 9)
I dont know is it safe or optimized to use in Multiplayer game?
If you adjust the MeshLocation you have to actively save the offset iirc
FNetworkPredictionData_Client_Character* ClientData = GetPredictionData_Client_Character();
if (ClientData)
{
ClientData->MeshTranslationOffset += FVector(0.f, 0.f, MeshAdjust);
ClientData->OriginalMeshTranslationOffset = ClientData->MeshTranslationOffset;
}
That stuff for example
The Event has nothing to do with that though. You might be creating the Widget on everyone by mistake
Character also has code for the Initial MeshOffset. Might also be relevant.
void ACharacter::OnStartCrouch( float HeightAdjust, float ScaledHeightAdjust )
{
RecalculateBaseEyeHeight();
const ACharacter* DefaultChar = GetDefault<ACharacter>(GetClass());
if (Mesh && DefaultChar->Mesh)
{
FVector& MeshRelativeLocation = Mesh->GetRelativeLocation_DirectMutable();
MeshRelativeLocation.Z = DefaultChar->Mesh->GetRelativeLocation().Z + HeightAdjust;
BaseTranslationOffset.Z = MeshRelativeLocation.Z; <<<<<<<<<<<<<<<<<<<<<<<<<<
}
else
{
BaseTranslationOffset.Z = DefaultChar->BaseTranslationOffset.Z + HeightAdjust; <<<<<<<<<<<<<<<<<<<<<
}
K2_OnStartCrouch(HeightAdjust, ScaledHeightAdjust);
}
Yes, everyone has the widget. But in 3 client game, everyone must print 1 time (Total 3). It is working right when i use Construct event. It runs on only owning client. But when i use Initialized event, one client prints for all clients. Its like that:
Again, you might be creating it on every for everyone
Maybe you don't call the AddToViewport for everyone
But you are creating it
Show the involved code
And where is that Component added to?
Then the BeginPlay will call for every player for every pawn
You are creating it 9 times
What does the CanExecuteCosmeticEvents do?
There is some code that I want to run even if I don't add the widget to the screen so im trying to initialized event but its weird
If you only want to do this locally, then you can't use BeginPlay
There are some functions in widget and i want to run these when i created the widget. I shouldnt have to add to viewport. Construct event runs only when i add it to something
I mean, I didn't say anything about that
I said:
- You are creating Widgets on all Players for all Players cause you are running this on BeginPlay.
- You seem to only run AddToViewport on the local Players
This will result in Initialize to call 9 times and Construct to call 3 times.
If you want to use Initialize and you want this to only call 3 times, then create the Widgets only locally
And for that you need a different event.
Thanks for help, i will think about it
Hmm ok. I was testing with a custom movement but I can replace the movement with Crouch() and I get the same outcome. I will look more into some of the snippets you posted. Thanks
@sinful tree hey man, you got me into thinking yesterday and made me understand multiplayer so much better now, i have just one more question, How should i replicate when i use savefiles? as example i want every player to load his savefile on his computer
Do i need to run on server or what do i need to do?
How can I set a property replication to go to specific clients? ie, I have a "team" that should all receive the rep events but no one else. Is RepGraph the simpilist way or can I do it through property rep conditions?
Any time you need to send data to the server, you'd need to use a Run On Server event with inputs included on it.
Just be aware that you can't trust clients and you need to validate what you can on the server. Any data you allow a client to send to the server could potentially be spoofed (eg. a player can easily send to the server and say that they're level 9000, have 1 bajillion hit points etc.). If you don't really care about cheating then it's a bit of a moot point, but be aware of what data you do send, and limit what data you can trust from a client.
ahh okay
No, RepGraph is by far not the simplest way
yea i mean its gonna be a coop game for fun, if someone cheats in it they can ruin the game for themselfes, but i run the save/load on the server than
A better way is to have something like an ATeamState : public AInfo actor
But i run the save on onwing client no?
And then overriding IsNetRelevantFor
On the PlayerState of each player you can have an ATeamState variable and in the IsNetRelevantFor function of the TeamState you can check if the Actor is set on the PlayerState
You can split the Data that only a specific Team should see and the Data that everyone should see into two different Objects fwiw
There is also COND_NetGroup
If you're wanting to handle saving on the client, then you would save when you know you're running on the client. It doesn't necessarily mean the server has to tell the client to save, you can have the client save whenever.
Not sure I used that before though
Think COND_NetGroup can't be used on properties though
Ohhh okay okay thanks
@unborn nimbus
/**
* Manage the membership of subobject's replicated with a COND_NetGroup condition.
* For a COND_NetGroup subobject to be replicated to a connection, they both need to be part of the same netcondition group.
* A netcondition group is simply an FName.
* This manager holds onto the groups the subobject is a part of, while the connection's player controller is
* where we hold information on the user's groups.
*
* Groups are inclusive and non-binding so subobject's can be part of multiple groups at the same time.
* As long as a player is a member of one of the subobject's group, that subobject will be replicated to that connection.
*/
class FNetConditionGroupManager
I have never used this, but maybe you can use that inside the TeamState with Subobjects
Or something like that
(sounds pretty cool tbh)
const FName NetGroup = NetGroups[i];
if (UE::Net::NetGroupOwner == NetGroup)
{
bCanReplicateToClient = ConditionMap[COND_OwnerOnly];
}
else if (UE::Net::NetGroupReplay == NetGroup)
{
bCanReplicateToClient = ConditionMap[COND_ReplayOnly];
}
else
{
bCanReplicateToClient = Connection->PlayerController->IsMemberOfNetConditionGroup(NetGroup);
}
/** Returns true if the player controller is a member of the netcondition group */
bool IsMemberOfNetConditionGroup(FName NetGroup) const
{
return NetConditionGroups.Find(NetGroup) != INDEX_NONE;
}
So in theory @unborn nimbus , you could have some SubObject be registered to a Group (E.g. "TeamOne") and put a player into that Group via APlayerController::IncludeInNetConditionGroup(FName NetGroup)
If would suggest maybe using GameplayTags as they can resolve to FName just fine iirc
Makes it easier to tag a team :P
If I find the time I will try this and write something about this on my page. But probably not gonna happen anytime soon.
If not you, then @fathom aspen. If he wants to slack, then @pallid mesa.
This is my vote.
I would vote James as well, but he still owes us a FInstancedStruct blog post 😠
Does FInstancedStruct need a blog post though
Maybe not for us - but for beginners, yes.
Hm okay. Didn't know it was that complex.
It's not. But knowing how to actually use it could throw beginners in for a loop.
Yeah I guess. Still gonna be a tiny post :D
Even if you only know basic syntax for C++, it can be a bit difficult to actually parse the code on how you're supposed to use it and all that.
// Define FInstancedStruct
FInstanceStruct MyStructContainer;
// Init with Struct that this InstancedStruct should represent
MyStructContainer.InitializeAs<FMyStruct>();
// Get the Mutable Data from it and modify it
FMyStruct& InstanceData = MyStructContainer.GetMutable<FMyStruct>();
InstanceData.SomeValue = 42;
// Sample function
SomeFunction(MyStructContainer);
int32 SomeFunction(const FInstanceStruct& SomeStructContainer)
{
// Get the inner Struct again, needs to know the Type
const FMyStruct& InstanceData = SomeStructContainer.Get<FMyStruct>();
return InstanceData.SomeValue;
}
That's more or less the gist of it or not
Awesome, thanks!
I don't even do it like that exactly. I have been using the MakeStruct<>() method. Like, otherwise I've been doing it the same.
Got it, you tend for my long ass articles more than you do for @pallid mesa 's shorties 
Yeah idk, I learned it that way and didn't have the time to see if there are other ways
Been using FInstancedStruct and instanced UObjects excessively the last weeks/months.
do you ever use structs by value anymore or always instanced now?
Of course I use normal structs
But whenever I can turn something into using InstancedStructs I usually do that
It's mostly for situations where I have some Object that has a generic Init function with some data
And the child classes need different data
Then I use an Instanced struct
Makes sense
that was meaaaan
Get roasted ducko
hi hi is there somone here That can help wil a replication problem i have Im learning To Make MP BP's but im struggling with a basic part code
Begin play -> is locally controlled? -> no -> hide
tried this before okay
tried it but idk if I can test it on same machine should I test it on exe on server maybe
This is for debuggin Do but this is the main problem with my Code
If the client Tells It to destroy actor Nothing happens But if the server dosE it wil happen
This isn't why they do it that way, not even remotely. Evaluating animation is slow and they have a very limited performance budget - the amount of data needed to store gameplay-relevant bone transforms over a short period is irrelevant compared to the cost of calculating them in the first place.
You want to watch https://www.youtube.com/watch?v=GO6MIboHDiY which goes over their technique.
Replicated Actors are only destroyable by the Server
Your code doesn't make much sense tbh
What Actor are you getting there with the GetActorOfClass?
Depending what Actor that is, you can't perform any RPCs in it
Due to Ownership
E.g. an Actor in the Scene won't allow for Server or ClientRPCs
And since your Health is already replicated, there is no need to Multicast the change (and it also shouldn't be multicasted, since health is a state)
Thanks, ye i saw it and forgot about it lol 😄
hello, I have a question that's been bogging my mind for weeks. Let's say I have a Character with a character movement component. And I want to add running input to it's implemented reconciliation system ? I've tried sending and rpc when player presses shift but it doesn't look like a goodpractice and it completely destroys the purpose of client sided reconciliation
i dont get it when ii call these function my game locks (it dose not breake) but i cant get out on the input modes
tested not working
I saw others widgets
That is only possible via C++
yes but like how would I add that extra reconciled data to the existing character movement component
or is that not a thing ?
Bottom most one is kinda wrong or?
yeah thats changed*
It is, by making a Child Class of the CMC
And adding loads of boilerplate code
We have a Git Repo pinned to this Channel
That has some examples
Whicih one are you referring to or is it all of them ?
You should be able to use the Normal just fine, as long as you do the same math with it in the same Timestamp
It might, but very small corrections are totally fine once in a while
The degree of tolerancy is like sqrt(3) or so
In position
Again, you should be able to do that just fine
I created a mimic of the CMC a few years ago for a hover drone that can drive on all walls and ceilings
It works fine
The corrections are really not big. It will only be bad if your corrections aren't properly handled
bool UCharacterMovementComponent::ServerExceedsAllowablePositionError(float ClientTimeStamp, float DeltaTime, const FVector& Accel, const FVector& ClientWorldLocation, const FVector& RelativeClientLocation, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode)
{
// Check for disagreement in movement mode
const uint8 CurrentPackedMovementMode = PackNetworkMovementMode();
if (CurrentPackedMovementMode != ClientMovementMode)
{
// Consider this a major correction, see SendClientAdjustment()
bNetworkLargeClientCorrection = true;
return true;
}
const FVector LocDiff = UpdatedComponent->GetComponentLocation() - ClientWorldLocation;
const AGameNetworkManager* GameNetworkManager = (const AGameNetworkManager*)(AGameNetworkManager::StaticClass()->GetDefaultObject());
if (GameNetworkManager->ExceedsAllowablePositionError(LocDiff))
{
bNetworkLargeClientCorrection |= (LocDiff.SizeSquared() > FMath::Square(NetworkLargeClientCorrectionDistance));
return true;
}
return false;
}
bool AGameNetworkManager::ExceedsAllowablePositionError(FVector LocDiff) const
{
return (LocDiff | LocDiff) > GetDefault<AGameNetworkManager>(GetClass())->MAXPOSITIONERRORSQUARED;
}
MAXPOSITIONERRORSQUARED = 3.0f;
So yeah, the tiniest offset will trigger it
And you won't notice or see it due to smoothing of the Mesh and replaying of saved moves
Unless your reconciliation is bad
Depends on what you are doing based off of the normal
If you utilized SavedMoves etc. properly, then it should be fine
As long as you do your code inside of the CMC's functions that are in sync due to Timestamps and executed on server and client, you can do whatever you want
That's also why JumpPads don't need to be predicted
Cause the client and server step on it in the same timestamp
No. If you want to avoid corrections you'll need to ensure that Server and Client Moves on the same Timestamp result in the same End Location
And that a Client can replay the moves it made between correction and whatever it is doing now properly
If you had to guess, what would your approach be to modify jump to have a custom arc?
A forced one?
Yeah, something with a bit of hang time at the apex or whatever
I would suggest you to look into RootMotionSources
GameplayAbilities have nodes for them, but they are not locked to GAS at all
You can expose them to normal BPs
There are versions for Jumps with custom Curves for the Arc
And if you properly supply them with the same values on Server and Client and you fwiw Flush Server Moves before executing them, they will be properly synced
I had thought to maybe make gravity dependent on velocity in the PhysFalling code but that smells like integration errors to me
We'll look at RootMotionSources
I wouldn't bother with that if all you need is a fixed jump ark
We use that for all sorts of Jump Abilities
in CMC land are you still falling, just modified by root motion?
or is it a custom movement mode
You can provide it with a MovementMode of choice
struct FRootMotionSource_JumpForce : public FRootMotionSource
UPROPERTY()
FRotator Rotation;
UPROPERTY()
float Distance;
UPROPERTY()
float Height;
UPROPERTY()
bool bDisableTimeout;
UPROPERTY()
TObjectPtr<UCurveVector> PathOffsetCurve;
UPROPERTY()
TObjectPtr<UCurveFloat> TimeMappingCurve;
FVector SavedHalfwayLocation;
Check UAbilityTask_ApplyRootMotionJumpForce for an implementation example
I think you usually just leave whatever MovementMode you have
You just have to use one in general, cause something has to tick the RootMotion
Is there a better way to check if a player state is the local player's other than checking the PS->PC against the local PC?
HasLocalNetOwner?
maybe anyone of you can help me ... im trying to build a nice RPC Connection between my C# Server and multiple Unreal instances. Sadly i want to send RPCs both ways and i cant figure out how to do that. Has anyone of you a good idea of a good library that could help me ?
is there a way to replicate uobject contained by another uobject? guess only way to do it from parent actorcomponent?
So I'm having this issue where my line trace refuses to interact with any collision component of the player. https://blueprintue.com/blueprint/ny3blr3a/
Any ideas where I'm going wrong?
Is there a way to check if the local process is a listen server?
Looking for a blueprint node.
There is no node, but there is a combination of nodes:
IsServer && !IsDedicatedServer && !IsStandalone
You can make your own blueprint utility function, so you don't need to do it everytime
Ah then there is no need for all I said
Yeah then use IsNetMode
I thought you had no access to cpp
Yeeeah, just was weirded out there wasn't blueprint node for it already
Nah I just had to walk my buddy through it after trying to find the node for a while
how could you get the same values on both server and client😭
What channel are you tracing? BPUE doesn't show that well
I guess you could forward the code that collects the UObject to your outer UObject to collect the inner one?
So you want to build a socket connection and send packages?
Can someone tell me if microsoft playfab is more cost effective than aws services ?
Yeah UObjects lack that functionality, only actors and actor components has. Dug a bit of code and found out even actor component AddReplicatedSubObject is redirecting it to Actor so I think correct solution is just keep track it over the actor owning the UObject.
Is there a delegate/event(BP) for when GameState does replicate to clients? I believe it's possible to get null from GetGameState on Actor::BeginPlay on clients, right?
Yeah Actor's are the only ones that ultimately can do this. But you can also try to forward the call with your own function that you call from the ActorComponent one
Or call the own of Owner being ActorComponent
BeginPlay of the GameState (:
And no you can't get null on BeginPlay of other Actors when getting the GameState
Cause it's the one triggering the BeginPlay
You'd probably need to open both pricing pages and compare
Ultimately they both will take all your savings
Another issue I am having now is; replication of a newly created object. I have array of objects, aka "Status Effects" and I want to notify client when a new one is added, so i can show it on UI. But calling a Client_StatusEffectAdded function right afterwards makes it pointer null, if I wait for a second or so using timer it works, is there a way to know when an object is replicated?
how to give tag to a player in 2
is it viable to do for indie team on tight budget if the game is paid and costs like 15 dollars ?
If you don't have a shit ton of money, a server system that lets players host their own games is probably favourable.
hey guys 😊
is there a common practice what to do with the character while stuff is still loading? do you freeze and hide it or something like that?
I want to possess our character to the pawn I spawned in my Unreal Engine 5 C++ project. There is no problem on the server side, but the code I wrote on the client side does not work.
Don't posses the pawn on the client at all.
The server does it and notifies you.
You should also do !IsValid(Pawn) not !Pawn.
That goes for all uobjects you aren't sure are valid.
Don't forget to check the pawn in the server function too, in case you call it somewhere else and forget the check. An extra check doesn't hurt.
You should also include error output if you pass an invalid pawn.
Silent failure is failure.
And it won't work at all if you aren't currently possessing the character on the client.
Is it common practice to have an owner property on components such as health stamina.. so you don't have to keep getting the owner every time you want to do some type of role checking etc?
Absolutely not. The owner value you already have is sufficient.
Casting is free in c++
No consequences
I was thinking I would have to call getOwner everytime unless I did that.
But you're saying it's perfectly fine to call getOwner every time I want to get the owner? I'm a bit confused
Ok
Honestly, it's fine. That's a micro-optimisation that is swapping memory size for a probably inlined function.
hm okay thanks. I was thinking if I was making an RTS had a bunch of characters calling getOwner everytime they want to update health it would lead to some issues
Rts games don't use characters.
Because they simply won't be fast enough.
If you want to make an rts game with any kind of scale, you may not even use actors.
Check out #cpp from an hour or two ago. Big discussion about it.
Thanks
Np. Good luck.
Hmm looks like Mass is an option but its experimental
yeah but i thijnk i found a good Solution in SignalR.
Enhanced input was experimental until 5.3. It really means nothing at this point. Epic just have a policy, if it goes beyond experimental, it has to work forever and for everything.
Thank you for the advice you gave. But I didn't understand what I should do. What do I need to do to make this possession process work?
like this?
Correct.
If that isn't working, there is an issue somewhere outside that function.
Like get controller is retuning null or something.
still isnt working
Or you're spawning the pawn on the client?
The pawn has to be spawned in the server.
i solved bro
thanks for all 
Np
Hi, I'm using this kind of function on my Input component for the Item to get the inventory component, as when i press the input, it should use the InventoryComponent to store the item. On the green picture I store the item on button press with the InventoryComponent. This is Enhanced Input stuff and i heard that the input happens only on locally. So now I'm little confused should the SetupEquipment -function happen only on the server and replicate the InventoryComponent?
As also on SetupEquipment function, i find the "New equippable to Store", which is the item I want to store. So in my mind it should be server function, even if the input stuff happens only locally
I'm trying to get animations for my multiplayer game. The servers pawn plays animations on server and client but the client's pawn only seems to play on the client and the server doesn't animate (although it does move)
Started looking into Iris, is it something you're meant to use alongside the replication graph or just another complete replacement?
Show where in your code your anim BP decides what to do
I bet you're driving your animations with inputs and not results
Seems like a replacement 
Got it, I'm not reaching this point as there is a validity check for the controller before entering this part
Which won't exist on the client, so it's exiting before getting here
That looks fine, just don't rely on anything but the pawn owner for this.
Is this correct for AnimationBlueprints as well? We had a problem regarding to an animation not playing upon an event dispatch from GameState from time to time. While debugging we ~~realized ~~ thought GameState was null on BlueprintInitializeAnimation so the event wasn't being able to be binded. Did we screw on the debugging part?
Anim blueprints aren't replicated afaik
So makes sense that they can initialize sooner
Any input events on the client are always on their own machine only, so if you want the server to do something based on that input event then you would need to do a run on server event.
Anything with manipulating replicated variables needs to happen on the server, but you don't necessarily want the client to be able to tell the server to do it as sometimes the server can do it on its own when it knows it should. If you do need to call an RPC to have the client to tell the server something, you shouldn't necessarily be extremely specific about things that you're allowing the client to tell the server. It's better to be generic "Move item from slot 1 to slot 2" than to be specific "Move 'item ref' to slot 2" and this usually also provides you with a better means of validating if the operation should proceed.
In your case, the "Server Store Equippable" function has two inputs so at any time you're effectively allowing a client to make that function call and input any values they want. If a client has reference to any replicated "equippable" that exists in the game currently, they could potentially call the server with this "Sever Store Equippable" function and pass through a reference to it, even if its potentially something they don't own themselves (like it could be in another player's inventory potentially).
Blueprint Initialize Animation doesn't quite sound like BeginPlay 🙃
Hey guys, I have a bit of a strange situation... I have an actor that generates heightmap data, and then builds a procedural mesh using the heightmap. The BuildMesh() function uses some parameters which are stored in the GameState. Because procedural meshes dont replicate, I'm using a repnotify so that when the heightmap data changes, the clients call BuildMesh() locally, which is all fine.
The problem is that when clients join the server, and the actors are replicated to them (triggering the BuildMesh function), often the GameState hasnt initialised for them leading to a crash. I'm wondering if theres a good solution to this? I could just duplicate the params or set a timer which calls BuildMesh again once the gamestate is loaded, but these all seem rather inelegant...
Oh well for now I created a queue system on the player which waits for initialization of everything then triggers all the queued build requests, but if you have any better suggestions let me know 😅
Use the game state's begin play
hey guys, im hoping someone here can explain client travel to me. So in my game, I have a dedicated server that server loads a map, and when the clients connect they client travel to the server address. Is this supposed to also load the map the server is on? Or am i supposed to load the map a different way? Currently clients are able to join the session but they're not loading the server map, they're loading the default map which is the main menu. Any help will be appreciated 🙂
I do use that to start spawning the actors, but on connecting clients those actors still replicate before their version of the gamestate has initialised
Actor replication order isn't guaranteed. You have to keep that in mind when writing multiplayer code ^^
GameState's BeginPlay: Call an event in a game instance, a subsystem, whatever makes more sense to you, let's call it OnGameStateBegunPlay
Other actors that need the game state:
- If the game state is null (hasn't replicated) or hasn't begun play, have them bind to
OnGameStateBegunPlay - If the game state is valid and has begun play (
HasActorBegunPlay()), just call the function you'd bind otherwise
Hi! i'm using UObjects for my inventory items, i'm seeing UObjects replication and it seems a mess, am i shooting on the foot if i use a RPC to fake replication whenever there's an item change and handle all on the server? (no* security is not a problem)
Edit: justs saw the new replication system for subobjects and it's way simplier and straightforward
confused about the use of SetNetAddressable(), when should I use that in my C++ code when replicating components?
Guys! I need a hand about multi system. The animation blend spaces what i made doesn't work in listen server. Do someone know smth about it?
Yoyo dudes quick question. I wanna try out how the game loads my characters stats when loading in. for example player A plays with his save file and player B joins with his save files. Now i have the problem that it keeps loading up the same save file on both windows and idk how to make it that each one loads his own one
try to set the load event on replicate on owning client Maby that works ?
@soft flare
Nono thats not what i mean
it saves the files with say name "save1"
and no matter wich client tries to load, it loads the file save1
mmmm
Yeaa im to noob for that 2 then i gues
Im stuck a little bit 2 ant its the last ting i need
Im a little bit stuck here Becos this is on owning clinet call but i want to destroy the actor on both sides
if there is somone here that can help me perheps? Im streaming now on twitch IF you are abble to help Username on twitch = Killercknl
Whats an efficient way if I want to create an ability for clients to detect hidden actors based on a radius?
For example a hidden trap door that a large sphere collision client component will make visible when overlapped but is it efficient to use sphere collision?
It all depend on the type of game But if its not like Minecraft redius style I woul prefed Spehere i ghues But its prefrenc how you want the radius to be @stable grotto
And i ghues the best way would be when overlap collision yes abilety
When end overlap Disable abil
Just make a Bool branch the event En youre good to go
thing is I'm worried about collision being on tick and want to see if there are any other efficient ways to do it especially if the actor spawns and is not static in level
Hu collisions on tick ? Its a register event right so it only triggers when you colide with the borders
Hello, does anyone have experience with seamless travel? I'm trying to seamless travel between worlds, and in my player state I have a TObjectPtr with a UPROPERTY which is essentially a UObject I create to save some dynamic data, however anytime I seamless travel I get an ensure that is saying that the UObject is not garbage collected. How should I handle the object if I need it throughout the whole game session (not during the seamless travel though)?
Put it on a game instance subclass
Or simpyl use a game instance subclass instead of your uobject (make it a game instance subclass)
It is then not replicated, so that's a consideration for MP.
I think there's a way to copy data from one playerstate to another after travel.
I have no idea how that works, though.
You'd probalny need to rename the uobject (in c++) to change ownership of it to teh new playerstate.
Or just create a new one.
Nevermind, I was wrong 😛 The UObject I was working with had outer set to the current world, which made it not GC or something. Not assigning the outer (i.e. leaving it /Engine/Transient) doesn't make the ensure to trigger, and everything works
The only problem is that it's impossible to get the world using that object, but there are other works around for that
Little question : condition repnotify initial is recalled everytime an actor enter/re-enter net relevancy, right ?
Should be.
Hi guys, can we replicate uObject?
yes, trough c++ there is some work to do with interface.
Yeap, we can, here's an article describing everything you need to know https://jambax.co.uk/replicating-uobjects/
Thanks
Hi I am working through a Udemy course but am not sure what I am doing wrong,
The issue : When i Crouch on the server it crouches on the server but when i take control of a client and press crouch it affects the server AND the client.
This is the logic for the crouch function
this is when we call the server function
As you can see the button press makes the client and server crouch, Anyone help please? 🙂
Probably has to do with how you're initializing the component with its "As BP BaseCharacter" variable.
Is that in the Crouch function? Thank you for the reply.
This is how im initializing the Base Character reference.
I,ve been trying to use Actor Components more and more so i put all the movement functions inside a Component Named ADMovementComponent and added it to the BaseCharacter.
I got tired of keep redoing all the Input Actions and Context Mappings so I thought I could do it this way and reuse the component but i think it,s causing issues with the server/client communication
This is the component i added
So the crouch function is inside that.
I also enabled Replication for the Component (Sorry for the spam just trying to give as much info as possible)
Is this course you're working on supposed to be about multiplayer?
I'm curious as if this is what they gave you as an example of what to do on begin play of anything in multiplayer, I'd ask for a refund.
hey guys, im hoping someone here can explain client travel to me. So in my game, I have a dedicated server that server loads a map, and when the clients connect they client travel to the server address. Is this supposed to also load the map the server is on? Or am i supposed to load the map a different way? Currently clients are able to join the session but they're not loading the server map, they're loading the default map which is the main menu. Any help will be appreciated 🙂
-
You can't properly use "Get Player X by Index" in multiplayer reliably, especially when running on the server. Instead, your component should probably "Get Owner" and cast that to your character class instead, assuming this component is attached to your character. To get the player controller, you should be able to take your cast and use a "Get Controller" from the and then cast that to Player Controller.
-
Begin Play fires on both the server copy and the client copy of the component. So if this component is attached to your character, when a new character is spawned, the begin play for that particular character will fire on both the client and the server, even if it's the server character or the client character, it'll trigger on both still, so then you're basically executing this code twice on both the server and client, once for each character. For at least the input mapping context, you only want that happening if the character is the one that is locally controlled. You could do this by checking if the As BP Base Character "Is Locally Controlled".
-
There's no point in check if something is valid immediately after casting. If the cast succeeds it'll be valid.
When you connect to a server, the client should automatically be loading the map the server is on. By the sounds of it, the client may be failing to join the server. Check the logs.
@sinful tree Thanks for the replys I had to restart my machine windows updates... I,ll have to read through your reply and I guessed that Hardcasting to the player might be a bad idea I,ll transfer all the input actions i have in the component to the main character blueprint so i dont need to cast to it.
Ahh i,ll try the Get Owner first that kind of makes sense.
Omg your reply makes a lot of sense and a great deal of explanation, Thank you so much !
And yup the code inside the component is executing twice as you stated. 🙂
@Datura Thank you so much for that reply I am at the exact same point in the video now, Where they have clients replicating crouch animations correctly but the server isnt replicating to the clients but I think hes going to explain that next.
And you was 100% correct with the Get Owner and Get Controller.
how to hide widget component for other players in game ? tried these but not workijng
output is still this I see ui of another 😄
i wanna somehow hide it
solved
Anyone know why a client might not receive ONDESTROY message when the server destroys an actor? It fires successfully about 90% of the time.
Show your code, are you multicasting something when the actor is destroyed?
No multicasting, the setup is so simple I can describe it. At BEGINPLAY, we Bind Event to OnDestroyed. The server destroys the actor (from some damage). The Clients run the event 90% of the time.
Am I at least correct that clients should be getting the OnDestroy message every time.
Ah I get it now. Thank you
I guess you could say that they should. I would suggest you use EndPlay instead as an Event, similar to BeginPlay. There can be more reasons the Actor is removed than being destroyed.
Thanks that's a good answer
Does anyone know what the difference between PhysWalking and PhysNavWalking is?
Oh I didn't know what a Nav Mesh was. But that kinda makes sense.
It's used for AIs and iirc it's mainly used to ensure the AI is literally stuck to the NavMesh.
Hello!
Does anyone have any tips for having different idle animations on the client vs server?
does somebody knows a solution for this'
just check if you are in client or server
In the ABP?
I dont know so much, but you have this nodes
some branch maybe?
Animations are driven locally. So there shouldn't be any need to check if client or server
If you're idle, just let the ABP pick a random idle animation.
It would be no different than if the game was single player in this case
There are some cases where you want animations to be different depending on if it's the controlling user or other users viewing the character
That's true in my case, anyways
And the animation is still driven locally.
You replicate data to the character and the ABP gets its information from that to drive itself
In this case - they just wanted a random idle animation, not other parameters. So you just build it like you would a single player game.
I'm confused by your response. Random idle animation? I want a specific idle animation to play for the client and I want a different idle animation to be playing for other players
Oh - I read that wrong. Apologies.
No prob
You want to check if pawn is locally controlled then
Hey guys, are using the voxel plugin and show a loading screen until the world is loaded. If a new client joins, the other players can already see and attack the joining client. Is there a common way to delay spawn a joining client?
let the client request when they've loaded the game, spawn them
most simple way
Avoid loading the last save game file, and make more than one save file. The idea is to make each window select the save itself, so that each game instance can use on a separate save.
As for the first part, you essentially will need to use different names for the save files, like SaveFile_0, SaveFile_1 etc. As for the second part, you would need to not automatically load a save file, but display a widget containing a list of button like 0, 1, 2 etc; clicking on a button would tell the save system to load a certain file, afterwards the game would work exactly the same. Make sure to remember the loaded save file, so that you know which one you have to write data in.
As for the packaged games, make sure to either manually remove the selection widget, or make it always select save 0 without even displaying. Perhaps you would need to think more about on this part. 😛
is it possible to do that with blueprints? to save different savegames with different names?
Yep
That's what the "Slot Name" input is for. That's basically the name that will be used for the file that gets created.
how to create that for every client, in debuggin mode where I test locally a multiplayer
the player index is always 0, for every window that opens
doesnt matter it is PIE or standalone
Hey all! How would i go about setting up save information for dedicated servers? Would i have all of the clients save their info on separate save games on the hosts pc only, and load it when they log back onto the server?
Yoyo dudes, i have a actor that moves with "move component to" but its super stuttery for clients, any idea?
it also faces the player with a "set world rotation" wich is stuttering aswell
Probably because it's only updating the client every so often, so it's lagging behind the server and updating every 5 frames or whatever, so teleports.
You could, instead of relying on transform replication, turn that off and run everything on the client as well as the server? Idk how people do this normally, but there's definitely some interpolating and client simulation invovled.
You mean by multicast?
The rotation, for instance, you can not replicate and set locally, right? That's just always looking at the player. You don't need to send that information over the network at all.
Movement is harder.
The event tick does this
the randomizing does it on the server aswell but the Mc fires off for all clients
and he moves smoothly now
Thanks ❤️
When exactly should i use Mc?
for movements aswell?
i heared u should only mc on animations and mesh changes etc
MC is... not something you should really use all that often.
Honestly I don't know the best solution for your situation.
MC Spam can be part of the problem. Multicasts are not supposed to be the end-all-be-all do the networking thing. They are a tool to broadcast one-off events to any clients that have the actor relevant.
Movement is a change of state, which means that it should be getting handled VIA a replicated variable or in this case, it could just be that the movement just needs to happen on the server and if the actor is replicated I believe the moving of the component would be replicated. If component movement is replicated and you're moving on all that means the server's updates would supersede whatever is being done on the client, causing jittery movement.
Add to the problem here, you're multicasting and calling "Random Float In Range" and plugging that into the Z location? So then on every screen it'd be moving to a different Z location.
Try moving it only on the server, see if it replicates. If it doesn't, try enabling replication on the component you're trying to move. If that's still failing, then MoveComponentTo is not the appropriate solution.
Movement should mostly be getting done on the server. You can have clients interpolate movements too, but it wouldn't be done through a multicast
I have a dediated server up and running on my local machin, so whenever i try to connect a client with it it connects but there's already a map opened on that server(does thta mean theres already a session created on that server?) how can i just simply connect client with it and no map opening.
So what node should i use instead of move component to?
Im using it bcz im making a flying enemy
what i did now is moving the function form the parent to the child and now for some reason it started beeing kinda smooth again(im confused but i take it)
this good or im dumb?
well it still stutters...
someone hmu if he can go quick dc call, im not spammin yall i just keep trying until i go to sleep
i finally solved it omg
If anyone else has problems with your pointers not being assigned properly from Begin Play on clients, I have noticed UE doesnt wait for a controller to be assigned to run the Begin Play event. I have made a macro that is in my opinion, necessary to deal with any of these odd issues. This is also useful when needing the playerState as that is also not assigned until after the controller is assigned so using onPossessed may not be sufficient to get a pointer to your playerState. If anyone has better insight on this please feel free to correct me; these are just my observations/results
Is it a bad practice to override the IsNetRelevantFor for despawned actors? (I keep them in the server for a future respawn, no point to replicate them to client until they are respawned)
Far better off putting them into dormancy
Thanks
It's more about knowing what events to use to properly handle when certain things happen. Begin Play is basically the place where a the thing is spawned, but that doesn't mean all the pointers it needs have been replicated to clients yet. Pawns have a function that gets called on clients when their controller changes, NotifyControllerChanged, which would be a good time to know on a client when their controlled character gets possessed by their controller.
is that exposed to BPs?
Sadly no. A lot of useful stuff for multiplayer isn't
That is annoying, so what would be the BP solution?
To expose it to blueprints yourself.
I know it's a lame answer, but that would be the best solution, and saves you from having to do that delay check :/
Wouldnt just using a RepNotify function/variable work as well? I usually set the player controller pointer to repnotify to tell the client to do UI stuff. I suppose all are 'solutions'
Technically it could, but that's just replicating something that's already being replicated - An example, would be that characters already get a reference to their controller (if its the owning client of course) so why replicate a pointer to their player controller if they're already going to be getting one? Again, a function exists for that OnRep in a Character too, OnRep_Controller(), but it's just not exposed to blueprints.
how can i estimate how network intensive would be having 5000 players shooting at each others?
Have 1 player shoot. See how intensive that is. Multiply it by 5000.
is it that simple? don't projectiles have a bunch of parameters like travel distance and more?
Are you making your own server from scratch?
Because that's nowhere near anything Unreal Engine can handle 
do you mean unreal in general? or just the multiplayer system?
In multiplayer
Insanely intensive
You probably wouldn't even reach 200
How often do they shoot and how many players are close enough to care about the shot?
Every player you add will add another player shooting AND another player who needs to know about what's happening. So it scales worse than linearly. If every player cares, then it's 25,000,000 x as intensive as one player
i dont have anything but what would happen if they were in a 2000m radius and some projectiles reach 800m and some 2000m?
There's a reason nobody has done this. It's basically impossible.
With very very clever programming you could maybe get 1000 people
it all depends on how much data needs to fly around
Not without heavy engine modifications
Doubt even Iris would help in that case
Its not even worth pursuing. The level of optimization required to even get to 500 players would likely dictate the removal of any actual gameplay, making the "game" unplayable anyway.
EVE Online is typing........
you can do a lot with a 1 hz tick rate
lol
no lol
Purpose built proprietary engines are not part of this discussion.
His question was in relation to unreal.
I remember tech demos and the like where they had thousands of live players
In battles
So of course its do-able
If thats literally what your engine is built for
But Unreal isnt
Do I have to setup port forwarding to use dedicated servers on EOS? I’m struggling with figuring out how to connect to a server without doing port forwarding on other machines… do I have to use something like playfab for this or would eos work?
What's a safe way of teleporting in multiplayer and overriding the character's rotation?
If I teleport a player via:
this->TeleportTo(DestLocation, FRotator::ZeroRotator, false, false);
The server character rotates (to face zero), but a connected client overrides the rotation because the camera and I presume therefore the player controller stomps on the teleport rotation.
You need to set their ControlRotation
Makes sense, thanks. I shall give it a shot.
how would i switch from having client prediction to waiting for the server's calculated movement for a player's movement and have that be changed whilst in game?
Have listen servers changed at some point in unreal 5? Can't get any to work for a prototype
Opening the level via the in game console with ?listen on the end for the host opens the level
and then 'open {ip}' for the client doesn't result in a connection even locally using public ipv4
have you setup portforwarding for 7777 when using your public ipv4 locally?
Only thing ive not been able to verify thanks to my router logging me in, automatically logging me out then saying it cant log me in cause im already logged in... Guess ill get to restarting my router to unfuck it haha
lol nice. Should still work with localhost ip without forwarding tho, tried?
y'know, thats really fking obvious and i hate its taken soemone telling me to realise it, god i shouldnt dev at 2am LMAO
I cant possibly imagine anything more fun than debugging for hours at 2am without any hope of actually reaching some progression 💯 🍻
Yeah, i know I need to try and get nat p2p working via EOS anyway for this so ill probably just leave it to that and leave myself as a test case 
Hi guys, I'm relatively new here. First, I have this function in UI_Auction, to update items to the auction. UI_Auction is a child of UI_Main.
Then I'm trying to pass the data from the GameMode to the PlayerController, which handles the UI, which can be seen here.
But it gets the variable note as you can see above.
What did I do wrong?
What data are you trying to pass from the GameMode?
What is the goal here?
Also, just saying "it gets the variable note as you can see above." tells us nothing.
Yeah we can see it says "NOTE", but we dont know what thats even complaining about.
If you hover over it, it will tell you.
Paraphrasing Errors or Warnings doesnt help. Be very specific.
If you see an error or warning (or note), tell us exactly what it says.
Sorry @fossil spoke the note is this.
Does refreshing the node remove that?
Its not obvious why it would be complaiing about that.
Also what isnt working here?
The data isn't passed from the server to the UI.
That is what isn't working.
Ok, where is your RPC down to the Client?
Your images are so small its extremely hard to tell
This is from the PC (which handles the UI) to the UI.
And this is from the server to the PC.
I'm relatively new so what is the typical way to do the RPC?
GetControlledPawn??
Do you see why thats wrong?
Please dont say INTPlayerController is a Pawn...
Enlighten me.
GetControlledPawn returns a Pawn.
If your UpdateAuction interface function is implemented on a PlayerController.
But you are calling it on a Pawn?
I have an event node in my player class that executes on server and it takes an array parameter of a custom actor component class I created. When using the event node, there is a note on the bottom of it that states: No Value will be returned by reference. Does anyone know what would cause such a thing as well as a potential fix? The value its...
I'd just have a struct for your auction though.
But it doesn't work if I do this.
So why would you think it would work by using GetControlledPawn???
I see. So how do you normally do it?
I just don't want to cast it from one BP to another.
Why
It creates hard references.
Sure its a strong coupling, but is your intention then to use interfaces for everything?
Might have found your problem
You're making that interface call on the pawn
But expecting it on the controller
So it just goes nowhere
@dark edge Ive already explained that mate.
It works well for SP. I'm relatively new to the multiplayer though.
What is the normal way you guys do it?
Usage of Interfaces vs Casts (inheritance) hasnt got anything to do with SP or MP
Both have pros and cons
Enlighten me. I'm eager to learn.
Depending on the needs of what you are trying to build, an interface maybe an entire waste of time.
Where a simple function call on a specific type would be sufficient.
Which would require a cast somewhere.
There is nothing wrong with casting.
So what would you do in this case?
You would use an interface when your source doesnt care what the target type is, only that its expectation being it can handle the event
Can you explain in detail what the system is, where it exists and why?
In short, you want a cast
So there is no abiguity as to where the implementation exists.
Do you anticipate any other class from handling this operation from that call site?
Assuming CurrentAuction is a global thing that everyone cares about, I'd have it as a replicated variable on GameState with repnotify (function that runs when it changes)
This would mean, no Interface, just a direct function call on the specific PlayerController blueprint.
Let's just say I have this simple deck with the data. How do you guys normally pass it to the player? I'm trying to learn more from the best, like you guys.
Its better for you to understand the fundamentals of particular features of OOP first before asking "what is the best way to implement this specific feature".
Like the difference between Casting (inheritance) and Interfaces
What they do and why you might want to use one over the other.
Convert what you currently have over to using a Cast and direct function call first.
So that you get it working.
There maybe other issues.
Let me test it. Thanks for the help @fossil spoke @dark edge. I have no experience regarding this so bear with me.
So I want to learn more about multiplayer. Where should I learn the industrial way of doing it?
Read the Pinned Messages in this channel.
Especially the Network Compendium
Read that twice
Also your request is like asking how long a piece of string is.
There isnt just a single place to "learn multiplayer".
You learn it over a great deal of time
Feature by feature
Understanding what Replication is.
What RPCs are.
And the many other facets of what makes up "multiplayer"
Start by reading the Network Compendium in the Pinned Messages.
Thanks @fossil spoke
By the way, is there any good sample of a complete multiplayer game to learn from?
Unreal Tournament
ShooterGame
Lyra
🤷
I feel however looking at those will only serve to confuse you further, given your level of experience is very low.
Since my goal is only make a simple multiplayer boardgame, what should be my best approach to this?
Research the specific things you need.
Read the compendium first
Read it a couple of times
It is an important resource
how do i make create and find/join session work in one button
i tried like this
but not working
not sure why that wouldn't work, you can try adding a small delay, maybe a delay just until the next tick and see if your result changes
some things don't like to be done on the same frame
oh ok i thought it would search for 100 results before creating a session will try
nope not working with delay
is there actually any verifiable results being returned?
i printed
even if there is no session it's going for success
you were suppose to try adding a delay to on success
success finding session ? but there isn't an existing session
isn't it supposed to go failrue
bro add a delay to on success from the find session node
still the same
Hi, Where can i write a dedicated server's logic? like level change and handling multiple players and their movements? Which class should i choose and where can i write all this logic?
Has anyone tried to integrate UE4GameLiftClientSDK? When i add the plugin and the regenerate the vs code files, it's throwing an error saying the name PublicLibraryPaths doesn't exist in the current context in plugin/clientSDK/cognito.build.cs
Are you trying to use it with UE5?
That's not how you do it in Unreal. You don't write a dedicated servers logic in one place.
Can you explain me a bit more im totally new to it?
Theres literally nothing on internet regarding this
Dedicated server logic is what source does, right?
Forget everything you know about Source and Unity.
You just put your logic in whatever class you are using and check if you're on a server or client at the appropriate time.
Okay so how can i communicate between server and client?
i was studying about rpc and used some of them but didnt get any clue whether they are getting executed on server or not
like how can i put logs on server?
Have you read all teh pinned messages in this channel?
No, let me go through them
The game mode class is server-only, though. But that can't be used for everything.
I am able to connect with my dedicated server using open level function but dont know how to implement multiplayer game a bit confused where to start but im going through the pinned messages hope will find answers
In Unreal you won't usually be making a server-only class and client classes. You make a class, and certain functionality within it is server or client or both
Thanks
Can you recommend a good resource on multiplayer gun firing and death in terms of understandability?
Just to understand it,
Lets say I have a car, to manipulate the values of it as player character I will need to have RPC from the player character blueprints accessing the vehicle pawn right? cuz if he isnt the server it will not give him the option to do so
You need the RPC functions on your player character.
Where you call them from doesn't matter.
Hey there!
Is anyone familiar with the Pause logic in the default APlayerController class?
I'm scratching my head over the implementation Epic made as it raises many questions.
So APlayerController has a function like so:
/** Replicate pause request to the server */ UFUNCTION(reliable, server, WithValidation) void ServerPause();
The purpose of this function is to call the the SetPause() function like so:
void APlayerController::ServerPause_Implementation() { SetPause(!IsPaused()); }
Currently, this method has a _Validate counterpart as well, which goes like this:
bool APlayerController::ServerPause_Validate() { #if UE_BUILD_SHIPPING // Don't let clients remotely pause the game in shipping builds. return IsLocalController(); #else return true; #endif }
So basically, if you're running a shipping build, and you are calling this on a client player controller (which means that IsLocalController will return false on server-side), this validate function will kick you out of the game because you're not calling ServerPause() on a server player controller. So this raises a couple of questions:
- First, if you need to call this on a server player controller, how on earth are you supposed to do that on client-side, given the fact that you only see your local controllers and nothing else
- Second, if I were to RPC a pause request in my own method over to the server so the server can find a local controller on his side, on which it can call ServerPause(), what the hell is the purpose of the Server rpc then? It could be a simple function call without RPCs as we are already on server side.. and we can't just call this server RPC on the client because of the 1st point i've mentioned..
- Lastly, how is this even acceptable on dedicated servers? As far as I know, dedicated servers have no local player controllers, meaning, no server PCs.. how do you pause there?
Is Epic's intention to overwrite the ServerPause_Implementation and _Validate functions?
Also as an extra note, why the limitation on ServerPause, why can't it be called on client PCs?
One additional note: I know there's a SetPause function already that we can use for whatever we want, but Epic was kind enough to let us know that we should call ServerPause to pause a networked game (indicated by their comment above SetPause)
/** * Locally try to pause game (call serverpause to pause network game); returns success indicator. Calls GameModeBase's SetPause(). * @return true if succeeded to pause */ virtual bool SetPause(bool bPause, FCanUnpause CanUnpauseDelegate = FCanUnpause());
@humble wadi Things like these are mostly remnants from Epic making an Engine for UT.
They don't want Clients to Pause the game or request a Pause.
If you want to allow that, feel free to make an RPC or override this one.
I assume the idea behind it is mostly that the RPC should work in Test and DevEditor Builds, for debugging mostly I assume.
Lastly, how is this even acceptable on dedicated servers? As far as I know, dedicated servers have no local player controllers, meaning, no server PCs.. how do you pause there?
Well, you just don't call the RPC and pause with SetPause on the Server directly.
DedicatedServer has PlayerControllers of each player.
All it does is this:
bool APlayerController::SetPause( bool bPause, FCanUnpause CanUnpauseDelegate)
{
bool bResult = false;
if (GetNetMode() != NM_Client)
{
AGameModeBase* const GameMode = GetWorld()->GetAuthGameMode();
if (GameMode != nullptr)
{
bool bCurrentPauseState = IsPaused();
if (bPause && !bCurrentPauseState)
{
// Pause gamepad rumbling too if needed
bResult = GameMode->SetPause(this, CanUnpauseDelegate);
if (AWorldSettings* WorldSettings = GetWorldSettings())
{
WorldSettings->ForceNetUpdate();
}
}
else if (!bPause && bCurrentPauseState)
{
bResult = GameMode->ClearPause();
}
}
}
return bResult;
}
So you could just call SetPause on the GameMode directly fwiw
ForceNetUpdate on the WorldSettings might have some reason
But either way, just calling SetPause on the First of any PlayerController should be fine
Ah yeah the WorldSettings hold which player caused the pausing
bool AGameModeBase::SetPause(APlayerController* PC, FCanUnpause CanUnpauseDelegate /*= FCanUnpause()*/)
{
if (AllowPausing(PC))
{
// Add it for querying
Pausers.Add(CanUnpauseDelegate);
// Let the first one in "own" the pause state
AWorldSettings * WorldSettings = GetWorldSettings();
if (WorldSettings->GetPauserPlayerState() == nullptr)
{
WorldSettings->SetPauserPlayerState(PC->PlayerState);
}
return true;
}
return false;
}
But yeah, the WorldSettings seem to actually drive the Pause state. So if that PlayerState is set, it will pause.
I guess a DedicatedServer without players is not pausable.
// If paused, PlayerState of person pausing the game.
UPROPERTY(transient, replicated)
TObjectPtr<class APlayerState> PauserPlayerState;
any way to make unreal multiplayer in a blueprint game?
You can start with Multiplayer in Blueprints, but depending on your Game you will sooner or later hit the wall and need to use C++ or a Plugin that exposes whatever you need to BPs.
Multiplayer in UE is too complex to be done solely in Blueprints. Some simple games will work just fine though I guess.
Really depends on what you try to accomplish.
so what i whant to do is to let other player's join a player's game
There should be quite a lot of tutorials and resources about this. The general gist of it is:
-
If you want Players to join via IP, you can do that via the
ExecuteConsoleCommandnode, where you have to put inopenfollowed by the IP and Port. -
E.g.
open 127.0.0.1:7777. 7777 being the default port. The hosting player will be required to open their 7777 port on their router in this setup. -
The hosting Player will need to call
OpenLevelwith the Level of your choice andlistenin the options field. -
If you want Players to join via a Server List, you will need to use the
CreateSession,JoinSession,FindSessionsandDestroySessionnodes. -
The hosting Player would need to call
CreateSessionbefore callingOpenLevelwith the Level of your choice andlistenin the options field. -
The searching Player/Client needs to call
FindSessionsfollowed byJoinSessionif a Session was found. -
JoinSessionwill take care of actually opening the hosts level
The Session solution will by default only work in LAN. It uses #online-subsystems , where you'd need to, in the future, choose one that suits your platform.
An example would be Steam. Without that you can't host/find/join Sessions online.
In addition, the Session nodes that UE offers are very limited. Sessions usually allow to actually provide some settings to display or filter by.
That requires either C++ or the use of a Plugin (e.g. Advanced Sessions).
Thank you for answering. Yes, we thought about overriding it but were unable to reason with their decision with the "Validate" function. Sure we can use the SetPause as i've said but the comment they've added makes this especially confusing given the fact that the whole RPC thing there will disconnect the client. The ForceNetUpdate thingy seems to be there because the moment you pause the game it seems all replication stops as well, so they just sneakily force in a net update that'll be dispatched before everything pauses so clients will get the replicated "PasuerPlayerStatate" on their end.
Makes sense yeah
I can tell you that after 8 or so years, I stopped to reason with stuff in UE
Ignore the Validate/RPC part if you don't need it to work that way
UE has tons more of code that makes no sense for you to discover :D
hey somebody got a guide how to handle persistent data (Player Location, Abilities, attributes etc.) with playfab?
The Login is working... now how can i handle persistence?
greetings Eric
You send data to PlayFab and load it again back. This is more a question for PlayFab's Community
well first i need to get how i can handle persistent data in unreal.... its like i should save players location in every tick?
then send it to the DB?
I wouldn't do that every frame. That's potentially multiple times per second.
Sending it at a fixed rate that serves your game should be enough
That's more a question of what the requirements are for your game. How far back are you willing to accept players would be rolled back if there is a server failure before the most recent save is done? Players won't care so much about exact frame precision of their character location, but they would be infuriated to lose that legendary item they may have just picked up that they've been waiting for months to get. So then it really all depends on what you're saving and how important it is should dictate how often you may save it to an external database. I second Cedric in that you wouldn't necessarily want to save every single frame, so you can rely on event driven approaches to save, like any time the player's inventory is changed, or timed approaches like every minute or so to save their location or any other details that aren't extremely significant that a player could easily shrug off, or not even notice, if they lost a bit of progress. Again, it all depends on what and how long you're willing to accept that they get rolled back in case of a failure.
One would likely save any unsaved data about a player when they're leaving or had been disconnected from the server too.
thats how i want to do it. and i need to research how to do that.
good to know 😄 thanks for the headsup 😄
When i leave/destroy a session, by default the player always travels back to the game default map, is there a way to override that? Since i would like to have a different game default map for starting the game and travel back after the player leaves a session?
okay nvm.. found the solution, by overriding return to main menu in the game instance cpp
Hey, i'm trying to create a private lobby and the host have to be able to invite players, here is a part on session settings:
SessionSettings->bAllowJoinViaPresence = true;
SessionSettings->bShouldAdvertise = false;
SessionSettings->bAllowInvites = true;
bShouldAdvertise is false so FindSession can't see it. bAllowInvites and bAllowJoinViaPresence are true, but host can't send invite, any idea?
i believe that you need to set should advertise to true but set instead session hidden or so to true as well
ohhh maybe bAllowJoinInProgress to false, lemme try
working fine, thanks
You're welcome 🙂
also, can we change these settings we session is created?
it's been a while and I forgot, but how do you differentiate between client side players vs server side, including the listen server's local client? switching on authority to remote only works on really remote pawns, not for the server's own pawn
I guess I basically want autonomous proxies, but not sure how to check for it
Usually IsLocallyControlled
You have to be careful to call it after the pawn is controlled tho
Tips and tricks article goes over how to filter for owning client execution paths
ah! that sounds like it
ok yeah that was it, I couldn't for the life of me remember that one 🙂
There is also a C++ only function(eventually I'll make a PR to expose it to BP) where you can check if the actor has an owning client or even if the owning client is local to this machine
HasNetOwner & HasLocalNetOwner for checking if it has ownership
To get the owner you just use GetOwner
Hey guys, on my GameMode blueprint class, I have this teaming system that basically puts pawns into two separate arrays. For some reason, it's not replicating to other clients and I'm unsure why. Before calling "Create Teams" in the first linked blueprint, I set up a RPC so the RPC_Server is ran on the sever and RPC_Client is set to multicast. Not sure why it's not replicating to other clients
this is sort of my first time messing with a multiplayer game, no clue why it's not replicating what pawn goes into what array
@gloomy axle The GameMode only exists on the Server
Therefore it wont have anything to Replicate to or call RPCs on.
You will want to move this functionality to the GameState instead.
yeppers, sorry i forgot to update this situation lol
How would I use custom replicate condition? The doc point to SetCustomIsActiveOverride(UObject* OwningObject, const uint16 RepIndex, const bool bIsActive) function but I found no example on how to use that function.
I tried to call it in PreReplicate but don't know what is RepIndex and what should I put in that parameter.
Hm, it seems when I try to set the properties of a client on the gamemode blueprint, it just doesnt happen
What do you mean by "set the properties of a client"?
Show what you're trying to do
Stop using the GameMode, the Client doesnt have a GameMode
Use the GameState.
Guys are there any good tutorial on youtube about a full multiplayer game?