#multiplayer
1 messages · Page 433 of 1
Hmm I never knew that they were replicated in the same bunch
95% sure it would work that way
if not you can OnRep_AutoEquip
it does make sense that the Actor would send all its replicated properties in initial bunch that spawns it
otherwise, you'd have chaos with what arrives when
Right, it makes sense. I'm just not sure if that is how it works
i can't say i explicitly tested a scenario where i spawn something, then immediately set its variables
but that is probably because i never had trouble relying on it
as for other cases of multiple variables replicating together, they will replicate in DOREPLIFETIME order
that i did test
@rough iron Can you confirm that setting a replicated property directly after spawning that actor will always result in that property and actor being replicated in the same bunch?
In other words, can you rely on the values of replicated properties in BeginPlay?
Hey guys, I'm trying to spawn replicated actor, which has a replicated child actor inside. That child actor spawns on server but does to appear on client. What my be the problem?
it is easy enough to test @jolly siren
just set the bool to not its default value, breakpoint BeginPlay and read it from there
(you'll hit twice, you're interested in one with ROLE_SImulatedProxy)
Right, yeah I know. It's the intermittent issues I'm worried about. But I'll test with lag
@jolly siren not 100% sure but it all depends how much you need to replicate, if the netcode decides to chop all your data in smaller parts some will comein later, I remember that exposed on spawn values are valid in BeginPlay, others I wouldn't rely on it.
NetDriver shouldn't send any Actors before it evaluated the entire traffic for that frame
Hmm okay, it seems like it isn't common knowledge then if it is true.
I would think that if the bunches were chopped up, they would be reassembled before UActorChannel::ProcessBunch
it is my current understanding, ExposeOnSpawn also need to be set under the hood
before the blueprint construction script runs
but i never found the time to read the entire net code
Okay, just read a long write up by an Epic dev.
Answer: They try to ensure that BeginPlay is called after replicated properties are received. But it is not guaranteed in all cases.
And we should use PostNetInit instead.
Both UT and Moss's Twin Stick Shooter example have places where Client rpcs are called immediately after spawning a replicated actor on the server
hmm
does your FActorSpawnParameters have something related to PC as the Owner ?
No, I don't set the owner with FActorSpawnParameters. I am setting the owner to the Character within GivenTo
So really it looks like this
AGun* NewWeapon = GetWorld()->SpawnActor<AGun>(DefaultInventoryClasses[i], SpawnInfo);
NewWeapon->GivenTo(this, i == 0);
void ABaseGun::GivenTo(APortalWarsCharacter* NewOwner, bool bAutoEquip) {
ensure(NewOwner);
Instigator = NewOwner;
OnRep_Instigator();
SetOwner(NewOwner);
MyPawn = NewOwner;
PrimaryActorTick.AddPrerequisite(MyPawn, MyPawn->PrimaryActorTick);
ClientGivenTo(Instigator, bAutoEquip);
}
void ABaseGun::ClientGivenTo_Implementation(APawn* NewInstigator, bool bAutoEquip) {
Instigator = NewInstigator;
SetOwner(Instigator);
MyPawn = Cast<APortalWarsCharacter>(Instigator);
PrimaryActorTick.AddPrerequisite(MyPawn, MyPawn->PrimaryActorTick);
}
As long as the Owner is set before you RPC it should be fine
So the client rpc can't beat the actor (AGun) replication?
anyone know how i can make the muzzle flash more conistent looking
it plays on the remove client longer than it should
remote*
Can't really say without knowing more
so the muzzle flash is a GA cue attached to the muzzle of the gun
when i fire local is fine, muzzle flash plays properly, on remote the muzzle flash carries on for quite a while
before stopping
and looks really odd
after i stop firing*
think ill handle the firefx outside of GAS
it seems to be hit and miss on replication times
@jolly siren you can't call a client RPC on it before you call the GivenTo, as it has no NetOwner at that point
@winged badger ClientGivenTo is called within GivenTo after setting the owner on the server
it didn't look like that from your first snippet
you spawned it, then called ClientGivenTo directly there
sorry, yeah the 1st snippet was a simplification
The 2nd snippet was meant to show more
oh really? I didn't know that
it happens every time NetGUID resolves into a null reference
multicasting from PC or GameMode
or calling a Server RPC on an object thats no longer there
all result in client disconnecting
The same goes for client rpc?
while i never managed to make that happen by accident
pretty sure it does, there should be no difference from Multicast
(in a way the RPC is resolved, the difference is in to whom its sent)
i did have the situation recently with InventoryItem (ActorComponent) with no cooldown - result was if you spam fast enough when your stack is 1 server would destroy the component, and client would send another RPC before it got that information from the server
which would result in attempting to call a function on a component that was no longer there and client disconnecting
ahh okay, yeah I think I'm going to remove the rpc for now
Does anyone have jitter when walking on a terrain in multiplayer that they don't have when walking on flat ground?
How?
think there is some smoothing settings
or something
not get editor open atm
maybe need to increase replication frequency?
lots of things can cause jitter
It seems like it may have something to do with vehicles. I have AWheeledVehicle pawn, it replicates fine but it seems to get very jittery
Is it advisable to replicate a timer from server to client or would it make more sense to just set the timer on server and then simultaneously set a timer on the client via RPC? The client timer is just for UI purposes, there’s no functionality on the clients end
I guess what would be the least expensive from a bandwidth perspective is my question
I have my character's mesh pose not ticking on the dedicated server. Therefore, when I drop weapons they come from the tpose location instead of where I really want to drop them from (the animated location). Is there anyway to tick the pose for a single frame before dropping the weapon on the server?
I thought calling RefreshBoneTransforms would work, but it's not
What can a cause of getting this error when trying to replicate functions be? 1>C:\Users\Sam54123\Documents\Unreal Projects\TVStudio\Intermediate\Build\Win64\UE4Editor\Inc\TVStudio\VideoSwitcherComponent.gen.cpp(47): error C2511: 'void UVideoSwitcherComponent::ServerSetInput(const TScriptInterface<IVideoSystemInterface> &)': overloaded member function not found in 'UVideoSwitcherComponent'
const TScriptInterface<IVideoSystemInterface> &input
TScriptInterface<IVideoSystemInterface> input
Signature mismatch
I get rid of the & and it complains about a signature mismatch though
const
void UVideoSwitcherComponent::ServerSetInput_Implementation(TScriptInterface<IVideoSystemInterface> input)
That still seems not to work
1>C:\Users\Sam54123\Documents\Unreal Projects\TVStudio\Intermediate\Build\Win64\UE4Editor\Inc\TVStudio\VideoSwitcherComponent.gen.cpp(40): error C2511: 'void UVideoSwitcherComponent::ClientSetInput(const TScriptInterface<IVideoSystemInterface> &)': overloaded member function not found in 'UVideoSwitcherComponent'
void ClientSetInput(TScriptInterface<IVideoSystemInterface> input);
Same issue
This time for the client RPC
?
This is my first time networking btw
But to my knowledge I followed the wiki exactly
Obviously swapping function names
It's just the same issue with the server rpc function, you have a signature mismatch in your client rpc
ClientSetInput_Implementation
Change the parameters of that to not be const ref
It's not
void UVideoSwitcherComponent::ClientSetInput_Implementation(TScriptInterface<IVideoSystemInterface> input)
I fixed all of them at the same time
"UVideoSwitcherComponent::ClientSetInput(const TScriptInterface<IVideoSystemInterface> &)" (from your error)
Are you sure?
new code: https://pastebin.com/R9mzJjwW
It looks the same, I haven't changed anything since I posted that, but here's the whole compile log: https://pastebin.com/vHx0aABg
I may have missed someting
Line 38 use GetOwnerRole(), there is no Role since this is a component, not an actor
Is that the cause of the entire fault?
Might be, hard to tell if the other errors are false positives or not
Well, it's not compiling. Not intellesence's falt
New error log?
@jolly siren I would try TickPose() then RefreshBoneTransforms(), you shouldn't need UpdateComponentToWorld
Hey guys, I was looking into the best way of replicating an inventory
something like the fortnite or pubg ones
my idea was to have a list/database of items with item ids
and only replicate that
not the struct that holds all the info
but what are other ways to have a proper working inventory? all tips are welcomed
I heard something about FastReplication as well but i have no idea what is that, can't find anything on google
@sharp pagoda I tried that too, it isn't working
GetMesh()->TickPose(0.f, false);
GetMesh()->RefreshBoneTransforms();
The location I am trying to use after doing that on the server is
Weapon->getMesh3P()->GetComponentLocation()
Not sure where to post this but anyone familiar with discord’s richpresence ? Is this at all something to use for dedicated servers so if client sees client b is on dedicated server and requests to join etc or just peers to peer stuffs
Pretty sure how you handle the join request is up to you
If it's done right, they send you a request with payload
That payload should be info about the session you want to join
Shouldn't matter if Listen or Dedi server
Hmm might have to review my ded server setup. It makes sessions but it’s using nulloss I always get log messages for no session to join etc even tho it works
@red ledge replicating IDs is the best way to go imo
Unless this is normal for dedicated non steam server..
You can make Sessions but with NULL OS they are only local
NULL OS Dedi Servers would need connection over the internet via IP
@sharp pagoda Okay so the following is partially working.
So I'm doing the following from character right before dropping the weapon
GetMesh()->TickPose(GetWorld()->GetDeltaSeconds(), false);
GetMesh()->RefreshBoneTransforms();
This seems to start off in the wrong location (tpose location) and gradually get closer and closer to the correct animated location the more I drop the weapons. Any ideas why this might be?
Hi, does anybody know a good tutorial to make LAN Multiplayer? Because with Advanced Sessions, the LAN Tickbox doesn't really work; I can't join another session in my own network (except for PIE
@jolly siren thanks!
np
@winged badger What is your understanding of how long after SpawnActor a replicated property can be set and still come over in BeginPlay(really PostNetInit)? Is it any property set within the same frame that the SpawnActor was created?
@jolly siren I think is is because the pose/animation have a transition time, so when u tick it with certain deltaseconds, it will use that to interpolate the pose to the correct one
@jolly siren try setting the delta seconds to something big like 1.f
cus then i believe its enough time for it to do instant transition to the current pose
I tried setting it to 100.f. But yeah using a 0.f delta seconds caused it to not work at all. I'll try 1.f now
It acted the same as with GetDeltaSeconds. I'll try again tho
worst case u gotta call it lots of time, but i believe there should be a better way, not too familiar with this functionality :/
A lot of times with different delta time each time? Yeah I was thinking of doing it in a loop and incrementing delta time
but im not sure if that may work, the pose transition may be hard bounded, gotta experiment i think
Yeah with 1.f it is still gradually getting lower
I'll try a really really high number
ye, i checked the source code and nothing clamping the deltaseconds
yeah even this still has the issue
GetMesh()->TickPose(999999.f, false);
Moving to #animation
Anyone on 4.21.1
?
using the createstaticmeshcomponent or instancedstaticmeshcomponent seems to be busted across networking
LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: StaticMeshComponent
Logging this when testing with multiple clients
animation blueprint wont properly replicate movement velocity when touching the mesh created with the node
Maybe its base movement returning null …. not sure
Its almost like it doesn't know how to cook these actors that call this node anymore
Copy of my construction if anyone wants to see if they can reproduce
Client> Saves Setup to savegame
Client> Joins Server
Server> Creates PC - Sends RPC to Client to send info back.
Client> Loads savegame data, Sends to Server Values to set on PC server side
Server> Server Sets PC -> PS character setup
Server> Spawns Character - Exposed var from PS for what body parts.```
Will the values for each part of the character be replicated correctly or will it just spawn defaults?
This is my workflow theory of setting up say int for what Head or arms etc should be used as a character, customizable char over multiplayer
If the Server is setting the Meshes it should replicate fine, though typically you would want the Client to update it locally as well for instant feedback.
Also using a Client Side savegame to set values on the Server leaves it open to Players modifying the Save and potentially gaining access to content they shouldnt have access to.
Are you using BP or C++? @hasty adder
You should look into the ClientTravel function and the Options you can append to the connection URL that gets sent to the InitNewPlayer function on the GameMode if your using C++
Unfortunately bp so I need to call back when pc is created. Luckily latency is ok because you still have to choose team from a spec state
here is what happens when walking across meshes created with that node. To work around create the static mesh components in the actor and set them using the set static mesh node instead of using the create static mesh component node..... unfortunately this means instancing is completely broken over networking until this is fixed.
I’m gonna give it a try tonight or tomorrow depending on my wife’s schedule lol.
yo
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_WeaponAK47_C_0. Function ServerRemoveAbilities will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_WeaponScar_C_0. Function ServerGrantAbilities will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_WeaponAK47_C_1. Function ServerRemoveAbilities will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_WeaponScar_C_1. Function ServerGrantAbilities will not be processed.
the weapon has an owner though
Are you sure?
Does it have an Owner with a NetOwningConnection though
IE something connected to a PlayerController
Make sure its not a remote clients version of the actor calling the RPC as they wont have a PC that they own to make the call for them
@fossil spoke that is what my investigation through locals just confirmed
the pawn calling it has no Owner
so i need to do IsLocallyControlled before calling the Server rpc right?
yeah
{
if (!OwningPawn->HasAuthority() && OwningPawn->IsLocallyControlled())
{
ServerRemoveAbilities();
return;
}
UAbilitySystemComponent* ASC = GetPawnOwner() ? GetPawnOwner()->GetAbilitySystemComponent() : nullptr;
if (ASC)
{
ASC->SetRemoveAbilityOnEnd(ReloadAbility);
ASC->SetRemoveAbilityOnEnd(SecondaryAbility);
ASC->SetRemoveAbilityOnEnd(PrimaryAbility);```
like that?
now im hitting a check if i put IsLocallyControlled
check(IsOwnerActorAuthoritative()); // Should be called on authority
oh i think i need to return out if not IsLocallyControlled
and screw them
hmm now i have no abilities at all
thats cause i !IsLocallyControlled is bailing the server, mmmmmm
so what is the best prcatices
for handling ListenServer and dedicated server?
in RPC calls?
RPC calls should always come from an actor with owner set
Has authority or is server branch
Why would a pawn calling it not have an owner?
If the pawn is ai it should be owned by the server ai controller
If it’s a player it should be owned by the player once the ak actor is equipped or gripped(vr)
Set owner on equip
right
so the player switches gun, OnEquip is called
OnEquip calls GrantAbilities
but that should be server only
so non servers get bailed out, and it calls Server to call that function
fixed it
i was just derping a bitg
in a multiplayer scenario with a dedicated server, is there any way to use Level Streaming such that the server has all of the levels loaded in the world, and all of the actors active, but the clients only have the levels loaded they can 'see' or care about, and only tick actors and get replications for the actors in those levels?
last thing i read about this was from 2014 and basically was 'no if the server loads a level all the clients do it too'
trying to cut down on the number of actors each client has to worry about.
If you're just worried about actors considered for replication then that's what the replication graph is for
Released in 4.20
can anyone explain what im doing wrong here? I have a Pawn_blueprint. In that blueprint I have a G pressed event. When G is pressed the event calls (RunOnServer) which calls (MultiCast) which spawns actor from class. I am not running a dedicated server. Client1, the listen server, presses g and the actor spawns on all clients. Client2 presses g and the actor only spawns on his own client. Why is it not spawning on server? https://gyazo.com/1329ac8dfeb44d0c79d9fe3905ad9a3c
lol whut
as it will spawn under hosts (listen server scenario) or first player that logged in (dedicated server) cursor
sorry
you can't use GetPlayerController[0] in this scenario
when i call this on listen server, it is spawn on server and client, when i call it on client its only spawned on owning client
yes, thats why i use ron on server on client, and then multi cast
and you should send the HitResultLocation as an input parameter on the ServerRPC
because that will return a different location on each machine
so I have to replicate the hitresult before sending it?
as it is now
no, click on red event node
add input in details panel of type vector
and connect the pins
that way vector is sent with the RPC
multicasting is a terrible choice here
as any player outside NetRelevancy range, as well as any player that joins later won't have that Actor
Players cant join later so that doesnt matter:P
it matters for relevancy, and its really bad practice
https://gyazo.com/5d87660c78b9dcd18a2d42b003de6b24 you mean like this with the vector?
not quite
you plug those 3 nodes into the first server RPC
both server and multicast should have the vector input
is the door replicated?
that explains why it "works" when server does it
XD
so
your HitResultLocation is evaluated when Spawn is called
and each machine has a different idea of what is PlayerController[0]
wouldnt the pawn return its own playercontroller ?
so each machine takes a different location for the spawn
no, GetPlayerController is static
it doesn't use Pawn as context
so on your client PC 0 is its local controller
so im basically returning the listen server playercontroller everytime?
and on server its the host's controller
when your server spawns a door
it spawns it under its cursor and it replicates, so clients see it where it should be
clients however spawn an additional door wherever unreal figures out their own cursor is locally
and if you are using multi window PIE, that can result in some interesting numbers
bottom line
replicated Actor should be spawned on server ONLY
So multicast is not needed?
and you need to push the Location (because its dependent on local controller) through the ServerRPC
no, its not
server has no clue where the clients mouse cursor is
ever
or what buttons a client is pressing
unless you RPC the info
so how do I get the local controller?
you don't need to
your SpawnDoorRPC has vector input
when its called it will evaluate the location locally
and then send the result to server along with the RPC
basically saying "spawn door at this location" instead of 'spawn door"
So I made a replicated vector variable, it gets the vector from the hit result, which it sends to the run on server
and this seems to work fine
@winged badger would you consider this a proper set up?
Also, thanks, been stuck on this for days 😛
almost
you don't need an authority switch
or a variable Vector
otherwise, yes
Yeah I left the switch cause im lazy :P, I thought I'd have to replicate the vector so I made a variable. Gonne try without it.
it would not do anything, as client setting variable locally wouldn't replicate to others
and clients would overwrite whatever server sent when they press G
the RPC carries location with it now
lulz, Guess I got a lot of bad info on youtube xD. Thanks a lot, now I can finally continue my project
Hey guys what would you say is the best way to handle knocking back a character in a way that is server authoritative yet also without a noticeable delay?
maybe try add impulse
Interesting bug found by TheJamsh https://issues.unrealengine.com/issue/UE-67695
When I call a net multicast function, does it run on the server as well?
Yes
Interesting bug indeed
yes, it is intended
I posted that issue to Answerhub too with code. Got a reply from engine team which says it is a bug, got a guy on it.
General limitation with how the rep layout is generated.
Note that if you manually create a NetSerialize() override, the previous value is correct
Ahh okay cool, yeah I came across your udn post on it
Ah cool cool. Yeah I'm surprised it hasn't been found sooner.. makes me wonder how many people are using that functionality. I find it really handy
The old value with OnRep is sort of a hidden feature
I guess the other workaround is to just store a shadow copy locally and update it in the OnRep function, but.. kinda annoying
Yeah for sure
I've had issues with it before too. Can't remember the specifics, but it definitely isn't rock solid
Someone encounterd FPS problems with 4.21? In our Multiplayer FirstPersonShooter you start to lag when you pass 180FPS...
Hehe, well thats our workaround for now, but we arent sure whats going on. You dont want to limit the FPS.
I wonder if someone else has this issue
Yeah not ideally. How are you testing it? In PIE?
The error isnt in PIE when i understood correct.
Looking through my code it looks like I was having issues with the OnRep previous value when it was a TArray. Might have been fixed by now tho
Our game can create also Listen Servers, when you play on them the problem dosnt happen. Means it only happens in Online Mode. Lan is fine. Its weird.
Also difficult to find out what is cuzing it...
I hope it's been fixed as I rely on that sometimes too haha

Do server functions have to be called by a pawn or can they be called by any replicated actor?
Is there a way to make an actor dropped into the level able to call server functions from the client?
I'm trying to make a very moddable game with replicated components that can be easily put in any actor and I don't want to custom code the player pawn to individually find all the actors that might contain a component and try to replicate them every time the function is called
A client has to be the net owner of an object to call an RPC on it. Only way
Whole networking system is built around that concept.
How do you recommend implementing a system where a player on a client can press a button (in vr) on an actor and it calls a server function?
What's the best way to pull a variable from the server into a variable in a server owned client variable without always replicating the variable?
Without always replicating it? So you want to replicate it once only or multiple times that you have control over?
Never mind
Does anyone know what to do when the compiler complains about inconsistent dll linkage when implementing GetLifetimeReplicatedProps on a compoent?
Lots of problems there
should be void UVideoSwitcherCompnent::GetLifetimeReplicatedProps
And you aren't calling Super::GetLifetimeReplicatedProps
Just following the wiki
So what am I doing wrong
Shit, I'm an idiot
Didn't read that I wrote UActorCompontnt::GetLifetimeReplicatedProps
yeah I just said that
I guess the wiki was confusing when it uses AActor as a placeholder for your class name
Now I'm getting 1>C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\CoreUObject\Public\UObject/Class.h(3032): error C2039: 'StaticClass': is not a member of 'IVideoSystemInterface', but I think it's unrelated
What are the potential causes of an property outright not being replicated? I have it marked as ReplicatedUsing=[function], it's activated at the bottom of the file, my component and actor are set to replicate, and Blueprint even says it's a replicated property, yet when I update it from the server, my function isn't called and my property isn't updated.
Okay, I figured it out. I forgot to put const at the end of GetLifetimeReplicatedProps, which led to it trying to define a new function.
Has anyone ever returned false from a _Validate (RPC)? Maybe ever in the history of UE4? Genuinely wonder where you'd actually handle failed validation in that manner
Returning false in a validation will boot the client, so you can do so if you believe the client is attempting to cheat based on their inputs.
Yeah I've used it once or twice, but very rarely
@sharp pagoda I mean compared to dealing with it in another manner, I know what it's for 😀
Any cheat detection I've put in hasn't been in the validate methods
But I guess I can see some edge cases that might catch an excessively blatant cheater
The real problem is cheaters who do minor adjustments like reducing recoil, hiding foliage, etc
I've only ever had one use case for it, but it was pretty unique... client sends through reliable RPC's with a "Handle" - and the handle is always just incremented from the last value. The handle is used to seed RNG, so if a client "knows" a particular handle that generates good RNG for them they could just repeatedly send it. The server verifies the handle first by checking its the "next" one, and kicks them straight away if not
But tbh.. chances of anyone figuring that out anyway are pretty much slim to none
Anyone here who hase experiences with replicating things on servers with many players (e.g. 64)?
Anyone have any movement jitter when walking on hills? or on specific surfaces?
@stray patio Yes, but I'm not gonna sign up to answer any questions, the one piece of advice I'd give is to learn the engine inside out so that you know how to replicate the least amount of information possible and don't double up on things that are already replicated out of the box (this is extremely common with newer devs)
how do I identify a client on the server_
?
clients can have multiple player controllers on the server
no
clients have one controller on the server
and one controller local to them
so the server has a copy of everyones controller, and a client only their player controller
sorry
what I meant
is that I have local and online multiplayer mixed
So they have multiple local controllers
and I wanted to know if there was a way to tell by the player state or the player controller... What client they belong to
I can always of course just send the info from the client to the server so that he knows how they are grouped
I jsut wanted to know if there was a client ID
aready
I want to test my build locally between more computers
for some reason I can't join with 127.0.0.1
but using the exact ip address works
(local one)
any idea why? 🤔
are non replicated actors always ROLE_Authority, even on client machines?
no
only server owned actors has role authority even if the actor is not replicated they have authority role as i remember
If a scene component is replicated, does it automatically replicate location?
If I have an actor with a static mesh as it's root that's supposed to be replicated, do I have to set the static mesh to replicate as well?
anyone seen the syptom where you suddenly lose movement speed when using acceleration curve in multiplayer as a character approaches maximum speed?
narrowed down the problem, but this issue has been a massive road block for months now for me 😦
More info here https://answers.unrealengine.com/questions/860045/sudden-loss-of-movement-speed-when-using-accelerat.html
I have a server variable that is updated a lot by the server (like every frame) but is only used by the clients once and a while. What's the best way to implement a system where the value is only sent to a client if it requests it? The client may not be the owner of the actor.
@opaque forge of the top of my head, possibly instead of the client directly trying to pull down the value (since it updates so often) have a chain of RPCs or something, whereby the client requests the server to send the value.
Then the server can do a single event for that client with the variable you want updated only then and there.
What if the client isn't the owner of the actor?
It's for a media player synchronization across all clients.
handle it the same way as you would with a widget running a function on the server or something. You need to do a chain of events that goes through the player controller, then to the server
Okay
Also, quick question when an rpc has a return value, what's the client's protocol for waiting for the return value to come back from the server?
not sure off the top of my head. Have you read http://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf ? If not thats may get you more int he head space for how data flows from Server to Client and back again
Can you send a client rpc to just the client that called the rpc?
Client RPC send to the owning client
We're not sure it's going to be the owning client though
The server RPC will be sent from the actor to the player controller to the server
'The server RPC will be sent from the actor to the player controller to the server'
There are no player controllers on clients for simulated players
The server has one for every player then each player has only their own
I know
You really should read the compendium that was linked
Each client will use their own
Or if there's a better way to do what I'm trying to do, I'm all ears
The compendium will inform you how to make any solution for anything
heres an example from my game. I have a widget button which spawns a NPC into the world.
- On the Widget Blueprint when button is pressed... Talks to Player Controller Ref to run event there
- In the player controller ref, the Event "Executes on Server", then it runs an event in the Game State
- In the game state the event Executes On Server. and does all the required stuff to spawn the NPC
From that chain, the client sees the NPC spawn into the level
I'm trying manually request a value from the server from on the clients because the server updates it so often, it's impractical to update it on all clients every time
And it's more of a master value that, theoretically, the clients should be individually simulating
We just need to check in periodically that it's correct
And when a new client joins, of course
do what I did above, but instead of spawning a NPC. The server just sends runs an event on the Player CHaracter that requests the value from
But how do I get a return value from that?
How does the rpc system deal with return values?
I can't find much documentation
What documentation, you were linked the compendium, if you read it you'd know how to make it
I'm planning on it
remember, the player characters LIVE on the server. The client only has a puppet that essentially controls them. Replicationwise its up to the server if it wants to send data back to the client to show the client whats really happening witht he player character
Can we do it on the player controller?
so you would store a replicated variable on the player character or whatever, but its ONLY gets updated when the event on the server is trigged becuase the player requests it so
yeah player controller or whatever.
I'd suggest possibly making a widget button that maybe does something to your character which the server does. Just leaning how to request the server to do something from a non owned source will help it be a bit clearer
I get the function calls to the server
That makes sense
Just how do you handle the return value in rpcs
And waiting for the server to give you the return value
Again.. you can't
i think you're in the wrong mindset to what you're expecting it to to.
You're expecting something to happen in a way that it simply doesn't
think of it this way. How can the SERVER version of your character get the data you want only at certaintimes?
cause when that SERVER version of your character gets it. It'll propogate back down to the client
Ooooh, that makes sense
yeah its one of those weird wacky things unreal does which if you've ever leanred networking programming it throws ya off a bit 😛
Will that turn into spaghetti code because of the fact that the component I'm trying to replicate has absolutely nothing to do with the player/player controller, and there might be multiple of them?
first make it work, so you understand it; then make it better 😃
Will do. Also is there a printer-friendly of that compendium?
the text is pretty big on those PDF pages, you couyld probably just open it up on a tablet or a phone
Okay
what you'll find is that EVERYTHING lives on the server. And if you were to have your own pawn (without the unreal special Movement Controller) you'd notice that when you send control inputs to the client in a high latency environment; it will take a noticeable amount of time before the server actions it and send you the update that the client moved position
anything client side is essentially like "please server, can you make my character do this please?"
Yeah
I've done a little bit of networking
I'm actually trying to figure out how to replicate a media player
The server would keep track of the time the media is supposed to be at, but we can't constantly replicate that to the client
Especially since the client will theoretically keep at the same time
But there might be occasional buffering, etc
you'd probably have a StartTime in world seconds that the media is playing at
so 5min video starts at 12:04:03
and if its 12:05:06 then video is at 1m 3sec into playing
Of course
Why didn't I think of that?
The server will have the option to pause it, etc, but we can always math the start time out of that.
yep pretty much. Saves having to spin an update time each tick
the less you have on EventTick the better
That's my problem, I get single minded and try really hard to solve my problems instead of finding ways around them
oh we all do. I'm STILL banging my head on this charactr position reset problem I've had for months in my game
https://answers.unrealengine.com/questions/860045/sudden-loss-of-movement-speed-when-using-accelerat.html <-- thats it there in its most pure form after whittling down the issue more and more over the months
I read that when you posted it earlier, and had no idea how to awnser it
😭 i hope someone out there sees it and can atleast point me in the direction of a good work around concept or something 😦
Lol that's certainly not an engine bug
btw, will using start times like that get screwed up with timezones?
use UTC clock in unreal. MUCH better
also you can also use Server time to base the position off rather than trying to match UTC time across clients
@livid barn that's not a bug at all, you need to integrate anything that modifies movement into the existing code so the prediction uses it
so server started 1000 seconds ago, video starts at 1000 seconds... etc
You can't do it in BP
How well are the clients synchronized if I use server time?
You'll want to override and copy/paste then modify CalcVelocity in Character Movement component
@grand kestrel i thought I had done that, as I've attempted to do it in C++ with a custom movement controller and everything. Still not change.
This issue seems to happen occasionally also. Which makes it even weirder. Like I have done frame by frame velocity checks and at some point the server just goes "nah fuck it you're slowing down for no reason at all" then after about a frame or 2 resets the position. The issue seems to happen i think just before the reset
Anyway, going to bed. Marry Christmas, if you celebrate it!
@opaque forge if you send an rpc to the client and save the current time, then the client sends an rpc back, the current time when the rpc is received minus the time it was sent gives you the clients ping
And from there you can solve the time offset between server and client
technically speaking (TimeRecieved - TimeSent) /2
And just because you've got a custom movement component doesn't mean you're doing everything CMC gives you for free (as part of character movement)
CMC can be like 4 diff components, really
yeah im reading through the source now
CMC is like.
wut.
but also CMC was before components could directly RPC
so its not even as good as it can be
but yeah i feel a bit lost from this; as Im not really seeing what BP or C++ wise Im doing wrong as it works for many many frames, and then suddenly shits it self almost randomly. And i cant seem to trace it back to what makes the server go "nah time to use different values"
Also don't use set walk speed
its not obvious.
Override GetMaxSpeed
Also yeah, don't do that.
Crap this is a mission on a phone
SetWalkSpeed is set once. Im not updating it
In that case you can just set it on the component
if you get a chance have a go at the steps to reproduce the issue that i have in the link above. Like I've been hammering away at this for months trying all sorts of approaches. The symptom is not consistent, despite how I attack it.
I've already modified CMC immensely, last time I made it use a spring algorithm for acceleration, I've also made it move naturally along a spline without setting it along the spline
I'll have a look when I'm home
In four days
Just @ me around then
Or I'll forget
cheers 😄
and thats over network?
Yeah
Everything I make is network capable
I don't do single player systems they're a waste of time
Has anyone found a way to fix the issue with the add static mesh component node not assigning netguid to the component properly for multiplayer
Test with 2 clients and server doesn’t send velocity or handle client movement properly
(Name=0x00000112655a4bd0 "NODE_AddStaticMeshComponent-0")
This what's failing the NetGUIDLookup in PackageMapClient.cpp
but its very strange because at first this value comes across
+ NetGUID {Value=23 } FNetworkGUID
it breaks here
if ( NetGUID.IsValid() )
{
return true;
}```
result
```[16] = {0x00000112298a8800 (Name=0x0000011266e192d8 "StaticMeshComponent0"),{Value=23 }}```
Any insight on a fix would be awesome.... only 4.21.1 bug keeping me from migrating
@severe widget BTW can't you see your PMs?
Hey guys
so i replicate a Object inside of a Component and i replicate a string inside that replicated Object in cpp and it works fine, but if i create a String in the blueprint child of that object and replicate it, it doesn't work
is there a way how i can replicate Blueprint Vars in a replicated Object ?
So, any reason my local (same machine) client gets 30ms ping - scaling with the server framerate, so basically two frames ?
I'd understand one, two seems weird
Hey, do you know if there's a possibility to decrease replication frequency and accuracy with distance? Let's say that I want other players to be in perfect sync within 50m around player, but players distanced at 200-300m aren't relevant so they can replicate even once per 5 seconds just to show their presence?
@austere veldt UE4's replication graph system would allow that
It's what Fortnite uses
@thin stratus thanks, that's exactly it. So I do assume that I could design dedicated nodes prioritizing different activities in the game like for example melee fights. If fight between players is detected then the actors will be routed to this dedicated node which adjust their update frequency. Am I right?
I notice that when I want to have a client-triggered action to multicast to everyone in the server (e.g. swapping their current weapon), I find that after a while of doing this over and over I end up with a bunch of dummy router helper methods in my PC or in my GS that are only just passing on the word from Owning client to Server and then to Multicast.
Is this the right way to go about implementing this? It seems to work fine afaik but I still wonder if I'm doing it the "right" way.
yeah you doing "right", however lot of options exist for weapon change..
you dont have any other choice to start this since the beginning of this happening on client..
after you forwarded this to server you can use multicast to trigger animations or you can use replicated state enum variables etc.
but multicast is also fine.. personally im using replicated weapon state so i can fully ignore multicasts
What's the "right" way of processing input from clients?
For instance, when a client presses a button I want to set a variable on their controlled pawn, but I want the server to do that as well
Will I just need to do a multi-cast event call and have an extra event for that single set node?
Client->SetVariable
Client->ServerRPC
ServerRPC->SetVariable
Multicast only makes sense for fire and forget things
Would rather mark the Variable is Replicated
@austere veldt Not 100% sure how it works but the graph system puts actors into groups
These groups are more or less important
Wouldn't just the ServerRPC and following SetVariable be enough?
I guess you define rules on which group an actor belongs to
Because the owner would get the replicated value back anyway
@heady scroll Yes, but then the local client has to wait 2xping to get the update
Right
or 1xping? well delayed
Yeah, 1x ping
But the point stands, if you're playing with people in the US while you're in Europe, that sucks
You will feel it even with 30ms
That's why movement for example is simulated on the client
@thin stratus yeah, it's a bit complicated and based only on C++, but the idea is great. It's too bad that it isn't documented... What interests me the most is the possibility to dynamically route actors to specified nodes basing on their actions, like for example fist fights
I think there is a blog post about it
And that's it
That's all or so
not sure
Also, as a primarily SP dev, thanks for the compendium @thin stratus
The third about GameStates and that sort of thing is making my life a lot easier in singleplayer things as well 😛
"SpawnActor","2.356 ms","100.0 %","0.049 ms","0.1 %","0.0",
Why does spawning an actor take 2.3 miliseconds
Is there any built in functionality in the engine for transmitting specific data from one dedicated server to another? Like if I had players that were “grouped” and they bounced servers to another map, sending info to the new server to let it know to regroup those players?
Otherwise I think I have to use a database solution which I guess is fine, but not idea
Ideal
@twin juniper Depending on the Actor, it can be pretty heavy to spawn one :P
@jade gazelle Doubt, cause UE4 is build for games like UT.
While you can also use the whole Engine for tons of other games and setups, it's still limited to that base idea of having one Server and playing one match from start to finish and which then goes to the next map.
If you need Servers to talk to each other, you have to add your own solution
@thin stratus I am trying to spawn a new actor every 15 seconds
It's an AI zombie thingy
@jade gazelle theres no built in system, but there are plenty of free plugins to aid do what u need.
http://prntscr.com/lzg55a http://prntscr.com/lzg67s spawn sewer mesh im not appearing by other player how ı can solve this. -sorry for my bad english
Anyone know why I can't reconnect to the same server after disconnecting? This is my game info instance:
@tropic snow Crazy. I bet you may have followed a tutorial for lobby? Find your network error handling
There might be a branch for is server
You do not want server to destroy its session on error. And if it’s the tutorial I’m thinking of it has a branch true or false both kills the session on error
@tropic snow look at events like on logout or something along those lines
if you wanted auto reconnect
Anyone here have experience with the steam inventory?
Anyone else having issues over multiplayer with the add static mesh component node?
21.1 regression
This worked fine in previous engines
Can I put ustructs in a replicated uproperty?
Hello there! So I'm having a issue with replicating the projectile to either client or server (I can see the player shooting but not someone else), I'm new so would really appreciate advice!
Why do you have two ServerRPC behind each other?
And what is calling "PlayerFire"
And where are you calling FireProjectile?
thats a very good question, i set server fire to multicast and i call the fire function in the rifleBP child blueprint
That seems rather wrong
The correct order is:
Input(Client/ListenServer)->ServerRPC (ServerFire)->CheckIfCanFire->Fire
Your base weapon should implement the FireWeapon already
okay ive put the fire proj in the master BP
and now it looks something like this
and could you explain the input/rpc/fire a bit more for the beginner? im just very new to everything still and i know how frustrating it can be pointing out the obvious
your naming is a bit odd for starters, i would get confused calling a Server RPC PlayerFire
i noticed that now, its supposed to be a normal event because its the player character that does the shooting action event "presses button" and should go > Server > Multicast IIRC?
heres the correct way i believe
a non authority can't multicast
so your PlayerFire is invalid
PlayerFire -> ServerFire -> Multicast no need for the authority switch, only issue is your multicasting the projectile and projectile spawning
which is not needed
Server should spawn the projectile and just multicast the effects/fx
the projectile should be replicated and will be visible to all players when spawned on the server
So i should put multicast in between reduce ammo and play sound?
Aka after fire projectile
But still in the same exec so to say?
CanFire checks ammo, you spawn with 30 default
so, client calls ServerFire, ServerFire checks for ammo, if true, it spawns projectile, and multicasts the sound and effects
ideally i would check for ammo locally
if you can that value locally which you should be able too
Well this is the master blueprint for weapons which is going to have child actors
PlayerFire -> Check for ammo -> ServerFire -> Spawn Projectile -> Multicast
Oo I see
i mean my projectiles, the server does more sanity checking before firing it
but start with basics first
I read your networking document @thin stratus and found that my dumbass didnt replicate the projectile itself in its own blueprint
Hey there! I'm here from a guide on how to make a dedicated server from unreal engine. I have successfully made my dedicated server! I want to host my server on Amazon GameLift. I have added the Amazon GameLift plugin. So how would I package my server so it could be hosted by Amazon GameLift? Thanks!
how can i hide a spawned actor on the server that is replicated from the owner
How do servers work if I wanted my games servers to purely community run kinda like how valve do it? Can I just package up a server executable and make it public? Is it safe to do that?
@tall maple yes
not hard to do if you dont already know how it works
but requires engine built from github source
not that you need to modify anything, visual studio just wont create a server binary otherwise
I'm trying to work on fall damage for my game... right now the server is auth over all damage (engine default), this means the client hits the ground and locally nothing happens, then they hit the ground on the server, then the server tells the client they should take damage or die. the delay is a bit jarring and I'm wondering if it might be common practice to implement clientside prediction for receiving damage (maybe only for self-inflicted damage), similar to how clientside-prediction and server-checking of movement is done? would "pro" games ever build a saved state system that could be rewound and replayed for health just like saved moves? or do they just make the client able to apply self-inflicted damage to itself and broadcast up to the server? (does that open an avenue for cheating somehow, even if I limit it to damage events only and not healing?)
Anyone have much experience with Advanced Sessions Plugin? Trying to figure out how to best utilize the Search Sessions Filters Struct. Any points are welcome.
@hoary lark apply any effect locally, the actual damage deduction done server side
If you're using CMC it's predicted so the result should be nearly identical
My question comes from the fact that if only the server applies damage, death/ragdoll gets that delay
And the change to your health bar but that's not as important
I guess you ultimately have two choices
First, process the death immediately on client, revert it if server disagrees
Second, process the death immediately on client, and notify the server that it received fatal fall damage and the server can just kill the player
That's not a bad idea actually
Since you can't really cheat by falling to your own death
It should be ok to take the clients word for it this one time
Simplifies things and doesn't create too many nasty loopholes. I'll put that into the team for consideration. Thanks!!
Not for fall damage, specifically only for dying from it
If there's a way to heal other players it could potentially cause an issue if they were healed immediately before hitting the ground but it would be rare and they'd just think they were too late. You could refund any cost of the heal with some good logic
Logic is basically -> client says they died -> saved by that heal on my end -> refund
Yeah it makes perfect sense. I can cope with a delay receiving some damage from falling, it's when you land and keep running and then suddenly fall dead it sucks. 😄
Another way depending if it suits your game is to add a tiny stun from fall damage
Though might still not look great
It's pretty fast paced, I don't really need to handle it much otherwise... Some local fx from the impact that don't really do anything, and forcable death, will be perfect. I'll have to implement a little logic to prevent double playing fx and stuff but... Liking it more the more I think about
question. im doing server/client travel to connect multiple instances together. i can host on one client, and join it on another by connected to my local ip address just fine. the problem is when i port forward(im 100%positive the port is good) and try to join through my external (11.111.111.111:1234) for example with clienttravel, it does not connect. is there something im missing here? or is it related to me trying to connect with it with that ip/port from a local machine?
@ocean geyser Are you trying to use your public ip on the same PC?
Cause I'm half sure that's not working.
Public IP works for connecting from outside of your LAN though
When you try external/public connections between processes running on the same machine, you are "vulnerable" to router hairpinning. The technical explanation doesn't matter since you can't control that, but the effect is that some routers will prevent that kind of connections
Stick to LAN or separate WANs
how can i get projectile to act smoothly on client?
you can see the issue here
the frst non wobbly one is local only and the wobbly one is server
Is there a way to "Bake" NPCs into a map
so like, they spawn in groups, instead of just one SpawnActor() at a time?
Each actor has to be spawned through the SpawnActor code
You can preplace them
Or loop in one and the same frame to spawn multiple ones
Is there a way to spawn a group instead of just one? SpawnActor is a very expensive operation
Nope
If you have a lot of Actors that have to be spawned, you spawn them at the start and make sure to pool them
You keep an array of your actors
So basically spawn 100, keep an array of the inactive ones
When they die, you don't destroy but mark them inactive
If you spawn one, you take an inactive one from the pool
I know that the engine is capable of handling 1000s of actors in multiplayer, because of what was shown in Fortnite. However, I seem to have issues just spawning a number of zombies on a timer
Oh so you would just spawn a few thousand of them on load, but then move them to where they would be spawned? Instead of actually spawning new ones?
Correct
I see
That would make much more sense actually
In theory, you could spawn a few thousand actors on load
and then move them as needed
issue with 1000 actors on load is memory
Well, the issue I have is basically trying to figure out how to have different sets of actors in different locations. However, I need to have them based on the zone/city/area they are in.
I tried to spawn them using a timer, however, there is lag whenever that timer event goes off
yeah cause your instantiating a bunch of actors same tick
Large numbers of NPCs, based on different zones, seems very complex to do. Manually placing them wouldn't work either because we need to be able to respawn them if they die
so either space your spawns
or pool and spawn
you will still get a tiny hickup when spawning the actor, but if you spawn an actor every .1 second it will help reduce the amount
How do games like Fortnite spawn all of those items for example?
There's like 3000 items, each I assume is an actor randomly spawned, not even mentioning the chests.
the map is pre-populated
before clients connect
and all chests etc are spawned during this initialization
What about Conan Exiles? They have thousands of NPCs, with unique interactions and quests!
and then the npc's even spawn, but no lag
w<
they probably use pooling
Is this a good example to look at?
For how to do this
not really my pooling manager is better
link me
and allows for pooling of any object, it is c++ only
o_0
mines not released
but
ill share it as its quite simplistic but good
well any actor not UObject
just to clarify
Hey there! I'm here from a guide on how to make a dedicated server from unreal engine. I have successfully made my dedicated server! I want to host my server on Amazon GameLift. I have added the Amazon GameLift plugin. So how would I package my server so it could be hosted by Amazon GameLift? Thanks!
Is PktLagVariance supposed to affect ping?
I'm trying to test very large lag spikes. Looks like PktLagVariance is clamped at 100
I'll see if I can do it with clumsy
Its a percentage i believe
Anyone have any experience with getserverworldtimeseconds? Im seeing it not sync up properly from server/client
Does ARK use object pooling to spawn 25,000 actors within a few milliseconds?
@twin juniper Might be better to ask that on an ARK Discord? Unless there is an ARK dev here with that knowledge its anyones best guess.
Is there anyone who has been able to have 25,000 NPCs and mass spawn them on map load?
Definitely don't spawn them all at once
Quick questions. I’m working on a small multiplayer game, 6-16 players. My graphic card fried this week and I’m waiting on a replacement so I don’t have much to do on the computer so I figured I’d start a open conversation about replication graphs. Going to shoot a few questions out and see if anyone feels like answering. Would I even need one for a smaller project like mine? Would I benefit much from it? How hard would it be to implement into an existing project? And what kind of results have you had if you have used it?
I can tell from some of the above conversations, some devs may benefit from replication graphs when trying to spawn increasing amounts of npcs or items
Can I replicate arrays and if so is the entire array replicated upon change?
@flint plover Doubtful. Replication Graphs were only introduced to handle 100 players and thousands of replicated actors for Fortnite
It just gives you finer control than "distance" to what is relevant to your players
you can replicate Array's but not TMap
and yes it will replicate entire array
if you want to be smart you can use a FFastSerializer
I should break down and read a tutorial on multiplayer inventories then instead of trying to roll my own it sounds like
to only replicate what changed
Not that tutorials always follow best practices
FFastArraySerializer < sorry]
Can a UObject be replicated if it is created on the server and assigned to a replicated property?
a UObject would need some stuff added to it to make it suitable for replication
by default they wont replicate
UActorComponent is a good place to look for replicating UObjects as its based on UObject
AActor aswell is
ok question i am confuzzled
how do I check if the pawn that has had its variable replicated is actually being possessed by the client?
void Client_UpdateHealthWidget();```
i thought that this would only be fired on the owning client?
Aside from your actual problem, it's probably better if the player broadcasts an event when his health is changed, and the health widget is registered to that event and updates it
That way you can create the widget locally only for the pawn you possess and any time that pawn's health is changed the UI automatically updates without having to manage specifically telling the client to update their UI
yeah the UI is client-sided, and no I dont want to bind and poll for the health on tick, i would rather an event-driven UI
"broadcasts an event when his health is changed" = event-driven
but that's what I am already doing, except it is broadcasting on all characters whose health change
my original question is : how can I tell which character the listen-server/client is owning?
ex:
CharacterA (listen-server is possessing this character) damages CharacterB
it triggers a server RPC to change CharacterB's health
it then runs a client RPC to update the widget (this part needs a check if the character is the one the client/listen-server is possessing)
would it be just a matter of getting the character's controller, and seeing if it is the same as the first player controller?
that seems convoluted, there should be some flag for ownership somewhere...
omg
im stupid haha
i was damaging CharacterA instead of hitting CharacterB, so that was pretty awful of me
IsPlayerControlled() && IsLocallyControlled()
this is what should tell you if the pawn is owned by the local player authority
(or networked client)
Has anyone found a resolve to the 4.21.1 add static mesh node in construction script bug?
a commit or something?
- create a new FPS template blueprint project.
2)create a new actor and add the following construction script.
https://blueprintue.com/blueprint/v5u_cb_4/ - make sure the collision is block all on the add static mesh component node.
- test in editor with 2 clients and walk over the actor mesh.
Listen server wont send movement data to clients
Doesn't matter which template you use... its the engine itself. Something got messed up with the GUID on that node.
This bug is literally holding me back from migrating from 4.19.2
@severe nymph Is it because each client is creating their own uniquely named instance which aren't linked to each other so anything that tries to replicate it fails?
It’s not marked replicated
It’s just a net load on client in map actor with add static mesh component node
Works fine in 4.19.2
Right but looking at the error in the console
"could not resolve the new relative movement actor base, ignoring Server CorrectioN"
When the player walks over it, the player controller sets it as the movement base, and it doesn't exist on the server/client (as a same/linked entity)
Oh yeah it seems they are both creating their own instance
(Name=0x00000112655a4bd0 "NODE_AddStaticMeshComponent-0")
This what's failing the NetGUIDLookup in PackageMapClient.cpp
but its very strange because at first this value comes across
+ NetGUID {Value=23 } FNetworkGUID
it breaks here
if ( NetGUID.IsValid() )
{
return true;
}```
result
```[16] = {0x00000112298a8800 (Name=0x0000011266e192d8 "StaticMeshComponent0"),{Value=23 }}```
Maybe you can say the StaticMesh component has Replicates Component enabled? I'm not sure if that would cause them to link properly or not 🤔
So it’s two versions of the node component
I tried that
It clears the warnings but server still doesn’t send data
It appears something is wrong with GUID on this node
Guys,
do I need to configure my router for dedicated server to work over steam?
Adding inbound and outbound rules doesn't helps
@trail dragon so I would have to now replicate any actors that use static mesh component nodes and set the components to replicate also?
That seems a bit strange considering that if you add a static mesh component to the actor and set the mesh with construction it behaves like it should.
It only has this issue when using construction scripts to add the static mesh component.
@severe nymph Is the construction script run when the map starts, I don't remember. I think it also differs in editor vs. packaged builds.
In previous versions it cooks properly in map build
They get re-run after a compile (because they get re-created, but still 👀)
Not in 4.21.1 it seems
Construction script is basically an extension of the C++ constructor, so it will run everytime you create an object
Compiling a blueprint will recreate it so yeah
There were certainly changes to networking between 4.19/4.21 because Fortnite... if the construction script is only run when editing the map (and not before Begin Play) you should see why the server/client think they have different instances?
My roads, stairs and sidewalks are all modular using this public var system to construct different types
ie: There's a "Stream Sub-Levels during Play in Editor" checkbox in the Level Editor - Play that might make a difference
If I replace the node with an actual component it works but I have to destroy components not set by vars
And it’s simply a ton of work to redo my entire map actors
Plus having actors with components just to destroy them is bass akwards
The add static mesh component node is practically useless in multiplayer now
If you disable "Use Single Process"?
According to that debug editor c++ breaks I was doing the node isn’t passing the check. I’m not sure how previous versions of the engine handled the node but something tells me that it was simply overlooked
Primarily because if you tick component replicates on the node it clears the warnings even without actor rep ticked
Which does nothing if the actor isn’t replicated
Might be worth a bug report then
If I replicate the actor and the component then it seems to work
But I shouldn’t have to do that on a net load on client actor
Static mesh component at that
It’s like saying you have to replicate a landscape
Or a house floor
Chews up bandwidth for nothing
There should be no difference in behavior between a constructor static mesh component and an aactor with a child component when parsed by mapbuild.cpp
Packaged behavior is no different than editor
Dude just slides
Haha 😂
You've made an ice skating hugging simulator
Apparently 😂
My project is already heavy on bandwidth due to it being VR with transform data for IK
About 5kb per client not including voip
Aiming for 35 clients on dedicated on 100mb fiber
Anything I can do not to have garbage replication data the better
To be fair, they only replicate once.
I hope epic overlooked this and isn’t expecting us to rep this manually
Maybe they replicated it by default in previous build and ripped it out for fortnite
But that still doesn’t explain why placing a static mesh component in an actor that isn’t replicated yields different results
Vs using the constructor
The client should understand it’s walking on a non movable static mesh component baked into the map
Technically the server should understand
It errors for listen server client as well
So it’s definitely a server issue
Locally everything is fine the movement just doesn’t make it anywhere
The PlayerState isn't valid on the client when their Player Controller is first spawned right
If so, how can you tell when the Player State has been replicated and the player is ready to actually set up 😦
no one?
@trail dragon you run an isvalid loop break
Until valid
Or write a c++ function to give you a playerstate valid event
And expose the node to bp
@jolly siren Any idea of how other games handle the saving and spawning of NPCs?
How do people spawn 25,000 NPCs, and then save them in the same position, with the same stats, and when the player leaves the game and comes back, the NPCs have the same stats, health, etc
Calling SpawnActor<>() and then setting the stats causes too much lag
ARK does it every time you load into a single player map
I think Conan Exiles does it too
but i dont know how
If I have a widget component nameplate attached to all players that gets updated and set via OnRep, what would be the best way to implement a client side “hide nameplates” option? If I run a function on the client to hide all nameplates that would work until a new person joins and then the function would need to be run again to remove the new persons nameplate
Should the OnRep function maybe check to see if the player has a bool set for nameplates on/off and then function accordingly?
@jade gazelle Using OnRep would hide it for sure and it would not need to be hided when a new player joins
@twin juniper batch he spawning
Create a spawn manager actor with a que
Spawn with a deviation so it happens randomly between frames. Will reduce the hit
That doesn't work, tried it
Calling SpawnActor()
is just not going to be an ok solution
I can spawn 50 per frame random delay loop over the first minute and get 10000 no issues
If your not delaying 10 seconds after map load it’s going to hurt
Spawning NPCs during map load is a bottleneck
Are these just basic actors? or are they complex?
I need to be able to spawn NPCs
which are complex
My NPCs are ai
3rdperson character base
Are you handling with a grouped controller?
Or are you spawning 25000 controllers also
Might want to modify your behavior tree to group your controllers for like NPCs
Cause truthfully 25000 NPCs with a controller each is 50,000 actors
You can use crowd manager or write your own ai controller class to control a group of NPCs either way
@twin juniper
Also if your using some plugin for sql or MySQL and not using vars then that will be much slower
Yea
There is no SQL
But it is spawning controllers.
@severe nymph
But I don't think the controllers are the issue
You’ll be surprised how much the ai controller instance slows things down
But delay on your spawn manager to allow map load to finish ... spawn actor in loop up to 50 then random deviation on the timer handle to recall the spawn event
You should see much smoother performance
@twin juniper
The actual spawn actor should have a random .2-.5 delay in front of it
Keeps it out of the same frame
@severe nymph Could you show me an example of how you are using a single AI Controller to control thousands of NPCs?
How does that work when they are all going to be moving in different locations
Hey!
I'm making a simple multi stealth game and I'm doing the Hosting a session and Joining a session with blueprint. I have a bit of an issue, I'm using "Find Session" and it returns a blueprint session result array, which contains IPs I assume, but I want to let the guest choose from different available sessions in the Joining a session menu, but I can't figure out how to print those values in my menu so the player/guest can choose. Well I kinda did print it to screen, but either I get 0 when I fail to find a session, or 1 if I do. I got those numbers by checking the lenght of my blueprint session result array so I know there is a value there, but I can't print it to screen (with print string).
I'm a bit new to this, so please bear with me.
Sessions aren't an IP address
They're not printable
Dunno how that's exposed to Blueprint, but you should be able to get something like a session name, or the names of joined players, etc
How would I set the session name? When I use "Create Session" I don't have that option
@twin juniper in the controller the only difference between a single ai and multiple would be to loop through the pawns to perform the behavior tree logic
Move to ... attack ... whatever. The services you used in behavior tree should execute for each casted pawn object you pass in
Crowd manager is good for really dumb NPCs but for anything with meat to it your going to have to write a custom class
Also I’d recommend a c++ or nativized class as blueprints are a little slower handling this but it is better than 25,000 controller instances
@bitter oriole I can get the name of the server who's hosting the game, how do you think I should do this?
@severe nymph You do know a Controller can only possess one pawn at a time right?
lol
@tall knot I haven't done this, so I don't know. I use sessions for friend matchmaking, so I never list sessions in a menu.
sessions have names
@severe nymph Do you know what I mean
Yes but your misunderstanding
In your controller
Loop through the actors
All actors of class
Pass in the pawn to behavior tree
Do service logic
Technically it’s not possessing them all at the same time
But once they perform the action the service timer has to execute meaning the controller moves on to the next pawn
@bitter oriole thank you for your help tho 😃 have good day
There are tons of examples on google and YouTube of custom group ai controller classes
Just study what they are doing and work out the logic on how you want to do it for your situation
Guys,
do I need to configure my router for dedicated server to work over steam?
Adding inbound and outbound rules doesn't helps
I’m using a single controller for ai horde logic I loop through all the zombies pass the pawn to the blackboard run the service to move to and move on
Just depends on what you need. If you want them all performing complicated unique behavior then instances will probably be the only way (remember a single controller shares variables across all possessions) so most vars will need to be in your pawn in this setup
@twin juniper
@severe nymph yes but the pawn needs a controller to possess it
pawns must have controlers that possess them
otherwise behavior trees dont run
lol
I feel like your not reading what I’m saying
You possess them on get all actors of class -> loop -> body -> possess
In the controller
You can have a pawn in the world with no controller
You pass the pawn cast into the object in your behavior tree so it knows which pawn to run the service for
Object key
If you don’t want to worry with that then write your service to loop through the actors @twin juniper
Have 1 controller behave as the logic for all actors but still have an ai controller instance on each
Really there is so many ways to skin this cat
You’ll need the subclass of the controller not run the behavior tree in this situation
With 100- 2500 NPCs it’s fine no big deal but if your seriously trying to do 25,000 then your already pressing the cpu and memory to some extremes then throwing a behavior tree and service tick on top
It’s going to be costly
You know as soon as you call Possess() on another pawn, it stops the behavior tree on others right? @severe nymph
Like, what you are suggesting just is not possible to do
I don’t know what to tell you other than it’s how I’m setup
You have to be mindful of your returns service timers and loop timers
It’s all just timing and math
The using ai controller subclasses with a parent class maybe easier for you to get your head around and use as a “leader” but I can assure you that you can indeed control groups of pawns with a single ai controller by being mindful of your logic and possession/action timers
@twin juniper
Just because something isnt fitting into the way your thinking about it doesn’t mean it’s not possible. It’s just that it’s not “done for you” you have to write the logic all the way from the controller -> possession -> pawn -> service-> action return variable to control the next event call in controller
is there a reason bHidden on actors is replicated?
seems like it should be clientside only
@twin juniper that’s a great start yes but you would need an event to call it once the previous pawn completely returns its actions
If you want to have a horde behavior then you’ll need to think about a parent controller with subclass for possession
So you can control group movement and actions all at the same time but with a single controller logic
Basically a “leader sensing”
@severe nymph I think ARK has a custom "SpawnActor" node as well
I highly doubt either of those games are actually spawning 25,000 NPCs
If I spawn replicated actor B from replicated actor A, is there anything in the engine that guarantees replicated actor A will be created on the client before B?
A is the owner of B
A is Character in this case and B is a Gun
in theory.. yes..
if you spawn actor a then you spawn actor b from actor a straightforward server would create a before b
but this not means actor b would be created on clients with proper owner of actor a
this is why all of the actor has onrep_owner in case if owner is not replicated at the moment when created on client
Well I'm talking about 100% guaranteed, not theory. I'm not really worried about the owner pointer itself
I'm worried about if actor a exists on the client when actor b hits it's PostNetInit
im not sure about this, but i think actor b and actor a both can be valid at same time (or actor b can spawn before actor a ), so order is not guaranteed..
owner rep is the final step in replication which happens after client spaned those actors
yeah the problem is that I need to have the values of multiple other replicated properties on spawn on the client. Which is why I am using PostNetInit because it apparently guarantees that
of course actor replication is modified by netfrequency or distance
/** Always called immediately after spawning and reading in replicated properties */
virtual void PostNetInit();
Set Owner should be valid in PostNetInit, however if the character that Owner points to hasn't been replicated yet then it will still be null
yup its weird but i run in this problem several times..
actor was replicated properly, their base properties also was replicated properly
but owner was not
seems owner is always in late and replicated after that actor is created on client
but sometimes owner was replicated before everything else :D
im not sure postnetinit is a safe point
Argh, I'm not sure what else to do besides packing everything into a struct