#multiplayer
1 messages ยท Page 694 of 1
yep i have it overridden on both my UObject and my proxy actor
im doing DOREPLIFETIME(UJob, Title); and DOREPLIFETIME(AJobProxy, Jobs); respectively
i updated it to use github if you care to take a look. i included both of my classes in it too
Hmm, it looks identical to my implementation. Maybe if you can catch Jambax around today (he usually roams around here at 12PM for UK time) you can ask him directly
thanks for checking it. i should be on about then
anyone? ๐ I apologise if my question is wrong formatted ๐ณ
I don't know about that issue, but keep updating it constantly, I know some people here has some knowledge about similar things. You can wrap your code with triple ticks (`) to format it
Hi everybody! does anyone know why this OnRep is not triggering at all?
I'm adding new items to the array or using "set array elem" and the OnRep is not triggered at all
Replication for arrays is only triggered when the array is set, not when elements are changed
You should be able to change an element, then set the array to itself? I think the replication code had stuff built in to make sure that the property being replicated has actually changed
that's weird, i have another array that is arrays of Structure, and if i use "Set member on ST" on one of the array items, it triggers the onRep
Perhaps I am mistaken but I'm pretty sure I confirmed this ages ago
I can remember that being a problem and since I never have the time to confirm it again I usually set arrays with themselves ๐
In BPs that is
In C++ .Add() doesnt make it replicate for arrays?
C++ OnRep and BP OnReps work differently
Ah, curse of BP
if i do the "Set to itself" workaround, it's triggering the OnRep on server side only ._.
In BPs it's more of a "Property Changed" callback, which thus also calls for the server
In C++ it's actually driven by receiving new network data. Can't recall how that exactly triggers
Which of course sounds like both should support .Add() etc
That sounds like a general problem with your setup? Is the actor set to replicate?
yeah, the actor and the array are both set to replicate
i'm testing it in the most simple way and it still only calls server side
Actor
Hm okay
yeah, it's a children of the parent class "Inventory Base"
i'm checking for the OnRep call on the base
Not sure then atm. Non replicated is the only thing that comes to mind
no problem, i'm gonna try to find an easier way to update the UI, my previous setup was working fine but was a mess
and OnRep is kind of wonky : (
Other stuff, but that's a long shot, would be if you are doing reliable rpcs on tick or so
OnRep is usually actually fine
This must be something you overlook ):
I use OnReps constantly for state changes, even with Arrays just yesterday
yeah, it's weird because the InventoryContent has the same setup with a more complex array and it works okey, prob i miss something. Going to erase this changes and redo it from scratch
Also, is this the best way to do this?
Okey this was the problem.
The child of inventory base had Ony relevant to owner, how was that one ticked? No freaking idea
Hi again! I am using FJsonObjectConverter to serialize /deserialize structs. For some reason after deserialization my FStrings of my struct are empty. Have any ideas?
{
FMatchflowStateBase state;
FJsonObjectConverter::JsonObjectStringToUStruct(stateSerialized, &state, 0, 0);
return state;
}```
Can anyone advice to me about how I synchronize physics objects?. I have a fallen tree, which seemed to be synced working fine. Falls in the same place on each client. But if it gets hit. It can acts differently on each version. I tried replicates and replicates movement but that didn't work, Guessing that's just for Pawns with a movement component.
If you just want it nearly identical and don't mind the cost while it's moving or writing the code to optimize it when it stops moving, etc, you can visually get away with replicating it's location, rotation, angular and linear velocity and letting clients interpolate towards those values in their own ticks. It doesn't work well for fast moving things, but for a falling tree it should work fairly well.
I found for most things you don't really need to replicate it more than maybe 4-6 times a second. Can have some jitters on faster moving things, but ๐คทโโ๏ธ
Ahh okay, so that is the way it needs to be done. Thanks!!
Bear in mind that this method leaves clients always behind server. Not by much, but it shouldn't be a huge issue for something like a falling tree using physics.
Is there any convenient way to test multiple clients on one machine using the Steam OSS?
Not really
I'm trying to implement a 'charged rifle shooting' mechanic. I update a float value (which has replication condition as COND_SkipOwner) on tick by incrementing it by deltatime. When players starts firing, it fires a RPC to server to start updating it. With 'average' network conditions difference between server and client is about 0.25f. What is the best way to make this most accurate?
I'm thinking about still making server and client update values simultaneously, but when client releases the trigger send its local value via RPC, if the gap isnt too much let server use it, otherwise use server's value.
It's the only way in blueprints. Otherwise you can create a new event, which you fire inside the onrep and override that instead
https://github.com/nahuelarjonadev/blueprint-json-converter I made this class to serialized and deserialize json in blueprints. Maybe you can get some ideas from it. Look at UBlueprintJsonConverter::JsonStringToStruct implementation
You have to first turn the FString into a FJsonObject with FJsonSerializer::Deserialize, and then turn that FJsonObject into a UStruct using FJsonObjectConverter::JsonObjectToUStruct
Sanity check, does InitializeComponent() runs on authority only?
I doubt it. Add a breakpoint?
It does not stop at breakpoint, thats why I asked for a sanity check
Probably something else is wrong
How does RepNotify gets called? AFAIK they get called only on clients when bound in c++ and on all when replicated through blueprints, but now I have a blueprint array property with rep notify and that only gets called on clients
I'm using VaRest SubSystem and it works really nice and is quite easy to use. Not sure if available for c++
in blueprints, its a callback from property changed tracker
if you were to set array it would get called on server, too
blueprints are generally terrible for networking, as you have less then 10% tools, and half of those are hacks
Increment Int and Increment Float nodes won't trigger a blueprint onrep for server either.
One question with OnRep on BP.
If i have an array of floats in one actor, set to replicate (both the actor and the array) and OnRep i update the UI.
Should i be passing the new array value on the methods or just get the actor reference on UI and grab the value of the array?
Really depends. Can go either way. If it's a massive array that can affect a ton of slate, definitely consider passing it along and only affecting that. I find it can lead to more accurate UI just to update the majority of it when something changes. It invalidates slate from text sets and such, but you don't necessarily need to recreate the widgets and such.
how can i make this day night cycle work on listen server ?
I guess a simple authority check would be enough
i dont know what is that
There's a BP node called "Switch has authority" or smth like that
It's also a concept you should try to understand before doing things
im stupid
Felt the same at the start (and i still do)
this is the problem
Is the actor which owns this light replicated and also the light itself ?
Highly recommended to read the multiplayer compendium when starting with MP, most of the little i know about mp came from that source.
https://cedric-neukirchen.net/
Was about to recommend that too
cedric would recommend it too, probably : P
thx man
So what are my options here? I am trying to teleport a character/pawn to a location, and THEN possess them in a server-side function. However, despite the fact that the possess is called after the setransform call, the transform change doesn't seem to rep to the owning client till after the possess.
Don't know what is wrong ๐ฆ
what does your JSON payload look like
though it might be expecting your struct members to use the UE4 naming conventions and I'm not sure if that's case sensitive
L"{\r\n\t"childName": "New Name!",\r\n\t"parentName": "Please Work!",\r\n\t"inMatchTime": 20\r\n}"
I'll try. Sounds wild, but why not ๐
i kind of understand the multiplayer but my light direction is different and i cant get it to work
Any experience with voip attenuation not working even when setting it correctly by setting the voip variable after create talk player, the attenuation itself works properly but it seems when players use it there is no attenuation?
When I start a local server and have multiple instances connect to it, the player character is duplicated but only for the person who joined. This is on the third person project, how can I not have their characters duplicate whenever I connect another window to it
Didn't work. I did some tries further and as a result found something weird
How this is possible?
okay. It works further in code. Just strange debugging issue
Thanks all for help
If I want to change the mesh property of a StaticMeshComponent on a StaticMeshActor, and have it update on clients to match, is there something I'm missing other than marking the SMA to replicate? (via bReplicates = true in constructor of the SMA)
Static meshes already have special logic to handle this replication. Are you observing some issues?
what's the solution for dealing with attached actors falling out of network cull range and just never updating on the clients again? In my case, i have a car that i can drive, once i get out, my old body is teleported to the get out location but the attached actor is super far away so it never gets shown. I guess I could teleport all attached actors to my player but i feel like theres a better solution
The mesh wasn't updated on clients when changed on server. I just fixed it by setting Component Replicates to true on the SMC 
All though the mesh is in a completely different location on the client now
Mesh position is replicated separately
I'm checking what the bool is called, but there is different bool for replicating location on static meshes
is it Replicate Movement?
bStaticMeshReplicateMovement
Yeah I got that checked.
Hmm.. I can't see where I found that before
I'm looking in the code btw
I'm making a custom StaticMesh, so I was aware of the replication oddities.
You should be good then
Oh wait, it looks like that was on the StaticMeshActor
As in handled on a per instance basis
I might be incorrect though
I haven't actually experimented on it yet, just reading code
So, when I check Component Replicates to true on the SMC of my SMA, the mesh updates properly but the location is being set to some seemingly random value on the client
When I leave it unchecked/false, it's in the right spot on the client
๐ค
/** This static mesh should replicate movement. Automatically sets the RemoteRole and bReplicateMovement flags. Meant to be edited on placed actors (those other two properties are not) */
UPROPERTY(Category=Actor, EditAnywhere, AdvancedDisplay)
bool bStaticMeshReplicateMovement;```
This is on the StaticMeshActor
The comment makes it sound like you need to change that variable on the ACTOR
In addition to marking the component as replicated
hmm. I have that true on the SMA.
That is odd
Oh yeah, obligatory working on UE5 warning
Sorry I can't be much more help right now
shoulda prefaced my question with that lol
I'll be working more directly with this myself over the next couple days
I appreciate the help none the less
Correct
I think this is a non-multiplayer issue at this point because the vector it's being offset by is not random
by that doesn't make sense as to why it isn't matching up with the server
Left window is Listen-server, right window is client. Right hand weapon seems to work correctly, left hand is not. Both are spawned from the same class.
Aha. It was the FAttachmentTransformRules being passed into the attachment that was causing the client only offset. How it was causing it to be offset only on the client, idk. Why I had different attachment rules for left and right hand weapons, idk.
Just starting out with unreal programming (have a background with c++) but if I wanted to have a multiplayer spaceship game is it better to replicate the properties for the players position or handle the users input via RPCs?
This course is free in Unreal Learning Academy, search it by its name and you'll find it. It's explaining and going over the things you are asking for: https://www.gamedev.tv/courses/635403/lectures/11781097
TL;DR you need to use replicated movement, look for FRepMovement struct in AActor
Also PostNetReceiveLocationAndRotation() and OnRep_ReplicatedMovement()
cheers for the info, will look into the learning academy link
Test
Sorry was not letting me send a message and was testing a shorter message
So i've been working through tutorials and reading documentation to help implement better and more reliable multiplayer in the two player first person shooter im working on. I've hit a snag in the tutorial document i've been reading though and though it would be easiest to find the anser here. Its to do with the players healths. The general flow is when a player takes damage their "PlayerTakeDamage" is called which calls the "SetCurrentPlayerHealth" which in turns runs the following: ```c++
void UInventoryComponent::SetCurrentPlayerHealth(float NewHealth)
{
if (GetOwner()->GetInstigator()->GetLocalRole() == ROLE_Authority)
{
CurrentPlayerHealth = NewHealth;
OnHealthUpdate();
}
}
The OnHealthUpdate() looks like this:
void UInventoryComponent::OnHealthUpdate()
{
//Client-specific functionality
if (GetOwner()->GetInstigator()->IsLocallyControlled())
{
FString healthMessage = FString::Printf(TEXT("You now have %f health remaining."),
CurrentPlayerHealth);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, healthMessage);
if (CurrentPlayerHealth <= 0)
{
FString deathMessage = FString::Printf(TEXT("You have been killed."));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, deathMessage);
}
}
//Server-specific functionality
if (GetOwner()->GetInstigator()->GetLocalRole() == ROLE_Authority)
{
FString healthMessage = FString::Printf(TEXT("%s now has %f health remaining."), *GetOwner()-
>GetInstigator()->GetFName().ToString(), CurrentPlayerHealth);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, healthMessage);
}
} I've also made sure that the CurrentHealth has the UPROPERTY ofc++
UPROPERTY(ReplicatedUsing=OnRep_CurrentHealth,EditAnywhere,BlueprintReadWrite,Category= "Inventory | Player Settings")
float CurrentPlayerHealth;```
And the OnRep_CurrentHealth just calls the OnHealthUpdate function.
The idea behind this is that when the take damage is called it SetsCurrentHealth on the server which also and since the change happens on the server and health is replicated the client also gets that change and calls OnRep_CurrentHealth
However the issue im having here is when the client shoots the server it never makes it into the SetCurrentPlayerHealth's if check, but when the server hits the client is does seem to correctly function. If anything stands out to anyone I would be appreciative of some feedback
I think it's something like.. if you just set the boolean on the server, it won't get replicated automatically
so you'll have to manually make sure it also gets pushed to the clients
i'm not particularly good at this though
From what i was reading when you have a variable set with that Replicated="function name" in its UPROPERTY that means when the server changes that value its gets replicated to all connected clients' copies of that instance. I didnt specify having to any manual work for getting the server to push the updated value to the clients. But im also new at this
guys i am making a ball game but when we i host a game and other players join, everyone has their separate instances of the ball and they can't see each others balls so that fails the purpose. Here's what my replication section looks like.
how can I fix this?
so what you pasted, i believe, is the replication section for just a single class ?
you probably, no offense, want to work through some kind of tutorial
you're going to have to make that section work for everything in your game
not just the one class you're looking at now
no prob man, be brutal. idk multiplayer yet
thanks for the info
@stoic dagger check this out
The message got pushed up a bit, but if anyone has any insight I seem to just be going in circles without much avail. Everything in the documentation I'm going through says this should indeed be working...
It might also be worth noting that the class type im working in is derived from a UObject which is a UActorComponent. Thats why im doing that c++ GetOwner()->GetInstigator() That just gives me a reference to the player owning the inventory component
Just for extra info I've got it working correctly for when the server shoots the client. The issue im finding is that when the client shoots the server and this code is ran: c++ void UInventoryComponent::SetCurrentPlayerHealth(float NewHealth) { if (GetOwner()->GetInstigator()->GetLocalRole() == ROLE_Authority) { CurrentPlayerHealth = NewHealth; OnHealthUpdate(); } }
Which is supposed to update the health on the server , doesnt get ran at all. The GetLocalRole() when this code gets ran from hitting the server returns ROLE_SimulatedProxy. Can anyone elaborate on this conundrum?
Sounds like you might be running SetCurrentPlayerHealth on the attacking client rather than on the server?
ie. not RPCing the attack to the server so the server can handle what it needs to
as someone who is still trying to grasp the concept of networking in unreal could you elaborate on that so I can better tell if I'm indeed doing what your hypothesizing?
I know what RPC's are and everything just what exactly you mean by the situation your describing
What I'm thinking you might be doing is along the lines of:
Client Presses Attack Button > No RPC is done > Whatever functions you are calling to determine damage are all being run on the client rather than on the server.
Where it should probably be:
Client Presses Attack Button > RPC to Server > Whatever functions you are calling to determine damage are being run on the server.
So when a player fires a projectile what is ultimately happening is this function gets called: c++ UFUNCTION(reliable, server, WithValidation) virtual void ServerFireProjectile(FVector Location, FTransform CollisionTransform,FVector Direction) override; which spawns a projectile on the server. Then when the player registers being hit by the projectile (which both players do) the 'damage' code which is described above gets ran
I am checking what player is getting hit and what player is getting referenced by the GetOwner()->GetInstegator() and the players all seem to be correct when it comes to player 1 and 2
i really do think you need to change something from Replicated to RepNotify
and everything works fine when the server player hits the client player. The health variable gets replicated correctly and the OnRep function gets called all as expected. Its just when the client player hits the server player that if check in the SetHealth() doesnt do what id expect
what do you mean by something? Wouldnt the health be the only thing in this specific case that requires RepNotify? What else would need it in this case?
i was just looking at https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Blueprints/#eventreplication for the thing i'm debugging, and it reminded me of what we were talking about
anyhow you have to narrow it down somehow
but yeah my thought was, it works on the server but not the client because the client is not actively reading the variable but waiting for it to change
i don't know, your issue keeps ringing this vague bell
like the check is failing because the variable it's reading is not synced
Within this same block of code, could you test what GetOwner()->GetInstigator()->GetRemoteRole() returns when the server is hit by a client?
I will say also.. please don't hate me.. I have literally been removing code to sync multiplayer health tonight from my project, because I realized that I should probably be using 'PlayerState' and not implementing my own version of it
The remote role when the server gets hit is 3 which is the the Authority which doesn't make sense at all...
Because that would mean it thinks the client is the server correct?
I believe that means the SetCurrentPlayerHealth is being called on the client.
Which actually could happen - if your collision on your projectile is triggering the call on both the server and the client(s).
Since the projectile is spawned on the server could that situation you're describing be happening?
The projectile is marked to replicate no? So clients can see it?
The projectile is indeed replicated
Currently having trouble with other players being able to see the vfx when it's spawned on the server but yes the projectile itself works as intended
What I think I'm not getting is if it was indeed getting ran on both client and server, would the prints not indicate that by double printing mismatched information? The information it prints in regaurd to what was taking the damage is correct
Ok, so when you spawn a replicated actor and it is relevant (I imagine it would be in this scenario) then a copy of it would exist on the server and any clients that see it as relevant.
Question: When you say you are doing prints, do you see Client1: or Server: being displayed?
For example server is Player1 and the GetOwner()->GetInstegator() in the method prints the Player1_C
The prints are being done in c++ so it doesn't print that info along with it. Unless there is a way to do that like it does automatically in blueprints?
Dang
Yes I agree, you would probably see two prints if it was running on both. Since it appears that you're getting ROLE_SimulatedProxy for the Role and ROLE_Authority for RemoteRole, that's heavily indicating that it is being called on the client only.
Okay so I'm peering through the OnOverlap im using for the projectile and one thing does stand out to me (NOTE: i did not write most of this code as I recently got pushed onto fixing most of our games networking issues). The overlap looks like this: ```c++
if (!HasAuthority()) // if we arent the server then dont continue
return;
if (!OwningPlayer) // make sure we have our owning player set
{
if (GEngine)
GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Yellow, FString("Projectile Owning Player not set!"));
return;
}
if (OtherActor->Tags.Contains("Player") && OtherActor->GetName() == OwningPlayer->GetName())
{
return; // we are hitting ourselves when the projectile spawns
}
if (!OtherActor->Tags.Contains("Player") && !OtherActor->Tags.Contains("Environment") && !OtherActor->Tags.Contains("Enemy") )
{
return; // were overlapping with something we dont care about
}
//if overlap with environment
if(OtherActor->Tags.Contains("Environment"))
{
GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, FString("Hit Non-Enemy"));
Destroy();
}```
The thing that stands out to me is that authority check at the top
But the projectile does hit the appropriate player as would be expected so im not sure if that would really cause any issues
!HasAuthority() should mean ignore everyone who doesn't have authority, which is what you would want for an overlap of a projectile.
Buuuut.. that could also be worded poorly depending on what you want done... Like... You want to have authority to do the overlap checks.
So if HasAuthority returns true, and you're notting it, then it would be false.
which in this case looks like it would proceed (if I'm reading it right lol)
Yes you are indeed reading it correctly, as long as i am also reading it corretly lol. Other than that everything else is pretty trivial then, just check to make sure what we hit is a player and taking that hit actor and dealing damage to them which trickles into the taking damage code above. Nothing to indicate that if the server is hit then call the function on the client
I would also like to say thank you for all the help and info you've provided so far! It's been a huge help (even if it isnt fixed yet lol), and with the deadline thats been put on me with little time to try and learn how unreal does it's networking and change a heap of non-networked code into networked code this has been great so far
Somewhere in that overlap check there is the call to SetCurrentPlayerHealth? Like there's no other RPCs in there anywhere?
Hey, Can I get "Is Character owned by client itself" ?
"Is Locally Controlled" not worked for me
There are none otheres, it calls deal damage to player which is in the player and that function in the player calls the inventory components which calls to the SetCurrentPLayerHealth
Ok, and you're positive that you're not spawning a projectile while running on the client yea? Like the only time the projectile is spawned is after ServerFireProjectile is called from the client and validated?
So client presses key > maybe a few client side checks to make sure they can shoot > ServerFireProjectile()
What are the common reasons OnRep function is not firing for clients in C++?
I mean the ONLY place a projectile is spawned along the path taken after clicking fire is within that ServerFire_Implementation
I've been trying to find a reason for it since two hours, couldnt wrap my head yet. Object is replicated, property is registered to list in GetLifetimeReplicatedProps, server is setting the value, it's still not firing
Value not changing is one of them.
Well it only needs to be changed in server
So client will detect the change locally and call onrep
Is the actor your in set to replicates? Probably first thing you checked but better safe than sorry
Yep it replicates
Value is synced and RPCs firing perfectly, somehow just OnRep is not getting called ๐ค
The class is overriding this function i assume as well: ```c++
void UInventoryComponent::GetLifetimeReplicatedProps(TArray <FLifetimeProperty> & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
//Replicate current health.
DOREPLIFETIME(UInventoryComponent, CurrentPlayerHealth);
}```
Yep
Welp i new to all this and still learning so thats about all i got lol
Np, thanks for the effort anyway
GAH... I'm a goof... if (GetOwner()->GetInstigator()->GetLocalRole() == ROLE_Authority)
You're calling this check on the inventory component. So it'd be the owner of the inventory component that you're checking if they are the authority which not want you want - you just want HasAuthority() here too so that whoever the server is proceeds with setting the value.
OH! Well that actually makes sense I think, so your saying something like this? if (GetOwner()->GetInstigator()->HasAuthority()) {...}
You might also mean just HasAuthority() by itself, but in that case since this derives from a UObject it doesnt have that method to call
No, you don't need to care about the owner at all - you just want to make sure you're running on the server.
So even IsServer() if that exists on a Uobject
UObject doesnt seem to have access to either IsServer() or HasAuthority()
๐ค
Trying to look up how to check if running on server while in a UObject
GetWorld()->IsServer()
Ahh well that is indeed avaliable. Is that the same thing as the others or is that just a huntch?
Hmmmmmmmm...bad news...that didnt change anything. I'll trying printing that out to make sure it is indeed false. I guess a good question to ask would be why that SHOULD work? Is that because the projectile should only be running on the server?
and therefor when it hits the player that logic is continued to be handled on the server?
I really am a goof... That was a eureka moment that shouldn't have happened. An attached component will return the appropriate authority on the server:
LogBlueprintUserMessages: [BP_ActualCharacter_C_0] Server: BP_ActualCharacter
LogBlueprintUserMessages: [BP_ActualCharacter_C_0] Server: ROLE Authority
Ahh okay i see
You're not attaching the component at runtime are you? ๐
Just found some interesting info. I went ahead and in the projectiles Tick i printed out: ```c++
GEngine->AddOnScreenDebugMessage(-1, 0.01f, FColor::Blue, FString::SanitizeFloat(HasAuthority()));
By that you mean in the characters constructor creating the default sub object and doing it that way?
Constructor should be fine.
Just again, narrowing down places where things could be getting done on the client that could possibly cause this kind of issue.
Okay, good. Can confirm that thats where the Inventory gets created and added to the player
client fired it only printed 1 as expected. But when the server fired it printed both 1 and 0.
this is concerning.
Yes, yes indeed. That means when fired from the server its putting a projectile on the client and server correct?
When a replicated projectile exists, it should exist on both client and server. Has Authority == 0 on the client's copy. Has Authority == 1 on the server's copy.
If you only see 1 being printed when the client fires, that tells me the client is firing the projectile directly as the client would have authority of a projectile spawned on the client, and since it was spawned on the client, you wouldn't see two numbers being printed.
ALTERNATIVELY...
If the projectile isn't replicated, in which case the server could still be spawning it, and the client doesn't get it at all, so then your Has Authority == 1 would display, but seeing as you are getting two numbers when you know the server is spawning the projectile, this seems unlikely to be the case.
@neon ether its imporant to take grom Datura's explanation that HasAuthority and IsServer are not the same
If I wanted to play a montage on all clients ASAP, Should I play it locally then ask the server to replicate it to other clients, or should I just ask the server, and play it locally when it multicasts back from the server?
Sorry for the late response, im sure your asleep by now assuming were in similar time zones. Though I will leave my response to you comment here in case you still end up seeing this at some point
So the way I'm spawning my projectile is when the player reads a fire input the inventories "StartModFire()" is ran from the player's blueprint. That method first checks to see if "GetOwner()->GetInstigator())->GetLocalRole() < ROLE_Authority". If it is then it runs "ServerStartModFire()" which is of course a reliable server method whos implementation just calls StartModFire() again. StartModFire() then proceeds on with FireActiveMod(). This to me from what I understand just ensuring that no matter who fires, client or server, that it will always also happen on the server. FireActiveMod() calls the Mod's Fire() if and only if "GetOwner()->GetInstigator() && GetOwner()->GetInstigator()->IsLocallyControlled()" essentially saying proceed if we're on the local machine from what i understand. Then from the Mod's Fire() that calls the ServerFireProjectile() which is also a reliable server funcion. Which is supposed to put the projectile on the server which in tern also on the clients as well. I dont know how it would be possible for the server function to only spawn something on the client side.
Okay so i think my issue is with that FireActiveMod check for c++ if (GetOwner()->GetInstigator()->IsLocallyControlled()) { DefaultMod->FireActiveMod(CameraComponent,MuzzleLocation); } If i remove that if check entirely then nothing changes with reguards to the server but for some reason as to which im not entirely sure on, the client now fires two projectiles on the server and one on the client instead of just one on the client and nothing else. Although even with this extra server projectile the client still only damages the client one time. So it works but its not perfect
Hello Guys .. If i have a big space and i want to seperate each planet on different instance or different server is that possible with ue4 ?
yes, iz nice
that would be a response for your avatar, a more sensible response would require more specific details about how you plan to implement interplanetary traversal mechanics
@odd iron you can use servertravel to do something like that I think?
yes, if you want to see a planet in distance have some kind of load mechanism and wait for the actual load to travel there, servertravel would be sufficent
Similar to how EVE handle star systems. Each one has its own virtual server or osme such
then when you pop in what about the ships in the area
will you replicate copies to nearby servers? ๐ฟ
Good i saw this method in a game called Atlas when you travel from island to another one you will have to connect another server automatically
Thats why im thinking to start implement that when i start building the game
Well i think web socket can handle this stuff
possibly
Cool then its seems easy littlebit
Maybe i think i hope i wish
That's basically how a lot of games work, even like world of warcraft at zone transitions
you typically get around it by portalling where you can't see what's on the other side, that's not really easy to hide in space
If the distances are large enough, it won't matter. Just ENGAGE WARP DRIVE to jump to a new server
Yea but we can hide it with behind dust or fog
you will have harsh transitions, best option design a warp mechanic or something
Like space jump on Space engineers
like warp to sector can work well
I will put that in plan
But if i made the game witb ue5 world partition isnt that better for one server ?
but tbh I don't think it hurts just using it anyway, in case you do need it
partitions are not instances
Yes i meant paritions much cheaper than multiple servers for each planet
ohh
Server**
you need to design and test each server
Dont forget Borat
Hey @chrome bay any chance you feel like helping me out with this? I've followed your article and linked a gist containing my UObject and actor proxy but nothing is being "written" in ReplicateSubobject
Looks fine to me. When you create the Job it's "outer" is the actor too right?
actor is replicated and Jobs are SupportedForNetworking?
got love unreal with that Outer switching
and also whats your test scenario? what did you do to conclude they are not replicating?
Hey, How can I get whether the character is mine or not?
Depends what you mean by "mine." The server owns ACharacters and has authority over them too.
But if you just want to check if that character is possessed, you could get its controller.
I've come with my own question.
I understand that before BeginPlay is dispatched by the world, the game mode and the game state are guaranteed to exist since together they initiate BeginPlay. I also have read that before GameMode will tell GameState to dispatch BeginPlay, it needs to have the controller class? So that means that by the time PlayerController's BeginPlay fires, it's guaranteed that the game mode, game state, and player controller exist.
My question is, what about controllers beyond ID 0? Will GameMode wait until all travelling/connected clients' controllers exist before telling GameState to fire BeginPlay?
Any advice would be appreciated.
Cheers.
i would sort of guess that it doesn't.. they have to handle players connecting mid-game, right?
I'm curious also though, I don't know for sure
Why am I getting error messages when trying to do 'get player controller' on multiplayer? I only want this logic to execute on client, I thought 'get player controller (index 0)' just defaulted to giving you the PC of the client (which is what I want)?
Are you calling it before the player controller might exist?
Definitely possible, when I use 'isvalid' it removes the error but also calls the logic afterwards which I don't understand, wouldn't 'isvalid' just prevent the execution? Or does it queue until valid or something (in level blueprint on begin play)
IsValid doesn't create a queue. It either succeeds or fails.
Weird that the isvalid node then gets rid of the error
Also the error was displaying while the logic was executing
Maybe it just delays execution for a fraction of a second needed for the PC to be created?
It's funny that it's similar to my question above about begin play order. I hope Jambax or Zlo or someone who knows all chimes in to clear it up for us.
It's working fine now but wouldn't trust it in a finished product XD
But even before 'isvalid' node was added, logic was all executing, just a red error message after I closed the game (which is bad if you want to package)
Yeah, I can't explain that.
Hey, How to not replicate event even it is run on server?
"Changing camera with changing weapon attach location" Event cause this issue only on listen server
Dedicated server won't cause this because all players are client
you could probably add a check for the authority level and only run it if it's a client
but I also want server to run Event
If I use "switch has authority" or something, it won't run server, and it means "server player can't change camera"
I just don't want to replicate this weapon's location when it's on FPS mesh
can somebody help me i have my variables replicated and its still not working
A game can exist with 0 player controllers in it. The Game Mode only requires the class of the player controller, not for there to actually be one existing. Otherwise, yes, by the time a PlayerController's begin play fires, the game mode, the game state and the player controller exists.
Ignoring the rest of the logic for now, why is the print string only displaying on server?
The reason you're getting an error message is that the Begin play fires on both the client and server copies of the actor you're looking at, and I'm guessing you're doing "Play as Client" which means it's a dedicated server, and dedicated servers cannot have widgets created for them. Your best bet here is to use a HasAuthority node and only do the widget creation on the "Remote" node only.
The standard Get Player Character / Controller nodes are also not very good to use in multiplayer and should be avoided. There's usually other ways one can get the controller or the character depending on where you're calling values. For example, if this code is on the character, you can usually do a GetController node instead which is different as you're then asking for who is in control of this particular character rather than asking for a specific controller. Something to keep in mind though is that controllers only ever exist on the owning client and the server - you cannot get other player controllers while running code on the client.
Lastly, if the code you've posted is on the player character then you'd not only need to do a HasAuthority node, but also check if it is Locally Controlled - if true, then you would want to add your UI. If you don't do this, any time a character begins play, additional UI would be created overtop of the existing UI for every single player that joins the game, or becomes relevant again.
This is in a widget?
yes
Widgets aren't replicated.
And theyโre guaranteed to exist at that time? When BeginPlay is fired on the server and/or the client.
It would be a great relief to me if I could count on GameState[Base] existing when PlayerController calls BeginPlay.
I'm actually thinking to use a host. Also why would the logic run on both server and client? Obviously though, I am doing something wrong. I have a bad understanding of how multicasting works.
From the server's perspective, yes. From a client's perspective, probably not. GameState needs to replicate to the client, so on a client the begin play on the player controller can fire before the begin play of the gamestate fires on the client.
Because Begin Play fires on both the server and client copies of the actor if it is a replicated actor that is spawned by the server.
your 'show on all' event runs everywhere, clients and server
I understand that the BeginPlays may be out of order but will the GameState exist before BeginPlay calls on the controller?
I think it must as GameMode tells GameState to dispatch BeginPlay to all actors. But I donโt know for sure.
The actor is a non replicated widget
On the server, yes. The GameState would exist before a client connects. On a client, it's technically still yes, but since the game state replicates to the client it may not exist yet to the client.
And so the BeginPlays on clients may fire before GameState exists. ๐
In my basic testing, it doesn't look like it is a problem. On the Begin Play of the client's player controller I can cast to the game state and run a function and I don't get a fail on the cast. Try doing what you're trying to do with the gamestate, and if you're starting to get unintended behavior from whatever you were doing on the gamestate, then you at least know where the culprit may be.
Thanks for testing that, Datura. Iโve just read so much about BeginPlays firing in different orders on the server, on the client, in the editor, in the build, and etc. that it has me scared.
this event runs when a player overlaps a server owned actor - how can I get it to run only on the overlapping character's machine?
The playerstate I know suffers from a problem in that the actual copy of it doesn't exist on the client on the beginplay of PlayerState. The only way around this particular issue was to override the OnRep of playerstate so that it calls a function so that I know that I have the appropriate playerstate.
can I somehow check the index of the pawn input or
Use a HasAuthority check on the overlap and use the "Remote" path. You can then also do a "Is Locally Controlled" check on the character before passing to your interface. Using both of these will make sure that the overlap is being looked at by the overlapping character's client.
has anyone tried advanced sessions recently?
we had a playtest a few weeks ago and everything worked having 10k in sessions find and now doesn't ๐ฆ
even with a few millions
the authority check is meaningless because it returns the same for all players
It's to ensure that it's not running on the server.
same... locally controlled does not help, the actor is controlled by the server
You want to check if the character is locally controlled.
oh i see
Simple, have the changes being done on a local actor that is not replicated
Since your problem lies with the replication of the actor, and not some authority check in blueprint logic
also, having PC spawn widget is messy, use the HUD, its what its there for
no.. it spawns in the game world above an actor, but thank you
thank you for the unsolicited advice
it has plenty of responsibilities, that is not one of them ๐
UObject that is not Actor or ActorComponent?
outer is playercontroller
yeah, but it needs extra c++
GetRemoteFunctionCallspace and something else overriden
it is in c++
in order to be able to RPC
virtual bool CallRemoteFunction(UFunction* Function, void* Parameters, struct FOutParmRec* OutParams, FFrame* Stack) override;
virtual int32 GetFunctionCallspace(UFunction* Function, FFrame* Stack) override;```
those 2
i did ill share code hold on
they did add some complexity to that function, multiple net drivers
some unsolicited advice is good advice ๐
you did not call Super in GetLifetimeReplicatedProps, btw
though why didn't you just use an actor component that has all of that setup already?
but there's nothing in uobject base
hi please STOP PINGING ME
I had a really specific question, thank you
jesus christ this discord
UMyObject in that pastebin does really seem like it's reinventing the actor component
iam currently using actorcomp but idk why it doeesnt work for uobject
I'm sorry that I am not going to rewrite a fucking tutorial because "Zlo" objects
what with this ego?
i borrowed the code from ActorComponent around 4.12 or so
for similar purpose
bool USolsticeBuffBase::CallRemoteFunction(UFunction* Function, void* Parameters, struct FOutParmRec* OutParams, FFrame* Stack)
{
AActor* MyOwner = GetActorOwner();
if (MyOwner)
{
UNetDriver* NetDriver = MyOwner->GetNetDriver();
if (NetDriver)
{
NetDriver->ProcessRemoteFunction(MyOwner, Function, Parameters, OutParams, Stack, this);
return true;
}
}
return false;
}```
looked like that back then
and it worked just fine
I was trying to get a sense of why you needed a plain old UObject over an actor component
since if all you're doing is just doing everything UActorComponent implements for networking anyway
@winged badger or @verbal tendon if all you do is tell people what to do, without even attempting to explain why it doesn't help
it just gives you an ego boost
i could had explained you the whole separation of concens
you did not seem interested to hear it
if you really, really have to jump in, an hour later, just to tell me to arbitrarily change code?
so why would i bother writing half a page
start with the fucking knowledge part bro
i know, why bother teaching, when you can just preach
who shat in your corn flakes this morning
Can't tell if you're angry at Zlo or if you're just having a really shitty life. Gonna assume life, cause this is like the third time I've seen you losing your shit on someone in here. ๐
yeah and I didn't see anything that bad
thank you for your contribution
You're very welcome.
lol you signed up for this
Also you should use HUD for UI stuff.
old epic tutorials used game mode for ui?
TL;DR; UI gets replaced 10 times during typical game development - doing anything that requires you to modify the game code in order to modify or completely replace the UI will bite you in the arse
tldr, I DIDN'T ASK ABOUT UI
I hope not
you just all really need to lecture me about it
you can set the AHUD class from game mode, but that's just sent to clients as an RPC
Pretty sure CreateLootableWidgetWidget creates a Widget doesn't it? Pretty sure widgets are used for UI.
try reading the question bro
it's the part you replied to, i can see it without even scrolling up
someone answered it
you guys are just getting off on the lecturing or something
@tawny nova please be respectful to people who are helping, we are volunteers here, and help because we want to help.
dont get banned over ahud man
XD
no it's cool, i just wanted them to stop pinging me, so i'm blocking them
That is fine to do, just sometimes its best not to say anything sometimes, and ignore/block.
If I call a Client RPC in the controller beginplay should that be okay? Because it's not being called on the client?
should be okay
May be okay. Also make sure to gate it behind authority, or it'll run twice on client since it'll try to call that from client's beginplay and then get the RPC from server shortly after.
from client side it will always run on invoking client
it just never gets called ๐ฆ
i think you can follow a player locally without rpcs
I love it when people act like dicks in public. Get called out on it, and then PM me in private to call me shitty and then block me. ๐คทโโ๏ธ
let the mods know he'll get banned
Well this is awkard, I literally just got back to check if any further elaboration was needed, which I have time now and would be very happy to do. And then I read chat history ๐
This looks like you're spawning something and then calling the RPC? Chances are the thing you spawned and sent as a pointer isn't valid yet on that client. The RPC would reach the client long before the replication will in most cases.
That's fine however I'm trying to just print in that function
The print doesn't come through.
What sets your IsServer?
Nothing its just GIsServer
I would consider a HasAuthority or GetNetMode() != NM_Client
Well I'll publicly say you're awesome. You've always been super helpful to others, including myself and your presence here is much appreciated.
i sent him a screenshot of someone who privately dm'd me to say thank you for sticking up to a bully
lol
A screenshot that wasn't even related to today's conversation. It was a screenshot about some other conversation involving Zomg.
bro pls stop this xd
Also thank you. ๐
they should add beef channel for sure
As in ping, or more advanced?
Ye I use NewObject<UJob>(jobProxy, jobClass)
The on rep function is never called and debugging it shows that ReplicateSubobjects returns false
I know that PlayerState has a ping value. It's compressed, I don't remember the exact compression though. Memory offhand says multiply that by 4?
Yeah, here.
I think you can get a more accurate ping for the local connection
Ping isnโt delivered on some platforms FYI
if that's what you're after instead
which
As accurate as possible
And how does one get the client timestamp?
Is that a thing?
I usually use bp, but have started to use c++
what is the problem you're trying to solve, let's start with that
Server rewind
for lag compensation? because we tried that and just went for CSHD instead
How would I go about doing that
Just register hits locally and do some server checks?
yes, and our server checks are relatively strict because it does steal one lag compensation concept
there's a buffer of historical positions and it compares them based on a server timestamp (which gamestate does provide, but with an increased update frequency)
Ah I was trying to do that exact thing
I mean recording locations on the server and checking againsed that
Out of curiosity, what platforms is that usually? Never hurts to have random extra knowledge I'll never need. ๐
So should I go and check the game state
This is something I setup in like 30 mins so its a bit simple atm
@lost inlet the server timestamp, is it this:
oh damn, you're doing this in BP
we changed ServerWorldTimeSecondsUpdateFrequency to be more frequent on the GS too
but if the client sends their server timestamp, then the server will know roughly how far behind they were when they shot their weapon
Steam lobbies / dedicated, anything iOS off the top of my head
I've never seen the ping property in PS ever not work
well steam session results are different to the playerstate property
It doesnโt work on iOS
it's not platform specific, what you've linked is session results, which is OSS stuff
Itโs transport specific
well it works on consoles at least, and PC
and nothing I saw about the in-game ping value was platform specific
I forgot about this, lmao
I have just gotten back to doing multiplayer, thanks for the reminder
Hi everybody! can anyone think of a reason as to why this RPC (on server) could not trigger? (even if the inventory ref is valid) ?
i'm having a trouble where that RPC triggers okey with one child type of inventory but not with other child (none of them change the rpc in any way and are set to replicate)
I'm off to bed so I can't answer further, but you probably want to include some screenshots for people to help you better
If it works for one item in your inventory but not others, it might be that not all the items have replicated to the client fully and that's why you're getting hit & misses
Yeah, let me add some pictures and explain a bit more, i wanted to keep is as simple as posible
I have this 3 inventory class (First one is base, the other 2 are childs)
This RPC is on the base class, the childs don't override it
I'm having one case where this call from a widget is not even triggering the RPC even when the Inventory Ref is valid
it pass the valid get, is triggers "VALID" but it doesn't trigger the RPC
the ref is valid, is replicating and i can target that same inventory from my player controller and the RPC triggers okey
it just doesn't trigger when i do it from the UI(even if the ref is the same)
or even if i get the same inventory that the ref is pointing from other way
So I assume the Widget is pressed on client, just because the Ref is valid on client, doesn't mean it exists on the server
What do you mean by the "ref is pointing from other way"?
That ref on the UI is a variable (replicated) on some other actor
if i do actor --> inventory -> RPC is triggers okey
The two most common ways of Client->Server RPC failing is
(1) the client actor not existing on the server that the RPC is being called on / same thing for one of its params
(2) the client actor not being client owned
if i do UI --> Inventory Ref -> RPC not even triggers
hmm
any way to actually check if it's on the server?
if the item lifetime is controlled from the server ( spawned on server ) then it will exist unless you're also destroying it and the client has it when it's alrady destroyed on the server
it's not that the item is not being destroyed, the RPC won't call at all
the item is just text on the InventoryRef
This is how the inventory Ref that is failing (when called from UI) is created
it's probably something really really stupid that i'm missing, but i can't find it after a few hours.
Sorry really gotta go, make sure you're not running into a case of (1) trying to execute an RPC on the client on an actor that's not client owned
you're spawning this in some class in the server
no problem, thanks for the help
What blueprint is this being created in?
Ok, this part appears to be in a widget. If that's the case, the Inventory Ref here shouldn't be marked as a replicated variable as widgets don't replicate. And you're saying this part prints the "Valid" print string?
I checked "replicated" as a desperate test.
Yeah, it checks valid.
i think there's something wonky with the ref in the case where it fails
You're not getting a warning in the log indicating something along the lines of "No owning connection" right?
let me check
that's it
okey, so the reference on the UI is pointing to a diff actor than it should, prob a client version.
Can a cheater in a multiplayer game add or edit component tags? I plan on checking for tags on the server is that a bad idea?
im not an expert/authority on cheating by any means but i think its a pretty safe assumption that client-side a cheater can do anything. thats why server validation exists
Cheaters can affect their own PC's data. So if you're using a listenserver, they could cheat the tags. But no other user could add tags to the server's version of the actor.
ahh yes, that makes sense
Unless you explicitly allow them to in an RPC or something.
One more pic, sorry for interrupting.
Even on that case, directly pulling the actor from the player controller, i get the error of not owning it.
But if i print the inventory name from the controller on that exact same way, i get a different actor name.
Yes i found it
Got it working now?
The Widget owner wouldn't really matter in this case.
So long as the expedition inventory has an ownership back to the player controller of the client that's trying to manipulate it, it should RPC without issue.
it has to be something with the Ref on the UI, at least i can look into that now with the Error that you pointed out in the log
And from what I see, you're spawning the expedition, setting the owner to the playercontroller, and then spawning the inventory, setting the ownership to self (so the expedition being the owner) so that should work.
okey, it's probably here, just need to dig a bit more.
i'm getting 2 actors of inventory, the names are the same for what i see on server and the one throwing the error, gonna look why i'm getting that second one, but most likely that's it
you can probably pass a reference to the owner into the event
check for server / role early in your BP, then set the reference and pass it around
i actually did this one and it works, but by doing so i found that the owner of the owner of the inventory is "None" somehow, i'm checking on that. The spawn is on server and with playerController as owner
just in case someone is interested, i fixed the problem with the UI and the Ref.
The problem was that the inventory failed when the owner was posseses by a AI controller, i fixed it by just switching the owner of the inventory to the player controller on spawn
thanks datura for the clue on the error (?)
If a UNiagaraComponent is spawned on the server does it automatically get show on the connected clients as well?
no, there's no replication with visual components
So if a server is spawning a vfx how would i get that vfx to be shown on the server itself as well as the client?
multicast RPC?
I had experimented with that but didnt have much success, I figured that would be the case, so I'll have to give it another shot
If a print is within a multicast RPC then the expected output when that rpc is ran would be two prints being done since it would be called on the client and server correct?
Other question: if HasAuthority() is printed within that multicast RPC then the expected output would be a one and a zero correct since it should be running on the client and server?
a multicast called from the server calls the _Implementation on both client and server
HasAuthority() will return true for the server
It is a bit annoying that when running the Editor as listen server for MP testing that it is seen as a client no matter what action you take rather than the server. At least for sure when un-possessing to test some server code.
No idea what you are referring to tbh
If my pointer to a replicated object has COND_SkipOwner is it normal OnReps are not getting called in that object for the owner client?
I'm trying to solve why OnRep function is not being fired for my clients, I implemented all necessary things to make it work but I'm clueless about why its not working
It is normal. That's what SkipOwner means
But the object itself is replicated for everyone
SkipOwner only applies for variable of that object's pointer
Probably my English failed again at that sentence. I have a uint8 bSomeBool : 1 in a replicated UObject, and that UObject's pointer is stored in an actor with SkipOwner Condition
When I set bSomeBool from server (which doesnt have any condition) OnRep is not getting called
I still don't understand. This is the workflow of skipping replication for owner. You make sure the object bReplicates to everyone and you add that COND_SkipOwner to skip replication for owner
I would suggest to start showig some code to clear up confusions
bSomeBool belongs to that object which replication is skipped on owning client. So it won't replicate either.
I have this variable in UPlayAnimationObject. Its a replicated UObject spawned from server and stored in an actor
/** True if we are playing an animation and waiting for finish. */
UPROPERTY(ReplicatedUsing=OnRep_PendingAnimationFinish, VisibleAnywhere, Category="Animation")
uint8 bPendingAnimationFinish : 1;
This is my actor storing that UPlayAnimationObject:
//// .header
UPROPERTY(VisibleAnywhere, Replicated)
UPlayAnimationObject* ReplicatedObject;
//// .cpp
DOREPLIFETIME_CONDITION(AIntaxWeapon, ReplicatedObject, COND_SkipOwner);
But it's just to make owner client predict the object's value. The object itself still exists on everyone, including the client
Woulnd SkipOwner condition only prevent the replicated variable changed on owner client?
How would it affect the object's state itself?
It should only cover the replicated property, not the object's replicated state itself
Yes it still exists for everyone.
Yes
The documentation on this is pretty clear, the replication conditions only affect the replication of the variables that they are set on
the class instances that they are part of are either replicated or not replicated
Yeah, I'm just trying to solve why my OnRep is not being fired to client when it's changed from server
I just had a suspicion maybe if its related with replication condition because everything is implemented propertly
How would you go about getting that bPendingAnimationFinsih?
You would say: ReplicatedObject->bPendingAnimationFinsih
If ReplicatedObject is skipped on owner then bPendingAnimationFinsih will be too.
I don't get it via ReplicatedObject->bPendingAnimationFinish, I set the value inside the replicated object directly
So replication condition should not prevent the OnRep from triggering
Anyway, seems like the issue is not related with this issue. Issue itself is too vague to find a reason for, thanks for the effort for trying to help
Make sure you call the OnRep on server if you're not doing this already
hi guys , i wanted to implement missile in multiplayer , and when i created a pawn "missile" my told me "Anything controlable with steering needs to be character class for movement prediction" . i dont wanna look an idiot infront of him lol , can someone explain wtf is that mean and why i shouldnt use pawn ?
Is it a guided missile?
It's likely just a laziness thing. CMC has an advanced input and multiplayer prediction system. Normal missiles could use the PMC, but adding input to that would be a small task that probably isn't worth it in the end. And the floating movement component doesn't really network well.
TLDR making a flying character with a missile mesh is easiest way to make controllable missile in Unreal without spending a month correcting system bugs.
Black Jeopdary is the best
How would I go about implementing a replicated Actor (that exists on both client and server) however set the particle to be only visible for the owner but not other players
It's literally a property on the actor. OnlyOwnerSee
thats for the actor visibility in the game world
you just do your particle
it should be local by default
how can i get the player index of the player who pressed a key?
yeah my case is more complicated than just only owner can see, that's only a start
for example this is for setting up traps, I want it so that only players from the same team can see the trap but the opponent team can't but can interact with trap (overlap with collision etc..)
that also can be done locally, since the actor trap is already replicated so everyone will know about it
but if its placed by team (a) its hidden in game for team (b)
would you please be so kind as to offer more extensive explanation ?
I still can't grasp it yet
if a player placed a trap
all clients will spawn that trap at the same transform
you might set the trap actor by default to be hidden in-game
then eg. OnRep trap actor if the actor instigator/owner actor's team is (a) set actor hidden in-game = false, otherwise true
Hi, I am having a struct with this data
int32 SlotId;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Inventory)
FGameplayTagContainer SlotTags;
UPROPERTY(BlueprintReadWrite, VisibleInstanceOnly, Category = Inventory)
UARTInventoryComponent* ParentInventory;
UPROPERTY(BlueprintReadWrite, VisibleInstanceOnly, Category = Inventory)
UARTInventoryComponent* ParentInventoryA;```
And then I do a very simple NetSerialize
``` Ar << SlotId;
SlotTags.NetSerialize(Ar, Map, bOutSuccess);
Ar << ParentInventory;
Ar << ParentInventoryA;```
But for some reason game away crash and return ensure(IsValidLowLevelFast)
Is there any reason why this is happening?
This thing ran fine with the first 3 properties but when I add the 4th it just crashs.
basically save the player pawn/character reference who spawned the actor (trap) in your actor (trap)
then on actor (trap) begin play ( if is dedicated server == false ) check the pawn/character reference team
if pawn/character reference team == your local player team show the actor in game otherwise hide it.
If I unposses while Net Mode set as "Play as listen server" and I call an event exposed on an Actor via "Call in Editor" I can't seem to ever get a ref from "Get Game Mode". That must be because clients don't have a game mode. But I've told the editor to play as listen server, so is editor not the server? Then who is?
thank you thank you
the game mode is always null client-side
how can i get the player index of the player who pressed a key?
Yes but should the editor be server or client? It seems editor is client.
the window that gets opened first is the listen server
seems like the first window that gets opened is client
Leaving the viewport/editor to be listen server
probably like this is better you can see who is server and client
can someone help me please
what kind of index?
player controller index
is it local multiplayer?
I can see already? So the information is either wrong or not communicated correctly. Further more if I do it like that I can't call events via editor. @quartz totem
yeah
i tried with get instigator controller but its not working
Yes c you can control it by mouse
I never tried that as i didn't do any local multiplayer, but if you explain a little bit more what you trying to achieve someone might help
You probably need a character then
If you got the $, check this out: https://www.unrealengine.com/marketplace/en-US/product/missile-control-system
CallInEditor has nothing to do with runtime though
UE4 has two worlds when you have hte editor up
The EditorWorld and the GameplayWorld
Your EditorWorld has no GameMode
You are using CallInEditor wrong, this is not meant to be a button for runtime
If you need executions in runtime, you can add events to the LevelBlueprint and call them in the console via ce NameOfEvent
Hey, apologies for the ping. I realized I'm also suffering from the same thing. I was mistaken with our latest convo, I thought OnRep was being called but it wasn't. Have you solved this issue?
Somehow RPC works but OnRep not called ๐คทโโ๏ธ
So i was testing the basic grinding functionality of my game and i got stuck for almost 1 hour farming items to get the right stats
grinding is so freaking adictive, it should be ilegal
lol
You mean trees?
Foliage is appearing in both
Anyways, make sure that thing bReplicates
Already solved, The problem was two duplicated virtual textures in landscape
yes is Trees
The grass is spawned by bluprint, not by foliage system
Okay , but why then? Why just dont use pawn? Cuz its also recieves inputs isnโt it?
Try using a pawn and see where it breaks. It's always better to try than not to.
Thank you for this tip. Very eye opening. I'll give that a shot
That works perfectly!
Would the multicast rpc run on clients? The actor wouldn't have been replicated till the end of the frame afaik so I imagine the rpc wouldn't go through
SomeReplicatedActor* Actor = GetWorld()->SpawnActor<>();
Actor->SomeFunc_NetMulticast();
Setting up some properties on a weapon spawned by the character. Server character spawns the weapon, then sets some properties on it calls it's initialize func (basic telling the weapon "I'm done setting you up, now do your stuff").
The intialize func is dependent on some of the properties set before calling it. I'd send a snippet to explain it better if I was home
You can just spawn it deferred
Which is basically how ExposedOnSpawn vars work
I wouldn't send an RPC for this
Mark the Vars replicated and set them between the Deferred and Finishspawn
Mark the InitialOnly if you only need them to replicate once
They should all have the correct value on BeginPlay then
RPC sounds wrong here
Alright, so in what cases i should pawn ?
Oh I like the sound of that. Thanks.
When you need something much simpler and probably don't care about multiplayer prediction and or want to write your own new pawn movement component that has input and network movement prediction.
This RPC is guaranteed to not run. You're calling it right as you're spawning the actor on the server. It's not going to be replicated to the clients
Fyi, regardless of whether or not RPC usage should be done in this case, just some general knowledge
That's what I figured. Just wasn't sure if it would do some magic like "queueing rpc's for actor replication" or something
I appreciate the clarification
Im having an issue where when i call a NetMulticast RPC from a server RPC to spawn a vfx intended for both the client and server players to see it only runs on the server. I even am printing out inside the multicast to check and it indeed only gets called one time on the server.
Hey, How are you doing?
What exact variable is the timestamp
show code
and make sure your actor is actually replicated
Okey then! Thank you very much ! Helped me a lot !
The Server RPC is being called on an actor that is not replicated on the clients
The actor that is calling the the server RPC is being replicated via having bReplicates = true in its constructor
S H O W C O D E
and does the actor that is calling the server RPC actually have ownership of the actor?
This is the delceration o fthe server and multicast rpcs within the actor. The server calls the multicast within itself like so
Yes just because it is being replicated doesn't mean it has actually replicated to the clients, there are a myriad of scenarios where a server RPC will never be executed because the actor isn't properly replicated
The actor is a weapon mod which derives from out weapon mod. I should preface with i am no expert and am reading and learning as I go. I got recently thrown into updated non-networked code into networked code for the game my team is currently working on
So with the limited information that we have
My gut feeling says that you're calling the Server RPC on a non-client owning actor
well that was the first mistake, converting something SP only into MP
you design for MP first if your game is supposed to be MP
yes that was also my opinion but i got outvoted
but it still doesn't explain either of the things, typically the Multicast call would never be virtual
the _Implementation is usually what's virtual
That's okay, just make sure to communicate to the team that this project is going to burn and that it's not going to be your fault when it does
lol then I'm assuming your team is a bit... saying this as politely as possible... a bit naive?
Gotta do that expectation management
oh believe me sir rogers I have made that quite clear
very
Then sit back and enjoy the ride, learn everything you can. Don't forget the popcorn! ๐ท
Thats why I'm here, trying to learn as best I can given the situation
a bit of house keeping first
and show the C++ side
if this MultiSpawnVfx is defined in a base class, then that should have the UFUNCTION markup instead
because in that cause you should be overriding the _Implementation function in the child class
adjustment has been made, thanks for the corrections!
On this note what do you mean by non-client owning actor?
When you want to call a Server RPC from a client actor
the client that the RPC is being called on needs to own it
I've not heard that term yet or read it in the documentation i've gone through
Example: you dont want player2 to shoot player1's weapon
That's why (Client to) Server RPCs can only be initiated from the client that owns the actor it's being called on
Hello! I've recently started with multiplayer c++ and after many hours learning about replication, multicast and so on...now I'm stucked with the using of loops....at least using the while loop: every time a while loop executes every client get freezed...after a couple of hours trying to figurate out what is happening...I don't have any idea ๐ฆ and I don't know what to do next. Any advice? Is this a normal issue? (There is nothing like kind of bug in Google omg)
Do you have prior experience with coding in general as well as experience in UE not doing networking?
I have studied computer science and I have been working 4 years as backend web programmer :3
I also have 2 years of experience using blueprints
so checking to make sure IsLocallyControlled would be important before calling any kind of server RPC?
So the issue is not understanding while loops and for loops?
all clients get freeze...
I tried execute the while loop only in local and only in the server....the same bug
the idea is to start the loop after an input....and ended it when release
Sounds like potentially you're forever executing in a loop and never exit
but why all get freeze? xD With if(IsLocallyControlled) for example it would have sense that the client who pressed the input...get freeze....not everything
If they are all executing it they all freeze ๐
This is a very difficult question, because generally your code just kind of knows when it should RPC. Sometimes you check it's on authority or not, but like if it's from input and you need to ServerRPC, there's no point in checking. Input is local so only one line of execution will run it. Can you? Sure if you want, but it's just clutter you sometimes don't need. Also IsLocallyControlled won't work for every network actor. Only Pawns. A weapon that the pawn owns for example cannot do that check. It has to check if it's owner is locally controlled. A bullet that the weapon spawns would have to check if it's owner's owner is locally controlled. Etc.
You don't want to do that. While Loops have very situational uses, and should only be used when they're going to be ended fairly quickly. The better thing to potentially do, if you need something constantly firing every single frame, is to use a gate that opens and closes with the button press, and with Event Tick as the enter input to it.
So the general layout of how the code functions is as so:
(The following is within a UComponent for the players inventory)
- Input received for weapon fire "StartModFire()"
- Checks to see if running on server? If not then "ServerStartModFire()" calls "StartModFire()" so the logic also gets ran on the server
- Continues on "FireActiveMod()" which determins what mod is active and calls its "FireMod()" (Note: still running on client and server up through this point)
(The logic jumps over to the Mod Actor, of which does have a reference back to the owning player if needed) - Within the Mod Actor's "FireMod()" the "ServerFireProjectile()" is called to spawn the projectile on the server (from what I know this spawns a projectile actor on both the client and server)
- Finally within the "ServerFireProjectile()" the NetMulicast "MultiSpawnVfx()" method is ran to try and spawn a vfx that both players are able to see.
The result of this logic gives the result of the client and server seeing the vfx when the client shoots it but the client cannot see the vfx when the server shoots, though the server is able to.
oh sounds good, thanks! ๐
Indeed, maybe this bug is for using a while in a binding function instead of using the event tick
The issue is everything effectively executes instantly. When you're in a loop, it's trying to continually loop until whatever condition is met, and since it's doing that effectively instantaneously, the engine can quickly think it's got an infinite loop as it just keeps going through the loop hundreds of thousands of time as the condition is never reached.
No.
Hey sorry discord is not notifying me of pings. I have not been able to solve the issue yet. My next thing is to move away from UObject and use AInfo
No need for check on Input, input is received in the right place. Ditch the check, you're just going to add bugs. ( ListenServer for playerhosted games. The client is also the server )
At least with the tick/gate method, you're just telling it to execute once per frame, rather than trying to execute however many thousands of times per frame.
I'm not sure what you mean exactly, the input check is what gets the ball rolling on all the logic. The input is what starts the "StartModFire()"
shame on me, lesson learned
dont check IsServer on the input, burn that check with fire
This change seems to only effect the ability for the server to see the clients bullet when it gets fired
Sorry? (:
I'm considering to use a Multicast to replicate an animation montage down.
Not sure if i should feel weird about it as the OnRep method doesn't seem to be great neither.
Like the attack animation itself should only be relevant for the other players around, right ?
For those who have handled weapon swapping/switching, do you tend to do the spawning of the weapons on the server and just have them set to replicate, or rpc to the clients to spawn the weapons themselves, with the information for the weapon spawning coming from the server?
Is it also possible to replicate properties that can't be marked with a uprop? A TArray<>* in this specific case.
Hi,
What's the best way to replicate TurnInPlace animations?
- replicated yaw property
- reliable RPC invoked from the server
- something else
Depends on the game design constraints. If the weapons can never be dropped on the ground or otherwise influence the game, and based on whether or not there's hotjoining into the game or if it's competitive ... it all depends.
From strict to non-strict constraints: spawning on the server -> spawning non-replicated on the client
Technically yes, but not advisable, given the nature of your questions - there are so many things that can go wrong doing things like that without the proper procedures. But the correct solution is probably to go back to the drawing board and make it uproperty'able
I appreciate the input. I did indeed go back to the drawing board, ended up creating a bit of a big mess of my code ๐
Had weapons spawning on server, ran into an issue with a tarray<>* not being replicable, started transitioning to rpc's instead, then lost track of where I was at 
I'm heading off to bed. So I can't advise further, take a look at why that TArray is not replicable, there's most likely an easy solution to that, which is what you want to look at
just doing RPCs means unless you add a bunch of custom logic that you then need to keep track of ( if you want to support hotjoining with your game, amonst other things ) is not advisable
The standard advisable route is doing things through the property replication system, unless you absolutely really know what you're doing and you can go off-piste, being fully aware of all the trade-offs that you're making
Because if you're not aware of them, they will come to bite you potentially hundreds or thousands of manhours down the line when you're going to have a much much harder time to retroactively change things
I am far from knowledgeable/comfortable enough to go off-piste with multiplayer lol. Thank you Sir Rogers, I appreciate it.
That's why I mentioned it. I bid you good night, if you can't figure out making your TArray replicable, share all the details here and ask, someone should be able to help

so how are you supposed to replicate physic objects in multiplayer?
I have this falling cube that I want to replicate in multiplayer
the location replicates fine but I want to make it so the player can move it around with controls input (so add force based on if the player is pressing a button or not)
do I have to spam custom event on tick from the client to the server with the player's input value?
or is there a better way to do it
networked physics is something you do only if you have no other alteranative
because it generally doesn't work
unreal physics is not deterministic
well my game is physics based literally
so even if you manage to perfectly sync all timestamps and data over the network, which you can't
the physics engine can still decide to do 2 different things on 2 machines
well they manage to do it with the regular player right?
the charactermovement component replicates
it has velocity and stuff
so why can't I do it with a cube?
well u can launch it but I guess maybe it's not the same
and collision is simple and easy to correct
lauch is also better done with root motion montage via gameplay tasks
because it can desyc really bad if you just use vanilla launch over the network
or at least jitter like crazy
mhm
so would it be okay to run a custom event on tick from the client to the server?
to send the movement input from the client to the server
my issue is mainly input, the rest works fine kinda
you can't guarantee server and client tick at the same rate either ๐
physics + network, its terrible
if i had to do it, i would try with something akin to what CMC does with FSavedMove
mm what's that?
oh wait what if I just send a custom event only when the input changes?
like when u press/unpress
that shouild work let me try
no, this more lets you accumulate a chain of timestamped inputs
ahh
so server they can both replay the stuff
well I don't think I need somthing that complicated
i think you might
if this is a learning project, physics based networked game is a terrible place to start
requires a ton of custom c++ correction code
easy to get lost if you don't have plenty of network coding under your belt already
no it's a real project
okay give me a bit let me try to fix the input and then I will see how it runs
so you can teleport the root and ease the mesh to root's position without jittering
it will get much worse in edge cases where client detects a collision and server does not or vice versa
note there are games that do this
but they generally have a very low number of physics objects running around
like rocket league
yea
my game is like rocket league
it won't be much
every plaeyr is a physics objeect
max 8-16p layers
i think they did a GDC or somesuch talk
I would be happy with only 2 players too
if they did, should probably watch it
oh
found it
thanks
will do
In this 2018 GDC talk, Psyonix's Jared Cone takes viewers through an inside look at the specific game design decisions and implementation details that made the networked physics of Rocket League so successful.
there is a silver lining
if you pull this off, you will probably no longer find 10k lines of CMC code in any way intimidating
well I don't plan to put too much time into it
just gonna try and see if it works without too much trouble
there is a difference between "works" and "is on production level" too
works is much much lower bar to clear
๐ ๐
so it seems they went for a custom physics solution
:/ not rly something I'm looking to do
i know about the basics of multiplayer and im doing it with steam but im wondering about a another solution that involves host migrating and steam.
unreals out of the box replication doesnt handle host migration in any way, shape or form
so what would i be looking at to do that?
your problem is clients don't communicate directly with one another
so you can't migrate anything on server auth network model
second is there are plenty of server only objects running around that clients never get to know anything about
and third problem is, clients connect to server/host, reconnecting to another would require hard travel
- a whole host of minor problems
so you'd be looking to roll your fully custom network solution using FSocket
you might be able to still do it, and you might be able to show some UI to obfuscate the hard travel
but it's in no way a trivial thing
if you're migrating because server disconnected, you don't have time to do it, not really
yeah I remember COD:MW2 with its listen server approach would force the host to send the relevant data to the new host before they got to the main menu, but if the host crashes or force quits the game in some way, you're SOL
a more seamless way of doing it with p2p would require a custom networking solution
and the difficulty of that depends on the game, with us new host would be missing the gamemode, 200 or so AIControllers and entire mission system
holy crap-a-cheno. sounds very out of my reach for now
either a) don't care about the host going AWOL or, b) use dedicated servers
I plan to put my game on a dedicated server to accommodate a higher number of players. The game will not be sold or mass distributed for now, and I want to make it so I have authority to do things in-game that nobody else can: ending matches early, for example. Any suggestions on how to go about assigning special privileges to certain players on a dedicated server? I assume thereโs no way around using some sort of login system.
no but in this case it can be very rudimentary
if its steam, or some service with consistent unique net ids
you could have the game just write an external data file with steam ID / permissions
you hardcode your own in and use console commads or UI to grant it to others
So far, while testing with listen servers, I have just packaged the game, zipped it up, and distributed it to friends that way. Itโs all been very informal. Iโd like to keep doing that and avoid Steam or some other service.
if you are keeping the game out of distribution, you can probably avoid using the external auth server
and just write an auth system as a .json file on the dedicated server
Ive heard from a lot of people that root motion is a pain/impossible on multiplayer. Is there any way to do it reliably?
ah ok, sweet, montages is all i need, is there anything special i have to do for them?
i haven't done that system on our game, so can't tell you much detail off the top of my head
i know the broad strokes
basically GameplayTasks will handle root motion montages well
gotcha thanks!
thank you so much for the advice, Zlo. I wasnโt familiar with .json but will read up on it.
unreal knows how to serialize structs to and from json out of the box
as long as you're keeping it private and are running a single dedicated server instance, you'll be fine
as this provides no mechanism to sync the auth data between multiple server instances
(unless you're running multiple instances from the same computer and use a shared auth file)
there's a plugin that can convert any var to json and back
I seem to be running into a sorta race condition issue. I am using a RPC to give abilities to a character based on an item in a slot. I am using a validate function with the RPC call to make sure the actor is actually owned by the character before giving them the abilities.
Stepping though the debugger this is what appears to happen.
ClientSetOwner
ServerRPCIsCalled
ServerRPCValidate->No owner on equipped item so client is kicked
ServerSetOwner
ServerRPCIsCalled
ServerRPCValidate->Completes as expected
ServerRPCImplementation
Throwing the rpc behind a role check to see if it is the server works...although it seems redundant to call a server rpc only on the server, but I like the idea of the validation checks. I also thought that was just done for you when you define it this way.
UFUNCTION(Server, Reliable, WithValidation, BlueprintCallable)
void Server_FunctionWhatever();
I could also make the set owner function when the item is equipped an RPC to the server but seems unnecessary. Any ideas on how to potentially avoid this issue? It technically works but seems hacky.
that doesn't sound like a race condition, it sounds you are running what should be server logic (set owner) predictively, and then trying to validate it on top, one of those needs to go
either client can wait a round trip for server to run SetOwner, or server can trust the client the owner's legit
I have a root motion based melee attack system for AIs, currently I'm sending a data object as TSubclassOf that also stores the required root montage asset via multicast to play melee attacks. Is there any better way to do this?
Behavior Tree selects best melee attack animation by calculating their conditions and scoring them, but I couldnt find a efficient way to make the animations replicate
Sending reliable multicast RPC for each attack feels bloated
so im doing SpawnActor<>() on the server, but its never created, or at least BeginPlay is never called, on the client. is there a way im supposed to spawn an actor on the server to replicate it? the actor im spawning is AInfo with bReplicates = true and has a UPROPERTY set to replicate
Make sure the actor is relevant to clients
thanks, i have this in the constructor alreadycpp PrimaryActorTick.bCanEverTick = false; bReplicates = true; bAlwaysRelevant = true;
is there anything else im missing?
its not blueprinted
For what it's worth AInfo is just AActor with a sprite and replication disabled by default, so check with AActor
Info.cpp is 50 lines
no dice with AActor. i can see that GetLifetimeReplicatedProps is being called on the server so im guessing the issue is inside there with it not writing anything
By the way, my issue with replicated uobjects fixed somehow
Be sure you are checking the value of bWroteSomething when you changed a property
Otherwise it will return false
it was always false for me
If it doesnt return true on value changed from server and same thing happens with actor probably something is wrong at UWorld level
Are RPCs being called?
Try calling some RPCs, if they dont work something else is wrong
its not even working with AActor so i think ive broken something
Alright dumb question time
You are not on standalone right
It should still work tho but
i dont think so. ive been packaging the game for client and dedicated
been running it locally
i cant test in PIE because im using the steam subsystemm
Maybe avoid debugging the sub-objects for now and just get a basic replicated actor working
The OSS shouldn't make a difference to game-level MP code
You should still be able to test MP in editor
You don't connect to a specific server, the engine will run a server in the background and connects to that
oh nice
Just open a game level, set to "Play As Client" and hit play
ye doesnt work with PIE either
although my server crashed inside the editor which is nice
Yeah so must be just a general issue
But yeah being able multiplayer in PIE is pretty essential to any sane workflow ๐
ye ive been packaging every time i need to test :l
also the editor doesnt seem to be launching my dedicated server configuration. am i mistaken, or is it not supported?
All you need is the editor to be in "Play As Client" mode, and a dedicated server is launched in the background.
hm because its crashing in editor when trying to GetWorld in my UWorldSubsystem but it doesnt crash when packaged
Yep lifetimes of objects can vary in editor
UWorldSubsystem in particular has some troublesome initialization routines in editor
very nice
well, if i leave before it crashes i still get no log output from my proxy actor to indicate its being networked
Also you have to be careful with static vars, since they share the same process unless you explicitly tell them not to
i dont think im using any static variables
do i need to pass anything extra to SpawnActor? this is what im using JobProxy = GetWorld()->SpawnActor<AJobProxy>(AJobProxy::StaticClass());
Shouldn't do, worth checking it's actually spawning
its spawning in the server, that is the pointer being returned is valid and BeginPlay is called
Kk, so it sounds like it just isn't replicating then for whatever reason
But, if it's always relevant and bReplicates = true, then there's really nothing more to it
I feel you Gambit ๐ Wasted a nice weekend to solve a vague issue as yours
@plucky prawn small not for PIE. If you're making a game that runs on dedicated servers, you want to test "As Client" for the networking mode in PIE. If you're making a game that's playerhosted, you want to test "As ListenServer" and maybe alternate that with "As Client" if you're feeling lazy and usually testing in the main window. It's to simulate the setup that you have at production to the closest
Because with dedicated servers all players are always Clients, but with ListenServer you get a mix of Client + Client&Server ( the host, a ListenServer )
I only just started using PIE when jambax explained how to use it. Outside of that I would package my client and dedicated server, run both, and connect to the dedicated server from the client. I can connect fine, my player controller and stuff are all replicated but not my actor.
I promise if I find out, I'll tell you. No one should suffer as we have suffered.
Have you done any engine source modifications?
Hi! I'm working on a multiplayer game which I eventually want on a dedicated server. A host/"listening" server seems logical and makes sense - but setting up a dedicated server is like a brick wall to me.
Can I develop using a listening server and transfer to dedicated later or would it be a big mistake?
You could run into a few problems
As far as tech goes, it should work out fine. Key thing with dedicated is that it's got a cost and it's usually correlated with other expensive stuff - anti-cheat, infrastructure work, online services etc
Usually if you're thinking about dedicated it means you should start there
I'm just getting started really and didn't realize how much difference it would be between single and multiplayer. Basically had to scrap everything I had built up to date.
I didn't want to face the same problem trying to switch to a dedicated server.
You won't face the same scale of issues, if it works in listen server it's very likely to work easily in dedicated.
Main thing again is that usually, you know early if you want dedis. Competitive play essentially required dedicated
And you don't want to need dedicated so if you're not in competitive play you'd rather stay on listen
Ok, thanks for your thoughts.
I'll probably need experienced help to set up a dedicated server, since it's beyond my skills. But I'm a long way away from that.
Does anyone have an idea of how to set materials of other players but only on local client screen? Trying to make opposing team have a red tint and all teammates have blue tint.
Hi,
Do dynamic-multicast-delegate broadcasts replicate to clients by default?
- DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FTurnInPlace, ETurnInPlace, Direction);
If so, how can i stop the broadcast from reaching clients, i want the broadcast to only happen in the server?
I am getting some weird behavior with turn in place animations.
By default, ActorRotation replication occurs between the server and the clients, but not between the clients and the server, correct?
Is prediction included in the default implementation of ActorRotation replication server->client?
Should I rotate characters exclusively on the server and allow the client to adjust the actor rotation only through replication?
Character rotation is predicted via the movement component
So long as you aren't explicitly setting it anywhere and are using the built-in rotation features, i.e. following control rotation.
I am using custom rotation logic, and using the SetActorRotation method.
Should I modify the controller rotation, instead of changing the actor rotation directly?
how can i get the player character index of the one who pressed a key?
i mean, if i want to jump when i press space on the second player then both of them jump. How can i fix this?
well.. you can probably get a reference directly to the character that pressed the key
it sort of depends on how you've set up your key press handling though
i think that like this it will always makes jump the first player because the player index is 0 so i need to get the index of the character who wants to jump but i don't know if there's a specific node or what
is that in your character blueprint?