#multiplayer
1 messages ยท Page 63 of 1
Will give it a try
guys quick question do I know mix array somehow? I have custom spawning but this for loop is checking playerstarts one by one in same direction every time so it will pick always first red and first blue, not if I will always mix it
how I can mix it ?
i dont want to delete them / my game has also respawn
then they will not be able to respawn
ooo shuffle
okay ths
thx
I have a replicated pawn I have attached a child actor component to, then i set the child actor class of that component to a replicated actor. When the server dynamically spawns the pawn using "Spawn Actor" everything works fine, but when I just have dragged the pawn onto the level about 50% of the time the child actor isn't visible to the players (but logging shows it is there from the servers perspective)
is there something about the loading order of the level where if the pawn loads before the players that the replicated child component isn't visible or something? any idea how to fix this, is very annoying for trying to test some behavior in PIE
@thin stratusDo you know if there's a way to disable CMC's root motion prediction easily? They didn't make a bool or something? ๐คฃ Trying to implement my own for a specific system and I think it's conflicting
Might try removing it from the move response container
Poor Cedric is going to get nightmares again over the CMC at this point lol.
I'm revoking my question, looking at it, its too.. integrated, I'm probably tackling what I'm doing the wrong way ๐
Also I tried to profile Iris just now, but honestly I have absolutely no clue what it's supposed to change. I don't see any real differences in my profiler (if anything Iris has some weird spikes(?)). But I can't tell if my profiling technique is just wrong, if I'm just stupid and perhaps didn't properly disable it again or something or just have a bad testing case ๐คทโโ๏ธ
Basically set up a scenario with a listen server and client and a thousand replicated actors with 2 properties being changed in tick.
Should just let it try and predict it instead of doing it myself, and just predict the stuff it doesn't do like motion warping vectors and the actual montage thats playing (which can, albeit rarely, get out of sync)
soo, i finally made a sucessfull connection to dedicated server through eos using two different machines... the lack of port forwarding was an issue and i didn't need a static ip address in the end... hopefully that would work with other machines with different internet connections.
EOS should definitely be taking care of the IP routing so yeah wont need static IP
#epic-online-services you might want this channel tho
now my question is how could i join a session as a group of players (something like in tarkov) lets say i invite 4 more players in the group, the group leader is the one who decide when we join the server. is that something that is difficult to implement with eos or is it supported already?
@grand kestrel is this still a EOS related question? i assume this is universal to how unreal handles connections?
Isn't this just lobbies?
sorry, just started with the whole multiplayer thing, still not 100% on point with the terminology.
I'll check it out, thank you for the hint.
smooth instant replays on lyra? hell yeah https://gyazo.com/a6f3a9d814d7a1a37111463aa0b0e7e4
I think this was an interesting experience
yeah hahaha
lyra has too many ensures
and ofc when you duplo the dynamic level collection all the gameplay features yell at you
so you need to be like suuuuper careful because some GFs react to the AddToWorld delegate
the way to differ from the replay world is that noone got a controller
a bit iffy but got it working nicely
๐ค
i love when you get crash/bug reports because someone was using a debug camera, too ๐
debug camera controller has no pawn
haha
this is the other way around
these pawns are treated like sim proxies
so no controller anywhere XD
I just set my viewtarget to the instigator pawn and interpolate rot and loc
rot is getbaseaimrotation
which is replicated and makes it onto the replay world (duplicated level)
so i had to override the camera component and the camera modes
Hmm why can't CMC handle a montage played from HandleImpact predictively, it just desyncs each time whether I do it via a local predicted GA or through Montage_Play
Super::HandleImpact(Hit, TimeSlice, MoveDelta);
UAnimMontage* Anim = TraversalAnimations.Last().Montage;
const UAnimInstance* AnimInstance = CharacterOwner->GetMesh()->GetAnimInstance();
if (!AnimInstance->IsAnyMontagePlaying())
{
bIsTraversing = true;
if (UAbilitySystemComponent* ASC = UAbilitySystemGlobals::Get().GetAbilitySystemComponentFromActor(GetOwner()))
{
const FGameplayTag Tag = FGameplayTag::RequestGameplayTag("Ability.Traversal");
ASC->TryActivateAbilitiesByTag(Tag.GetSingleTagContainer());
}
// AnimInstance->Montage_Play(Anim);
}
It handles it fine if it stems from an input
I must be missing something obvious
didn't succeed there either, if you find out lmk o>
I could make it caches the result then a "pretend" input applies it, but thats an awful hack
Is it.. like.. double prediction, where the HandleImpact is already predicted but then its predicting the root motion on top of it
@pallid mesa HandleImpact only sets bQueued to true, this doesn't desync
if (bQueued)
{
SetMovementMode(MOVE_Flying);
bIsTraversing = true;
if (UAbilitySystemComponent* ASC = UAbilitySystemGlobals::Get().GetAbilitySystemComponentFromActor(GetOwner()))
{
const FGameplayTag Tag = FGameplayTag::RequestGameplayTag("Ability.Traversal");
ASC->TryActivateAbilitiesByTag(Tag.GetSingleTagContainer());
}
}
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
Oh, well, I'm wrong, sometimes it does
Its a start
@pallid mesa Got it, just move SetMovementMode into the ability. Doesn't desync now
So the main thing is to remove it from the predicted loop into TickComponent
Finally, a way forward ๐
You could probably get away with SetTimerForNextTick within HandleImpact but I haven't tried yet
Hey Guys I'm stuck an I'm not sure where a better place to do this is. I'm creating a widget that is acting as my "main HUD" because its just like the master widget with all other health, score etc related widgets within, It works fine when create an add it to the viewport in BeginPlay of the controller class where I just guard it with a IsLocalController, my issue is when it comes to respawning, I'm trying to have my game mode handle creating a new pawn an calling unpossess an possess on the new one and then after I call posses in the game mode Im calling a client function on my player controller that is responsible hooking up the new pawns OnHealthChanged an other delegates, my issue is when I call it for clients (not listen server) the new APawn* newbodyI pass through is null for clients but not for the listen server. I assume it has to do with not replicating in time before i pass the pointer but im not sure. Here is the code an the Client_NotifyClientOfRespawn
void AMinion_GM_Base::RespawnPlayer(APlayerController* pc)
{
if (IsValid(pc))
{
APawn* oldPawn = pc->GetPawn();
pc->UnPossess();
FTimerHandle respawnOnTimer_Timer;
TDelegate<void()> respawnLogicDelegate;
respawnLogicDelegate.BindLambda([this, pc, oldPawn]()
{
const FVector spawnLoc = FindStartLocation();
const FTransform spwnTrans = { FQuat::Identity, spawnLoc };
FActorSpawnParameters spawnParams;
spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
APawn* newbody = GetWorld()->SpawnActor<APawn>(minionPlayerSubC, spwnTrans);
if (newbody)
{
pc->Possess(newbody);
oldPawn->Destroy();
if (AMinion_PlayerController* castPC = Cast<AMinion_PlayerController>(pc))
{
castPC->Client_NotifyClientOfRespawn(newbody);
}
}
});
GetWorld()->GetTimerManager().SetTimer(respawnOnTimer_Timer, respawnLogicDelegate, 5.0f, false);
}
}
Inside of the client function if comment out the code and print its current GetPawn() it should in theory be the new pawn I just possessed (which it is on the server) but not for the client, the server is clearly aware of the new pawn an possession before the client is, clearly I need to move where this is being done but im not sure where to move it to
the RPC will arrive before the NewBody Actor replicates
so the argument it carries cannot be resolved on clients
I'm unsure of where this is "suppose" to be done
there is AController::SetPawn function, virtual and runs both from server after possess and on clients after OnRep_Pawn
you should use it to wire your logic there
thanks, ill try that
this will work for local client only btw
as the others don't have the player controller involved in this respawn
So it wont work for a listen server? sorry im just new
it works fine for the server
as it has all the player controllers
and for local client, as it has the PC for which you're doing the respawning
on other clients though, that SetPawn won't run as there is no instance of the PlayerController for which the pawn is being set present
Oh okay, I understand I think
but as your client RPC is failing, and it runs only on local player involved
SetPawn should do just fine
that function is also a good place to bind various delegates... etc. that need to be bound on both server and client
Is it normal for this to be called so many times?
where do all the cool kids put their UI updating logic for new pawns? im struggling, lowkey about to set a .5 second timer to update after possession an call it a day hahaahh
you can just call a function/event on the HUD from there (on local client)
or broadcast a delegate HUD listens to, same difference
if your HUD has a c++ base, PC has OnPawnReceived delegate (if i recall the name right) that would also work, but its not dynamic
Yeah it was the right place I was looking for, I just did a few checks with a cached pointer to ensure it didnt make multi huds. Thanks heaps for the help I really appreciate it
void AMinion_PlayerController::SetPawn(APawn* InPawn)
{
Super::SetPawn(InPawn);
if (IsLocalController() && InPawn && InPawn != currentPossessedPawn)
{
currentPossessedPawn = InPawn;
Client_NotifyClientOfRespawn(currentPossessedPawn.Get());
}
}
thanks i did same way like this but for some reason its not working need to find problem i dont see any bar
it looks like on the start of game its loaded but immediately get deleted
ah found problem my pawn is not valid weird
I have a PC that has temporary ownership of a server Pawn... setting ownership to the PC works... what when I want to remove ownership what would be the right way?
SetOwner(nullptr)
Careful though as posession/unpossession also messes with the owner
I don't possess the vehicles, only rerouting inputs
My player pawn is stuttering on the client, i profiled with Unreal insights and im only sending a couple bytes so it shouldn't be latency. Anyone got a clue what it could be?
An actual pawn or a character?
Character
Please at least say that you're calling EnableInput and handling the controls in the vehicle and not actually rerouting them through the controller or pawn?
Did you modify specific parts? Unless you perhaps turned emulation settings on by accident or modified things it definitely shouldn't stutter. Also how are you adding the input to the character?
yep ๐
You guys don't make a big web of code going to random actors to just get input somewhere? /s ๐
It drives me nuts when people put controls in their controller, just to store a reference to something and call custom inputs. ๐ฌ
I'm going to be honest with you, when I started with Unreal at some point I did something like this in the absolute worst possible way. I had a pawn that received input and I needed it on a different actor. So what I did was I created a method for every single input I needed on that pawn and then inside the body of that I called the appropriate function on that actor ๐ ๐
Unreal has definitely been a journey so far lol.
Also as a disclaimer, no this was years ago I definitely don't do this any more.
I have a question Multiplayer Join Session I have a vehicle and character blueprint setup it works fine in 2 windows without joining session but when you create and join the session it does not update the collision
Yeah. I had a few small arguments over that with people who somehow think that enable input is bad. Like.. You're doing the same thing! Just in a worse way!
Collision state should probably be replicated instead of multicast.
Vori ๐๐ป is there anything additional to implementing animation budget allocator, I've got it turned on I can see in the console log, I have skeletal mesh component budgeted as my character meshes, set to auto register, but it never actually kicks on... [i have it set to 0.1) just to see it kick on and even with an army of characters it never does
You can start with unreals tutorial series, they are pretty decent although there are mistakes there https://www.youtube.com/watch?v=abmzWUWxy1U&list=PLZlv_N0_O1gYqSlbGQVKsRg6fpxWndZqZ
In this video we take a look at the finished project and step through each of the features that will be covered in this series. We show our functional Main Menu and its options, a lobby where players can chat with one another and select their characters for the game, some server options such as changing the map or match time as well as the abili...
thanks
I'm trying to add a teleport type movement to my character that is already moving with character movement component, I'm currently using this and it works like 90% of the time but sometimes just failes. With mem breakpoints it looks like my teleport function passes but then character movement component error correction teleports me back to the starting loc
The CMC already handles* the teleporting / position replication, you don't want to multicast the teleport but instead just let the server deal with it. Although not entirely sure why you end up back at the first position unless you're using client authoritative movement.
Also the * is because I believe it doesn't handle predicting teleportation by default on the client, so it will very likely end up in getting corrected for the client. But I may be wrong on that one, someone else may know ๐
Client authorative movement is disabled for my cmc and running the event server only results in no tp :/
1> Creating library C:\Unreal Projects\ProjectVR\Intermediate\Build\Win64\UnrealEditor\Development\ProjectVR\UnrealEditor-ProjectVR.suppressed.lib and object C:\Unreal Projects\ProjectVR\Intermediate\Build\Win64\UnrealEditor\Development\ProjectVR\UnrealEditor-ProjectVR.suppressed.exp
1>PlayerPawn.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl APlayerPawn::Client_MoveRight_Implementation(void)" (?Client_MoveRight_Implementation@APlayerPawn@@UEAAXXZ)
1>PlayerPawn.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl APlayerPawn::Client_MoveRight_Implementation(void)" (?Client_MoveRight_Implementation@APlayerPawn@@UEAAXXZ)
Wtf are these scary looking errors
These are both not checked in the movement component?
yup
What exactly are you trying to do?
UPROPERTY()
FVector NewLocation;
//Movement
void APlayerPawn::Server_MoveForward_Implementation(float AxisValue)
{
//MovementDirection.X = FMath::Clamp(AxisValue, -1.0f, 1.0f);
if (Controller != nullptr && AxisValue != 0.f)
{
const FRotator Rotation(0.f, HeadCamera->GetComponentRotation().Yaw, 0.f);
NewLocation = GetActorLocation() + FRotationMatrix(Rotation).GetUnitAxis(EAxis::X) * AxisValue * MovementSpeed;
SetActorLocation(NewLocation);
UE_LOG(LogTemp, Warning, TEXT("%f"), AxisValue);
Client_MoveForward();
}
}
void APlayerPawn::Client_MoveForward()
{
SetActorLocation(NewLocation);
}
What do your character's replication settings look like?
Is client move forward a RPC?
You're missing the _Implementation part in the declaration then.
Ah fuck me how did I miss that ty
๐
Just gave it a try with this simple setup. Works just fine for me, maybe try quickly creating a new character and see if that one does work I guess?
Also it does not actually say it fails to teleport in your logs right? Just making sure ๐
Try comparing the two and see what's different I guess, I'm not entirely sure at this point my self what exactly might mess it up. Worst case you could try rebuilding your character with the new one and see if it still works or breaks at some point.
Well.. Yes, that pretty much answers it lol.
They forgot another few settings
Just make client fully authorative, ignore checks on server
whatever problem you were experiencing, is fixed now! ๐
I mean depending on your game it might be better IMO as you don't have to deal with first of all complicated net code, then also packet loss becomes like essentially no issue and interactions in general may feel a lot better (bumping into others for example). But there are definitely some downsides to it and it's absolutely not right for all projects either.
@clever hound using replication there does not guarantee it reaches the client before that client rpc is called
you can send it in the client rpc itself instead
Do you mean that I would calculate the NewLocation in the ClientRPC and then use the SetActorLocation() in serverRPC
no, in the server rpc, the place where you are setting NewLocation and calling the client rpc, you send that as a function parameter : Client_MoveForward(NewLocation)
stupid questions time: if i spawn actor only on the server, but set it to replicate, does it get "spawned-via-replication" on simulated proxies too? (assuming it is NetRelevant)
It gets replicated to all that are relevant yes. If anything that's the only way to do it as a client doesn't have the authority to spawn a replicated actor (will just spawn it locally for them).
thanks, i tend to have weird ass questions that consfuse google, it really helps when Real People answer โค๏ธ
UFUNCTION(Client, Reliable)
void Client_MoveForward(FVector NewLocation);```
```cpp
//Movement
void APlayerPawn::Server_MoveForward_Implementation(float AxisValue)
{
//MovementDirection.X = FMath::Clamp(AxisValue, -1.0f, 1.0f);
if (Controller != nullptr && AxisValue != 0.f)
{
const FRotator Rotation(0.f, HeadCamera->GetComponentRotation().Yaw, 0.f);
NewLocation = GetActorLocation() + FRotationMatrix(Rotation).GetUnitAxis(EAxis::X) * AxisValue * MovementSpeed;
SetActorLocation(NewLocation);
UE_LOG(LogTemp, Warning, TEXT("%f"), AxisValue);
Client_MoveForward(NewLocation);
UE_LOG(LogTemp, Warning, TEXT("%s"), *NewLocation.ToString());
}
}
void APlayerPawn::Client_MoveForward_Implementation(FVector NewLocation)
{
UE_LOG(LogTemp, Warning, TEXT("%s"), *NewLocation.ToString());
SetActorLocation(NewLocation);
}
I might be just stupid because I still dont get it
is the value not the same?
should be
or close atleast
also you're missing FVector there
you put it in the declaration on the header file (.h), but not the implementation (.cpp)
1>C:\Unreal Projects\ProjectVR\Source\ProjectVR\PlayerPawn.h(83): error : Function parameter: 'NewLocation' cannot be defined in 'Client_MoveForward' as it is already defined in scope 'APlayerPawn' (shadowing is not allowed)
Would absolutely recommend trying to 'practice' that though, it's an absolutely invaluable skill to know how to find answers on Google as an example. There's not always going to be an answer in here for everything, people do other stuff too. But a lot of the time there are also entire (sometimes even better) answers out there on for example the docs ๐
yes you are missing FVector there
Fixed that. I tried both
in that .cpp function
void APlayerPawn::Client_MoveForward_Implementation(FVector NewLocation) this?
yep
its there
Got that after it
You already have a member variable with that name. You can't do that.
Give the RPC variable name a different name ๐
oh yea thats right
you have a "global" variable called NewLocation and also a local one with the same name
yeah i do try to google all the time, usually though some things turns out i confuse/commingle two things and google is completely lost too
UPROPERTY()
FVector NewClientLocation;```
```cpp
//Movement
//Movement
void APlayerPawn::Server_MoveForward_Implementation(float AxisValue)
{
//MovementDirection.X = FMath::Clamp(AxisValue, -1.0f, 1.0f);
if (Controller != nullptr && AxisValue != 0.f)
{
const FRotator Rotation(0.f, HeadCamera->GetComponentRotation().Yaw, 0.f);
const FVector NewLocation = GetActorLocation() + FRotationMatrix(Rotation).GetUnitAxis(EAxis::X) * AxisValue * MovementSpeed;
SetActorLocation(NewLocation);
UE_LOG(LogTemp, Warning, TEXT("%f"), AxisValue);
FVector NewClientLocation = NewLocation;
Client_MoveForward(NewClientLocation);
UE_LOG(LogTemp, Warning, TEXT("%s"), *NewLocation.ToString());
}
}
void APlayerPawn::Client_MoveForward_Implementation(FVector NewClientLocation)
{
UE_LOG(LogTemp, Warning, TEXT("%s"), *NewLocation.ToString());
SetActorLocation(NewClientLocation);
}
๐ค ๐ค ๐ค ๐ค ๐ค ๐ค ๐ค Idk maaan this is so weird that it still does not want to work
I made the NewLocation "const FVector"
you're using NewLocation in your UE_LOG
@clever hound Don't let your NewClientLocation
UPROPERTY()
FVector NewClientLocation;
```and
```cpp
void APlayerPawn::Client_MoveForward_Implementation(FVector NewClientLocation)
```have the same name.
I think you want to print the parameter instead
How could i "sync" up autonomous proxy spawned grenade actor to a server one? (obviously keeping the server one authoritative) Or is this a path to jank and tears and/or tons of interpolation and I should just rely on server spawning one and hope for the best (it would look kinda goofy because we have tons of players that play from US on EU servers and vice versa)
That too.
but also yes, you'll have the same problem with that code, 2 variables with the same name
Would it be smarter then to just replicate the variable with virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override Or would it cost too much ?
replicating does not guarantee it will arrive before that client rpc is called
the client rpc could be called but the new value may not have been replicated yet
if you want to use replicated variables you'd remove the client rpc and use rep notifies instead
//Movement
void APlayerPawn::Server_MoveForward_Implementation(float AxisValue)
{
//MovementDirection.X = FMath::Clamp(AxisValue, -1.0f, 1.0f);
if (Controller != nullptr && AxisValue != 0.f)
{
const FRotator Rotation(0.f, HeadCamera->GetComponentRotation().Yaw, 0.f);
Location1 = GetActorLocation() + FRotationMatrix(Rotation).GetUnitAxis(EAxis::X) * AxisValue * MovementSpeed;
SetActorLocation(Location1);
UE_LOG(LogTemp, Warning, TEXT("%f"), AxisValue);
FVector Location2 = Location1;
Client_MoveForward(Location2);
UE_LOG(LogTemp, Warning, TEXT("%s"), *Location1.ToString());
}
}
void APlayerPawn::Client_MoveForward_Implementation(FVector Location2)
{
UE_LOG(LogTemp, Warning, TEXT("%s"), *Location2.ToString());
SetActorLocation(Location2);
}
UPROPERTY()
FVector Location1;
UFUNCTION(Client, Reliable)
void Client_MoveForward(FVector Location2);```
But how does the Location 1 value turn into location 2 then
It's a bit of a pain honestly because of latency. The problem is if you don't predict the autonomous grenade then it's going to lag potentially behind quite a lot because the server needs to spawn the actor and then also replicate it (which may not necessarily happen directly) + of course whatever latency applies to that. The general concept I believe I've seen used is to spawn a local version for the person who threw it and then just have the server spawn a replicated actor but not replicate it to them (except perhaps the explosion?) and then have the server just explode it whenever you want to keep authority. But tbh most games have a horrible grenade throw system regardless because of this, there's always going to be the problem that a different client gets less time to react to the explosion than whoever threw it because of latency.
I believe there's also a video about a GDC talk from Bungie (creators of Halo) where they discuss some of this stuff somewhere in the channel pins.
im mostly worried about issues of "my grenade bounced off the tree to the left on the client but it went right on the server"
You actually sync them up tbh
What do you mean by that?
You're assigning location1 to location2 and passing that to the RPC. Not quite sure what the problem / question with that is ๐
Iirc you throw the local one and tell the Server when. With the Latency in mind, the Server would spawn the Grenade where the Client's version currently is and test everything in between with a traces.
Once the Server version replicates to the Client, you hook them up and remove the predicted one
disregard that, that was about your previous problem
Something something, Unreal Tournament
That really depends on your design though as this is giving even less reaction time to other people if you're spawning it based on the thrower's 'location', maybe more accurate for the thrower but a lot less accurate for others.
But mine was not meant as a "this is THE way to go" ๐
it sounds like a bit of a nightmare
One person always loses this
i think a bit of an issue might come from the game being ported off HL2 and their weird netcode
@clever hound it seems you're misunderstanding some of the basics:
- Client RPCs are called from the server but executed on the client
- Server RPCs are usually called from the client but executed on the server
you can also call server rpc's on the server
but they will only be called on the server
I know that
in your code, on the server, you are calling a ClientRPC with a FVector as parameter, so you're sending that FVector value from server to client
We really want to improve overall performance, because the game is at least 64 player multiplayer, with tons of projectiles flying about, so i cant do crazy logic either
projectiles as in grenades and shells, not bullets
But if I can't get it from the server how do I make it happen then? Do I calculate the location on the Client_MoveForward() and call Server_MoveForward() inside that?
So it would be other way around. Would it have the same problem
I dont understand what you're trying to do, but usually when it comes to movement you do it on the client first then send a server rpc to do it on the server
I mean to be fair with that amount of players you're already quickly getting into more advanced topics regardless as that's a lot of players. Especially if it's "at least 64". At that point you're much better off profiling your networking and general performance.
Rather difficult for us to say what fits within your performance budget and what doesn't. Which depends on the implementation of things either way I suppose.
In scenario with no prediction and given that the grenade doesn't interact with other objects, would you consider pre-calculating the grenade movement in the server and sending it to the clients so that it is consistent?
I think it's probably best to just not predict those. At least not unless you really need to cause it visibly spawns too late. I would go from the pov of making it best for the local client who throws it
But this can get complex pretty quickly
UE I lacking a really good base implementation of predictively spawning actors and rewinding a set of actors
Yeah that makes sense
I see. I would say that generally speaking prediction for general use cases is difficult
The only system that I know with very good general purpose prediction would be deterministic lockstep rollbacks
Lockstep is absolutely not suitable for a whole lot of games though ๐
Yeah, and even if it was it would be a pain to develop
Hl2 uses rollbacks right
no idea, also rollback is a very wide term so sometimes I don't even know what they are referring to. I usually mean fight games-like rollback
Hello everyone, smol question if I may!
I recently starting to learn multiplayer.
I was wondering if blueprint interface events can't be used in multiplayer?
There are no replication options for them from what I understand, I just want to confirm. Thanks!
well, turns out im kinda re-making the "anything that isnt a bullet" system from the ground up, so im mostly just sitting on my ass and thinking about what would make sense and what wouldnt lol
and i dont really have much experience...so thats suboptimal xD
Hello!
Might be a noob question but im trying to understand the Anim graph and replication. My Walking and Running blendspace animation is replicated but not my Sprinting.
I created a anim instance cpp, created a bool for Sprinting so I am guessing that I need to manually replicate this across all clients somehow. But why not just use the wame Walk/Run blendspace for Sprinting? I currently have the walk/Run blended with an aiming upper body animation. I prefer the full body sprint like Fornite.
So my understanding to replicate my value across all clients I need to setup a few things in my header:
UPROPERTY(Replicated, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = "true"))
bool IsSprinting;
void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
Then in my cpp:
#include "Net/UnrealNetwork.h"
void UCustomAnimInstance::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(UCustomAnimInstance, IsSprinting);
}
Is that it or do I need to create a server_implementation and multicast functions as well?
Anim instances dont normally replicate
And they also shouldnt
Put you bIsSprinting in the character and replicate it there, then pull it into anim instance UpdateAnimation
Ah interesting, so if I set something like IsSprinting = Character->IsSprinting; in my UpdateAnimation. As long as my character variable is properly replicated, then it should sync up correctly with my anim instance?
Also to make sure im doing the replication correctly. I would then setup my character header like so:
UPROPERTY(Replicated))
bool IsSprinting;
void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
Then in my cpp:
#include "Net/UnrealNetwork.h"
void UCustomAnimInstance::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(UCustomAnimInstance, IsSprinting);
}
Would this be all I need or do I also need to include a On_REP, Server_Impl and or Multicast function?
I get al these 3 confused
Yes for replicating sprinting through charactet
No, mostly, for everything else you just asked
kk thx for the info, really appreciated ๐
For RPCs
2 functions need to be implemented, and subobject calling RPCs doesnt need to be replicated at all, only its actor doed
GetLocalFunctionCallspace and i think CallRemoteFunction
For server/client RPCs additionally actor owner needs to be owned by the player controller
For OnReps you need to use ReplicatedUsing and object itself, as well as its actor owner need to be replucated, and you need to declsre and define OnRep function
Hello! I'm looking for a way to read custom arguments when a client joins the server. I already do it for the host, but it's unclear how to do it for the client. I'm attaching an example of how I set arguments ๐
Pretty sure it's not possible from blueprints to retrieve those values for a client, they are stored inside a class that doesn't expose the variable (the net connection) to blueprints and the moments it gets passed on in the beginning in for example the game mode it does not seem to get passed on to blueprints either.
So you'll either need to use C++ for this or you'll need to use a different solution. You could for example RPC the data up to the server in the player controller, but definitely not ideal yeah :/
Isn't there a parse options node?
But how do you want to parse it when you can't access it from BPs?
Unless I'm just stupid I guess xD
Pretty sure you can. You do it in OnPostLogin or something like that. I can't recall exactly.
That's where the fun part begins, gamemode indeed has those parameters but does not pass them onto the BP events and the actual method is not a ufunction you can implement.
I just found it annoying, so I just RPC that stuff to the server, lol
I don't care. Co-op for the win.
Alleviates A LOT of stuff some people have to worry about, lol
It's pretty simple in C++ to access but it's really poorly exposed to BPs. As in just not.
Most things actually end up being pretty simple in C++ honestly. Considering most of the engine is opened up for you, lol.
Also I think this is the node you're talking about btw: https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/GameOptions/ParseOption/
Parse Option
But you need the FString for it. Which you can't get.
Also to be honest the only reason I know how to access it is because there was someone we spend half an hour searching with to find a way to grab that stupid connection string from C++ x)
I use it on server side in GameMode, but this won't work for Client
Okay, let's then refrase question
When my player joins server, the get join menu and I would like them to be able to customize some parameters, like color of their pawn.
I already made UI to select the value, and now I need to pass it from Client to Server when joined
I would just use the same way Durox just described, basically you temporarily save that data in somewhere like the game instance as that persists throughout world changes and then when you've joined the server you can send a RPC to the server with the data you want to send.
Yeah, true, but I wanted to prototype everything in Blueprint before moving to C++
Big downside of C++ that many times it makes engine crash, which consumes a lot of time
What I just described is completely possible in BPs ๐
I was just reading back your discussion, sorry ๐
That's dirty as hell, but will work for a start
If I ever get back to refactoring this, haha
Is there a way to create custom persistent actor?
I mean.. The engine is sometimes just not leaving you with a whole lot of choices when it comes to blueprints and multiplayer ๐
With C++ too at times I suppose, but that can be more easily solved with a source build.
I'm always thinking about ways to create more general tools to solve such problems
Actors aren't really meant to persist like this. There are "subsystems" however that have various life times, although I have absolutely no clue if they in specific exist in BPs.
But anything that persists data beyond a world change should work I suppose. As long as you can access it when you need the data again to send to the server.
Hello hello Slackers !
I am trying to understand how OnRepNotify works, but I can't get past the compiling when I am trying to implement the function in my .h file ๐ฆ
I am doing this :
TObjectPtr<UMaterialInterface> Material;
UFUNCTION()
void OnRep_MaterialUpdated();
yet this won't compile and it would say that external symbol is non resolved. I checked the naming and it seems fine :/ any idea ?
Show your compiler output ๐
Also I don't think there's much point in replicating a pointer to a material interface in the first place. But I could perhaps be wrong in that.
I am trying to set a material on an actor server side, and I want to replicate this to the client whenever the material would be updated ๐
I just succeeded compiling by adding
{
DOREPLIFETIME(AActor, Owner);
}
although I am not totally understanding why, and its not clearly said in the documentation why we need this
You should call the super on that btw, otherwise the actor it self isn't going to replicate properly.
The reason that method exists is so you can specify exactly how you want to replicate certain properties, there's more dynamic stuff to that if you need it as well but it basically just maps out what properties to use and how.
I see, thanks ๐
Can't run unreal now that I added this xD It will throw a assertion failed error at initialization hum/
Here is my chunk.cpp file :
{
UE_LOG(LogTemp, Log, TEXT("MATERIAL CHANGED"));
}
void AChunk::GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AActor, Owner);
}
.h file :
TObjectPtr<UMaterialInterface> Material;
UFUNCTION()
void OnRep_MaterialUpdated();
I totally did not look at what you were actually replicating in the DOREPLIFETIME, but you don't want to set the Owner in there. It's already being taken care of by the actual engine so need to do that your self. You would instead use whatever variable you made your self.
So for example:
DOREPLIFETIME(AChunk, Material);
oooh I understand, that makes sense
But I'm still not sure if Material will work honestly. Normally the way you do this stuff is by having a 'look up table' as I have seen it been named before. There's no reason to try and replicate entire objects most of the time like materials and a lot of objects don't even support this in the first place. The better way to do this is to replicate for example an ID or a name or whatever fits in that use case and then use that to find the material.
The thing is I am setting the Material from a manager that spawns the Actor. It does set the material, but server side only, I figured it would be only simpler to just replicate that material set to the client while setting it on the server
Well in this case you're only printing a message when the OnRep gets triggered. So it's indeed not going to do much else than printing that message ๐
that's... true lol
Hey guys,
Struggling to replicate my Sprinting bool. I want to use this bool for my animation instance to then control my sprinting animation across all clients. This is what I got so far in my Custom Character source file:
void ACustomCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ACustomCharacter, IsSprinting);
//DOREPLIFETIME(ACustomCharacter, bIsInAir);
}
void ACustomCharacter::OnRep_Sprinting()
{
if (IsLocallyControlled())
{
IsSprinting = CustomMovementComponent->Safe_bWantsToSprint;
}
}
void ACustomCharacter::SetSprinting(bool bNewSprinting )
{
IsSprinting = bNewSprinting;
ServerSetSprinting(bNewSprinting);
if (bNewSprinting) {
if (CustomMovementComponent) {
CustomMovementComponent->SprintPressed();
}
}
else {
if (CustomMovementComponent) {
CustomMovementComponent->SprintReleased();
}
}
}
void ACustomCharacter::ServerSetSprinting_Implementation(bool bNewSprinting) {
IsSprinting = bNewSprinting;
}
void ACustomCharacter::SprintPressed()
{
SetSprinting(true);
}
void ACustomCharacter::SprintReleased()
{
SetSprinting(false);
}
Its still not replicating and I dont understand what im missing
Even ChatGPT spit out a very similair output lol
I found that chatGPT gives a lot of times not complete informations, especially about replication stuff ๐
you need to remove the "IsLocallyControlled" part from the OnRep_Sprinting
ChatGPT has absolutely no concept of context when it comes to Unreal. It may be cool for general concepts to be explained or whatever but it's absolutely horrible for direct implementations.
I don't see why the entire IsLocallyControlled is needed in the first place. If you don't want it to be called on something that's for example locally controlled just skip the owner in the replication ๐
or use skip owner condition with DOREPLIFETIME
well I just added Mesh->SetMaterial(0, Material); inside my OnRep function, now the material is correctly set both client and server side ๐คทโโ๏ธ thats awesome, except you raised a good point and I don't really get why it's working
I guess the engine can link them up in this case through a net ID / name or whatever. But it's still advice in general, not everything will work like that. An example is dynamic materials for example, they don't replicate their properties when you do it like this and the entire thing it self doesn't even replicate either.
Is is possible to make an homing projectile work in a networked way?
I see, so ideally I would create a variable server side referring to the material, then ask for this variable from the client whenever needed ?
you mean replicated ?
It does replicate but only seem to apply the base speed of it and not the direction. I tried adding "replicate Movement" but the experience is terrible.
I guess it's fine in this specific case? But just depends. Not entirely sure what material does under the hood ๐
thanks for your help !
Replicate movement is a horrible experience in general yes, if you're not using any physics based actor it just directly sets the location etc. ๐
Or not using the character system*
Should I not use homing projectile and use my own predictive code maybe?
Because I just wanted to prototype something
I've not in specific used that, so I'm not sure what it does or doesn't do.
Oh wait I'm setting the target after the spawn so this part doesn't get replicated.
Ok it is working now! I'm setting the target as a Replicated variable that I pass to the Projectile and I set the homing target in the begin play.
Hey dudes. Any local multiplayer gurus out there? I'm using Create Local Players to spawn additional players (In GameMode) but I can only get it to spawn one additional player. When I add more it doesn't add a player 3 or 4. Anyone know why?
Sorry @honest rain need to correct a mistake I made here. In general there are objects that are perfectly fine to be used like the way you did it. This is because the engine basically knows how to find them because it maps it in a certain way and it's available on both the client and server, so for example your material it can find. I'm not 100% sure how much network overhead this has compared to a simple ID or whatever but that doesn't really matter for now I suppose. That being said there are definitely still a lot of scenarios where this isn't the case or where the properties of something may not replicate over the network. But wanted to correct my mistake here ๐
If you're interested here's some more info: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Actors/Properties/ObjectReferences/
Same controller ID i'd guess
Isn't that the point of using -1? To get the next available id?
well no matter what it's supposed to do, sure as shit that worked. I just assigned them to 1, 2 and 3 and that worked
Hello folks, is there any tutorial, guide, docs about how to handle desync issues? I am testing my netcode with network emulation and everything is wrong if I have 200 ms. Any help is appreciated! Thanks!
What's the general shape of your netcode? You doing any prediction stuff?
Well I am at ultra mega beginning stage, changing a flipbook's animaton (paper2D) to another one. Sure all is fine at 0ms but when it is <0ms, host instantly changes animation but delayed on client side while when client changes its animation it is delayed too but host sees the change first.
Basically "what am I doing with my life" stage of things.
I wonder how I can delay the host's flipbook change trigger on its own side according to the lag, while making client's change delayed for host.
Basic desync shenanigans 
I think I might be screwing up the replication of my bool. I removed the LocalController I had and tried to add a condition to my DOREPLIFETIME but still no luck.
This is my header file:
void SprintPressed();
void SprintReleased();
UPROPERTY(Replicated) bool IsSprinting;
void SetSprinting(bool bIsSprinting);
UFUNCTION(Server, Reliable) void ServerSetSprinting(bool bNewSprinting);
This is my character source file:
void ACustomCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME_CONDITION(ACustomCharacter, IsSprinting, COND_SkipOwner);
}
void ACustomCharacter::OnRep_Sprinting()
{
if (IsLocallyControlled())
{
IsSprinting = CustomMovementComponent->Safe_bWantsToSprint;
}
}
void ACustomCharacter::SetSprinting(bool bNewSprinting )
{
IsSprinting = bNewSprinting;
ServerSetSprinting(bNewSprinting);
if (bNewSprinting) {
if (CustomMovementComponent) {
CustomMovementComponent->SprintPressed();
}
}
else {
if (CustomMovementComponent) {
CustomMovementComponent->SprintReleased();
}
}
}
void ACustomCharacter::ServerSetSprinting_Implementation(bool bNewSprinting) {
IsSprinting = bNewSprinting;
}
void ACustomCharacter::SprintPressed()
{
SetSprinting(true);
}
void ACustomCharacter::SprintReleased()
{
SetSprinting(false);
}
Quick video showing the issue:
I also added IsSprinting = CustomCharacter->IsSprinting; in my NativeUpdateAnimation from my custom anim instance source.
My understanding is that as long as you replicate it correctly in the character source, technically it should follow / replicate down to my anim graph as well, right?
Hello, I have a question about spawning AI in a multiplayer game. I have an actor in my level that serves as the spawn point for my enemies as well as actually spawning the enemies in waves. The logic of when to spawn an enemy is dealt with in the GameMode. The GameMode triggers the Event of the Actor in specific cases. Is that already enough so that the AI is only spawned on the Server and then replicated to my clients? Right now it works as intended but I just wanna make sure that this is actually not giving me any problems down the road. I would think that if the GameMode calls the Event to spawn AI they should only be spawned on the server cause the Gamemode only exists on the server correct? Even though the Event is implemented in another actor class
The spawn point exists on server too
Everything but GameMode exists on both
but don't multicast the spawn, instead spawn replicated pawns. Pretty much don't multicast anything except cosmetics
Yeah my pawns are replicated and my Gamemode calls the Spawn Event. So they should only be spawned on server and not on each client correct?
Not using multicast either
This is my actual spawn event
And I call that from the Gamemode
So it should be fine right?
I would just get Waypoints from the actor and have the gamemode do the work but same thing really
the actors in the level can just be data that the gamemode uses to do the actual spawning
just like PlayerStartActor
it's just there to be a place really
Alright thanks @dark edge !
you still have the IsLocallyControlled() there
remove it
void ACustomCharacter::OnRep_Sprinting()
{
IsSprinting = CustomMovementComponent->Safe_bWantsToSprint;
}
I'm not sure you need that CustomMovementComponent->Safe_bWantsToSprint
I think you can leave that completely empty
the value is already being replicated
My bad I did remove it in my source and switched the IsSprinting bool to Replicated instead of Replicated using.
Still dosent seem to be working correctly
is that SetSprinting function being called on the server when the server presses the sprint key?
Thanks a lot for the precision and for your help !!!!
I will post this just in case someone encounter the same issues I had setting material and vertex colors on ProceduralMeshComponent.
good thing to know : It seems CreateMeshSection is deprecated and should not be used anymore. I am not sure if this is because I couldn't get my vertex color material to work, but I have been using CreateMeshSection_LinearColor instead and it works great.
After your suggestions, I replaced the objectPtr with a UMaterial* Material. I don't think it is making a lot of difference, but I guess both options are viable !
spawning a new actor from worldManager.cpp :
if (NewActor)
{
AChunk* NewChunk = Cast<AChunk>(NewActor);
NewChunk->ChunkW = this;
NewChunk->Material = Material;
NewChunk->OnRep_MaterialUpdated();
}```
my actor I spawned.h :
```UPROPERTY(ReplicatedUsing = OnRep_MaterialUpdated, Category = "Chunk", VisibleAnywhere)
UMaterial* Material;```
actor spawned .cpp:
``` Mesh->CreateMeshSection_LinearColor(
0,
FChunkMeshDataVertices,
FChunkMeshDataTriangles,
FChunkMeshDataNormals,
TArray<FVector2D>(),
vertexColors,
TArray<FProcMeshTangent>(),
true);
{
UE_LOG(LogTemp, Log, TEXT("MATERIAL CHANGED"));
Mesh->SetMaterial(0, Material);
}```
Thanks again for your help ๐ cheers
I have an AnimMontage that can spawn actors (AN_Spawn_Actor).
But AnimMontages cannot have events (therefore cannot use RPC).
Can I just stick Server_Spawn_Actor RPC in GameInstance and then just have AN_Spawn_Actor call it?
Or is that messy or is there a better place to put the Server_Spawn_Actor RPC?
Could someone explain to me why on this picture (it'a tutorial) he's using a "Has Authority" if we're already in the gamemode which is on the server ? ๐ค
Because it's a tutorial and most tutorials are ass
If I uncheck the โsimulate physics on dedicated serverโ option for a character mesh, but multicast โset simulate physicsโ, will ragdolls still occur for clients? itโs not important that the simulations match at all.
Personally, I would recommend ditching the idea of branching on the Sprinting bool in your animbp and rely on speed instead. Sprinting is just a specific condition that enables faster speed.
Currently you'll have problems later if you say... add movement speed abilities that increase speeds. You'll have a character walking at the same speed you normally sprint and because you're not "Sprinting", it'll still play the slower walk animation.
Sprinting should be viewed as an ability. Enable and disable. It's affect is to increase speed and that's it. AnimBP shouldn't care about the source of the speed.
Wtf are you trying to do here?
If you have any specific questions you can ask them here or In #gameplay-ability-system for GAS. But if you're looking for people to help you out on the entire game this is definitely not the place. That's something for the job board.
SRRY guys
guys any ideas why my dynamicall healthabrs not working? should I RPC those player variable? idk if its ok to rpc inside widget
It's not. Widget should just be reading from some variable on the player or whatever
Also you're just setting the colour, nothing else
do you see that second photo ? I am seding there reference of self which contains team
and then I am comparing send player + locall player
Widgets are UObjects, don't have replication capabilities. Only actors do
Also it would be a bad idea to have them do it, widgets are not game logic
I'd suggest you to handle health etc in a character or pawn component and do the RPCs or replicate health through them
idk how to then make this dynamical health bar ๐ I am shocked noone cant find anything regard to this theme and its in every game
kekw
but wdym about my comparation inside widget cant work?
we are telling you how to do it literally
Widgets are not objects that should store gameplay values such as health
You need to use actors and components to do that
and then update the widgets to show the health from the component
Your comparison only compares the variable Player to the PlayerPawn and their team IDs
For such comparison I'd made sure that the teams are correctly setup and that the references you compare do correspond to your player and the others
I think there are several layers of problems so take it slowly and do it properly from the beginning
it's set correctly but peoblem is peopably that I am comparing in widget because I am sending there player pawn and compare it there with local player but as widget is only local it compares propably same person

and I bet I can't send replicated variable to widgets of all
so it's not working now
hello, I have some trouble with this, anyone can think of something, my Rep notify turns to run on the server only if I use this node, if I remove it, is replicates properly, I thought it my be linked to the fact that my "item master" is replicated actor, but if I make it not replicated, the rep notify fires only on server still.
I tryed "has Authority switch" and Authority is firing properly the Rep notify, meaning that its the server that is firing the rep notify, but things are still not sent to client, im out of idea ๐ฆ
exactly, the comparison is not properly setup
you need to replicate through an actor and then set the replicated variables on the UI
I'd really advise you to read the Network compendiums and learn multiplayer basis properly
The comparison is fine. If it's not working, it's because the variable is not replicated correctly.
There's nothing wrong with the widget's logic. The issue is that Team is not correctly set on the character.
I just put my game on steam to test, it is multiplayer with a dedicated server and I made a completely empty entry level for the client default map that just calls load level by name on the server ip. When I navigate to my executable in Steam > steamapps > common > mygame and double click the exe it loads and connects to the server perfectly, but when i click "play" in steam it just sits on the loading screen and doesn't connect to the server. Does anyone know what the difference between clicking "play" and double clicking the executable is? my launch options are set to the bare minimum i think.
Yeah you were right, I tested a few other things tho to optimised, but yeah as long as my "Item Your interacting with" was not replicated It would not work ^^
Hi, is it possible to multicast a function?
Would recommend checking your logs, could be a lot. Most obvious thing that comes to mind to check is if your steam overlay works if you're directly launching from the exe versus if it does when launching through Steam. Could indicate that Steam is not properly being initialized for example.
instead of having to use a custom event
I believe you can't in BPs. You can however just immediately make it call your own function.
But not 100% sure, couldn't find anything for it though.
what do you mean exactly?
As in just directly call a function to handle the implementation when the event gets triggered.
Not ideal, but better than nothing I suppose.
would this be good practice? The play sound function also plays the sound, not sure if that's nessecary, or if just the MC plays the sound for all clients
this is what's inside the playsound function
A multicast triggers for everyone that's relevant for the actor. That includes the server. So you're likely playing the sound twice now on the server.
Would definitely give it a try, but seems fine.
๐
hmm, the steam overlay does appear when i click play and steam and does not when i double click the exe so will start there, thanks
how bad is this in terms of performance?
/ is a multicast set to reliable hooked up to a tick performance heavy?
or bad practice
others here a lot more experienced than I so maybe someone will disagree, but I don't think its great performance wise, generally you want the actor running as an simulated proxy on the clients when possible, so have some minimal replicated stated that is enough for your piano to know what it should be animating and then let it animate all of that client side
so something like two replicated ints that are the start and end of the loop you have there, you update those server side
the piano just knows client side it should be playing from the start to the end
probably not super heavy (unless multiple instances are doing it at the same time) but I wouldn't do a reliable multicast per tick, the worse case scenario would be to skip one update if the packet gets lost
the for loop check every key's current value in the animation curve, so having just the first and last index wouldn't be possible
I now have it set up where the tick only runs when there is an animation playing, which lasts for 0,4 seconds. Is that still not optimal or a lot better?
it's better
still why reliable? what is the worse case scenario if an update is missing?
can still just replicate the key state, but for 0.4s maybe doesn't matter unless you have a lot of them. I think general pattern of replicating state not animation is better practice
You mean just ticking replicate movement in the details panel?
or replicate component*
When I spam keys on the server, the clients keys get out of sync and eventually get displaced. I'll send a screenshot
that shouldn't happen unless updates depend on each other
making the mc reliable fixes this issue
what do you mean exactly?
sorry but a screenshot gives little information nor context.
Reliable RPCs are slower than unreliable ones and there is a risk (although probs not high in this case) to overflow the buffer
Idk what are you exactly RPCing, but if those are events such as "key x pressed" an unreliable RPC that misses will just skip that event (bcs it doesn't reach a client). The next ones would be ok
To answer this. It's an absolute horrible idea to run any sort of RPC functions reliably on tick. The reason for this is that Unreal has to make sure that they actually arrive and has to do so in order too, when you're doing this on tick you're very quickly overflowing the reliable buffer Unreal uses with the slightest amount of packet loss. Which becomes an even bigger issue as soon as you get more connected clients, what if 2 clients drop a packet for example? Then Unreal has to resend them again.
This is an issue because Unreal will drop clients where this becomes the case as it can at some point not recover from sending all these packets any more because too many stacked up. This is from a test I ran quickly:
[2023.02.15-14.36.03:529][773]LogNet: NMT_CloseReason: (Server Disconnect Reasons) 127.0.0.1:17777
[2023.02.15-14.36.03:529][773]LogNet: - RPCReliableBufferOverflow
[2023.02.15-14.36.03:529][773]LogNet: UNetConnection::SendCloseReason:
[2023.02.15-14.36.03:529][773]LogNet: - Result=FailureReceived, ErrorContext="FailureReceived"
[2023.02.15-14.36.03:530][773]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = FailureReceived, ErrorString = Outgoing reliable buffer overflow, Driver = GameNetDriver IpNetDriver_0
[2023.02.15-14.36.03:530][773]LogNet: Warning: Network Failure: GameNetDriver[FailureReceived]: Outgoing reliable buffer overflow
BTW you are not doing one multicast per tick, you are doing 88
I didn't see the loop before, this is terrible performance wise
I have a curve set up, every key has a value mapped to it, this value means how far along it is in the curve. The tick basically checks which keys' values are currently below the length of the curves and adds the deltatime to the current value.
no i mean replicate an array of which keys are down, make a variable like "keys down" that is a list of ints
and then just lerping between 2 positions based on the position in the curve
that is an animation and should not be replicated at all
exactly
replicate only key up and down events
that's basically what's happening right now. It's only doing the multicast on the keys that are down atm
the exact position of the key doesn't need to he replicated
no, you are multicasting 88 transforms everytime
each transform being 9 floats
I added this variable to make sure it only multicasts when the key is being played
Yeah I worried this was the case
The tick updates all the notes positions by a slight amount along the curve every time and only of the notes that are currently pressed basically
I know but it's a really bad idea
because doing this with a timeline was impossible as I am using instanced meshes for the keys I had to use a different way to animate multiple keys at the same time
two options
either do one RPC with an array of indexes and transforms (still unnecessary)
or RPC significant events such as key up key down, and let the exact curve be calculated in the clients independently
alright, and the calculation of the curve would still happen using a tick I suppose
The whole transform thing is not going to be fun either way as this will not look smooth on a client regardless. Clients receive packets at inconsistent timing because of latency and packet loss. So the moment you're sending over the entire transform and just apply it immediately it's going to jump to the position/rotation etc. I would very much go with Max's last option.
Saves a ton of unnecessary data and solves the issue of not being smooth in the first place in a really easy way.
how do I calculate the position on the clients on a serverside blueprint?
aah wait
I got it
Thanks a lot guys
Also why is this just no where easily accessible to find on the internet. See it often enough be the case in here: "Why would I not just mark everything as reliable as it seems important that feature X or Y's RPC calls should arrive." ๐
Not even Cedric's compendium mentions it ๐ฆ
Other than "don't do it" I suppose lol.
in terms of replicating state I'd look at the example here: https://docs.unrealengine.com/4.27/en-US/Resources/ContentExamples/Networking/1_4/
you use an array of which keys are down (probably only 1-10 ints long at any given time), server sets that array, clients animate them on the repnotify
IF the piano thingy is the main part of the game and there is not much else being networked I'd also increase the frequency to something higher than 0.4
It really depends on what the use case of this is especially if you remove the transforms though, if it's a random piano somewhere random in the map. Sure replication all the way as no one cares about it. But if this is for example a music festival game or whatever and your piano is the main thing of the game I would use RPCs so you don't get the whole replication frequency system on top of it. Especially if you replace the transforms with "push up/down" events. But in general yes, replicated variables are definitely better suited for stateful events. Just not necessarily always, there are definitely exceptions to it.
it's not the frequency, it's the length of the curve
also I guess that even if location is technically a state property, it usually changes often enough that it makes sense to consider it eventful
I don't follow, then you are indeed sending many RPCs per tick, I understood that you lowered the replication frequency
Hypothetically what is best practice for handling things where someone logs in or comes into relevancy range if you are doing rpc @twilit radish , wonโt their client not have gotten the last rpc and thus not know the state on load? Having an issue like that right now in my game
I'm not sure if this works but this is the discussion where the idea for the curves and values linked to the keys came from
will probably clear some things up
that is totally fine for a local effect
you just need to sync/replicate the start of the curve and the rest is calculated in server and clients without further synchronization
If you want to use a RPC to send data when something becomes relevant or someone joins chances are you should have very much likely just used a replicated variable for it. What's the use case?
I don't think there's a way to do that with the way this currently works. There is no start event, sorta. The tick just checks if a note has not fully gone through the curve to go back to its initial state yet, and if it hasn't it progresses the curve of that key a slight bit, and then loops over all keys again
Anyone has a really good tutoriel on multiplayer please ?
All the key press event does is set the current curve value of that specific key to 0, then tick makes sure it will eventually get back to the end of the curve. which is 0,4 in this case
kekdot's tutorial is good
already watched him alot
I need something that goes deeper on the subject
Practice practice practice.
Read papers. Watch GDC talks from people who actually have the battle scars of actual networked gameplay
Practice without knowledge is kinda impossible, so I need the knowledge first then I can practice
Link me to papers
YT is shit in this regard. It is only going to cover surface level stuff that the docs already cover
Which is fine - if you just prefer videos to learn from
Everyone wants the secret sauce - but the truth of the matter is, you just need to do things.
Sure it is. Make a wave based shooter, networked.
Don't even worry about changing levels.
Google the things you don't understand
I prefer youtube tutorials but everytime people told me they were bad tutorials so if it's possible to have a website / paper explaining that it would be good
The most important thing - ignore best practices when learning.
You don't understand why they are best practices when you're learning
Make mistakes
Just do what makes sense to you in the context of your game.
Architecture will always be able to be criticized and improved.
it is the colored balls shown here: https://www.youtube.com/watch?v=grvt64xG20U&ab_channel=Swordai, when the sword hits a ball it triggers an RPC that updates the colors, what the colors should be in stored in a replicated array, but I am only actually updating the colors visually via RPC which works perfectly except when someone joins the game and wants to interact with a ball
Been working on a training mode for my sword fighting game, this is an initial prototype that involves feinting and swinging only (no blocks, working on incorporating blocks, ripostes and kicks now).
I am bad so I run out of stamina and stand there waiting, but directly after a hit lands you can see the cursor turn to a + and you can combo swin...
The more you work with doing the replication and stuff like that, the more 2nd nature it becomes.
People like Jambax and Zlo didn't become them by sittin' around trying to find a deep resource. They just...made networked games and practiced.
Definitely sounds like it should just be a replicated variable to me.
Yeah agree will try reworking into that
Was worried it wouldnโt be as responsive to the hits
If the actor does not have a high update frequency you can force a net update, that's totally fine in that case I would say. But then you don't have to worry about relevancy / new joiners.
It's impossible for me to do that, I need to learn concepts first then apply it and learn by doing
How do you force update?
Is this C++ or BP?
Specific tricks (like prediction, rollback, etc..), it won't cover. Because those are game-specific.
It does cover everything you need though.
guys how it is possible I am destroying actor after game over but in menu i still can shoot and I hear shooting behind screen when I push mouse ๐
If you're just beginning, Cedric's compendium covers basically everything you need yes.
this part is bp
Force Net Update
calling this from my widget to destroy me and propably not working heh
You've been in this channel for a little over 2 years. At some point, you're just going to have to practice my guy. There isn't a secret trick. What helped me starting out was doing things in BP, just to see the flow of things and getting in the mindset of, "Okay - now I'm on this machine. I need to send information to that machine, so I need X"
For the deep topics, GDC vault is probably one of the better resources. Because it is done by people who have actually released games.
I already practiced so it's not like I'm at level 0 I just need to push the concepts a bit more to learn more and to practice those concepts
Then you need to make a game that would utilize those concepts.
Make a simple racing game to learn how to deal with networked vehicles.
Make a simple UT clone to learn how to deal with competitive FPS networking.
Key thing being simple
UT ?
I dont want shit your deep convo but I have serious question why destroyed player can still use mouse input ? something weird
Unreal Tournament I guess.
It can't.
calling this from widget and anyways can shoot and hear shooting in menu
weird
I made mistake ?
"called" is executed
something has to set the curves in motion
You're assuming something isn't spawning a new one. Or that the code running on mouse click is running through the thing you're destroying. You need to debug and find out if this is even being called, if the actor is even being destroyed, and if both are true, why input manages to make it to the left mouse click.
Also regardless of all of those. You should disable gameplay input when dead.
Test projects/games are my absolute favorite way to learn things like this btw. You'll just never truly get the same understanding from something unless you need to actually make it work. Reading up on something is good to see what you can do with something initially, although YouTube tutorials in specific end quite quickly with multiplayer in my experience. There are not a whole lot of people covering multiplayer topics tbh so let alone a whole lot more in the advanced sections, that's mostly Epic them self doing an occasional livestream once per year or indeed a random GDC talk ๐
its called bcs string is printing but its like actor is not being destroyed
which is weird
really weird
it should be
What calls your left click code?
totally agreed. I had lots of fun doing a stupid simulation to try and learn Mass
That's what the tick is for, it gradually moves everything up the curve. If you have an idea how to set the curve in motion please let me know. Been trying to think of a way
I don't see any other way than using a tick or a timeline, but a timeline can't be played for multiple objects at once
but please stop talking about the curve and let's focus on the essential ๐ - WHAT or WHEN do the keys go down?
it is random? player input?
that is the event that you need to multicast
that somebody pressed a key or linetraced or whatever
and the rest is client-side
It can't be since the piano is an actor which always runs on the server
ofc it can be, isn't the Piano replicated?
It is
Somehow it's not updating for the clients even when replication is set to true
it won't update automatically lol
you need to do the RPCs
no offense but this could be faster and easier for you if you learned the basics first
use the compendiums pinned
none taken, I think I finally understand what you mean
haha damn, finally got it working the way you said
Thanks for the help mate
nice
np
but please check the compendiums pinned, those are really goo resources and will help you a lot
Compendium is awesome ๐
Yeah will definitely do, cheers
Both are
Never heard of this 'Wizard' person ๐
Although I do feel like his compendium is a bit more for when you're further into things already. Would definitely not call everything beginner friendly xD
keep waiting for the database section of that compendium
feel like i am guessing a good bit on what's best
Would not be surprised if he doesn't want to dig into the entirety of a database along with his job tbh.
haha yeah it may be listed as "coming soon" forever lol
But then again, I'm not him. So not going to put words into his mouth xD
Hello , my game server restarts a couple of time and then crashes with this error .
[2023.02.14-19.15.15:264][723]LogWorld: Error: Unable to travel to '/Game/FFA/Maps/Test5' - package is not a level
[2023.02.14-19.15.15:264][723]LogWorld: ----SeamlessTravel is cancelled!------
[2023.02.14-19.15.15:264][723]LogNet: Error: TravelFailure: NoLevel, Reason for Failure: 'Unable to travel to '/Game/FFA/Maps/Test5' - package is not a level' with a NULL UWorld
This happened after moved my project from 5.0 to 5.1
Used this method for restarting the game server
Hello, I'm stuck somewhere for Multiplayer FPS game. When they look at the character, they will see a TPS (FullBody) character, but we will see FPS while playing the game. Does it make more sense to do this by adding a Fullbody mesh and FPS mesh into one Character BP and changing the "owner see", or is it TPS BP + FPS BP?
There are a multitude of approaches. Do you see any problem with doing it with two separate BPs?
Obviously I have to do it as 2 separate BPs because I need to make AimOffset for TPS and for this "Use Controller Desired Rotation" has to be false. But for FPS character this has to be true. So I have to use 2 separate BPs.
But I don't know how to do it as 2 separate BPs. Will I spawn 2 separate characters at the same spot exactly?
I asked if you saw any problems with that approach
When I put Fullbody Mesh + Fps Mesh in a Blueprint, there is no problem. (except aimoffset)
I haven't tried it for 2 Blueprints separately. So I don't know if I will have problems or not. If there is only one thing I know, it is that I have to install this system in the form of 2 separate Blueprints. Any advice on how to do this? I don't know how can I do it.
"except aimoffset"
In multiplayer games, replicating things between the server and the clients is by far the most expensive and difficult thing
Why would you intentionally double your workload?
That's true, but I have to. So I want to get a TPS look for a Multiplayer FPS game. I could also have something simple just add TPS and put it on a camera head, but I don't want that. FPS Mesh should be of high quality and realistic.
Is there a method you would recommend for 2 separate Blueprint characters?
you can just calculate the aimoffset for the TP, use 2 meshes, 2 animation blueprints, 1 character, something like this
P1 is look down and left at his foot, P0 sees P1 head position accurately from aimoffset from the difference in the BP above, arm positions don't match exaclty in my case as the FPS arms are different than the TPS arms (with animations i am using, the TPS arms obscure your vision too much when fighting, so FPS arms follow same animations but are positioned lower and further back than the characters actual shoulders)
whats a good way of destroying or omitting a bunch of static mesh components on your server that are just visuals
currently in BeginPlay()i check if (GetNetMode() < NM_Client) //skip;
Assuming you mean dedicated servers? Those don't load assets like that as they don't have an interface to view it, would just be a bunch of wasted memory. Also GetNetMode() < NM_Client returns for listen servers and standalone too FYI.
So I need to make AimOffset for TPS and for this "Use Controller Desired Rotation" has to be false (disable). But the "Use Controller Desired Rotation" option must be enabled for the FPS to work properly. Could you watch the video please?
yep dedicated server. so for example, is a static mesh component with no collision enabled automatically ignored?
it looks like your heirarchy of components is backwards, make FP arms a child of the camera (I'd use a camera boom, but you don't have to)
I would assume the mesh it self not for the reason that visibility tracing and all that kind of stuff exists. Perhaps that there's a setting for it in specific as there's something similar for animations but not entirely sure.
But things like textures it could perhaps use are for sure not loaded.
ok cool
I made FP arms a child of the camera, didn't work.
I don't think it has anything to do with it. The game is a completely FPS game and the Client will only see us as TPS. I don't need CameraBoom either.
If I put the camera on the head of the TPS and choose the easy way, like removing the FPS mesh, the problem is solved, but I don't want that.
There is 1 FPS Mesh, 1 TPS Mesh, and the game is an FPS game, my goal is to apply AimOffset for TPS Mesh. And I can't figure out such a simple thing.
my setup is a bit different but I think you are fairly close
not exactly clear to me from video what is wrong, i would try to disable "Use Controller Desired Rotation" completely, make your FP mesh a child of the camera, have your "look" input add relative rotation to the camera
but there are lots of ways to do it I think and you are on the right track
Thank you so much, I'll try to find true way.
https://www.unrealengine.com/en-US/events/gdc2023
Battle-testing UE5 Next-Gen Systems with Fortnite
Please Epic give us actual performance overviews / insights into Iris ๐
Most likely - it's just going to be what their blog post covered. The one talkin' about using 5.1 features in Fortnite
๐ฅฒ
Is there any way for me to set listen on a map after opening it?
Hello, all. Is there a reason AGameMode::PreLogin is not exposed as a BP-overrideable function? I can't assign a player ID before ChoosePlayerStart is called because PostLogin and HandleStartingNewPlayer are both called AFTER ChoosePlayerStart...
Also, when should I set up my UI on my PlayerController clients? If I try to do it in BeginPlay, my listen server fails because OnPossess has not been called yet, but if I do it in OnPossess, that is never called on the remote clients...
Your UI shouldn't really care if you have a character or not.
Of course, it can change depending on what you have, but it shouldn't just fail.
I have Shields, Health, Power, and Heat components on my Pawn that deal with those resources and are replicated. But if the Pawn has not been possessed by the PC, how is the UI supposed to know what values to put there?
If the pawn isn't there, just hide the ui elements? Or set them to 0/0?
I don't understand. I have UI elements that depend on the Pawn's state. Where are these variables supposed to be?
Have a fallback.
That isn't answering the question
What is the appropriate event to set up my UI? Even if I hide it before the pawn is available, I need to set it up at some point. Do I have to busy-wait with a Tick (common in Unreal, unfortunately) or is there a network event that I don't know about?
There are definitely possession events, but I don't know if they are exposed to BP.
Well, I can confirm that at least in PiE testing OnPossess in BP is never called on remote clients
It would need to be a specific RPC tied to possession. Or an OnRep.
Well, my hack was going to be creating a new variable for my Pawn that is RepNotify, setting that in OnPossess, and then handling that on the client once the replication occurs
Does that seem reasonable/necessary? Working around the fact that clients have no event called after possessing a replicated pawn?
So yeah the onposses isn't a networked event, it seems.
Fun stuff.
So the pawn itself is an onrep'd variable.
So just use that.
UPROPERTY(BlueprintAssignable, Category=Pawn)
FOnPossessedPawnChanged OnPossessedPawnChanged;``` or this
Is this a custom delegate or a built-in one?
Copied directly from AController.
Yeah found it. Will investigate, good find!
So far, it looks like that delegate is never called for first-time possession. I don't see that being called for my listen-server, nor my remote client, but the server-side PC for my client gets the notif, but not the client itself
How are other people doing this? I've taught myself everything about Unreal, and I'm realizing that I have a wildly different approach to things than most people and even the folks at Epic. I fight Unreal ALL THE TIME because I just have a very different archtecture approach
I should really hire someone to teach me at some point
ye fighting the engine is generally a bad idea
for multiplayer I recommend the compendiums pinned
probs starting with Cedric Neukirchen's one
I have read it, I understand the architecture, I don't recall if it goes into detail on exactly how to implement many of these things (because they are often game-specific)
Yes, of course. I find myself expecting certain things (like events on remote clients when Pawn replication/possession has occurred) and I keep thinking that maybe I'm doing something wrong
What about ReceiveRestartedDelegate In the Pawn class? I use this for one of my components, and it's BlueprintAssignable. There's also ReceiveRestarted, which is a BlueprintImplementableEvent.
The comment above it: Event called after a pawn has been restarted, usually by a possession change. This is called on the server for all pawns and the owning client for player pawns
Investigating, good find
I would prefer it on my PlayerController (that's where I am building and presenting the UI), but I can work with it
Well, that is SUPER messy right now, but it's the only event that seems to be called when I need it to be called: after the pawn is spawned, replicated, possessed, and ready on both client and server
Good catch, thanks all!
Funny enough, the first event I see is the custom variable OnRep notify, before anything else is called on the remote PC
So might have to use both approaches: use the OnRep to Bind Event to ReceiveRestarted, then use the bound event to update the UI and carry on as "ready"
Have guests coming over, have to put a pause on this for now, thanks for your help, all!
Before I design my whole game in the wrong way. I'm pre-thinking the future multiplayer part of my game. I'm doing a squad based rts. So its small groups of units fighting other groups of units.
When 2 groups clash, I select random units and send them to the enemy group of units. At random.
Is this randomization good for multiplayer because it means each machine will have its own randomization. So each machine will select different units and different targets to go to.
This means that ech time there is this type of combat, i cant use randomization, i must use a predictable formula that will be used in both machines. Or if i cannot do that, i must send a packet for all the units, right? Which is not very efficient.
Should i rethink this through? It may need a deterministic formula instead of so much randomization.
Uuuugh... i have a pawn, on which i overrode the "on unpossess" function to spawn the default AI controller. At certain points in my game, i want to unpossess the players pawn and let the AI take care of the pawns movement. This is done in blueprint, i call "unpossess" on the pawns controller (Server side), and then issue the command to the pawn that starts the movement (also server side).
Now what confuses me is that this works in PIE when i play as a client with 2 players, but DOESNT work, when i play with only one. When i play with two, both the ensures for GetAuthority and the AI Controller return true, when i play with one, the Getauthority returns false, and the AI controller is null (because the pawns controller itself is null)....
can anyone tell me what i did wrong here?
Is there a reason why server events take a long time to trigger when called from the client?
To me it obviously makes sense since it takes time to go from client -> server -> client, however it would only be noticeable for complicated logic. I'd assume that on average network emulation profile in editor it wouldn't take too long, but I'm noticing that it takes long enough for errors to occur sometimes (for example, a simple item pick up can take a quarter of a second which is long enough for the client to try picking it up multiple times before the server tells the client it has been destroyed, which causes an error "pending kill"). But I notice it for simpler things too, like the most basic server event will take a quarter of a second to trigger on the client which does get annoying. Tbh, it could be an issue just with our project so if that's not normal let me know
I notice that this is happening even on average network profile, and it gets exponentially worse on "bad". The way I've been getting around it is by having things occur on both client and server (such as inventory changes on server, but the UI updates independently on the client so that the client doesn't need to wait for the server). Is this a standard approach to ensure network delay isn't noticeable? Or is there another better method
are you running your game in PIE with play as client?
I'm doing listen server with 2 players
It does the same things though when playing multiplayer in the shipped version
did you try overriding the network emulation settings? afaik default network emulation has a latency of like 0.1s, though im not 100% certain about this
where is better to handle widgets which should be multicasted to everyone in player controller or his pawn?
for example count down
timer
or game over?
yeah I wouldn't think any of the settings would be a problem
I'm going to go the "server decides target" route and send it to clients. It is very difficult to find a deterministic way to assign enemy soldiers from battalion to battalion. Something that might work is, if indexes are deterministic (soldier 1 on battalion 1 is also always soldier 1 on battalion 1 for other clients) is to do some simple assignment based on division/modulo
I'm personally going to try a server approach because there might be corner case scenarios where you want units to fight in a less strict way
For example if the enemy battalion is already engaging and there is no room to fight properly, units might fight closest enemy from other battalions or buildings
turns out this doesnt work because spawning the default controller doesnt work when the actors net mode is Client. Now to find a way for my server to unpossess a pawn from a connected client, instantly assign an AI controller and then call for the movement to be executed
AI stuff should (and is in general enforced) to be on the server side for good reasons though ๐
Anything significant imo anyway
Also @kindred gazelle what you described is just latency. I would recommend fixing those errors as your players are going to ruin into them regardless of you turning off the emulation or not. In your case the emulation profile is for everything which means that it's for both incoming and outgoing packets on both client / server.
So Client 1 sends a packet -> 30/60ms delay -> server receives -> 30/60ms delay -> processes on the server and sends a responses to Client 1 -> 30/60ms delay -> Client 1 receives -> 30/60ms delay and only then they actually get it. On top of the packet loss.
So sounds like normal behaviour to me what you've going on there. And if it's hindering gameplay then you should take that as a sign that someone who is actually playing your game with a slightly bad connection will have issues with it ๐
I would probably make something like a bunch of rabbits running around client sided
Depends on whether or not it needs to be synced. If it needs to be synced it's not a client's job to do it.
Also Unreal shields off decent parts of AI stuff on client net modes, as Fennel found out ๐
Yeah that's why I said anything significant, in the example I gave with a bunch of rabbits running around. Probably doesn't need to be replicated in most cases, because it'd probably nuke your servers performance
I mean to be fair, games that do this do not just load in a million rabbits all at once. The Forest has creatures for example and has at best 30-50 of them inside your distance. (Birds, rabbits, deer etc.) Which I think is still a bit of a high number.
case by case thing I guess, depends on what kind of game you're making. IIRC the forest doesn't allow many players in their multiplayer lobbies. So there's a lot more to work with
but something like rust or ARK would be detrimental for sure
Can i, on server side, unpossess a pc's pawn and instantly possess that pawn with its default controller?
Should be just fine, does something not work about it or?
If anything, the possess function ultimately unpossess if there's still a previous owner ๐
Well, in my case if i call SpawnDefaultController in the OnUnPossess function of the pawn, it fails to do so because net mode is client :/
That does not sound like you're on the server to me then.
If i unpossess in the server does it call OnUnPossess on the client then?
To my knowledge it should be a server side event only, are you sure you're actually calling the unpossess from the server though?
It does not seem like Unreal does much to protect from that (because why should it anyway I guess). So that might mess up some things too if accidentally happening.
Hi there, how exactly does replicated actor input work? I haven't been able to find any solid articles or documentation on this
For example: having a keyboard event on an actor and wanting to multicast that event
That's because they don't replicate by default whatsoever. If you need to send up something to the server you just do it your self. If a client as an example presses the interact button the client sends a message/RPC to the server "Hey I pressed my interact key" and then the server can do whatever it wants ๐
I tried that, but the server ignores the event.
Play note is multicast somewhere down the line
The actor has been set to replicate
Is the actor owned by the client trying to press the key?
Ah right, would that mean I have to set the interaction up in the playercontroller and send that message up to the server there first?
yeah
If you don't want to or it makes no sense to set the player as the owner of that actor then yes.
Okay, thanks :)
i mean im calling it the unpossess from a server reliable RCP in blueprint 
Can you show your setup?
1sec
@twilit radish This is the RCP that i call on an actor
this is the function within there, where i call "unpossess"
and at "AttachToGrid" the pawn needs to have an AI controller, because that uses AI movement
Can you show the relevant log part of what exactly Unreal is yelling at?
its not yelling in the logs, which makes it hard to debug... if the unit's owner isnt the listen server client, but any other client, it just doesnt spawn & assign a new controller in the overridden unPossessed 
because this returns client 
How did you check if that is the case though?
went through it with the visual studio debugger
the weirdest thing to me is that it used to work pretty much exactly like this...
wait let me rewind to an older version >_>
The actor from this screenshot is replicated right?
yes, thats the player's character
in that moment i want to take away control from the player and let the ai move that character 
Is this also in the character?
no, thats a separate actor called "Encounter manager". i spawn that at the start of an encounter
Is that one replicated?
yes it is
Is it actually spawned on the server?
The game mode is already on the server, not sure why you're calling a RPC there towards the server at the end.
Or well even better, game mode only exists on the server.
good point, that doesnt need to be server side RPC. but i doubt thats what is causing this issue 
...
i turned it off and on again
i didnt change shit (except that RPC you mentioned)
Turn what off?
You aren't using hot reload right..?
i wasnt changing anything in C++ atm
but i do use hot reloads when i do, usually. unless i change u-things then i restart the editor
Soโฆ don't use Hot Reload in Unreal Engine 4 because:
Data corruption in Blueprints: it can reset and mangle any variable at whim. The only way to fix it is to roll back to a previous file version from a backup or from source control (perforce, git, svn, etc.)
It can't deal with header changes (.h files) or constructor changes
It's deprecated, not maintained by Epic anymore
Just don't use hot reload please. If you insist on using something similar use live coding instead but please ditch hot reload:
https://horugame.com/dont-use-hot-reload-in-ue4/
It's very likely that it just messed up something somewhere tbh if all you had to do was restart the editor.
hot reloads = live coding, right? and the issue persists in ue5?
No. Hot reload != Live coding.
oh ๐ฎ let me read up on the diff
And yes UE5 still has the exact same issues. Hot reload is garbage and should get removed from the engine.
hot reload was the previous solution
live coding is the new recomended one
although some bugs still have transferred over
oh in that case no, not using hot reloads, only live coding 
It's at least better than hot reload, but indeed still far from perfect.
yes and even when using live coding, only use it when you change function bodies is what I'd recommend
Either way.. Hot reload strikes again ๐คฃ
id say "alls well that ends well" but im kinda scared this might happen again 
keep some backups, I've had cases where maps got corrupted and I wasn't even using live coding or hot reload
the joys of UE ๐
das why im using version control^^
yea you should
IMO just don't use both. Not having to deal with the corruption / weird issues that come from it is so much more worth your time besides that it does not save an extreme amount of time anyway as Visual Studio can already do incremental builds where it only changes the stuff that was actually changed.
Also +1 for version control yeah.
1 points for git-ryffindor
confusing question:
void UArcItemFragment_SkeletalMesh::GetLifetimeReplicatedProps(TArray<class FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(UArcItemFragment_SkeletalMesh, Mesh);
}
If i stick one of those into non-replicated TArray<UArcItemFragment> Stuff, will it still replicate anyway?
i DON'T want it to replicate
Its on an Actor that replicates it's movement, but the data is only needed on the server
Not sure I understand you. You don't want to replicate the item because you only need it on the server, then why are you replicating it?
Confusing question indeed
its a story and a half lol
well, im working on grenades
those fragments hold data for the weapon, but the item can be put away right after throwing
so i need to take a snapshot of relevant part and copy it onto the actual grenade actor
so that each grenade(or mine or whatever) has its own instance of the data (so you cant retroactively get a damage upgrade or something after throwing 10 mines)
but, will the fragments even replicate, when the array holding them isnt replicated?
This does still not make it much clearer if I'm honest. I really don't see why you just don't replicate the data.
If an array isn't marked as replicated then no the array is not going to replicate.
If a specific item within is replicated it self then that's a different story ๐คทโโ๏ธ
An exception were something implicitly replicates is if you throw it in a struct as a UPROPERTY and then replicate that struct for example, but then again you're explicitly replicating that struct. Although in that case the NotReplicated specifier exists.
would
UPROPERTY(NotReplicated)
TArray<ReplicatingFragments> Stuff;
work? doesn't seem so
๐ฆ
but does it even has anywhere to "replicate to" ?
the object only exists on the server
will it create a free-floating object on the client?
If you have a a TArray of actors for example:
TArray<AActor*> MyActors;
And that MyActors array is not replicated doesn't mean that the actors them self can't be replicated is what I was trying to say.
However if you do the exact same thing with actors that are not replicated but the array is now replicated they will just be nullptrs on the client because they don't exist from the client's point because they aren't replicated.
But again, still no idea what you're trying to do ๐คทโโ๏ธ
if we dont know what we are doing, then the enemy cant know what we are doing taps head
here it is exactly the opposite lol, its a non replicating array of UObjects (the UObjects themselves shouldn't (?) be replicating either, but they have some UPROPERTIES() that are set to replicated), created only on the server
does the replication system do anything at all in this case?
UObjects don't replicate. Since 5.1 you can specifically do this if you want to though. But if you have a TArray that is not replicated then you aren't replicating them unless something else is replicating them. Doesn't matter if you put Replicated above some random variable in there. If you're not explicitly replicating that object "somewhere" in your project then no it's not going to magically replicate as you're not telling it to replicate.
It's the exact same thing with actors and anything Unreal related, if an Actor is not set to replicate it's not magically going to replicate.
You explicitly mark what you replicate and what not. Whether that's a variable, an actor or whatever.
So, you basically need the object instance on both the server and the client for its properties to try replicating?
does the non-functional part of replication have any cost?
Where would they be replicated to if the object didn't exist?
hey, if i knew, i wouldn't be asking ๐
An uobject it self can't replicate it self. The only thing in Unreal that can do this are actors. An uobject can be since 5.1 be a replicated variable inside an actor but that's it.
Well it could also before 5.1 if you made some changes, but again it can only be a variable inside an actor if you want it to replicate as uobjects them self have no power to replicate on their own without an actor.
hello all, in a basic car template in UE5 , off road car is going 130 + in certain time in server but in client, it is stucking at 102 or maybe 104 speed .. i thought this as the issue of replication and tried run on server, mc events but still no effective result. Replicate movement is set to true. In standalone, car hits 130+ as normal as in server. i'm unable to figure what 's the issue ? thanks for answers
its really hard to understand what you mean
oh sorry, i have put no. of players to 2 players and net mode as play as listen server and clicked on play thus getting two windows - one as server and other as client. For the same distance, where the car in server goes till 130 km , the car in client is not going beyond 102 km/h mark.
Sometimes listen servers can execute code twice, because they have both roles
That would be my first guess
Outside of that it is kinda hard to say, we have no idea how your code works
oh .. for the movement, i have not added anything extra though .. the same bp code for move forward and move right which comes after creating project with template, is i am using
men, can someone explain me why deltatime is different between client and listen server in PhysCustom of the character movement component?
DeltaTime is not constant
Uhh because they probably run on different PCs
It's basically semi random "how long did the last update take"
Deltatime depends on hardware. And is not even consistent on the same hardware. Also depends on the code running on the said hardware.
how can I synchronize a value of a resource that is consumed during a certain type of movement?
i have a jetpack that use fuel during the time that is active
i was thinking to consume it with delta time in physcustom but i guess is a totally wrong thing to do
Well, I dunno how you feel about Gameplay Ability System xd
no pls hahaha
You may want to see it as "stamina" which in that case there's an implementation of in the last pinned message in this channel.
i just need to make the amount of fuel consistent between all client
oh yeah
thank you i will study that implementation
Hi I cant find any answers online, is it possible to have a multiplayer game that doesnt have steam subsystem or epic online service? I want to connect two people internationally, but every tutorial I find is just connecting people on the same wifi network or using some sort of third party system like steam sessions. Ive look into port forwarding but seems like its to complicated for everyone to just switch to port forwarding all the time. Any help would be much appreciated!
The reason why everyone uses third party systems is because two (or more) computers can not directly play with each other. So you either indeed need to port forward and specify the IPs or you need to use something that can do this for you. This is where systems like Steam, EOS etc. come into play because it's costly and difficult to setup your self. You can in theory do it your self if you want but I would just not recommend it tbh.
Hey there, im trying to replicate my mission system. My OnMissionStarted event is fired on the server (since ending and starting is handled by the server) and now i want to create a callback for my clients ui. Im trying to replicate the information back to my client via a client rpc but that rpc is never called..why tho? Shouldnt the server be able to call the client side at all times? (especially since this is in a player controller)
is there an alternative to Steam an Epic? Ive published multiplayer games before using steam, but its a $100 hit everytime. And epic has to verify that the game is legit before allowing users to connect. I create alot of "shit post" games that can get fairly popular and cant imagine epic would allow them into their store.
There's Photon which is free to test things out with but requires you to start paying when you hit like 20 players or something. It "supposedly" should work with Unreal but I've barely ever seen anyone here talk about it nor used it my self for Unreal.
Beyond that I have no clue.
When are you calling the RPC? Just random throughout the game?
@lapis zinctheres also reverse winter studios who just launched their own launcher, they also have a website called like that
its just that blueprint code ive shown you
I mean thats a pretty good start, I appreciate it! Thank you!
As in triggering / firing the RPC. When does the "On mission started" even get called?
roughly 0,2secs after begin play
Because it should indeed just work. Player controllers always have an owner and are always replicated, the only case where they can drop is if you're calling this before the actor is properly replicated.
this is really weird huh
That "Debug Start mission" thing is not attached to beginplay right?
Or something similar?
I think I see the problem. You're starting call Start Session Mission on the server with a multicast. Then that starts the mission. That runs on both the client and server.
Which in return probably also just calls that RPC on the client.
I mean I guess it should still work either way, it's not entirely how you should be doing that but oh well. What I would try to make sure of is that the initial call actually happens on the server and not the client.
output log says that the initial call only happens on the server
And you're sure your start mission node isn't returning early for a client/server or something similar and then not calling your event?
ill try another delay
Sounds problematic
but i dont think that its a time issue
I also don't see what a delay would do anyway. But in general it's a bit confusing code.
you were actually right
You're trying to call the start mission event for everything, that's fine. But then the start mission event calls a client RPC with that the mission actually started while the client already does the same thing and that's where I get lost a bit.
Where did you put the delay?
I broke the code down too
just right before the rpc call
wait wtf
idk how but the default on mission started call function is suddenly on client too
That's what I just told you. A multicast runs everywhere.
๐
But I think at this point you're calling this from somewhere where the controller is not properly replicated to the client yet tbh.
Mission doesn't even need to "start" on clients to be honest. Server just updates things that needs to be sent.
Sends messages, etc..
thats what im trying to do
Just use Flowgraph honestly.
What is flowgraph?
The bees knees
well, its actually not because of the delay, but because of the packet lag i added huh
That's what I'm saying. You're not giving the controller the time to replicate to the client and then it drops it on the server mean while when you call that RPC because it's not ready yet. Although Iris will start deferring that, but soonโข๏ธ I guess.
I don't know if I'd even mention Iris honestly ๐
Heaven only knows when it'll stably release as well as actually be usable.
So 5.3?
Still waiting on the stats though ๐
Yes ๐ฅฒ
"Trust me bro" - hardly a source
Do any Epic staff look on the multiplayer forums, would it be worth asking about it there?
ยฏ_(ใ)_/ยฏ
I can see that this question was not answered ๐ : https://forums.unrealengine.com/t/tutorial-experimental-getting-started-with-iris/758181/2
Oh there is a discussion thread :0
Thread, sure - discussion implies a back n' forth though.
๐
I kinda wish the new subobject replication made it simpler to replicate X subobject to a list of specific players
Since the subobject can only have one net group, kinda makes it a little dirty
You could still use the old way though which I believe gives you control with COND_SkipOwner etc. https://jambax.co.uk/replicating-uobjects/
Bit more work though.
Even I've moved to the new system ๐
You had no control what connections the objects replicated too in the old version IIRC
Ah nevermind then.
New system?
I finally got Iris working I think! Although it's a bit whack. CPU performance seems quite a bit worse with a lot of actors. However it seems like they are more efficiently being able to pack together replicated properties in the end(?).
The test was basically 1 listen server and 1 client. Both using -nullrhi (so no graphics) and both the same profile arguments. The server would spawn 2000 actors that constantly in tick increment a float and an uint64 that both are replicated. They were all standalone builds without running the editor and as minimal stuff going on for the PC. The only difference was toggling iris through a launch argument.
Can I just safely zip up profiling things? Then I can share them here I suppose.
It does get a bit more stable, perhaps when all actors were finally replicated(?). But yeah. Not so sure I like what I see ๐
This is what I was talking about, there's like a sudden "wow, let me actually be more performant now"..
Takes a while to replicate 2k actors
Well yes. But it goes up to 5-7ms during that period while with disabling Iris it does not spike up so bad as Iris does whatsoever.
After that point it does become pretty even with the normal system, it's not better or worse at that point though.
What about constantly changing stuff though? Like 2k actors coming into and going out of relevance? Cause isn't that what Iris is supposed to affect by replacing the replication graphs?
Dev editor?
And iris optimizations come into play with handling relevancy and also having genericout of the box struct delta serialization with compression
None of which applies to your experiment here
If you're asking if I did this in the editor. No this was packaged with the editor closed.
Is it fair to compare Iris to the existing solution which obviously cannot handle 2k actors? ๐
I mean it handled it better than Iris did lol.
Idk Iris' purpose but I guess is to do the same thing more efficiently rather than doing different things
Greetings!
Not sure if but - is it possible to listen=true a map without re-opening it?
Did it? Or is iris time slice interval different?
yeye but it's still crazy numbers for performance
it would be an interesting experiment if any of the two systems claimed or pretended to be able to do that
No, cant do it eith seamless travel either
See the first two screenshots I posted. Iris ran between 5-7ms for a solid 20 seconds when I assume replicating the actors while the normal replication system did not go that high whatsoever.
How to set dynamic parameter value only locally in player beginplay?
This how I do it now and it doesnt work
To play the devils advocate here, iris might had been replicating more actors per frame
it basicly changes world position offset in material
IsLocallyControlled
Hmm..
Thanks!
If only Epic would just give us a performance overview and how they actually test it. Because 'something' has to be tested as otherwise you can't see if what you're creating is better or worse lol.
But I don't feel like it's a completely unfair comparison though. Even if we for example assume that the regular system may better slice it than that still shows that Iris can be improved there as you really don't want a bunch of spikes.
Well I wouldn't expect that to happen until Iris is actually close to a ready form, idk the current status but might be too soon
Okay wait I'm stupid that's not true lol.
Finally, itโs worth noting that as of CL 22864286 in UE5/Main, Iris compilation is now enabled by default (i.e. bUseIris=true), with Iris being disabled at runtime by default. The rest of the steps here should still be taken in order to enable Iris in a project. Additionally, the experimental Iris plugin will need to be enabled for the project, and the โnet.Iris.UseIrisReplicationโ CVar set to 1.
But still something I guess ๐
Hey guys ! ๐
So I am trying to get a NetMulticast function working, but I must be missing something somewhere.
My actor 'World' is in the scene when the game starts for both server and client.
In this world I have a function
void testServerSpawnToClients();```
and in cpp
```void AChunkWorld::testServerSpawnToClients_Implementation()
{
UE_LOG(LogTemp, Log, TEXT("This SEEMS TO BE WORKING"));
}
but it only fires on the server. Now the reason it only fires on the server, is because no clients are calling it ?
I mean no owning clients
@honest rain from where are u executing that multicast
From the World actor, begin play function
and are u playing as a listenserver or a client on a dedicated server?
I am playing as a client on dedicated server
now the function seems to be only firing on the server, not the client
I dont see anything wrong with the code u provided, and if ur calling that in begin play from an actor that uve instantiated in ur level then something else must be wrong
I just did that exact thing u did now and it works for me
canu maybe paste the begin play function
sure !
{
Super::BeginPlay();
testServerSpawnToClients();
}
here is the constructor :
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
bReplicates = true;
bAlwaysRelevant = true;
USceneComponent* sceneCom = CreateDefaultSubobject<USceneComponent>(TEXT("RootSceneComponent"));
SetRootComponent(sceneCom);
}
have u removed net load on client on the actor or something ?
try running as 2 seperate clients
i have ur exact same setup in my actor that I just created
and I get 2 logs from multicast
is it possible that it is because the function is called when the actor is not fully replicated on the clients ?
I got this warning though :
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor ChunkWorld_UAID_244BFE55969AA26401_1423050272. Function Generate3DWorld will not be processed
Generate3DWorld is in the beginplay function as well
yeah looks like u dont have a connection to the network on that actor, did u spawn it in the code somewhere, or have u created a blueprint actor and dragged it into the level ?
I assume its only spawned on the client
Yeah I dragged it directly on the level
so when I start the game it is already there
`` #pragma once
#include "CoreMinimal.h"
#include "Components/BoxComponent.h"
#include "GameFramework/Actor.h"
#include "Net/UnrealNetwork.h"
#include "LevelManager.generated.h"
class ADefaultCharacter;
UCLASS(Blueprintable)
class TERANT_API ALevelManager : public AActor
{
GENERATED_BODY()
public:
ALevelManager();
UFUNCTION(NetMulticast, Reliable)
void PrintMessageToEveryone(const FString& Message);
protected:
virtual void BeginPlay() override;
};
CPP:
void ALevelManager::PrintMessageToEveryone_Implementation(const FString& Message)
{
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Magenta, Message);
}
void ALevelManager::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (OtherActor)
{
PrintMessageToEveryone("Hello");
}
}
``
ive also made it into a blueprint and dragged it into the level like u did
what if you call the function from begin play ?
Let me try
Only got 1 log though
but the debugscreen message happene twice
try using debugscreen message
Not sure whats going on here actually, just trying to help out xD
No I did get the Ue log twice actually, it just happened alot higher up, I had to search for the log to get both
So I think ur code is probably fine
The server calls that log, then some initialize happens on ur actor and u get the log filled with lots of other stuff, then u only see that last message at the end.
I guess a good confirmation you could print is to see if u have authority inside the string message.
oh I get 2 print screen messages
@honest rain filter the entire log by only the string ur printing, then u will see both messages probably, they happen with like 1 second in between
ur multicast is fine
Hello! I use the mouse position to rotate object. If mouse is close to the edge of the screen, I want pawn to be rotated.
The question is - since rotation needs to be done server-side, to do it I need to replicate mouse position from client to server every tick. This doesn't sound like good solution to me ๐ค
This is BP code which controls movement
I guess if thats good or not depends on many different things, but if u use standard replication and maybe go from tick to calling it every X seconds, and just linearly interpolate the rotation value, u probably will be better off in terms of performance, I assume.
it seems fine indeed ! I guess UE Log doesnt get called depending on client /server
@honest rain no the log is there u jnust need to filter the search
Then u will see that the log happens twice, its just happening with some delay after the first call from the server
would you know then if that is possible to call that NetMulticast function from a SERVER function, and getting still the client to get notified ?
ooooh I see !
Yes you can do that, but I would suggest just using standard replication for that
u can just replicate a value and the clients will be notified if that value is updated
theres a function called OnRepNotify
Yes but that's only for values right ? What if I want to call that UFUNCTION(NetMulticast, Reliable) void PrintMessageToEveryone(const FString& Message);
but from a Server function ?
I guess u can just use a multicast , especially for those 1 shot events I dont see any problems, maybe someone else has other ideas, but im pretty sure thats what they are made for.
maybe tag it as unreliable if its not so important to get it out immediately
Thanks
So, there is no way to get rid of mouse position replication, but I can do it not as often
Not sure if it's fine for input delay
So I can't get my head around how that works, and it's driving me crazy ๐
here is the full setup :
World.cpp , Function Server being called spawning an actor actor.cpp :
World.h :
void Generate3DWorld();
World.cpp:
{
Super::BeginPlay();
Generate3DWorld();
}
void AChunkWorld::Generate3DWorld_Implementation():
{
AActor* NewActor = World->SpawnActor(ChunkType, &translateTest, &FRotator::ZeroRotator);
NewActor->InitializeGeneration(Frequency);
}
Actor.h :
UFUNCTION(NetMulticast, Unreliable, BlueprintCallable) void InitializeGeneration(float FreqNoise);
Actor.cpp :
void AChunk::InitializeGeneration_Implementation(float FreqNoise)
{ if (HasAuthority())
{
// This code will only be executed on the server
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Magenta, "bBool BEING REPLICATED");
}
else
{
// This code will be executed on the client
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Yellow, "bBool BEING REPLICATED");
}
}```
The 'InitializeGeneration' function will only be called on the server, which I guess is normal since the server is calling the function... but at the same time, the function is Multicast, so it would make sense that it will be replicated on clients as well, since the actor it is being called on is set to replicated ? What am I missing ? how could I get the function to get called as well on the client ? I tried using OnRepNotify but it seems still being called on server only
No Sql for me sorry ๐ฆ
