#multiplayer
1 messages · Page 212 of 1
SetOwner, not Rename for ownership
It will likely get the variable on the next change
Rename causes endless issues in Multiplayer. Should be avoided at all costs.
Rename changes the outer, not the owner
Oh.. what does the outer do?
They will receive the value if and only if the Server thinks the client has a different value.
Outer is for GC purposes. Unrelated to net Owner
What should i use for outer? Cause as of now i was using the player that has that actor attached to it, but if then i detach the actor to drop it, and the player leaves, then the outer is not there anymore right? And the actor would get deleted?
And how does the server decide that?
Im having jittering issues with physics replication what settings are you refering to?
Server keeps a history of what properties have been sent (and acked) by each connection. Presumably if you change the owner it will reset it, but I have no idea honestly. Would have to try it.
Project Settings -> Physics Replication
thease?
yerp
Ok, i will try, thanks
alright does unreal have interpolation for example when a client sim falls out of sync with the server or is it always a snap? ive tryed the new physics replication modes in 5.4 and they make 0 difference not sure if you need to do setup for that or not
It interpolates up to a point, but if they diverge too much it snaps. The idea is you need to tune the settings that fit your use case for interpolation. If you have really fast objects for instance, the thresholds probably need to be a lot looser
Also it assumes you are running the same sim with the same input on all ends
If you're not doing that you'll probably be more likely to snap
alright ill mess around with those settings but i don't see why i have snaping here even with the default settings this sim is pretty simple. RTT is about 80ms
If i have a uobject based inventory (lyra style), and i want to be able to transfer items between players, how should i deal with the change of outer? Do i use DuplicateObject or do i create a new object and use the first to init it?
Ok so you would not suggest using uobjects as items?
You can, I just hate their fragment system
"Yes please attach 100's of replicated UObjects to my character, thanks"
Enjoy scaling that up
😂 yeah i was trying to find an alternative to that too
Cause i like the modularity that concept offers, but yeah, feels wrong to use that many objects
Idk if this is multiplayer specific or not, it syncs up fine, but is this the wrong way of "shooting" something? Because the location of the object does not follow the location of the sphere i applied the impulse to.
Hi, isn't UCharacterMovement component from ACharacter, replicated by default? If so, what does this setting do if set to checked/true (picture)? By default, it's unchecked/false.
I tested it in two Clients and I can't seem to see a noticeable difference. I might be missing something or not know it's definite purpose/use cases.
Can anyone clarify the purpose of the setting? Thank you!
Pretty sure it's not replicated
I figured this one out. The root component did not move, because the object was a child class. Idk how it should be done but i assigned a new root mesh to the parent object etc.
I'm currently looking at fast array serialisation/replication for replicating inventories.
It's mentioned that items can loose their order, but no conditions are mentioned in FastArraySerializer.h.
Will I need an index number so my arrays can be reordered to ensure they maintain their order, or is this only specific to something like adding/removing items?
I'd imagine if I have an inventory of 10 structs, and those structs change values, they shouldn't change order.
Order won't change randomly, but it isn't preserved when elements are added/removed etc.
So for example if my array goes from 10 -> 11, the new element isn't guaranteed to be the last element in the list?
correct
It will locally, but not neccesarily at the receivers end
The point is you can't rely on order at all, so anything based on that would be fragile
Also thinking, if arrays can have mismatching element order, are they still reliable?
Say I dirtied an add or removal and unreal skipped it, will it eventually get synced on the client?
I understand replicating movement because the value is always changing, if you skip, the newest state is still valid, and it's likely being changed every frame.
Whereas a fast array you have to dirty things manually, and it's not necessarily changing every frame.
I'm using order to index into the inventory atm. Sounds like it's be a good idea to add index numbers to the elements themselves so when they're replicated, I can recreate the order if it's lost.
they're still reliable because the items are identified with an ID, which you inherit per item as part of FFastArraySerializerItem
Just make sure you don't invoke the copy/assign constructors, or you'll clear the replication ID of the item
You'll get a new one by marking it dirty, but it'll be considered a new item as far as rep is concerned
UE won't skip adds or removes the same way it doesn't skip changes to any other type of property
I remember reading the part about IDs, didn't realise they're reliable. Useful to know 👍
all replication is reliable - you're just not garaunteed to receive every change
@chrome bay Since I'm using list order for indexing into the inventory, would reorganising items based on an index in the individual elements client side be the correct way to synchronise the order when adding/removing elements?
Or is there another approach I should consider?
Personally I like the idea of sending index with the item inside the inventory because I can do .Sort() on void PreReplicatedRemove(const TArrayView<int32> RemovedIndices, int32 FinalSize); and void PostReplicatedAdd(const TArrayView<int32> AddedIndices, int32 FinalSize); clientside, allowing me to preserve the order, and with little overhead to bandwidth and computing.
My inventories should be a prefixed size 90% of the time, so it's unlikely someone will need to sort their inventory to fix the ordering. Since like you mentioned if it's a change to a prexisting element/index, then the order isn't altered.
I try to make spectate system. I found a video in yt but it doesnt work. what is problem can anybody help me?
IMO the best way would be to make the arry once, then only edit the content inside
Interesting, what does it do? I did compare with 2 clients both checked and unchecked, and their movement seems fine to one another. Any example scenarios where I must use checked/unchecked?
Not sure what your issues are, but I noticed you're called spectate next on both left and right keypresses. Shouldn't one of them be spectate previous?
Also watch this video https://www.youtube.com/watch?v=HXCkOzkgamU it'll help make your code more readable because you'll be able to use the modulo (%) operator. The modulo operator is really nice for doing something like this ^. No need to check if you're out of bounds.
What are the Modulus/Modulo/% Nodes in Unreal Engine 4
Source Files: https://github.com/MWadstein/UnrealEngineProjects/tree/WTF-Examples
Note: You will need to be logged into your Epic approved GitHub account to access these examples files.
subobject is for special UObject replication
What do you mean?
My current approach: The inventories are replicated properties on a component. Edits are sent via RPC to the server where the edit happens, and then replicated back down to all relevant clients. To remove the feeling of latency, the edit is also performed locally before the replicated value arrives. If someone is cheating and a desync happens, I don't care.
Special does what? Any documentation I can check to understand it? dev.epicgames.com seems not to explain this.
you don't need to worry about them, they do nothing (in this case). Leave them off
i mean that you init your inventory first
like, create 20 empty slots
then you only edit the content inside (item, amount, etc)
its to replicate UObjects (all except UActorComponent)
when trying to watch the client, he starts to see through his own belly and cannot go back or watch someone else. if the server tries to watch, it sees from its own belly, sees upside down from someone else's point of view and finally returns to its own normal view
Thanks, I'll leave them off like the default. Though, is there a specific scenario where they come in handy? Are they needed as part of a specific multiplayer scenario?
This is what I'm already doing. But I have a use case where my inventories need to be upgradeable/expandable occasionally, which is why I'm asking if there is a specific/recommended way to maintain order.
idk for sure, personally i store index in the entry
so each entry knows its index in the array
I wasn't doing that because I want O(1) access time instead of O(N). So I'm considering doing similar to that.
What I was suggesting is each entry has an index like you've done, but the index is not used for lookup, but is used to reorder the inventory client side if there is an addition/removal. This way I keep the O(1) lookup time. Only sorting on the list growing/shrinking client side should be possible since there are functions that I can use to detect this PreReplicatedRemove and PostReplicatedAdd.
My inventory system stores structs not pointers, and lets say some system requires checking an item in the inventory every tick/frame. I need O(1) access time, because O(N) would be too expensive every tick for 1 or more items in multiple player inventories.
some system requires checking an item in the inventory every tick/frame
if you have this imo you failed in your design
I can't talk much about it because we'd be getting into NDA on what I'm working on. But it's not a design flaw. Inventories are a generic container systems used by other systems outside of just the players inventory.
This allows us to have a very simple gameplay item API that's the same for everything. Meaning you don't need to worry about item glitches like item duplication, and everything is automatically synced with the database in real-time.
idk why you need to check inventory every frame when you can use delegates
Hadn't thought about using them because I've been focused on optimising the inventory system atm.
Thanks for reminding me.
you welcome
i use delegates a lot so external systems can subscribe to inventory changes like item amounts
in this example i use that when opening the crafting station
so i can update what stuff is craftable and uncraftable base on what ingredietns you need
even if the server will check at the end
Hey guys i started 2 days ago my first multiplayer project i'm still working on my fundamentals, I'm doing a mix of both cpp and blueprint, and i'm actually trying to do a lobby system, in my game instance i have a map to get all my player and the boolean if they are ready or not. In my game instance i also have a function who require a player controller and a boolean to change the readyStatus. Then in my player controller i have a simple logic when you press F you switch between ready and not ready, the problem is that from the client persepective they always are the player controller 0, so i don't know where i have to put that kind of "press f to get ready" stuff
Thank you !
Got an issue when playing in standalone game, client joins host and there will be ridiculous latency. When removing client side functions like turning on flashlight (as an example) and only sending it to the server to send back to the clients to check the latency, it takes about 3 seconds if not more just for the flashlight to turn on.
The worst part is the entire game works around an ai monster that can chase players etc and on the client the monster is constantly rubberbanding and updates to positions take forever causing the game for the client to be almost unplayable.
I would like to blame it on my internet speed but I'm not so sure. Even trying a simple moveto node and testing it, the ai is constantly rubberbanding. I tried recording issues with network profiler but i'm not even sure how to read it properly tbh since there doesn't seem anything wrong
Server:
Client:
ai is unplayable in standalone for clients the latency is just so high
I tried to make a spectate system but there are a lot of problems. the first problem is that when I change the camera, I see upside down and I don't see it from the camera that the other player is looking at. the second problem is on the client side, when the client tries to change the person they spectate, it affects the server, not the client.
Thats because its only happening on the server
Ur running that information on the server only
thats ok I dont know replication much but why I see upside down and I don't see it from the camera that the other player is looking at
You only need to do that information on the client anyway spectating should only affect that client
Does your character have a camera that is facing the correct way and are you setting the view blend to that character
And where are you getting the player alive value from is that from the game mode?
I dont set the view blend
yes
how can I set view blend
Your camera is upside down
the character I use myself sees it properly but ?
Yeah but view blend will take that cameras current rotation values so the player will see it upside down
ok that fixed
ty
so how can I stop the camera from shaking, the camera I use is stable while the other one shakes wildly
Prob collision of the camera w the character. Have the camera ignore pawn and see if that works
Am i using the run on server correctly ? i'm new to multiplayer and i'm using this blueprint in my player controller. Set player ready Status is a c++ functional that add to my array( Player controller , boolean ) which player controller and if he's ready or no
I wouldn't use a flipflop here
just have the client say if they're ready or not (pass a bool over)
But when i'm testing the server doesn't receive anything
why is player ready status a property of game instance?
game instance is local only
player ready status should be a property of PlayerState if it's meant to be public (it's a part of the State of a Player)
Well my first thought was that i wanted to keep the array of player during the whole game, i mean even after they get back to lobby
the playercontrollers will get nuked and remade anyway
so the references will be invalid
So only the host has access to game instance ?
Oooh
GameInstance is private to each machine, it's not on here because it doesn't have anything to do with networking
So how i'm suppose to collect all their ready status ?
bool on PlayerState
I mean can i check this in the game mode by getting the info in their player state ?
yes
Don't worry about travelling back to lobby now, learn to walk before you try running
but in practice how can gamemode retrieve this information for the moment I just used the onpostlogin, I am still stuck on creating the lobby ^^
repnotify is your friend
Gamemode should check if the game is ready to start every time a playerstates ready bool changes
oh perfect I had started to read something about this, so I will dig into it thank you very much
That doesn't need RepNotify though
That just needs a proper Setter that is Auth Only and tells the GameMode.
Or even better, have a Delegate/EventDispatcher the GameMode can bind to
Easier to show in UI with a repnotify though.
Can anyone spot what I am doing wrong with this fast array? I have been mulling over this for two days and I can't figure it out
Adding to it works as expected, but I can only remove items if there is one item in the array. If there are more then they correctly get removed on the server but only the first remove is successful on the client.
I have figured out that on the client in FastArraySerializer.h the ItemMap which contains the ReplicationId -> array index mapping can not be built because none of the array Items have a ReplicationId set. So the ItemMap is valid as long as you add things, but becomes invalid as soon as you remove one thing. This is happening in the function void FFastArraySerializer::TFastArraySerializeHelper<Type, SerializerType>::ConditionalRebuildItemMap()
USTRUCT()
struct FFastArrayItem : public FFastArraySerializerItem
{
GENERATED_USTRUCT_BODY()
UPROPERTY()
int32 Id = -1;
UPROPERTY()
UMyDataAsset* DataAsset = nullptr;
FFastArrayItem() {}
FFastArrayItem(const int32 InId, UMyDataAsset* InDataAsset)
: Id(InId), DataAsset(InDataAsset) {}
bool NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess)
{
Ar << Id;
Ar << DataAsset;
return bOutSuccess;
}
};
template<>
struct TStructOpsTypeTraits<FFastArrayItem> : public TStructOpsTypeTraitsBase2<FFastArrayItem>
{
enum
{
WithNetSerializer = true,
};
};
USTRUCT()
struct FFastArray : public FFastArraySerializer
{
GENERATED_USTRUCT_BODY()
UPROPERTY()
TArray<FFastArrayItem> FastArrayItems;
void AddAndMarkDirty(FFastArrayItem& FastArrayItem)
{
FastArrayItems.Add(FastArrayItem);
MarkItemDirty(FastArrayItem);
}
void RemoveAndMarkDirty(int32 Id)
{
for (int32 i = 0; i < FastArrayItems.Num(); i++)
{
if (FastArrayItems[i].Id == Id)
{
FastArrayItems.RemoveAt(i);
MarkArrayDirty();
break;
}
}
}
bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms)
{
return FastArrayDeltaSerialize<FFastArray, FFastArrayItem>(FastArrayItems, DeltaParms, *this);
}
}
template<>
struct TStructOpsTypeTraits<FFastArray> : public TStructOpsTypeTraitsBase2<FFastArray>
{
enum
{
WithNetDeltaSerializer = true,
};
};```
I've seen people saying that if you have a replicated array of fixed size it is better to use standard array instead of FastArray. Is this true? If so, why?
My constructors or something were not copying the ReplicationIds anymore, so somewhere on the client the structs were being copied, leaving the ReplicationIds behind. The fix was to add a copy constructor to the FFastArrayItem 🥳
there are other factors but mostly when you edit a replicated TArray, all entries after the added/removed entry will be considered as delta
also, to know whats changed in a OnRep, you have to read the entire array to check
so truly know whats the best for you you should profile it
I was under the assumption that standard arrays replicated the whole array each time. So if you only change the value at an already existing index then only that value gets replicated and not the whole array?
can anyone think of any reasons why server latency is extremely high, i mean from 3-10 seconds long between sending to server and client recieving?
It cant just be my bad network
I heard something about differences in client and server framerate but idk
ai on the client is unplayable with the amount of rubberbanding
It's just painful because ai is run on server only with character movement obviously doing the replication and so theres nothing i can do code wise to fix this issue
Might be a Reliable RPC on Tick somewhere.
When testing in build or in editor with no network emulation ?
got no tick events
or rpcs that run on functions that tick
in editor standalone game
so basically build in editor
You should have 0 ping
thought that was only PIE
Isnt standalone without a server ?
you can run three players
and two of them wont work with steam so i've just used those ones
You can run with any player amount in any modes
Oh you are testing with steam API ?
Looks like you are sending a lot of move and camera rpcs
Do you now why you are for the camera ?
Thought that was just unreals built in rpcs
dont have any rpcs ive made with those names
quick question, unreal can natively host only one world at a time right?
so if you want to have players be in 2 diferent worlds it's not possible without using some plugin?
so what if you made a super level that basically holds the 2 worlds together and now the 2 players can be in different places?
one player leaves one world and goes to another what will happen is, the previous world unloads and async load another level into the superlevel
Does anyone know why my characters limbs that are physically simulated (ragdolling) dont replicate?
Because Physics isnt replicated?
yes not 1:1, but they are frozen
hi! so i have a weapon actor that i want to set the owner of via a server rpc from the character. things work just fine except that the clients do receive the change? at least, the OnRep function doesnt get called. any ideas?
btw i didnt use netMulticast, i figured the server should update the owner variable eventually
yep
oh i know of that limition/design choice
but the thing is the OnRep isnt getting called on the clients
im so stupid i was copy-pasting my code and i found the issue. i forgot to mark one of the function as a server rpc lmao
thanks a lot dude!
Is it possible to replicate uobject or aactor references?
Like I create a replicated actor and want to assign it to nearby players via repvar
same way you'd assign their name or whatever
Yes
As long as the UObject or Actor is replicated
Or has a stable name (loaded from the map, asset on the disk, etc)
wow fak, that's so awesome
What does this mean?
Basically as long as it's relevant to clients? Like not trying to RPC some local object?
when playing a montage on an interrupted autonomous proxy, breaking free from the animation works locally, but on the server and simulated proxy side, the animation continues to play to the end. So its like the server is holding back the autonomous player movementHow can I ensure the animation also stops on the server and simulated proxy side?
Basically, the OnInterrupted event is not replicated. Where it allows the character to move again
Yes. By that I meant that anything with a stable name (same on servers and clients) can be referenced. Actors loaded from the map (that were placed there in editor) are stable since they are loaded on the server and client with the same name, whether replicated or not. Assets on the disk have stable names because their paths are the same on server and client.
A replicated actor spawned on the server will be sent to the client, so you can reference it
Cool. Is it safe to replicate it immediately after spawning? Or does it need some net-initialized event first?
You can reference it after spawning
If the client receives a replicated reference without having the object on their end, the reference will be null until that object is resolved
You can get race conditions that way, so you gotta handle it in your code (object replicates before the reference, or the reference replicates before the object)
Ah shit, so there's no order of operations here? I hoped clients would receive data in the order it was sent
Otherwise if they try to handle the repvar on a null object -- there's really no other event for when the object is initialized.. just need to like, run an obscure timer or something.
No guarantee no
Iris might provide that potentially, not certain, does ring a bell, but otherwise nop
Well there is, if it's an Actor you have BeginPlay
It's called on clients when they are spawned from replication
wdym?
so IsAuthority, IsLocalPlayer, etc is all broken in BeginPlay lol
Oh well maybe just on connecting players then
I had to implement some new events and wang jangy workarounds for that lol
Anyway cool, all very good info, thanks man
I'm working on online turn based combat, where different people can be in their own turn based battle. So it's super helpful to be able to set which players are part of which battle via actor references
so question does everything check out
https://youtu.be/glWJB69GcMk
going thru some things and notice some things so switching from unity to unreal and villa, here ya go
but to be honest my question is i changed my ip so does this mean ive open ports somehow?
i know it late but jeez
https://pastebin.com/jM5yQTQX
I've started to get this network error for my clients after apparently successfully seamless travelling to the game map from main menu to lose connection with host immediately. Is there any information here that hints what's wrong from my side?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Hi, i have a question about spawning actors:
I have a server function that spawns an actor
AWeaponActor* NewActor = GetWorld()->SpawnActor<AWeaponActor>(ActorToSpawn, AttachTransform);
Now after spawning i would like to call a multicast with the actor reference, so that clients can do some additional setup.
Multicast_EquipWeapon(NewActor);
The reference is NULL on clients though, probably because the actor hasn't replicated yet.
That leads me to my question: What is the preferred way to handle this scenario?
That can depend on what you're trying to achieve, but easiest answer is your weapon's BeginPlay will work on every connected player as well as the server
Heya guys has anyone tried adding VOIP on the steam advanced session plugins
Just any random joe with the IP address of a server can join it?
Correct. It's the job of the game to reject their join attempt. And encrypt anything they wish to. Or the job of the network manager to prevent them having access in the first place.
If you want to produce some kind of secret key for joining that they need to supply by logging into a https service before that... that would work.
I try to make a spectator system but I cant replicate it correctly
what I need to do
hey this is run on the listen server
it dosent work the "set defiler server" is not run :;/ ?
its being called but its not runnint the "SetDefiler_Server" event
could you explain better ?
so you are calling Defiller event first, did you put a breakpoint on the branch to see if its called ?
also, what class is this ?
yeah
and what is the owner actor ?
then the RPC should work
yeah but its not running the "setDefiler_Server" event
did you put a breakpoint on the output of the Set Defiler Server ?
its not even reaching the rpc party
party ?
part*
is the bool Defiler true ?
nope
because you are only calling the RPC if its false here
exactly just tested again
run 1 being called
not run 2
and the "Defiler_Event" is called from a parent class
or no not even that
(client) attacks (listenserver) then the client runs the event on the (listenserver)
well server RPC can only be called if you are on server OR if you are on client side you need a owning connection, the controller, player state and any pawn controlled by the player controller have a owning connection
yeah i know all that should check out
im really in a awe i dont know whats going on
im sorry idk what could be the issue like that
hmm
ok so using the keybind works flawlessly
so it must be how the defiler_Event is being called
player character (client) casts to (listen server then calls the function on that owning client)
to narrow it down i guess
if set an actor to intial dormancy, how come all the logic on the bp still works ?
am i not understanding dormancy ?
guys, I have multiplayer game. With dedicated server.
In production for every level I will have different servers, so my server won't ever travel from level to level.
But during the development, it could be kind of convenient to test client code performing travel on server.
But I'm not sure it's anywhere near with what I will be using in production.
Maybe the best idea would still be testing it with real server processes and client process?
If you change a replicated property while it's dormant it will wake from dormancy. Dormancy just closes the connection when there are no properties to send, it doesn't destroy/kill the actor etc.
It's a memory/CPU saving for actors which change very, very infrequently - or perhaps never
ahh, so would making like a storage box / buildable that could be destroyed intially dormant be a bad move?
i was thinking to then wake them up anytime a player interacts but you're suggesting that it does that automatically?
would still be destroyed IIRC
In Blueprint it does yeah
In C++ you might have to explicitly wake it
They won't go back to dormant unless you set them back though
ok dope ty
Hey guys need some input here... Out of nowhere some of our gameplay tags appear to have different net indices on the server and client. As a result behaviors are getting swapped/offset when tags are replicated down because they're getting mapped to the wrong tags. Anyone run into this before or have any suggestions about what I might be able to do to remedy the problem?
Quick question: GameState variables, do I need to set them to replicate or does the Game State auto replicate variables within?
Hey. What is the correct way to check if Character is a Player (either local or remote) and not an AI character?
My idea was to see if I would be able to cast its controller to player controller - but in multiplayer this will not always be correct I believe as there would be player controller only for my Character and not for other simulated characters.
What do you think? Maybe I should also add a HasAuthority() check to only check on characters on the server?
Check if they have a player state. If they do, check bIsBot is false
If you're doing this on the Server you can check player controllers no problem
Thank you very much
Hey guys i'm doing something wrong but i still don't know what, i'm working on a lobby with a ready status, when all my player controller are ready i want to start the game here are my "core function" The first one is in my playerstate, i call this function in my player controller in blueprint when i press F, the second one is mostly for understanding what's happening and the last one is to check if everyone is ready and can start the game. I'm still struggling and learning a lot in both c++ and multiplayer
Missing the most important parts here, is the ready state a replicated variable in the playerstate? Is a server RPC being called between the button press and the SetReadyStatus on the server side?
@bitter robin I don't know if it's really replicated but at least that's what i'm trying, i readed some stuff about rep notify and that's what i'm currently trying
look at GetLifetimeReplicatedProps in PlayerState.cpp
@bitter robin Oh yeah my bad i forgot to screen that one aswell
Oh btw i'm using my player controller in blueprint can this cause issues ?
What about when you press F to ready up? when the client presses it it needs to go to the server before you do your SetReadyStatus. Do you have a server RPC there?
That's what happens when i press F to ready up, i'm changing my ready up value in my player state, and then i suppose that my gamemode must be called to check if everyplayer are ready up aswell
Yes, it looks like it should work so far. What exactly is failing?
@bitter robin Tbh i don't know my logs aren't even triggered, so it's kinda hard to know where's the problem
That should be fine then
ohh
the set
remove it lol
SetReadyStatus checks if the status changed, but you just set it to what it will be
Oh ok !
Thank you for help, i was kinda affraid that my structure was complete shit, that i had to reconstruct all my system because that's a lot of new small thing to take in consideration in multiplayer but i must be able to investigate by myself for now ! Have a good day ! 🙂
Hi im trying to allow players to carry each other using attachment system. It works perfectly on server but only works sometimes on client. How do i fix this?
Heyas, I thought Actors and UObject references could be replicated
However the OnReps for a replicated actor are never called?
You mean you have a replicated AActor variable that's marked as RepNotify?
Yes
Where is the variable?
A replicated actor is spawned, and I try to multicast or repnotify it to other actors
Oh hmm, I wonder if it hasn't spawned/replicated on the clients end yet?
Yup
Just have the clients set the variable themselves when they've gotten the spawned actor.
How would they know what to set, or when? lo
Wdym
I try to make a spectator system but I cant replicate it correctly
what I need to do
I'm doing combat like Baulders gate, where multiple combats can be going at once
I create the combat actor, and try to apply it to the players involved in the combat
However it hasn't yet replicated to them
So, how would they magically know which combat actor to take, when to take it, etc.
However you decide to set it up, not quite sure what you're asking
It's a design choice, really. You know the issue
Up to you how you want to solve it, it's too hard to give design/system advice from the outside
It's like, I sent my friend an email, but he never received it
How does my friend magically know that I was trying to send him an email
and which email to look for
since.. he didn't receive it lol
I just wonder if unreal has something in place for this as it seems like a common issue
The OnRep for that actor should handle this though
before I go reinventing the wheel
It should eventually call with a valid reference
Also UObject don't replicate by default, just fyi
Nope.
Spawn actor -> Set nearby players to onRep that actor -> it never gets called for them
Your code is only changing the the ViewTarget on the Server. That doesn't work.
There's another issue if the OnRep isn't being called ever
I imagined unreal would queue up the onrep, and call it when the actor is ready
The OnRep doesn't care what type it is, only the delta during the property comparison
You can stay locally and just grab the PlayerArray from the GameState. You should be able to get teh Pawn from teh PlayerState that sits in the PlayerArray.
Right, so I wonder if the actor has some property like "IsNetReady()" or something, when it's spawned for everone
But anyone there's no helpful design advice here?
I mean, SpawnActor -> SetOnRep should be enough
This has nothing to do with a design advice
Can you just post the relevant code?
A replicated Actor spawned by the Server will replicate to Clients.
Setting the RepNotify Pointer to said Actor, given the Pointer is inside something that is also replicated, should just work
If that doesn't work then there might be something wrong in your setup.
There was never a need to manually handle this
Called on Server:
ACombatScene CombatScene = ACombatScene::Spawn();
CombatScene.InitCombat(triggeringPlayer);```
Then inside ACombatScene:
```c++
void InitCombat(AUnit triggeringPlayer){
triggeringPlayer.CombatScene = this;
Then inside the AUnit (player pawn):
(Replicated, ReplicatedUsing = OnRep_CombatScene)
ACombatScene CombatScene;
UFUNCTION() void OnRep_CombatScene(){
Print(f"OnRep_CombatScene {Unit}");
}
maybe ACombatScene* ?
It's taking over the ReplicatedUsing
That's pseudocode or?
Oh sorry this is in Angelscript not C++, all actors are automatically pointers and stuff
It just takes care of some annoyances but runs the same as C++ (multiple big games have shipped with it)
But I'd bet you don't need Replicated and ReplicatedUsing in angel script either lmao
UPROPERTY(Replicated, ReplicatedUsing = OnRep_CombatScene) you only need one
Yeah only ReplicatedUsing is needed
And AngleScript can totally be at fault here btw
If you use a custom Engine with AngleScript you gotta be open to acknowledge that it's bugged.
Does Angelscript actually help people that much?
YES
Maybe. It adds a scripting langauge inbetween C++ and BP
UE C++ is already basically a scripting language on it's own lmao
But hey, if it helps.
It's a nice thing to have. We also have C# support by now, which doesn't need a custom Engine.
I would have thought that but multiple big name games have released with it, and anytime i imagined it was a bug with angelscript, it was an unreal problem instead
I have a C# scripting engine in my engine, but honestly I've debated removing it anyway (offtopic)
That's why showing code when asking for help is super important
You can try removing the Replicated and check. But what you describe should work. If it doesn't and the code is correct, then AngleScript would be the next point. ¯_(ツ)_/¯
helps with iterations
But BP doesn't?
or some people
Idk, not my cup of tea
Anglescritp is more performant
apparently very close to C++
I tried just multicasting and get this
Multicasting is not OnRep
No matter what, the client doesn't receive the actor 😐
So yeah i think it's just not ready yet. Gonna add in some arbitrary delay timer
I don't think it progressed much based on the Roadmap. Seems to still be on the same points as months ago
I meant in my own personal engine, not Unreal. Sorry
Is a test, right? Cause that's the worst fix you could add otherwise.
just a test lol
Anyway, can't really help beyond stating that it should just work.
I'm just confused, you have an OnRep, but then you said multicast?
They are trying both I guess
I'm just testing different things
Ah
Even after a 1 second delay, multicast sends over nullptr
Now, are we 100% sure you can send actor references?
Then it's clearly a problem with your setup though :D
OH, yeah maybe it's an issue with how angelscript automatically handles the references
UObject pointers build FNetGUID to be referencable between instances, if they're replicated properly it will work
Yeah it's got this at the start, which basically sets constructor values default bReplicates = true;
Beyond that, probably some obscure AngelScript stuff I don't know anything about
Right on, I'll go ask in there
Do you know if FNETGUID is something that could be passed, and have the client search it themselves?
No, you don't need to. It's handled internally
That's already what's happening
What else would be sent, the Memory Address? The whole data of the actor? :D
You can't ACTUALLY replicate pointers.
Unreal just internally handles the pointer as a FNetGUID
Try sending a int32 pointer through an RPC and watch UHT yell at you
Only time it won't be built I think is if the object is stably named, (I think it doesn't build the FNetGUID?) But I can't remember, it still might
But not important, and getting into bike-shedding anyway
Aighty, well thank you so much for the info guys
I think you're right here and the problem lies within angelscript
To the angelscript discord I go!
you need to add Reliable or Unreliable
Or learn C++ 😛
I know it lol, just don't wanna set up Rider 😛
Angelscript is reliable by default 😄
i cant guess that xD
Clearly not, because you're getting a UHT error
whats the error ?
Sorry, I know C++, just not Unreal C++ 😛
If you're talking about U#, it has progressed quite a bit. Roadmap just isn't updated much. It is much more stable right now.
@haughty ingot @thin stratus
Found the solution!
- I was spawning the CombatActor class directly and the actor itself actually wasn't replicating.
- So I simply turned it into a blueprint (without changing anything) and spawned that instead. Boom all problems solved.
Didn't realize turning a class into a blueprint made that much of a difference if nothing needed to be changed. But unreal gonna be unreallin'
If you changed bReplicates to true in the constructor it wouldn't matter if it was a BP class or not, so probably AngelScript related
Still shouldn't be AS related. Just needs to flip that flag on the AS side as well
Yes, all unreal issues must be angelscript related. All hail the engine with no bugs! 😛
so nobody answer my question and took down the comment perhaps
anyways my question is simple does changing ip and if you are online, means u open ports?
wow just wow, nobody in this server can answer a question like this? i am saying if u are on your game while ur ip change, ddoes it means u open ports or ?
Dang - 3 minutes is too long for you?
Immediately rule out anyone because everyone who is in the server isn't paying attention to you right at this moment?
what i am not, u the one wasting typing
You asked a question - waited 3 minutes and then said "nobody in this server can answer a question like this"
i ask last night
IP address and ports are not the same thing.
So no, changing your IP address doesn't mean you open ports
okay but in reality the other client can join like across the globe?
And nobody who knew may have been present at that time.
As long as you configured everything, yes.
ah okay thanks @quasi tide
@lusty kelp people here volunteer to help. They are not obliged to help or respond. Everyone who helps here does so voluntarily. Please have some respect.
Hey guys need some input here... Out of
To be fair, setting the bool properly in the c++ constructor doesn't require me to flip the bool in BP child classes.
Which kinda only leaves AngleScript then.
Yeah nor have I ever had that issue unless the child BP had changed that property itself
Yeah very strange, the BP looked fine with the bool already set. 🤷♂️
It's also possible I spawned it incorrectly at first, but then correctly when using the subclass -- I would imagine the problem is most likely my fault in some way rather than AS lol (I trust the creators of AS way more than myself)
Or angelscript has bugs?
I really don't think so for obvious stuff like that. Most likely I was just using it wrong
Hey, is there a way to start PIE as a spectator, to playtest and debug your spectator pawn?
F8 to eject from contoller
I think that just puts you back into editor controls, it doesn't actually make the player a spectator
make a cheat or something to make you a spectator?
Yeah I was hoping I wouldn't have to do that lol
I'd just be surprised if Unreal went through the trouble of creating a built-in spectator system, but wouldn't include any tools for actually using it
Destroying actor on server side will be repliaced right? or I have to do RPC?
Assuming it's a replicated actor that was spawned by the server, its destruction will be replicated
If it's a client-side actor, it won't be
yes it is rep, thanks
This is currently an issue for me that has been going on for quite few days and I was wondering if you would know what to do:
I'm doing SetOwner(PC) on a newly created actor on the server. The Owner updates on the server but not on the client which is the goal of SetOwner...
The warning that I get each time I try calling a Server RPC after I've done SetOwner(PC):
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_WeaponActor_C_0. Function ServerAddComponent will not be processed.
Is the actor replicated
it is
Can you send code
of what exactly?
SetOwner/Where you call the RPC
FActorSpawnParameters ActorSpawnParams;
ActorType* WeaponActor = GetWorld()->SpawnActor<ActorType>(WeaponClass, ActorSpawnParams);
if (IsValid(WeaponActor))
{
FAttachmentTransformRules TransformParams(EAttachmentRule::SnapToTarget, false);
WeaponActor->AttachToComponent(..., TransformParams);
WeaponActor->SetOwner(GetController());
}
Can you check GetOwner() after you call SetOwner
See if there was a controller at the time
it's good on the server, not the client so it prints a valid name
Are you 100% sure it's replicated?
wait, let me re-test
yes and yes it's valid
Do you have multiple clients @twin juniper
I do
Are you sure you're calling the RPC with the right owner?
Keep in mind player controllers only exist for their owning client and the server
Other clients will not have the player controller @twin juniper
This would lead to the owner being null on some clients
GetController in the PlayerCharacter works fine because the corresponding PlayerController owns that actor...
it's null in all cases currently
yes
Do you have bUseOwnerRelevancy enabled
Hi
Nvm actually
I don't, what's that?
Wouldnt affect that
#blueprint might help more
Thanks
let me know if you get something out of my problem
Question: If I call a Client RPC, does it automatically call on the owning actor?
Or do I need to specify which client gets it?
Ex: I need to run some code locally on a player, is it enough to just do player.clientRpc()?
or do I need to pass in it's player id
Client RPC is owning client
Any multiplayer expert that I could talk with? I'm stuck on a problem
Dont ask for help, just post your question and someone might answer.
This is currently an issue for me that has been going on for quite few days and I was wondering if you would know what to do:
I'm doing SetOwner(PC) on a newly created actor on the server. The Owner updates on the server but not on the client which is the goal of SetOwner... The Actor is also replicated.
The warning that I get each time I try calling a Server RPC after I've done SetOwner(PC):
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_WeaponActor_C_0. Function ServerAddComponent will not be processed.
This message indicates that there is no appropriate owner for the actor when you're attempting to RPC to the server.
Verify you are setting the correct player controller as the owner and that the reference is indeed valid.
reference is indeed valid and for the player controller, I'm doing GetController() on the server which should be ok, is that correct since this code happens inside of my player character? (which is why I'm confused)
2 of error that I just found:
- I forgot to call the Super function for GetLifetimeReplicatedProps 💀
- Error from not initializing a custom struct correctly (yes they must be sometimes)
THAT WAS IT, thx 🥳
Is it possible to have a replicated TArray of instanced struct, but for each struct type i can decide if it can replicate ?
Hi, anyone has any tutorials/documentation of how to end a GameLift GameSession using an API from UE?
Not very easily... I would highly suggest filtering in other ways
just having two different arrays is vastly easier
I might do that
I wanted to have a single array, with stuff server only and other replicated
you can do things like COND_SimulatedOnly to only send one to other players that see it as a sim proxy
Making it server only just means it's not replicated at all 😛
you could wrap them behind some other function that makes the elements generic, so that it doesn't need to know which of the two arrays it got the elements from etc
If you want to send things to ONLY one player I personally recommend just slapping it on their player controller (or a component owned by the player controller)
as the player controller is just between your local machine and the authority
you do not see other player's controllers
Its not a per player thing
Its just that some data holded by the item is only used on server, so it seems like a waste to rep it
you can actually mark uproperties of a ustruct as not replicated with UPROPERTY(NotReplicated)
if it's inside of a ustruct and a uproperty (that is being replicated somehow)
I guess i can do that
you probably don't need to do that here, just an FYI
But i will have empty structs
I guess i can figure this out when profiling, its just an idea for now
Having an empty field on the client is fine... I'm not sure you can easily remove it from client machine builds unless it's a dedicated server thing
could just add an ensure if you mistakenly try to get it on not authority
check(HasAuthority())
If you need more advanced serialization for things like this you will generally just want to wrap your array in another struct and give the struct a NetSerializer and manually check the elements of the array during serialization, and then reconstruct the array when the archiver is loading. But it all per-use-case dependent.
Hey guys,
is there anything special about welding two actors together in multiplayer?
I've done it on server but client doesn't follow socket position for welded item :/
So I have different Z transform between client and server
try having the actor location be set to one authoritative value on all instances before starting the tick, you can do it through an OnRep function for example
I have several questions here, that ArrowRef doesn't look like a replicated variable, how does your client even obtain a value for it? Are you sure the print is for the one on the screenshot? Unless it's the PIE bug, are you sure you're running on listen server mode, both of the logs start with server
ArrowRef is just reference to actor which is spawned and that actor is set to replicate
I can see it flying using projectile movement on both server and client, but end point is different on both because start point is different
So.. is OnRep called when setting the var to null?
I'm onRepping an actor which works fine when setting the actor var
but setting it to null later does not call the rep
yes unless the client's value is also null
REPNOTIFY_Always will make it so that it'll get called even if the client's value matches
does the actor get destroyed at the same time it gets nulled on the server?
Nope! I actually disabled the actor destroy
OnRep calls normally when combat starts, but not when it ends
So only the server runs the Endcombat_Local code
I've got this print in Tick for the client, and Combatscene is always set
lol
There's nothing wrong with angelscript man, I am the problem here 😛
I just noticed the server var is also still set despite nulling it
So probably setting it back again somewhere
Hi 🙂 I've made a very simple ball move around as a pawn, but when I play in PIE as a listen server the movement is not replicated, even though replicate movement is turned on in the class defaults. Any idea why this could be?
my own movement
Well
Online movement requires all sorts of predictions/rollbacks/handeling packetloss/latency issues, authoritation, etc. It's a mess if you're not a pro at this stuff
CharacterController has some of it built in, but I hear it's still a mess in real world scenarios
SO
Just get this and skip all the headaches lol
Gotcha :p thanks!
Does the '_C' suffix in 'A_MyActor_C' instances mean it's a client's simulated proxy instance?
no
class
for a blueprint, in a package you have the UBlueprint and the UBlueprintGeneratedClass
the _C is the latter
ah, interesting
for some reason, a bunch of _C instances get deleted for the client when the client enters spectating mode
which is quite confusing to say the least
thanks for help 👍
Question: The clients, when they start the application, load the "client" map, which is actually an empty level. Once they connect to the server, does that mean that clients are streaming the map (serverDefaultMap) from the server or does that mean that they are loading the map from the actual device they are installed on ?
@lost inlet I figured it out.. Like BauldersGate3, when another client goes near an active combat, they enter the combat fight.
So when my combat ended, the players were already in the fight zone and thus immediately re-entered combat lol
See, angelscript can be trusted, I cannot 😛
Sorry for the ping @keen adder , installed the plugin and added the component, but doesn't seem to be replicating still sadly :/
check their vid, it says to uncheck "replicate moves" on the pawn
and there's a bunch of stuff you can enable/disaable
im guessing physics has some diff checkboxes to use
I just dropped mine on the character and it worked 100% out of the box
All good, cheers
In the PostLogin function (abbreviated), I am expecting the following code to make the spawned actor an AutonomousProxy however it is a SimulatedProxy. Is this the correct behavior? DedicatedServer/Client mode. Playing with 1 client in PIE.
FActorSpawnParameters SpawnParams;
SpawnParams.Owner = NewPlayer;
FTransform SpawnTransform;
SpawnTransform.SetLocation(NewVillageLocation);
GetWorld()->SpawnActor<ANordicVillageBase>(VillageClass, SpawnTransform, SpawnParams
// On client
GEngine->AddOnScreenDebugMessage(-1, 50.f, FColor::Cyan,
FString::Printf(TEXT("Owner: %s, Actor %s | NetMode: %d | Role: %s"),
*VillageOwner->PlayerState.GetName(), *GetName(), NetMode, *ThisRole));
I guess what I'm asking is if an actor is spawned with an owner of a PC, should it be autonomous or simulated ?
Reliable just means TCP so it will resend if the packet gets dropped, and will wait for an ack confirming it was received.
Unreliable is UDP and is best effort, if the packet gets lost it will not resend
TCP has higher overhead so don't do it in a tick. Use it sparingly.
Depends how often it is changing and your replication settings on the actor, and server tick rate. I don't know but I would guess probably unreliable multicast.
stat net
When I set a struct to replicate and I change one property of the struct, does it send the entire struct over the network or just the changes?
Hey everyone, I'm having some trouble and could use some help.
I have an Interactable Actor variable on my first-person character. However, when the client sets the variable and tries to interact with it, the variable comes back as invalid.
Does the server override or change the variable in this case?
Hi im trying to allow players to carry each other using attachment system. It works perfectly on server but only works sometimes on client. How do i fix this?
I have read, that relaible off means, event can sometimes drop? or it always be replicated but just later?
make sure the components are all replicated
They’re all replicated it’s just player characters
why is replication (even server->client) works only when event is called on the pawn
I have 2 exactly the same multicast events
one is called on PlayerPawn, second is called in GameModeBase
first is replicated to the client, second isn't (applied only to server)
why
Because GameMode does not exist on client. Only server.
You can also only call server events on things you have network ownership of
Hi all. Wondering if anyone can offer advice on how to set this up properly. Using a listen server, I have my character customization screen happen before the join game, so the client can decide on their player colour for example. When they join the game, I need to send the colour they chose to the server, so then the server can replicate it back out to everyone else properly. I am trying to do this with an RPC from client->server, on the client's spawned actor OnBeginPlay after the join, but this RPC never reaches the server. If I add a delay of 0.5s before calling the RPC it works fine. Question is, is there a more correct way to do this? Or a callback I can listen to on the client, that says "yep everything is set up and net connected so RPCS are safe to send now"?
In gamemode I'm finding all actors for class TestCube and calling event Multicast_Paint on each one
and only server cube gets painted
but if I will do the exact same thing (find all cubes and paint) on pawn possessed by server - everything works correctly
Wait for your player controller to be ready as well
Since your player controller determines ownership
So if your RPC is on your player pawn, the player controller needs to be present & needs to be possessing your pawn before you can call a server RPC
@verbal ice thank you for the reply. Is there a callback or value on the client that can tell me that that the Player Controller is net connected and ready? I see there's an On Possess event I can override, but logging shows that is only fired on the server. It does look like the Player Controller is valid in OnBeginPlay, as I am grabbing a reference to it before the RPC. But it just must not be net-ready yet or something? (since it does work after a short delay)
Check to make sure GetOwner() isn't null before calling the RPC
Might not have replicated yet.
oh ok, just it's impossible to do anything server-side on gamemode, even with other objects
The gamemode is server only, so you can do server-side logic there
However you can't replicate anything to clients inside it. If you need to replicate something, you can have your gamemode call code on actors that are available to the client, like the game state, player state, or player controller (owning client only)
This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.
This explains it
im adding an element to an array on a server RPC, shouldnt the elements replicate?
Is the array replicated?
my clients have no elements in their array, the array is replicated
What actor is the array on
a replicated actor thats placed as a component on another replicated actor and is componentreplicated aswell
What type of actor, who is calling the Server RPC
Does the server RPC even run, you should debug that
it does, i print string and check. it sets the element on server
What type of actor
Does the replicated actor that holds the array exist on other clients
it should right? if i declare a replicated array shouldnt it exist on clients?
Debug it, if it's not working, you shouldn't assume
In PIE with multiple clients you can select the world to display in the editor
how do i check if the array itself exist?
You'd wanna check if the actor exists first of all
The replicated actor, how is it spawned?
it does, its placed in world and other replicated variables and methods of it work fine
i declared the array in cpp and since then its been weird
Did you add it to GetLifetimeReplicatedProps
yes
Is it UPROPERTY(Replicated)
yes
What does the array hold
FName
Also define weird
so like when i made a variable to hold socket name in BPs, ran a function to get the socket name. itd replicate the name to the clients, however when the variables are declared in cpp they arent being set on clients
Can you send code, GetLifetimeReplicatedProps for now?
yes
And you're sure that code is being called?
Have you added a Print String inside your function to check
i use a print string and yes it does get called
it returns the right socket name on server
When do you access those on the client?
basically after i attach a player to a boat, i add them to another array called as passengers. then to make sure the client is rotated right way and doesnt jitter, i call the same attachment on OnRep of that passengers array where its to get the element from the socket array for attaching
however since array is empty on clients the game crashes
The array might not have replicated yet
but this gets called as soon as the component is valid
No guarantee
i see
Use a rep notify for your chair sockets, see if it gets called on the client eventually
alright
Checking GetOwner() on the spawned player Actor is not null and is valid. The player actor shows the owner is the PlayerController correctly, and immediately OnBeginPlay where the RPC still fails to be received by the server, not sure what else I can check
Check the output logs, see if there's anything about your RPC
Do you think it would be appropriate to just wait for OnPosess to be called on the server, and send an RPC from server->client at that time saying "hey we're ready, send me your data now"?
If the owner is valid on the client, it means it's also valid on the server
The owner of a pawn is set when the pawn is possessed (the server assigns the PlayerController as the owner)
I'd just check the logs
the controller will always exist on server before the pawn
since the pawns is spawned from the PC
the clients do call the onrep
Awesome, so it's just an ordering issue probably
Do the socket names have to be replicated or can they be infered by the client directly?
what is an ordering issue?
@daring gorge can you show:
- how you declared the array
- how you rep it (replifetime, functions, ...)
- the results you get on client showing thats its empty
Already solved
You're using the socket names before they have replicated
socket names have to be replicated right because i wanna make sure the client sits on the same seat they sat on the server
How does the server generate the socket names?
are you trying to attach the player on client before the sockets exists on client ?
takes in a mesh through the params, this is also replicated. reads all the sockets on the mesh and filters and adds them to the array
no, im attaching on an input action
which i do like after i walk all the way to the boat and all and the sockets are read when the component is valid
Can't you just wait for the mesh to replicate and then calculate on the clients?
on server or client ?
i could just calculate these sockets on clients locally too but idk how reliable/viable that is
IMO you should attach on server so it gets replicated
server
yeah but its jittery as hell
then i wonder why you need the sockets on the client
and client doesnt get the right orientation until i attach on it too
There is no real way to know when a client would be ready to receive any RPCs from the server unless you have the client tell the server that it is ready to receive the data through its own RPC which is also kind of problematic. There are OnReps and Events that trigger when the PlayerController receives a new pawn and that would likely be the best event to use to start sending data to the server.
Hmm. Okay. I'm confused here though, because the logs show nothing. I can see the RPC being fired from the client, but the server just never receives it if it's sent too early in OnBeginPlay (or with a delay < 0.5s after). But if I delay for 0.5s, (or manually resend the RPC at a later time) the server does receive the RPC just fine
@lament flax So if the pawn exists, it should be able to send a RPC from the client -> server OnBeginPlay without issues? Because that is not workin. Or what am I misunderstanding?
- what class sends the server RPC and when
Can you send your code
i sent some vids here of what was happening if i only attached on server
- the clients that sit on the boat dont have the right rotation
- they keep glitching/ server corrections as it looks like
- they lag as if they arent exactly attached, theyre floating in the air aas the boat drives forward and follow with some delay
only owning connections can send server RPCs from client
by defaults those are the controller, the PS and whatever pawn the controller is owning
yes, but you need to call the RPC on serve side (which makes no sense since you are already on server)
i dont think thats my issue but ill debug more
Do you know which Events these are off hand? Because it seems the only events I can find are only called on the server and not the client, when I would like to know on the client that it's safe to send an RPC back to the server.
We already checked that @lament flax
If it's client to server then it should just work
Can you send your code
please just send code, its hard to guess with just your interpretations :(
@lament flax @verbal ice Yes I can, let me clean up a bit quickly. Thank you in adavance. It's really just the spawned Player actor though, trying to send an RPC to the server's ...actor. And again, it works perfectly fine if I just wait 0.5 seconds which is weird
i already showed that everything else is replicated
the first image is called on event tick which i plan to change later
and vehicle target becomes valid right after that set vehicle message
is the chair component on a actor ?
ye
then thats probably why its lost
because the actor isnt owned by a owning connection
even if its placed as a component on the actor thats owned by the server?
you need to get a ref to either the pawn, PS or PC
it doesnt mater who owns it afaik, because you are on client side
had same issue with my containers
the initial issue i had was that my containers wouldnt fire on Rep until i add to them in BPs, but it all worked perfect in BP exec
- what class calls the server RPC
- in what function
- who is the receiver ?
im trying to see if array has elements when i attach using the onrep when client attaches and not when sockets are set
by containers you mean arrays ?
can you show how you add elemnts on servers
if its on BP, you need to Setthe var array to itself, otherwise it doesnt call OnRep
this
On the PlayerController in C++ there is AcknowledgePossession() or even OnRep_Pawn(), there's also a delegate OnPossessedPawnChanged. In blueprints you can use OnPossess on the player controller or receive controller changed on the pawn.
you arent setting anything there
on pawn there is also OnRep_Controller
my bad, the loop goes ahead and filters through the names to add to the array
this
do
Set Empty Chair Sockets and as input give Empty Chair Sockets
.
im using chair sockets and i just tried exactly what you told, it doesnt work
is it set to OnRep
ye
if everything is replicted then it should work
Okay I guess I had warnings disabled, there is a warning being called:
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_Character_C_1. Function S_RPCTest will not be processed.```
Code is simple. Happening on my BP_Character, which is really just the same as the Third Person demo character Pawn that is spawned automatically when connected. Manually calling the RPC works fine, I guess since things have had a second by that point to make sure everything is ready
i am sure i didnt change anything but the client suddenly returns the value
okay i know why this happens:
- as I said, and the warning tells you : to call a server RPC on client you need a owning connection
- you are calling the RPC on beginplay, which is called on server and client (so the RPC will be called once)
- on client beginplay (and maybe on server if you arent possessing it) the player controller is probably not replicated yet, so the character has no owner
I think it's because they have more than 2 BP_Characters spawned, and because they're calling it on Begin Play, the Begin Play is firing for both copies of teh BP_Character, one of which wouldn't be owned by the client
the best way to do stuff once the PC is valid is to use one of the methods that gets called on server and client when a pawn receives a controller
Thank you for the explanation, so one of those methods to use would be like the "Receive Controller Changed" event on the pawn actor, instead of doing things in OnBeginPlay that require network stuff to be ready?
exactly
i know that you showed a RPC test, but for such events, you could just execute all on server, no need to do client->server if you can be on server straight
I don't think I can just do this all on the server, but maybe you have a suggestion? I'm trying to get data the client chose via their ui (like player color) to the server, so the server can then replciate that out (via state) to everyone else to get the changes for. How do I get data from the client...without using the client?
yeah so what you have to do, is from the UI, get player controller/pawn/state then call a RPC to the server
The player colour is decided before the join (it's actually coming from savedata in this case, as I'm trying to load the players settings from last time they played), and want those changes to show up as soon as their player joins/appears, and not have to have them re-setup their player manually after every join
They can already change those settings mid-game perfectly, and those get saved to savedata fine, it's just re-applying those changes right on the next time they join, rpc was not getting through as I showed, so they couldn't tell the server "this is what I look like" immediately as they join
But I'll give it a go with those other events. Thanks again for your help, and @sinful tree and @verbal ice
to make a system like that, i would send a RPC to server with new color, and make the variable holding the color replicated to all, having the onRep displayign the color
Yes, this is exactly what I am doing, and works fine mid-game, just trying to send that RPC right on BeginPlay, so the server could have the correct "initial data" (from savegame) for that variable to be replicated to all, was not working :)
yeah, just read your data, then whenever the pawn is posses on client send the RPC
I’m trying to use Render Targets for player damage, but every character gets the same damage?! Is there a way to instance a Render Target so each player has its own unique Render Target?
how can I replicate this spectator system correctly
Unfortunately, this is not working. I've made it so that the RPC is not sent to the server until both OnBeginPlay AND OnControllerChanged is called on the actor. And having some weird results with the logs. It's like the controllers are getting assigned not how I would expect on the client vs the server. This is what the logs are showing. ``` Server Starts
Server Char0 OnControllerChanged called
Server Char0 OnBeginPlay called
Server Char0 Set Initial Customization Data, since server is the owner of Char0 player (success visually we see this working)
Client Starts
Server Char1 OnBeginPlay called
Server Char1 OnControllerChanged called
Server Char1 Does NOT set data, because server is not the owner/controller of Character1, the client is
Visually, we see Char0 on client window with the correct data
Client Char0 OnControllerChanged called (irrelevant, since Character0 is the server's player, we don't care about that as the client?)
Client Char0 OnBeginPlay called
- Client Char0 IS locally controlled??? But thats the servers player? (IsLocallyControlled and IsLocalPlayerController = true)
Client Char0 Set Initial Customization Data (RPC never makes it to the server still, but it shouldn't have been sent anyways since this is not our player!)
Client Char1 OnBeginPlay called
** Client Char1 OnControllerChanged NEVER gets called, and so never sends data to the server.
No more logs
Visually, the client sees both players with the correct data
The server sees themselves with the correct data, but NOT the clients character (missing customization data)
I'm very confused for a few reasons, from the logs marked with a *. 1) Char0 is the servers player, but the client is saying that Char0 is locally controlled by the client, which...shouldn't be true? And 2), the clients own Char1 never actually gets OnControllerChanged called
try NotifyControllerChanged instead of OnControllerChanged
people will not do this for free
I don't have that event available anywhere? Is that supposed to be on the pawn actor? Or maybe it's not exposed to BP? It's just weird, because when the client starts up it's almost like it thinks it's player should be Char0, but that's the servers player. Boggling my brain today, esp since the client is saying that Char0 (the server player) is locally controlled
I can still ask. sometimes a kind person will come and help. as a last resort I'll get help with his money.
I learn many things from kind people here
Instead of asking "how do I make X system?" you should ask more specific things.
You'll get more and better answers.
I made spectator but when clients try to spectate the server's screen changes and it spectates so I asked how to replicate it
I learn that spectator system from a video but he doesnt replicate it
his???
Is your client making your server change? Or is it the server doing it?
no one will ever pay you to answer you
I'm setting up a target system. Actors can target other actors. I want that to replicate (so you can see what other actors are targeting). When the player targets something I RPC the target to the server, but I don't want the player to have to wait for the target to replicate back from the server. I can simply set the value of the target client-side when I send the RPC, right? Essentially predicting the change? 
I just missed it when I was translating.
oh yeah you are on BP only i forgot
Correct. I would add a rejection rpc which tells the client to reset their target to a specific actor.
(rpc the server's current value back to them)
If, for whatever reason, they targeted an invalid actor.
Sure, okay. Like if it's out of range or maybe ceases to exist or something 
Yeah.
Makes sense thanks 
Or they target the world settings actor 🥳

ok
Potential advice - create a blank ITargetable interface that you can add to targetable actors.
Or a gameplay tag or whatever you like.
The interface means it's compiler enforced. 😛
I almost did this but I'm like 99.99% sure that I won't need it. I said Actor but actually it's my specific Character subclass/baseclass ("Agent") and it can only target other Agents. I won't have something else that can be targeted besides other Agents 
I'm getting a weird issue where skeletal meshes (clothing pieces on a metahuman) warp and bend in weird ways when seen by another client in multiplayer. The standard clothing works fine. Any ideas?
It could be the movement of the actor is less smooth on the simulated proxy
You might want to consider making sure it's attached to the smoothed part of the cmc (the mesh) and not the actor root (the capsule)
just a guess on my part
it's the standard metahuman setup with part meshes that get set with a leader pose to the body
The skinning weights look almost identical to the corresponding metahuman part, which was the first thing I looked at.
Is it possible to debug why no server functions get executed?
What do you mean by that
You might be calling the function as client in an actor it doesn't own.
I think I've narrowed this down to an LOD issue. The metahuman body has 4 LODs and the misbehaving pants only have 1. The problem seems to occur past a certain distance where the LOD switches. I'm thinking that perhaps bone information is being dropped and messes up the "follow leader pose"?
Confirmed by setting Forced LOD in the LODSync component
Wrong channel?
The issue only occurs in multiplayer which is why I originally posted here.
Hi guys, I've got problem with FindSessions in UE 5.4.4. It returns me empty SearchResults because of the length of the header packet. More info here: https://forums.unrealengine.com/t/findsessions-returns-searchresult-empty-in-ue-5-4-4-problem-with-header-packet/2029031
Does anybody have a clue how to solve the problem?
Hi, I’ve got problem with FindSessions in Unreal engine 5.4.4. The session is created correctly see video “CreateSession (first video)”. Unfortunately FindSessions returns me SearchResult empty. When you look at the video “FindSessionIssue (second video)” you can notice that in LANBeacon.cpp line 260 IsValidLanResponsePacket() there goes parame...
Hey everyone, I'm having some trouble and could use some help.
I have an Interactable Actor variable on my first-person character. However, when the client sets the variable and tries to interact with it, the variable comes back as invalid.
Does the server override or change the variable in this case?
What does the code look like?
I made a spectator system like that but whenever the client tries to spectate someone it changes the screen of the person who set up this server. I know there is a problem in the replication part but I can't find what to do. can anybody help?
that would be your Get Player Controller node getting the 0 index playercontroller
index 0 player controller will be the local controller if its not dedicated
if this is in the player controller blueprint, replace that node with a "get reference to self"
when I interpolate the player location from one point to another (using lerp or anyother node) on Client its no smooth as it is in server.
Why is that?
are you lerping on both the client and server?
I’ve worked on weapon prediction and other types of prediction in my project, and I’m now looking to understand custom movement character prediction for my game (such as wall running). As a beginner in this area, how and where should I start? I’m aware of network replication systems like GMCv2, but I’m specifically interested in learning how to create it myself to learn more about custom movement prediction. Any guidance or resources would be greatly appreciated!
https://www.youtube.com/watch?v=urkLwpnAjO0&list=PLXJlkahwiwPmeABEhjwIALvxRSZkzoQpk this is where you should start. Also have a look at this github repo https://github.com/Vaei/PredictedMovementExample
Instead of using variables I've just used direct connections which is annoying, but the interaction event is not called on the server or multicast, could that be why?
nah I only replicate on server and the movement is automatically replicated to the client
well it makes sense then why it's not as smooth on the client, its not like the client received the location every frame. I'm not sure why you are lerping, but just moving properly using velocity will give better results.
So how do you guys tests your code on listen server while developing?
Because running from editor with 2 players on a listen server seems to work perfect.
Once you package your game it's totally different behavior.
I discovered many bugs that wasn't exists when I tested from the editor but on a packaged game with 2 different accounts and PCs they suddenly appeared.
Curios how to test the game properly.
Package it in development and attach to the game instances or run them direct from your ide?
Can you debug blueprints that way too ?
Probably not.
The only bugs you likely found were due to initialization orders. Which is a good lesson that you should never rely on them. Testing in PIE is perfectly fine for pretty much anything sans profiling for real world conditions. But you should always be aware that stuff won't initialize the same way all the time, specially on clients.
Yeah, that can work, but it also doesn't allow debugging BPs on the client side.
It's just one of those things you learn to work around. 🤷♂️ You make it the best you can, and then you test it in a real build and fix what breaks. You learn from it and don't make the same assuptions the second time around.
is this ok to use to get the player controller from the player state ?
Depends on the context. Who's playerstate are you getting it for and why?
i was going to use it to update widgets after certain variables are updated , in this example after a player kills another player or when you die (kills, deaths, etc)
Nothing about that should require the controller though.
how so ? im using the controller to update the client widget ?
You should use delegates or something like the GameplayMessageRouter plugin from Lyra. The widget should be able to get the broadcasting system and bind to it. Then your system can just broadcast and the widget can just work.
lol that seems like quite a rework ..
Shouldn't be. You have a death system. Just make something like a GameStateComponent to broadcast gameplay events. Death on the server can get the killer and the one dying, populate a struct of data and it can be multicast. The multicast can broadcast a delegate or send a gameplay message through the gameplaymessagesubsystem, either way. The widget binds to the game state's component or implements the gameplay message listener and throws up a timed child when the message runs.
i mean it does sound good, but at the same time i dont know if a full reworking of how im updating widgets is a real efficeint play at this point. i see what you mean, but is there an issue doing it the way i have things already setup ?
🤷♂️ Maybe not. Just convoluted. Either way, to answer the original question, that is perfectly fine to use as long as it's in a ClientRPC or already on the client who owns the playerstate. As that call will fail on any machine except the server and the owning client, and to update the UI, you want the owning client.
Unless you're getting it on the server to run a function on the player controller to run a ClientRPC, also works.
yea got you, i actually already had this event in the character which was where i was using doing it, on the server death for example i call that players controllers update gameplay stats on owning client. i only just changed some things to update in the playerstate and i have it updating the SQL and varibles, and then i call that owning client event
i do like what you were saying, it defintiely makes a lot more sense to set widgets up like that. never have done something quite as complex (i know it prob isnt, but it's new so yea)
😄 Try it next time. It ends up being a lot less complex, which is why it's usually preferred. You get a widget that just handles it's own stuff and a gameplay message broadcaster that handles it's own stuff. Multiple things can use the message broadcaster too. Say you want to tie into some visuals somewhere on the level. Show the latest player as dead in a video feed on a virtual monitor or something. Everything can run from that one delegate/messagebroadcast and it can be generic like that instead of having to know everything that needs to update when something dies in some long function that runs functions on everything.
yea definitely sounds easier / more efficent once understood. it is quite annoying to always use the controller to update widgets but i fully understand how that works so thats why i do it lol
quick q on that, would it require any cpp ?
Nope. You can do it entirely in BP. Could make it more generic in C++, but it's not completely necessary.
Like if you want a simplified version it would basically be...
@crisp shard You make an ActorComponent. Set it to replicate. Add an EventDispatcher and a custom function that takes in what you need.
Drop it on your GameState
Bind the event in your widget on Construct, GameState should be valid by here.
Then on the server, when you decide someone has killed someone else, you simply do this. And everyone with a KillReel widget gets notified.
You can make that handle function in the widget throw up a second widget in a vertical box or something that runs a timer on itself and then removes itself, etc. But this code alone would get you most of the way there with a debuggable print.
yea this is sick, thank you
makes perfect sense and is way better than what im doing to display the kill feed lol
currently was doing a for each loop on each connected player
in the game mode*
Hey guys! Noob question here. What is the best strategy to replicate AnimMontage playing to simulated proxies? I have a FireWeapon AnimMontage which plays when player fires. How do I replicate it? I saw some people using Multicast RPCs, but it really seems a bad idea, as player can hold fire input and spam the AnimMontage play (the montage may blend into itself). At the same time, replicating a flag also does not seem a good option, as the fire logic shoots a line trace, and I'm worried that simulated proxies will play the AnimMontage without syunc to the "hit logic", as once the flag is replicated, the logic already happened.
there's a few ways to handle this, im prob not the most knowledgable but w anims for attacks / firing, i usually do the animation on client locally, and then have the server event fire , do dmg and in that i either have a multicast that ignores the owning client becuase they already saw that local animation , and the multicast should fire during the server event so the player getting hit will see the animation when the dmg event takes place
I'm learning how to make a dedicated server, and the tutorial said to do use this node to join a server. But it doesn't seem to work, since in the tutorial a new map is opened when this node is called. When I call it, nothing seems to happen. What am I doing wrong?
In the tutorial they started a server after packaging the project and using the command prompt. I'm just using "Play as client". Does that make a difference maybe?
i draw lines with on paint function, BUT on server works allvery well but on the client the line " is flashing" the line draw every time new... on the client.. what can i do?
But what about network performance? If player holds fire button won't it flood network with multicast RPCs?
i mean, if it's firing an event every tick then yes lol but i wouldn't see how that would be the case ? you can do many things to stop the spamming but even if it's a machine gun you'd fire a single server event and then yes for each loop of whatever timer/tick function that is firing the bullets, on impact those would be multicasts and i dont think it's that much of an issue assuming you aren't firing like 100 events at a time
Cool! Thanks!
You've compiled out a dedicated server, and then launched the dedicated server and a standalone instance of your game?
No, I'm just trying to do it in Editor.
Ah. You should be able to do this still. Except the server needs to open it's own level. You open PIE with dedicated server on the main menu of your game. The server should open level on it's own. And then each client can use console commands to "open 127.0.0.1"
when i start the game in multiplayer... server works well... but client need 1min that i can controll hi... its like he loead 20sec or lagging
at the beginning
Hello!
I want to enable some functionality only when the system has confirmed that all the clients have ticked at least once for autonomous and simulated proxies. Is there a way I can do this?
i add elements to an FName array, after i add i print string in BPs and get the right value on print string from the server side. then a server side RPC that is to read that element, since the array is declared in Cpp returns that the array is empty and crashes?
it also only proceeds forward w the code after literally checking that the array has more then 0 elements inside of it
"a server side rpc"?
i meant an event that executes on server, sorry
Then something is amiss with your rpcs!
Either you're filling the array on the client, or you're not sending a server rpc to the server, but executing ti locally on the client.
if a print string, prints a string with server: value, then the value is being set on server right?
I think so.
weird part is, it goes ahead of that Num>0 but crashes at the print string
yesterday the clients didnt get the elements and all i did was change it to onrep and they did, now server doesnt get em
Weird. I don't see anything immediately wrong there!
i think 4..26 is buggy, since ive started switching code to cpp the entire system is acting weirdly especially when set variables or smth
the on rep isnt being called on the server? is there a way to call it when i add elements in BP
In BP, when you set a variable, OnRep is called on the server for you.
It is not called in c++.
i declared the array in cpp but adding elements in bp, its not being called on server, atleast i think . imma add vars in cpp and see if that works
Only matters if it’s been declared in CPP or BP. Doesn’t matter the context of which it’s being modified.
What you can find is, though, that you're creating a BP subclass... but then just using the c++ class instead.
So the BP class fills the array, but the c++ class obviously doesn't have that because it's not the BP.
But then .Num() should be zero.
exactly why i dont understand how it proceeds with the code to crash
What is the actual crash?
im declaring everything in cpp and whenever i use cpp methods to set vals, it doesnt call onrep on clients. so im using bps to set vals anyway, however its just being weird in general
the trying to access index in array of length something
i can get it to crash and get the actual error, but im first trying to use a cpp method to set the var and see if it acts differently
Assertion failed: (Index >= 0) & (Index < ArrayNum)
also using cpp is now calling the onrep on server but again crashed
Use a setter in cpp
yeah thats what i did, but it still crashes
void UMyClass::SetThing(NewThing)
{
Thing = NewThing;
OnRep_Thing();
}```
And the crash is?
,
eventho the way i access it is with that check i showed above, if num>0
Which line does it say is crashing?
could this be the result of the fact that the actor thats acting as a component on the other actor running this is placed in the world therefore has no owning connection?
Alright, I have successfully connected 2 quests to a local dedicated server, but somehow, I cant get position of each players in the map. (I just want to see other players location in VR), any idea how should I proceed ? I tried to add a set replicated to the event begin play, but I dont think it would be the right approach
oh wait, my bad its crashing from another array now, which makes sense
let me check w that rq
I made a spectator system like that but whenever the client tries to spectate someone it changes the screen of the person who set up this server. I know there is a problem in the replication part but I can't find what to do. can anybody help?
Well… for one you’re calling Get Player Controller in the context of the server
It’s just going to return the servers controller.
Get the controller from the pawn you are in here
Rather than whatever the first one is every time
Get player controller 0. Always a killer.
Also player arrays aren't going to be the same order on server and clients. Remember that.
The server is setting the view target here, that's fine
@ashen plume I'm having a similar issue, but only the camera lags behind the mesh. The camera is attached to the mesh, but something about the simulated proxy causes the camera to lag behind the head bone despite being attached to it
Would this on a client, send its position to the server so it can replicated to other clients ?
I havent worked with attaching things to simulated proxies, but my advice would be to look at spectator related issues to see how people synced them, since it involves cameras
Could be right
The only problem is that.
The issue only crops up when I'm playing a replay.
Otherwise it works completely fine.
I know factually replays struggle with the net position smoothing
The position interp from cmc doesnt sync into replays, i read somewhere about that
Hmmm, I'd love to know where you heard that. As that sounds about right.
Long fever dream nights in the forums lol
So, it sounds like, the camera is interpolating as if it was attached to a mesh that was interpolating. But the mesh doesn't interpolate and so gets ahead of the camera?
Did you ever find a solution?
I havent gotten to implementing spectating as im still pretty fresh in my project and unreal
But i dont think the forum post figured it out
Just like you did with me try and search some adjacent or similar problems to see if theres overlap
Yeah, I'm thinking the problem might not be the actual character class, as opposed to the cmc
I'm using the following to restart the match after a game is complete:
GetWorld()->ServerTravel("?Restart");
When this happens I get this crash:
AActor::CallPreReplication (this=0x7fd117c352a0, NetDriver=0x7fd11dbe75e0) at .\Runtime/Engine/Private/Actor.cpp:1578
Interestingly the issue only appears in cooked shipping builds on the dedicated server.
Even using standalone in editor it doesn't crash.
attach a debugger to the built dedicated server if you can
Was told to post here instead of blueprints:
Any idea why spawning an actor from server would show in both game views but not play in editor?
Hey Nonlin, did you find a solution to this? I'm also having problems with replays
Unclear. They only show in a packaged game or but never in Editor?! That would be really strange.
Both game views are also Play In Editor so Question is ambigious.
Hey, if I want to use GAS for multiplayer, should I still respect the stuff needed to do multiplayer (such as executing important stuff on the server, etc...) myself or is that handled for me automatically behind the scenes (as I heared that GAS handles stuff like Client Predicition and other complex stuff related to multiplayer so I'm wondering if it handles the rest of multiplayer too or do I still have to do that myself ?)
Oh, sorry, I have another window like the center one shown (so two game views and an embedded editor view). The game views for client and server both show the correct spawn, the editor view does not show anything (but shows the information on the right pane depicted above)
Maybe being hidden in editor or it's spawning those scissors in game. You can check the settings in this BP and the mesh inside it to see if anything is changed or any blueprints are doing this.
It's hard to say without seeing the settings on those BPs and meshes.
Does this help at all?
Basically I just want to be able to view what happens in editor as if I could detach and fly around.
Hmm, nevermind. It works if I set the mode to "selected viewport." That gives me the option to detach editor and select objects etc.
What I was hoping to do was run the two screens (i.e. New Editor Window (PIE) mode) and test things in the embedded/normal editor view. But I guess those scripts don't communicate with PIE the way I was hoping?
Did you ever get this sorted out?
Question about relevancy and visibility (NetCullDistanceSquared).
where is engine code that process "not relevant actor is destroyed" and "relevant actor is respawned" ?
when Distance between Character A and B is bigger than NetCullDistance, Destroy is delayed (about 2~3 sec) but Respawn appears immediately in my project.
so I want to see about engine code about that in UNetDriver::ServerReplicateActors(), but I couldn't find.
Anyone help? 😅
That shit delay
Don't get me started
At some point I had my GameState spawn in and out every frame 😂
It's not a silver bullet, no
Lemme see if I can find that part again
The Delay can only really be eliminated by changing engine code btw
And I would highly suggest to alter it in a way so it's configurable per Actor
@lament owl It should be around line 4787 in NetDriver.cpp
AActor* Actor = ActorInfo->Actor;
bool bIsRelevant = false;
const bool bLevelInitializedForActor = IsLevelInitializedForActor( Actor, Connection );
// only check visibility on already visible actors every 1.0 + 0.5R seconds
// bTearOff actors should never be checked
if ( bLevelInitializedForActor )
{
if ( !Actor->GetTearOff() && ( !Channel || ElapsedTime - Channel->RelevantTime > 1.0 ) )
{
if ( IsActorRelevantToConnection( Actor, ConnectionViewers ) )
{
bIsRelevant = true;
}
}
}
else
{
// Actor is no longer relevant because the world it is/was in is not loaded by client
// exception: player controllers should never show up here
UE_LOG( LogNetTraffic, Log, TEXT( "- Level not initialized for actor %s" ), *Actor->GetName() );
}
// if the actor is now relevant or was recently relevant
const bool bIsRecentlyRelevant = bIsRelevant || ( Channel && ElapsedTime - Channel->RelevantTime < RelevantTimeout ) || (ActorInfo->ForceRelevantFrame >= Connection->LastProcessedFrame);
Ah sure, this should be 5.3
ServerReplicateActors_ProcessPrioritizedActors, right?
I think there are 3 values that control this iirc.
First off there is the RelevancyTimeout in the line I mentioned. That's the 5 second global "cooldown", so Actors don't flip flop in and out of existance.
ServerReplicateActors_ProcessPrioritizedActorsRange
Then I a bit further up, part of the snippet I posted, there is a hardcoded 1.0 value.
Iirc that's to check that at least 1 second passed before it checks relevancy again.
Could be, I don#t have 5.1 at hand ,but the code should be the same, just elsewhere then
And last, that was the most annoying one to notice.
// if it is relevant then mark the channel as relevant for a short amount of time
if ( bIsRelevant )
{
Channel->RelevantTime = ElapsedTime + 0.5 * UpdateDelayRandomStream.FRand();
}
They add a randomized "delay" on top of the RelevantTime.
I had to "fix" this all for a MOBA so Actors can walk into Brushes and instantly stop replicating.
Well "instantly".
I basically changed the RelevancyTimeout and the 1.0 value to Actor Variables (added them to AActor) and gave them the same defaults.
Can't fully recall what I did to the randomzed offset
Oh