#multiplayer
1 messages · Page 527 of 1
well i have a few minutes if you want to get into a call and step me through it and we can figure out where the issue is
also try printing out a log at the end of the multicast and see if its firing
Anyone know of a way to force the spawning of an actor, but not have it replicate further? So ideally net update frequency should be 0, but the spawning of the actors needs to be as fast and instantanious as possible. I've tried all sorts of things, but no matter what I have tried the only way to make it work is to use net update frequency and have it set at a decently high value (10 +) but this means all these spawned actors are continuously being considered for replication and this is not needed at all, as the actors don't do anything other than existing and being destroyed. Anyone know of a way I can achieve this?
@void nest set your actor to not replicate in the constructor or checkbox thing is using blueprint? or if that fails set it in begin play on the server to false
I've tried that, but what happens is that the server spawns the actor and disables the replication in it's own beginplay. But when a player connects after the actor has been set to not replicate, this client will not see the actor. It needs to work regardless of when the clients connect, not only when the clients are connected beforehand.
does the actors do anything special? also roughly how many of these actors will be spawning? if its not a crazy amount have you thought about spawning them on the client for the join in progress players? such as creating a simple struct with the actors location/rotation and such and storing each spawned actor (that your trying to keep for the join in progress clients) into a TArray of the struct that you created and store it on the gamemode. then in a function like postlogin (on gamemode) have it call a client RPC for the player that joined and pass in that TArray as a parameter, loop through it and spawn an actor for each location/rotation shown in the TArray. that way those actors should be spawned on the client that just joined to keep that join in progress client updated with whats going on when he joined?
The actors are items, and they are in the thousands, tens of thousands even. The items do not do anything. They simply need to exist and not exist (open for looting and picked up) that's pretty much it. It stores of course some information as to what the item is and which item to give the player when he picks one up. This also means it needs to remain 100% serverside as we don't want players to be able to hack their items and trick the server into thinking they picked up a legendary or something.
replication graph plugin?
The more interesting question I have is perhaps what is the cost of having tens of thousands of items set to a net update frequency of say 10-20 ? If the actors don't have any replicated variables and don't do anythig other than existing, do they still have an impact on performance (CPU wise) I take it that bandwith wise it shouldn't really matter, as there is nothing to be replicated and thus no data to be sent. However, what I do not know and am wondering about is the cosideration for replication. If it says 10 times per second considered for replication, does that mean the CPU will check each item 10 times every second (meaning 10 000 items (f.e.) * 10 = 100 000 checks). Does this have a CPU cost? or are actors ignored if they aren't replicating anything?
Or does Unreal have some sort of built in optimisation for this already?
i dont think they would be using up any bandwidth just sitting idle
Literally can't find a single piece of documentation on this, hence my question
also what about bTearOff? the description is: If the Server sets this to true all clients will take authoritative control of their locally replicated versions of the actor and changes and function calls on the actor will no longer be replicated over the network. It will be as though it was a locally spawned actor
i wonder if this will still allow it to be replicated to JIP clients for its initial run
Well yes, bandwith wise there will be no cost as far as I can imagine, as there is no data to be sent over the network, thus no impact on bandwith
but the question is the checks, do they have a cost?
i wouldnt think so. only spikes as a client joins the server. cant hurt to try and see
Dude
Yeah, interesting point. So everytime a client joins the server there will most likely be a lag spike
Replication graph plugin
@hoary lark What is that? 😮
its the replication graph plugin lol
doesnt it tell you the info regarding how much of what is using what and such over the network
Wait a min, this rings a bell. Isn't that the thing they made for Fortnite?
I don't really know, I've never used it
but I know it is probably exactly what you need
I've seen a video of that a long while ago
But that looks complicated AF lol
But will check it out regardless, could provide a solution
Making a multiplayer game with tens of thousands of world items isn't not complicated af hate to break it to you lol
Well honestly, it's been pretty "easy" so far and we've got most of the game done. We're in the optimisation phase now and this is probably the trickiest thing to optimise thusfar.
And it's not really that it seems complicated, it seems more like massive overkill, for the insanely simplistic item system we have
any idea how relevancy would work in his case? if a client joins the server after lets say 70,000 items have been spawned, wouldnt it only create/replicate the items that are relevant to that client or does it go ahead and send information about all of the items to that client?
Pretty sure only those within relevancy range
because relevancy range is calculated serverside, server will then decide which actors are relevant and should therefor be replicated
then maybe it wont be that bad unless theres a ton of items in a cluster everywhere being sent around to each client?
You probably should break it up into sectors, or utilize distance.
actually not really, as the items only spawn after opening lootcrates
how are loot crates determined
so it's not like there are thousands lying around all at once, they appear, players pick them up and they are gone again, some items will be left by players, but those should go outside of the relevancy range quite fast
That's the thing with the lootcrates, they are spawned in advance, meaning that a lower update frequency is fine, as low as 1 works perfect. The lootcrates are spawned, they take a while to get over to the clients but that's fine as the clients will only encounter them a few mins into the game
but the actual items should spawn instantly after opening a crate
and that is where it gets tricky
Have the server store all the LC locations and information on the items/LCs, trigger spawning of the LC with the desired items on the client and server when the first player is within a certain range.
I have basically the same "question"/thing to point out as this guy: https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/45328-transform-modify-bone-in-animgraph-doesnt-work-properly
Im also using Transform (Modify) Bone and clients never see the replications
Build powerful visual scripts without code.
Does anyone have anything to say about this (Like, how to get around it)?
I really dont wanna have to make a animation for the player to look up, one to look forward and one to look down to be able to create a blend space for this and get around it that way if I dont have to as I will be making my final animations myself (lol, call me lazy if you like, but seriously)
Yeah I've also been thinking about actually having the lootcrates be deterministic and already have the items it will spawn stored in a list which is already replicated together with the crate itself. That way I could spawn the items instantly (dummies as it were) on the clients. Just need to figure out a way so that the client can't tamper with what they picked up and trick the server into making it believe client picked up something which isn't true
You should be using client side pickup objects if you're worried about network overhead for 1,000s of items.
@long willow make a replicated variable for the transform on the character and get/use that variable in the animation blueprint?
The loot crates should be owned by the server
Im my case were speaking vertical rotation
And its already bound to a variable inside the character blueprint, which is then fetched through a cast to the character in the animation blueprint, and sets the local variable for the anim graph to use from it
is that variable replicated?
Yeah but, the client still picks up a local item and gives this info to the server, so the server can actually add said item to the client's inventory. The problem with this is that the client can trick the server because he can tell the server he picked up whatever he wants basically
(Since youre curious)
the LC should have it's items set during initialization, as some sort of cheap pickup object.
Unless the items are already there, but not ticking and invisible and only turned visible after smashing the crate 🤔
would the server know your controller rotation?
hmmm that could work actually
spawn said pickup objects on the client
Im not sure tbh Cody
Tell me, would it know that Im using multicast when running the code
Do you think that is the issue? The server is preventing other players from displaying it
I can just make it run on the server individually as well right away then
why not see what it prints out on the server. you could pass in your control rotation to the server from the client and use that instead or do all the calculations on the client and simply send the final data to the server so the server can simply replicate the variable
If the server is authorative it doesn't matter what the client says, either that weapon exists or doesn't.
and no, remove that multicast event
set AimRotation to be replicated. set CustomEvent_4 to take in a Rotator. do all of the calculations you did in CustomEvent_4 on the client, then simply call the CustomEvent_4 and pass in the finished Rotator. in CustomEvent_4 just set AimRotation to equal the Rotator you passed in
Did you even look at the code?
Non of the nodes used to calculate the stuff are not even executed
Unless this is what you meant
Tho I dont get how that makes more sense
HOLY FUCK YOURE A GOD
It works somehow!!!
lol
Idk why, but it werks
thats what i mean, i got mixed and didnt see the multicast at first. your using a multicast to set AimRotation and your using GetControlRotation in that multicast. im 99% sure other clients dont know what your control rotation is so their never going to see it. you shouldnt be using a multicast in this case anyhow. do the math on the client, pass it into the server and have the server simply set the AimRotation variable. no need for multicast, just make sure AImRotation is replicated and being set on server
(excuse my language, but seriously you saved my sleep tonight lol)
In another scenario similar to this tho I believe I got issues if I didnt have multicast (I think it was clients didnt see changes other clients did, but clients saw what the server character did or something)
I might remember what you said tho when my game is at a more finished state and if I need to clean stuff up for performance reasons or something tho, but for now, Im happy if it works, so yeah
whats an example of that scenario
Crouch and sprint related
Another reason to that Im not gonna try removing it now is that its late, and I wanna spend some time with my family before bedtime ❤️
theres crouch functions built into the character movement component that you can setup and use fairly easy btw
for sprinting just make a boolean. if shift is pressed set it to true, if shift is released set to false. in your moveforwards and moveright functions use that boolean. for a C++ example i did
void ASurvivalCharacter::MoveForward(float Value)
{
if ((Controller != NULL) && (Value != 0.0f))
{
// find out which way is forward
const FRotator Rotation = Controller->GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
// get forward vector
const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
if (!bIsSprinting && !GetCharacterMovement()->IsCrouching())//if not sprinting(shift released) example. ignore crouching
Value *= 0.5f;
AddMovementInput(Direction, Value);
}
}
How would I get character movement to replicate to a client?
Movement is jittery on the client when I set the max walk speed from the movement componenet
So with a client event and a server event?
set it on client and then set it on server yes
basically client initiating the speed change is the only way to avoid corrections
GetLobbyChatEntry in steamworks, is the MessageLength the max chars we want to recieve for that message?
@winged badger Would this be the way to do it? Sorry if it's 100% incorrect, I'm not very experienced with unreal engine
can hardly see it
tiny
urgh
no need for Switch Has Authority on a server call
Server is already authority
you could do that with 2 functions
wait
could make it cleaner by wrapping into a function
like this
you get the idea tho right?
Yeah I do
Thank you for the help
Okay so an even bigger ty, it's working perfectly ❤️
Anyone know how to fix this issue? I have onlinesubsystem and advanced sessions. Is this a known issue? https://gyazo.com/53365bef1facd8dd94976707c33f2141
Are you using the same computer to host and join? @sly arch
AppID says zero, I think it should be 480 if you don't have an app Id of your own 🤔
How can I get advanced sessions working with an external dedicated server? If I launch my dedicated server on my computer it works fine but if i launch it on my ec2 sever I can't find the session with find session
using default subsystem
Is this not possible? I can get it working on steam subsystem no problem but not with default
lol rip thanks
@silent phoenix Yeah you need a subsystem with a masterserver. :D where do you imagine does the serverlist come from otherwise
lol i was wondering how the magic happened.
Steam has a master server. If you create a session it reigster it there. Finding session then asks steam for a list of them
Null subsystem doesn't have that. Finding sessions does a broadcast call on the lan network and waits for pcs to answer if they host a session
Thank you for the insight eXi
@pallid mesa @chrome bay so the servermovenobase is an error in itself? How would I debug this?
add a breakpoint and take a look at the callstack
Guys, why server control rotation does not get affected by AddYawInput and AddPitchInput, if character's ReplicateMovement is disabled? How do I send control rotation to the server?
That's sort of like asking why the light doesn't turn on if you shutdown the power
Control rotation is send via the cmc.
If you turn of movmenet replication then it won't send it anymore.
cmc?
Okay, I got it. I thought, that ReplicateMovement defines, if location and rotation send TO client, not FROM it.
Hey everyone, is there a way to copy non-seamless travel player properties over after a server travel? My first guess was as a connection string parameter but how can I test if the travel is the initial client connection or the result of server travel?
there is no connection string in steamless travel
there is no connection made
login functions don't get called during seamless
@fringe sinew In my config build files It’s already set to 480.
In the following example from ShooterGame:
void AShooterWeapon_Projectile::ServerFireProjectile_Implementation(FVector Origin, FVector_NetQuantizeNormal ShootDir)
{
FTransform SpawnTM(ShootDir.Rotation(), Origin);
AShooterProjectile* Projectile = Cast<AShooterProjectile>(UGameplayStatics::BeginDeferredActorSpawnFromClass(this, ProjectileConfig.ProjectileClass, SpawnTM));
if (Projectile)
{
Projectile->SetInstigator(GetInstigator());
Projectile->SetOwner(this);
Projectile->InitVelocity(ShootDir);
UGameplayStatics::FinishSpawningActor(Projectile, SpawnTM);
}
}
Is there any reason you wouln't send the Origin FVector as an FVector_NetQuantize instead if you don't need perfect origin accuracy?
I would assume it would still spawn at roughly the same place with less bandwidth cost per shot
it just loses precision past the first decimal
Which is millimeters in reality right?
Since 1 ue unit is 1 cm
Shouldn't be too noticeable at all in most cases
Should be fine. Pretty sure we use NetQuantize for shots
we do
@winged badger I was talking about non-seamless travel. In seamless you can just use CopyProperties, I wish to do something similar in non-seamless
CopyProperties is for non-seamless
but it works only locally
local hard travel can copy properties just fine
@thin stratus I saw you said something about how null online subsystem won't work for people trying to connect outside of lan, but what do you recommend?
Using one that supports it?
Right now i'm using steam online subsystem. Will that not work?
Steam has a MasterServer, so yeah that works.
Oh lol
Sorry, I was confused. Thanks lol
and clearly "null"
means no masterserver i'm assumming?
No, NULL is just the placeholder one that UE4 provides so you can at least do something.
Not having a MasterServer is just part of that.
I mean, such a Server must be hosted somewhere with a DB etc.
That's not magically working.
Oh, that makes more sense
Steam does that for you, but as one knows, also takes % of you
Will the devappid still work externally? or would i need a steamworks account
Ultimately you need your own app id
the dev app id is used by sh*t ton of people and ever so often causes sessions to not show up.
- it's for a different game afterall, so when you release you need your own
Yeah, I'm planning on getting one. How quick is the process?
Let's say you want to take care of that a few weeks in advance, cause you kinda also want to get used to the admin page, setting up your store page and all that stuff.
Also have to pay the admin fee to get a new app with a valid app id.
Approx £70 GBP, not sure on other currencies
Well i'm not nearly close to "release" but will steam allow me to use the appid without setting up a store page yet?
Yeah, I think it's $100 for u.s
Yeah you'll get an AppID as soon as you create the app / pay the fee
100€ here too or so
Don't need to publish or edit the store
No you can use the ID without caring about the store, but just making sure you are aware that there are some extra steps, so don't do it last week before release :D
If you have a prototype that is fun and you want to go further with the project, get the ID
Makes sense, can also use steam as a database or do you recommend an external company?
Sorry to keep bugging ya, i'm full of questions lol
i know the TMap's can't be replicated but can i pass it directly via an RPC
@rocky totem No
@sly arch Steam has some ways of handling data, but you better read the steam documentation.
Depends on your needs.
Yeah prob should lol
TArray of structs it is
The only concern I have is having to fill out the W4 on steamworks which you'd need to put in a SSN. Not sure how I feel about that
I mean, it makes sense..
It's a Tax requirement
Even if the game is free?
I guess so, just makes it easier if you want to change to not-free I guess
Yeah..
@winged badger so how would that work with classic singletons like IFileManager. does that get overwritten too?
I have a pretty simple question D_D]
Player Controllers are not replicated so if I use the free plugin from the marketplace for input buffering would that cause any trouble? Like does a multiplayer game that has input buffering need some special replicated stuff in order to do it?
not unless the plugin is really bad
Has anybody here ever used network encryption with
UGameInstance::ReceivedNetworkEncryptionToken
what algorithm(s) does UE4 use for compressing network traffic?
hey can someone help, I am ready to take my game multiplayer but I need some videos to help me learn and understand if anyone is reading this can post some good videos please do
@chilly mason unreal does not compress network traffic beyond some standard bit packing and quantizing float values
though they have a plugin that uses oodle network compression
I can see zlib and/or gzip being used, I guess that's all ue4 does?
What is the proper way to load a level for all players using Open Level?
I'm trying to open a level from a UMG button on the server but the connected players just go to a black screen for some reason.
use servertravel not open level
is that possible with blueprints?
execute console command 'servertravel /Game/Maps/Map'?
yes ofc
where should I execute that? I just tried it and it's still only opening the map for the server
It works for the server, but when I select 'Seamless Travel' in game mode and select a transition map it won't load the level for server or client
Just trying to come up with a respawn mechanic, I'm thinking auto respawn 10 seconds after death unless you quit, and the game should select the spawn point that has the lowest concentration of players within a sphere around it. Can anyone spot any holes with this approach?
yes, waiting 10 seconds for no reason sucks
why do people always want to make respawn countdowns
is there any console or pc os on earth that's not using BSD sockets?
not really
its pretty standard, as tcpip has grown around the library as well as the library growing around tcpip
so why the hell is FSocketBSD not public and exported...
Anyone in chat who has got attenuation working with VOIP talker? I got the talker working with PTT on dedicated server but I can't get attenuation working. I've tried setting the default settings and the "Set Settings" of the talker.
you can still hear players map wide
I have a static mesh component that is replicated attached to a character to attach particles to it but it doesn't seem to attach to the mesh
@chilly mason Steam Net Sockets don't use BSD
so basically windows/steam
you have to do steam net driver with passthrough to use of ip sockets
otherwise it either uses legacy steam p2p sockets or steam net sockets
neither of which use bsd sockets
good to know
was thinking of a reason not to make FSocketBSD public but I still can't see any so I'm gonna go for it
steam sockets is optional, nothing's built on top of it (hardware)
thanks for the insight
i would say put whatever you need into FSocket
and dont implement the function in steam sockets
Where do I find the Unreal Insights tab?
There's no tab, it's a separate .exe. Engine/Binaries/Win64
Hey there 👋
Do you have some links or keywords regarding advanced saving systems for self hosted multiplayer ?
I'm creating a zombie game where pretty much any object's state , position and so on has to be saved (Open world , crafting) .
Plugins seem a little "dangerous" to me 😬
Hi 🙂 I'm trying to replicate MoveForward, MoveRight, Turn and LookUp values (Animations and Bone transform) to all clients. Do I need to use RPCs or only OnRep?
or both? 🙂 ```
void AShooterTemplateCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AShooterTemplateCharacter, RightAxis);
DOREPLIFETIME(AShooterTemplateCharacter, ForwardAxis);
DOREPLIFETIME(AShooterTemplateCharacter, LookUpValue);
DOREPLIFETIME(AShooterTemplateCharacter, TurnValue);
}
// Forward Axis Input Value for the character blendspace
UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite, Category = Movement)
float ForwardAxis;
//Right Axis Input Value for the character Blendspace
UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite, Category = Movement)
float RightAxis;
//Mouse Turn Input Value for the Turn In Place-animations
UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite, Category = Movement)
float TurnValue;
//Mouse LookUp Input Value for the AimOffset
UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite, Category = Movement)
float LookUpValue;
this VR?
Thankyou very much @winged badger ! 👍
OnRep, with SkipOwner
Thanks, I'll give it a try.
Basic question: Does ping in UE4 mean how long it takes for the server to receive your data? Or does it mean how long it takes for the server to receive your data and to send you a response back?
Meaning, is it just the latency between Client and Server or is it Client to Server and back?
Client To Server and back
Has anyone ever done a VOIP tutorial for UE4?
I've started setting up OnRep replication for ForwardAxis, RightAxis, TurnValue and LookUpValue. I'm struggling to understand what I should put into the OnRep-functions.
void AShooterTemplateCharacter::OnRep_RightAxis()
{
}
void AShooterTemplateCharacter::OnRep_ForwardAxis()
{
}
void AShooterTemplateCharacter::OnRep_LookUpValue()
{
}
void AShooterTemplateCharacter::OnRep_TurnValue()
{
}
void AShooterTemplateCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME_CONDITION(AShooterTemplateCharacter, RightAxis, COND_SkipOwner);
DOREPLIFETIME_CONDITION(AShooterTemplateCharacter, ForwardAxis, COND_SkipOwner);
DOREPLIFETIME_CONDITION(AShooterTemplateCharacter, LookUpValue, COND_SkipOwner);
DOREPLIFETIME_CONDITION(AShooterTemplateCharacter, TurnValue, COND_SkipOwner);
}
These are the standard functions that runs on the clients and to store the value in a variable: https://pastebin.com/ccZmZsN5
Could someone help me with one of the functions? 🙏 🙏 🙏
There is not a single example of how to replicate axis values to all clients. 😶 Possibly basic knowledge, but still
You're not supposed to replicate axis values usually that's why
Why would you want to replicate the players input?
I want to replicate animations and bone transforms
@sand tangle You can't, it's way too much data and it won't replicate quickly enough anyway.
The players aim pitch is rotated by default for pawns.
"RemoteViewPitch" is the var
Hmmm, I'm using MoveForward and MoveRight in my strafing Blendspace
You shouldn't be
you should use the players velocity
then the animation will line up with the movement on the clients machine
Yep. Animation state should be derived from the characters state.
Hm
I have not been able to use strafing animations in addition to idle, walk and run animations in the same blendspace. Is it possible?
With the speed/direction way
Sorry for the bp spaghetti
this is from the anim bp to set the direction as a vector(fwd, strafe)
this is the blend space for rifle hip animations
top row are jog_rifle_direction and bottom row is all idle_rifle_hip
hope this helps, animation is one of my least favourite parts of game dev
Thanks! It worked so well locally and with the server client, so didn't think it would be a problem to use MoveForward and MoveRight. Guess I have to sit down to make it work the correct way.
Btw, I got it replicated using blueprints
And it worked, but still no one using that?
I get the message, it is a bad way to blend animations
It would be fine for a local game but since you want to do multiplayer the velocity is already replicated so there is no point sending the data twice
Okey
but I am using Turn value when speed = 0 to play turn in place-animations. Is it safe to replicate that one or is it already replicated?
The goal is to only send as much data as is required over the network as large player counts will start lagging when you start sending un-needed data or sending updates too often
rotation of the character is already replicated
so it should work over the network the same as local
I store the tuen value inside my own variable, because I'm a noob and don't know how to use the sameone used to turn the capsule
Turn*
Thanks :D one step back and one step forward in the correct direction :)
by all means you can calculate your own variable for something like turn speed on your animbp if you need to, but you don't need to replicate it because you can derive it locally from other replicated properties. (hope that makes sense)
Is there a way to have the editor "run decided server" not immediately connect?
I want to run a separate instance like it does but not connect until an instance of the game calls the open map node
I'm guessing the first thing my game could do could be to open a local map if it's not the authority (I don't do listen servers), discarding anything thats default from the command line
The local map would just be an empty one for the menu
Thoughts?
@meager horizon you can run a dedicated server manually with a batch file and uncheck the run dedicated server on Editor
But then how to I keep it up to date with what I'm working on?
you need to relaunch it
That sounds like an ass to iterate
but in advanced settings there is no "auto-connect" settings ?
I suppose I don't change the c++ side much, so all I need to do is have a batch script to cook and run
@meager horizon
you can access this menu from the "Play" dropdown and "Advanced Settings..."
If I change "Number of players" to be 2, it will load player 1 in as the listen server (authority) and player 2 as a client (remote), automatically
Found it too
Thanks @rare cloud 👍
This means I just need an option only in a debug build that offers 127.1 as a server IP option
yup better to make this side with C++
Well I wasn't going to, I was going to use the simpler blueprint open map node. Is there some reason it works better to use c++ for that? I prefer the flexibility of c++ but dislike the slowness to iterate
#if WITH_EDITOR
FString IpAdress = "127.0.0.1";
#else
FString IpAdress = "Something";
#endif
you can put this inside a pure static function
I think I already have an Is In Editor node in my blueprint function library
and for the batch solution you can use this :
https://gist.github.com/JohnsonJackblue/dc9d8b7e001a994f17ee
Thanks I may have use for that
My production dedicated server is going to run on a completely separate platform, I have some build scripts I made to deploy to it with rdiff
Has anybody attempted Dockerized UE4 Dedicated Servers? If so how did it go?
yes, and fine
i've dockerized the editor and building in a container too
there is a set of dockerfiles that someone in the community made
Awesome, Ty @gleaming vector
i ran into very few issues once i got docker working
ran into a lot of issues outside of the scope of UE4 though
just, docker doing docker things
running out of memory, disk space, etc
I don't suppose there would be anything stopping you from making a kubernetes cluster for UE4 dedicated servers with this?
i've never tried, but given how smooth sailing it was once i had a container running, i don't see why not
wicked
so I'm trying to make a weapon selection screen for my game, and it works great on a listen server for the host but when I try to select a weapon on a dedicated server, the server can't even find the array of weapons to choose from
here's the code that's in my weapon selector BP
also I have found out that the class doesn't even set the gamemode reference correctly, it just comes out as a null gamemode
How much difference in replication data bandwidth is it between Aim offset vs Bone Transform(3x spine)? Expect Aim Offset to use the least bandwidth, but still it requires more work.
Are there any smart ways to measure how efficient the game is in terms of replication and bandwidth?
The network profiler
Nice, a standalone tool. Thanks.
Hey guys, quick question here. I'm working on outfitting my game for multiplayer right now and it's going mostly well, but I'm not sure where to start on a certain aspect. I have a button that should change it's color based on how many times the player has pushed it, but I don't want the color to change for a player who hasn't pressed it. I'm not sure if it's possible to change something like the anim bp/variable of an actor for each client or if I should spawn an actor on each client and change the settings for each of the player's local buttons.
[Log attached] Hello guys! Do someone know what is wrong with my server? I already contacted the Steam support and searched everywhere(probably everywhere that you could send me links). Seems like everything is alright, but the steam master server just can't see my server, also i can't find the server in-game. The support told me that they can see the server, but for some reason, just they. Using AdvancedSteamSessions Plugin in 4.21 UE4.
i've been like 4 months trying to solve this problem and nobody can help me.
@winged badger Thanks that makes sense. I figured I was overthinking it. Thanks for the help.
Anyone in chat who has got attenuation working with VOIP talker? I got the talker working with PTT on dedicated server but I can't get attenuation working. I've tried setting the default settings and the "Set Settings" of the talker.
@silent phoenix
Sorry I asked this question yesterday and i'm still stuck if anyone has any insight 🙂
Create a new attenuation setting with default and assign it to the voip talker comp. Make sure you don't override it from code, so keep it default. I dont use voiptalker, but i made voip code before the attenuation was working, dsps and reverbs too. In 4.20 at least.
Hey, I got some issue with my servers widgets being displayed on all the clients as well, do you guys know how I could fix this? ❤️
(Please ping on reply)
I am doing seamless travel. is it possible to persist PlayerState from the old map to new map ?
I dont want them do be reallocated
@long willow Well, only spawn it on the server.
Spawned it in the PlayerController on BeginPlay with SwitchHasAuthority and IsLocalPlayerController or something like that
Is it possible to "write/read" data into a replicated struct?
Basically like a bit stream I can read/write to
I'm thinking about a system where I can do struct.WriteInt(myInt) on the write side and then read that back with myInt = struct.ReadInt()
Is FArchive good for that?
clients are never guaranteed to receive every change made to a struct, so no, I would say that's not possible, what are you really trying to do?
clients are never guaranteed to receive every change made to a struct, so no, I would say that's not possible, what are you really trying to do?
In my case, I'm using a fast array serializer
So it should be guaranteed
I want to write/read data from my fast array serializer item struct
and have it be replicated
@hoary lark
I'm hoping someone more experienced than me can chime in to confirm/deny, I could be wrong, but if you make multiple changes to your array data, a 2nd change could hide a 1st change. each net tick the server will only send the delta from the time the struct was previously sent. if you make multiple changes to an array index between net ticks, i don't think the client will have any clue about the middle changes. what makes (reliable) RPCs unsuitable for whatever you're trying to do?
furthermore Fast TArray Replication: "...The downside is that you will need to have game code mark items in the array as dirty, and well as the *order* of the list is not guaranteed to be identical between client and server in all cases."
further-furthermore you can only do server->client data transfer, not sure if that's all you need or if you were hoping for something two-way
1- I know the limitations of the fast array serializer :p and yeah most data comes server->client
2- changes to the data most likely won't happen that way anyway
I needed a system to write arbitrary data to the structs so that I can modify/read them back later
Fast array order isn't needed, the items have their "position" as a property
I just wonder if it's possible to replicate an FArchive
that or I'll probably have to make my own struct with custom net serialization
the latter
so make my own struct with custom net serializer and write/read functions?
sounds like an exciting thing to try out, it'll be my first time messing with the serialization hehehe
custom netserialize is the only way you'll ever send a non uproperty over the network
Will I be able to mark my custom data struct as a UPROPERTY() in my fast array item?
I assume so as long as the struct implements custom net serialization
good luck. trying to shoehorn a bitstream feature into struct replication just sounds like an alternative to self-harm to me 😄
(not that I have any alternatives/solutions, that's above my head)
its doable with bitflags
but its going to get pretty inelegant
it is very likely a bad design
is there some way to ensure a net tick has occurred before you (he) updates the struct again to make sure no deltas are ever missed? i guess there must be some callback somewhere
or maybe not needed, IDK.
it is very likely a bad design
I mean, if there's any other alternatives, I'd take them haha
It's for my inventory component. Right now,FItemSlot(the fast array item) contains the Id, Quantity and Durability of its item. However, I want to be able to encode additional data that some different types of items could have. Unfortunately, no RTTI kinda goes in the way, so I figured I'd add additional data and create readers/writers for each additional type of items that can read and write to the data of the slot
Thing is, where would I store the objects since they'd need to be tied to the FItemSlot 👀
FItemSlot has a UObject*
I'd still need to have an array for the objects somewhere else right?
if its a strong pointer no, if its a weak one (the approach i prefer) then a non replicated TArray in an object your fastarray is a member of
to keep the items alive
also simplifies any syntax where you have to iterate over all of them
hmmm
So my FItemSlot would only keep track of the Id/Quantity, and any other data such as Durability etc would be in an object that it points to right?
id, quantity and slot, if it matters
how would I force both the fast array and the object array to replicate at the same time?
i use similar approach for my buffs
fastarray keeps a poitner and number of stacks, buff hold everything else
if one replicates too late it might potentially do something weird 
you dno't need to
alright
if your pointer comes as null during the add callback
then a changed callback will fire as soon as its NetGUID is resolved
👌
fastarray handles the replication race for you
that's perfect
well, definitely way better than what i had in mind
thanks for the help
you can also kidna force it into shape by moving around the order of Super call in ReplicateSubobjscts
if your actor replicates subobjects before the SUper
they tend to arrive before the normal actor replication
i'll try that out
Hey people, I am getting an FBitReader overflow when setting a replicated property on a player's player state duringInitNewPlayer. The property itself is a USTRUCT with 4 string fields and an integer field and the strings themselves are not very long so I don't get why it overflows when trying to replicate it but the result is a network ckecksum mismatch on the player state when trying to connect
How long is not very long?
And have you overridden the structs NetSerialize() function, as that's what it sounds like
But it sounds like it hasn't been done correctly and the reading/writing isn't symmetrical.
I haven't overridden it no. One string is 24 characters long the rest are 6 characters max
Hmm kk, yeah doesn't seem very long. Network Checksum Mismatch though... that's usually because the server and client are using different assets.
Or are running a different build
Which means insta-kick
yeah that was my original thought but I triple checked the updating process and then I only got the log for the reader overflow after disabling the checksum test from the console
I can't see it being anything else. The reader overflow would also make sense if one build has some replicated properties that the other build doesn't
Is this a dedicated server build?
yeah
I would recook and repackage both server and client
It sounds to me like they are on different builds
alright I will try that then thanks
I wanted to ask, why should I use smart pointers for what I'm trying to do? -snip wrong ping sorry Zino-
@winged badger
Never had to use them before, I'd love to understand their benefits
i said i was using weak pointers
prefer not to have strong pointers in structs
as in TWeakObjectPtr
lol
not smart pointers
np ^^
and yes always use weak pointers if you don"t want your struct to keep your UObject alive
Hello all, can some kind soul tell me why this isn't working in multiplayer?
server cannot see clients moving, clients can only see self and server
What's the best way of preventing automated bot registrations for a multiplayer game? I'm thinking registration should be a web page and the game should present a web browser widget, then put recaptcha on the form
Is there any better way?
@ember needle who spawned the actor with the capsule component?
The server, or the client?
Good evening everyone. Hopefully someone can give me a direction here, because I cannot grasp best practices.
I use FP animations for owner character with a FPS setup, and TP animations for other players. I also have the ability to set Aim Down sight, which uses a secondary camera placed on the gun.
I have a "bullet emittor" on the gun, and I trace from there. One issue is that if not in Aim Down Sight, I don't necessary shoot at the center of the screen.
As in standard multiplayers, I compute all effects locally (firing SFX and also bullet impacts), and multicast only damage (if any).
The issue is: the position of the gun is different on my FP and TP animations, so clients do not see similar local results of fire effects.
What is the correct approach I should be taking?
I think it kinda depends on how exactly you did whole this system. But first solution I can think of - just adding another SFX runner at end of TP's gun, and handle visibility of it with "IsLocallyControlled"
Match? Why though?
Just do one, that's enough
You probably should do it on clients. This makes easier for player to shoot
I didn't understand you otherwise
For dedicated server, If I dont use single process and play in editor
would I come up to different results when I build it ?
I am asking this because game is over 20gbs
hi. im trying to make a top down shooter with WASD + mouse controls. i want the players to rotate toward their "target position", which is set to the position under the mouse. so that's only on the clients. how would i get that onto the server and the other clients? do i have to use RPCs? im new to multiplayer in UE4. it seems replication is only for data going from the server to the clients. is that right?
im now setting a targetposition on the owning client, then using an rpc to send it to the server. the targetposition property is set to replicate, though. meaning that the owning client will get that data back from the server. kinda weird... but it works.
Dividual check pinned messages, look for exi's network comp
ok, thanks, @rotund sapphire
Has anyone got clear documented list of how play in editor "run dedicated server" differs from an actual dedicated server build target?
Someone said there are differences, but not what they are
cooked server usually set to run at 30fps, but in editor it may tick in sync with editor. it probably better to run editor tests in 'standalone' mode once in a while. you can untick the single thread mode in advanced settings, it will allow you to run 2 player test with dedicated server from editor that kinda feels like a cooked game (except it load slow until you cook)
Ah, I've seen that setting
navmesh in cooked dedicated server may not recast, i think they didnt fix it yet
I was tempted to tick it, but I'm concerned I may not have enough ram to run 3 instances of the game, plus editor, visual studio and all the other stuff I run at the same time
Usually for a real world test I cook and build and rsync it to my Linux server then get a friend to test with me
you can do standalone play mode from windows commandline by running the editor with either -game or -server params and specify the uproject
I need to learn how to do unit tests with inputs, like a repay of input to multiple pawns
@rotund sapphire can you elaborate a bit more on the navmesh recast on dedicated server? cause that is exactly what i came here for to ask. my navmesh does not work at all on a dedicated server, however, the same map on single player works.
that should bring up a runing game for you, either server or client
@proper idol there are many type of issues, the one i mention is happening when you make changes to an instanced mesh component, it won't trigger navmesh to rebuild and fill the holes. Instead it will keep the holes as it was. I think you also need invoker for this issue to occure. Tho it may never recast the mesh actually didnt test without invoker.
been report this issue a year ago probably unresolved lost track of it
as a quick fix i decided to spawn static mesh components in stead of hism (on dedicated server only) those will trigger recast. had to modify character to not freak out when standing on differet type of components.
ok, well that issue seems to be somehow related to mine, but not quite. i am using the vr template and on a dedicated server, my locomotion does not work. maybe i need to modify the locomotion blueprint, no clue, but it does not seem to find a nav mesh at all when it is dedicated. listen server and single player works.
its possible a setting is disable navmesh generation on server, worth looking around
tho in my case i had a navmesh, it just never rebuild when changes occured to it
ok, thanks for the hint, i will be looking for settings it in the details panel.
also check project/editor settings
another issue is i have this blueprint here: this does not trigger the second print string node, only 1st and 3rd. its on the motioncontroller blueprint from the vr template. these motioncontrollers are spawned in at mapstart and get attached as component to the vrpawn blueprint instance. on vrpawn all 3 nodes are reached. but why. something is wrong with the replication it seems.
oh, and again, this only happens when its a dedicated server, listen server works fine.
you maybe have issues with authority, /o actor not spawn on server
ah true, that could be a route to success, will try it tomorrow and give feedback, much thanks 😘
So to start a steam dedicated server I have to have steam on? I get an error in the console if I don't. Is this normal?
@winged badger hey, just a quick question linked to our discussion earlier, do you replicate the TArray<UMyObject> too?
Because apparently UE4 doesn't like UPROPERTY(Replicated) on an array of non-pointer objects
actually, NewObject returns a pointer, so I actually need to have it be an array of pointers, right?
👀
that's right, as you started to touch on over in cpp, unreal convention is that storage/variables for any UCLASS classes have to be by pointer and storage/variables for any USTRUCT types have to be... not by pointer
i have a TWeakObjectPtr in my FFastArraySerializerItems
and a non replicated TArray in the same object the fastarray is a member of
i keep the TArray in sync with fastarray with callbacks
the TArray is not a member of FFastArraySerializer or the Items
ultimately making the sole and only purpose of the fastarray to keep the clients in sync
Why does destroy actor not work on the client? How would I go about making it destroy the actor when called from a client?
Already asked in blueprints lol
@normal garden are you trying to destroy the actor for everyone or just the one client?
everyone
make a call to the server passing in a reference to the actor your trying to destroy, then have the server execute a multicast that destroys that actor
Alright, I'll try that
or maybe you dont need to perform a multicast and destroying it on the server will be enough
I tried destroying it on the server, it doesn't seem to work
then might need to be multicasted
@ocean geyser Something like this?
Hold on do I even need the Switch has authority node?
are you on the server when your trying to destroy the actor? why are you using the authority check node?
I do think I am on the server, yes, and I just deleted that node as I realized I don't need it
if you were on the server the destroy would work
if your on the server, keep the authority check node and call the destroy actor, no need to call a server rpc from the server
do an authority check and print out a string to see if you are
From the server the string prints
then your on the server. if destroying an actor on the server doesnt work for other clients you may have to multicast that destroy (not 100% sure if you do or not)
Okay, well multicasting doesnt work
you don't need to MC destroyactor
well that answers that
something more fundamental is wrong
@winged badger by callbacks you mean the fast array add/changed ones right?
and remove, yes
awesome
only issue I see is listen server hosts since they dont trigger those callbacks
I'll work around that
so i decided to make my registration use the experimental web browser widget so i can use recaptcha v2 on it
seems to work ok, is there anything i should be aware of doing my registration this way? (not technically related to ue4's multiplayer, but multiplayer games with registration in general in ue4)
send the information to a server to interact with the DB, dont have the client access your DB directly. other than that thats about it
Anyone know how I can artificially add latency to one characters movement? I want one character to move behind reality a bit during replay playback
To start a steam dedicated server I have to have steam on? I get an error in the console if I don't. Is this normal?
@ocean geyser @rain sandal Thanks for trying to help, I figured it out, seems to be working.
Ok I have confirmed that there seems to be something horribly wrong with network performance in PIE going from 4.21 to 4.24. Been seeing some complaints around the net about it. I was wondering why the number of corrections grew exponentially since the upgrade. Plus, started getting the "move queue of 96 moves is full" output warning in 4.24 that does not occur in 4.21. I checked to see what changed in the backend between 4.21 and 4.24 with regards to move acking, corrections, and whatnot, but can't see any significant changes. Anyone have more luck identifying the issue?
Something that works completely fine in 4.21 is inexplicably unplayable in 4.24. I haven't tried a packaged project yet, but having to package the project every time you want to test something isn't very appealing hahaha.
Try upping the network bandwidth settings, plus cap your servers max tick rate
@solar stirrup Have you taken a look at FVariant? In our item system I use it for a basic replicated key value system, you can store any value with an FName key. Replicated, serialized the whole shebang
we got network saturated after the 4.22->4.24, our designed team played with network settings and got them all messed up, but somehow it didn't affect the 4.22 as much
Example: Item.GetProperty<float>(TEXT("SomeFloat"), OutFloat)
one of our trash mobs was always relevant with net priority 100, after the game spawned 40-50 of them took ages for normal priority actors to panic enough to get replicated
I'll check it out
Do all replicated properties of a same object replicate at the same time?
yeah
I was getting scared of getting race conditions by having two replicated properties with one that points to the contents of the other lol
Is it possible to change the Outer of a replicated UObject in order to "transfer" ownership so that the new component that handles it can replicate it as its own subobject?
There's no guarantee they'll arrive at the same time.
If you want them to arrive at the same time, put them in a USTRUCT()
Can I replicate an array of uobjects inside that struct from within my component?
Component -> Struct -> Array of UObject
the uobjects themselves should use the actor as the outer
The objects will be created with the actor as the outer on the client side when they are received anyway
so not the component but the owning actor?
yeah
aight
is it possible to transfer objects though? if I drop an item, I need the "item container" actor to handle replicating its uobject
simple solution would be creating a new uobject with the container as the outer and copying data, but that doesn't sound very optimal
You have to use UObject::Rename() to change the outer
But to be honest
You would then have to change the component outer as well
And I wouldn't expect that to work easily
So I guess new object + copying data is the easiest way
Easiest definitely, but most efficient probably not. You'll have to try it with Rename() - but I wouldn't expect it work out of the box tbh
Alrighty
But changing component outers is kinda weird anyway
I'd just make the item container an actor in that case
the item container is an actor
it acts like you'd think for items dropped on the ground
Oh I see, yeah then to be honest I would just create a new object unless Rename() works
It might be okay, but I can immediately see potential issues with the actor channel data buffer overflowing on read/write and causing a crash. hard to say
NewObject and a generic CopyProperties() function
NewObject would be a bit more annoying though since I'd have to add a way to copy data, and things like timers must be quite the hassle to copy
well timers you would have to clear and setup again
idk, rename might work, it might take care of the reflection issues for you - but I really don't know
guess i'll try it and see™️
stupid question but is this legal?
int AMyClass::GetServerStuff(){
if(Role < ROLE_AUTHORITY){
return Server_GetServerStuff();
}
return GetServerStuff_Internal();
}
int AMyClass::Server_GetServerStuff(){
return GetServerStuff_Internal();
}
int AMyClass::GetServerStuff_Internal(){
return 0;
}
if I call GetServerStuff() from the client will I actually return 0?
no
Won't compile
RPCs can't have return values, since they take time to execute
and ofc you can't block the whole gamethread while you wait
Yup, you'd have to block for the entire ping time, which is multiple game frames.
Instead, the server should simply replicate Stuff
No RPC even needed !
Server-to-client communication is always much easier and safer through replication.
You can always send a client RPC back if you must, but given the latent nature, instant returns from them aren't possible
ok makes sense
Not relevant to everyone => replication allows filtering
But tbh, even then you could use COND_OwnerOnly with a replicated property
Just one time => same
If the value only changes once - the replication will only occur once. Make it Owner Only, and you got yourself a very easy, always reliable server-to-owning-client channel
I try to avoid using client RPCs because you need to handle things like what if you join after the RPC was called etc
ok so if the class had a variable called int ServerInt and was DOREPLIFETIME_CONDITION(AMyClass, ServerInt, COND_OwnerOnly) then whenever that variable is changed by the server it will replicate down?
Yes, only to the owning player
ok so the use case is allowing players to get a list of saves on the server in order to load them
i know HOW to get the list locally but i'm stuck trying to send the data to the clients that are looking for it
Simply replicate an array of save data structures
You'd use a boolean in the structure to mark it as non empty
So the clients can wait until at least one save is non empty
And you know the data is there
so on the player controller I have
UPROPERTY(Replicated)
TArray<FString> ServerSaves
If you save data is a string, sure why not.
and then I have just a single rpc to the server called something like refresh saves
Honestly i just need the file names since the server will be in charge of loading them anywya
You don't even need the RPC.
Just update the save list on the server, and you can use ReplicatedUsing to know on the client that the saves were updated to re-draw the interface, for example.
Or keep a previous list and compare them
so
APC::RefreshSaves(){
if(Role == ROLE_AUTHORITY){
ServerSaves = //do stuff here
}
}
like that?
Or just
Super::beginPlay();
if(Role == ROLE_AUTHORITY){
ServerSaves = //do stuff here
}
}```
Seriously, no need for RPC
ok but then how would i refresh the server's view of it's saves if another one is made
do i need an rpc to tell the server it's time to update?
The server is always going to be the one changing its save data
So, like, just write ServerSaves at that point
I mean, put it in the GameState if it's public data, no need to even be PC-specific
You could even list the save data every single Tick on the server - as long as the data itself stays the same, no replication will occur
and then if, for example, I make a new save the new tick, the server would update the gamestate and then it would be replicated to all of the clients
Super::Tick(DeltaTime);
if(Role == ROLE_AUTHORITY){
ServerSaves = //do stuff
}
}```
like that?
Yeah, sure
Basically try to avoid event-based code because it's very easy to miss events, or have the timing of events change based on performance or engine versions or latency
Instead, try to work from the data directly
ok instead just have replicated variables?
and just constantly be sharing data everytime it updates so you can work as if the data were already there
Yup @rocky totem
ok i think I have identified the real question i should have been asking. If i have a variable that is COND_OwnerOnly, How does the server know who the owner is. I'm jumping through source files trying to comprhend it and i haven't found the piece that makes sense
and how would i as a the client say I would like to change this (like ammo in a gun)
The owner is the PlayerController ultimately owning the object
Basically you call GetOwner() on something, then GetOwner() on that something, until you get either nullptr, or a player
If it's a player, congratulations, this player can RPC, and will get COND_OwnerOnly updates
This is true of player controllers, player states, possessed pawns, actors spawned with a PC or PS as owner, anything you did SetOwner() on with a PC or PS
A weapon owned by a pawn owned by a PC will be 'owned' by the PC as far as multiplayer is concerned
ok so then if i call fire on that weapon. then the server handles the actual process of firing and says decriment the ammo. And since the weapon is owned by the player only that player's ammo will decrease
right track?
correct
If another player becomes the owner of the weapon, the variable will replicate to them.
Does anyone know if there is a way to add artificial latency to one character's movement? For example, if I wanted that character to move according to a different ping than it really has? Or am I going to have to store an array of transforms and hack CMC apart to have it use historical transforms instead?
Ugh, I'm suffering with some problems with my camera. The issue is, that clientside all works fine
But serverside...
"Source code":
Cam and spring arm config is the same as in "Third Person Character"
So i have movment component that is basically a stripped down version of the character movement component. what would cause my server to be spamming time stamp expired messages ?
conversely im also not getting corrections on the clietn
client *
@bitter oriole you mentioned that i should just put the server saves directly on the gamestate so it automatically replicated. That means i don't have to mark it as replicated correct?
No, it's not automatic, you need to mark it still
It's just an easy to use class that everyone can access
ok makes sense
and the replicated using are fired AFTER the replication has happened correct?
Should DetachFromControllerPendingDestroy(); be called on both client and server, or only the server?
In the case where you are cleaning up a pawn that will soon be destroyed
Does anyone know if there is a way to add artificial latency to one character's movement? For example, if I wanted that character to move according to a different ping than it really has? Or am I going to have to store an array of transforms and hack CMC apart to have it use historical transforms instead?
@jolly siren Hmmm, not sure if it'll work super well, but you can give it a go. There's a built-in command you probably know already (net PktLag = XXX). You can try run that command as a command line execution from within your c++ code/BP for a specific actor. I'm just not sure how it'll behave in a packaged game. Just the most simple way I can think of, beyond adding in a general movement/action delay with timers.
I don't want to add lag to the entire game. Just one character's movement. The local character's movement during replay playback
I have a local replay that I playback from the point of view of the killer (simulated proxy). So the victim (autonomous proxy) is ahead of where the simulated proxy thought they were in it.
Ohh, I get you, so like a pretty normal killcam type situation. You can maybe check out how ShooterGame or Unreal Tournament does it.
yeah, theoretically I should be able to just lag the local player (victim) movement behind by the killers ping
Any ideas why in editor game runs t 30 FPS when dedicated server option is ticked.
Else game runs at 60 FPS.
My PC is really highend, intel i7-8900k, 48GB RAM.
1TB Samsung 970 Evo SSD
Hardware shouldn't be constraint here.
I notice a large drop in performance with that checkbox too @rich ridge
It may just be the editor with hidden windows (often have the same sluggish performance if I have the material editor open on another screen for example)
@stable kindle mismatches between client and server can cause expiry messages. We've tried exploting the Character Movement Component with cheat engine speed hacks, and I noticed that our dedicated servers get spammed with expiry messages.
@grizzled stirrup Does is work smooth with actual dedicated server.
Yes the actual server is on a remote machine anyway
So there'd be 0 performance cost there
Not on that machine but on your local client
ok cool
is there a function that is called when an actor becomes relevant on the client?
depends if its loaded from the package or not
you could stash the last update timestamp during prenetreceive
and then decide it became relevant if the time from last update was suspiciously long
non-relevant actors that aren't loaded from the package get spawned in
those loaded from the package just get a full update afaik
can you have a static RPC?
Nope
How does one replicate a struct with two properties that need to be replicated
USTRUCT()
struct FInventorySerializedPair
{
GENERATED_BODY()
public:
UPROPERTY()
FFastInventoryArray FastSerializer;
UPROPERTY()
TArray<class UFunctionifyObject*> Objects;
};
Made a struct since I need the component to replicate both of these properties at the same time
oh wait, it only needs to be UPROPERTY() right?
grouping these in a struct will not ensure atomic updates
is there a way to ensure that then?
I assumed it'd work because of what TheJamsh said
the only way would be to have a custom net serializer on your struct and always write the values together
is there documentation on the way I could achieve this?
I'd need to write custom serialization for object pointers which would probably be a pain in the arse
@fleet raven from experience that is not true
structs are serialized together by default
it can skip serializing the latter property when the bunch is full
oh, that's what you mean
yeah
that can happen
but if any value in the struct changes, the struct is marked dirty
and the whole thing is marked for rep
so, it probably works, most of the time, but it's not guaranteed to work, and you'll likely never find the issue when it doesn't
dangit
but zeblote is right, override netserialize
How would that work?
FastSerializer is a fast array serializer which implements NetDeltaSerialize, wouldn't overriding netserialize screw that up?
it probably doesn't work when you have the array serializer aswell
why not just replace it with one array
How would that work though
dunno, it depends on what this is actually representing
I guess I could keep hard references to the UObject pointers in the fast array serializer items
Having it work would be something else 
I'm certain I'm missing something because I would probably have tried that before if there wasn't a reason I'd go for an array alongside the serializer
Would having a TSharedPtr of the object in the fast array serializer item cause any issue?
you can't replicate that at all
oh right
I didn't put the uobject in the fast array serializer because you can't replicate uobjects without custom replication can you
you have to use ReplicateSubobjects
my current understanding tells me that if i ever want the server to execute a function at a specific time and I am not currently the server I use an RPC exactly as i otherwise would
so instead of calling save I would call the server rpc Server_Save correct?
if i want that function to be modular where should it be located? I feel like it's kind of a rules thing which makes me think game mode but it's called from the player so the call will get dropped since the server owns the game mode. At the end of the day it getting initally executed via a button on a widget which would be owned by a player but that then would make it useable only by that widget. I feel like my player controller class is getting really clogged up with just server rpc's but that may be normal I've never done a multi user thing before. So my question is where should i put Save() and Server_Save(). and if the answer is a savemanager object where do i put that save manager such that it can be called from a client
@rocky totem depends on what you want to save. have you looked into the player controller?
i'm generating a savegame based on the objects in the level
and like i said i just feel like the pc is getting bloated with all the rpcs but maybe that's normal
I suppose this is the right channel for this. Got an issue I've been trying to solve. Decided to test out some multiplayer (clients) level streaming during runtime, and it doesn't seem to work at all. I found this thread (old) which has some nice BP features that were added to Rama's Victory Plugin. So using Victory Plugin 4.23 it seems to not be working. If anyone has any information on this, please let me know (or let me know in the thread.)
Build powerful visual scripts without code.
Hello Slackers!
I'm wondering about how to setup my controller and pawn input management.
Is that better to put the input bindings inside the pawn or inside the controller ?
I should have multiple pawns in my game with different type of controls (character, vehicle, ...) and I should prefer to keep only one controller (to have common input like menus or stuff like that)
I know that there is the InputComponent which could help. So the good choice seems to put the specific input bindings inside each pawn even if that's the same input like "MoveForward" or "Turn" for instance.
What did you think about that?
Thanks for your help
Up to your preference but I usually have the input in the controller @drifting plank
Got a quick thereotical question
Lets say I have Array A and Array B both replicated
Array B has a new pointer added to it
Array A has an item that contains a pointer to the new item that was just added to Array B
Array A is replicated first
Will the pointer in array A on the client be invalid until Array B is replicated to the client as well?
Can someone please help me figure out the solution to this problem with Updating Max Walk Speed based on Widget Button Click Event.
Things seem to work fine on for the Server Player (speed change seems to be applied to the Server Player Character and thus reflected in Server Window and in Client Window)
Things don't work though for the Client Player (speed changes don't seem to be applied when viewing the Client Player Character via the Server window, but there is stuttering of the Client Player Character via the Client Window)
The best I can deduce is that this is an Authority Issue in my Blueprint
In my widget Blueprint I have the following:
So I guess my question is how do I properly pass the request from client to server so the actual max walk speed of the client is actually updated?
This is the testing of the Speed Skill in question ...Working for Server Player in both window, but not working for Client Player
(Note: the speed change is exaggerated to show application)
oookay guys, you are going to have to help me out for a bit.
If I have a USTRUCT where UPROPERTIES are not marked as Replicated, and the user uses that struct in his blueprints and checks 'replicated' there, does it work?
or generally, how much of a C++ plugin's runtime module will be networking-compatible if networking was never considered (no replicated properties etc.)
given that I have done exactly 0 with networking in Unreal I have no clue at all
thanks, good to know. What is the replication property for then, if it's unnecessary to specify them?
classes
structs "invert everything", there's a NotReplicated specifier for struct UPROPs
lmao good to know, thank you. Function calls have to be marked explicitly then I take it?
(or is only data replicated? 🤔 )
yes, there is a special set of UFUNCTION Specifiers for RPC functions in classes (obviously none for structs because you're not supposed to put functions in structs)
read eXi's doc in pinned links if you haven't yet 😉
okay, thank you. This is probably enough for now. Have to submit an entry to marketplace on behalf of my company and with about 150 cpp classes and no experience in that matter it's hard to gauge for me 😂
I actually didn't. Shame upon my head. Will take a look
when the ReplicatedUsing function is called is the variable already changed?
yes
thanks
if i reserialize an actors data from a savegame on the server will all of the data replicate to the clients ASSUMING the actor was set to replicate if (A->GetName().Compare(ActorRecord.ActorName.ToString(), ESearchCase::CaseSensitive) && A->GetClass()->GetName() == ActorRecord.ActorClass) { FMemoryReader MemoryReader(ActorRecord.ActorData, true); FNeoSaveGameArchive Ar(MemoryReader); A->Serialize(Ar); A->SetActorTransform(ActorRecord.ActorTransform); break; }
can i call and RPC to the server from a widget?
Route through the playercontroller
To replicate an array of UObject I need to iterate through it in ReplicateSubobjects right?
@jolly siren so it it normal for my playercontroller class to just beblock after block of RPC's
yes, you can break it out into uobjects/actorcomps if you want. But it's normal to have a lot of rpcs in your PC
ok just looking at it i'm thinking MAN comments are saving my life to navigate this wall of calls
if you do a discord search here, im fairly sure you could find the exact code samples
Btw there is no way to access a game session runtime with BP?
Just saying, if not then its fine.
otherwise it would be easy to make my function
Has anyone had success getting the UnrealInsights 4.25 network profiler working? How does one go about enabling it?
@bronze arch Correct
@thin stratus thank you. last question do you know why dedicated server consumes much RAM?
Screenshot: https://discordapp.com/channels/187217643009212416/225448446956404738/687124276989526109
What i need to optimize?
Sort of unrelated to unreal specifically, but is there a reliable way of generating unique order IDs for steam microtransactions?
FGUID
How is that different from just generating a random int? and I will only use 64 bits anyway so going the random way seems like collisions waiting to happen
Not that I think this game will even have a single micro transaction actually happen, but I need to plan just in case
What are the odds of a GUID repeating?
How unique is a GUID? 128-bits is big enough and the generation algorithm is unique enough that if 1,000,000,000 GUIDs per second were generated for 1 year the probability of a duplicate would be only 50%.
but I can only use 64 bits, since that is what the steam order IDs are
Still, I will probably go that route, and just have users wait for a new one if there is a collision
within a scope of the application something like
struct FUniqueID
{
GENERATED_BODY()
public:
static uint64 ID;
static uint64 GetNextID()
{
ID++;
return ID;
}
};
would work, problem is you have nowhere to put it globally
yeah, if I had a single server that could initiate the orders, that would work
but that's not the case, and using a database would just introduce a race condition
i'll just go the random way and retry on collisions
thanks
you could probably encode a MAC address into the ID
then only chance for collision would be with oneself
if I construct a component on the player controller via ConstructSubobject(), would the server also have a copy of that component since the PC exists on both owning client and server?
How can I replicate a spring arm component that follows pawn control location?
@frigid bluff generally yes, i assume you're doing it in a constructor, in which case its just yes
I feel silly, but I'm running into an issue where running the logic below gets all of my clients to look through the same camera:
I was under the impression that player controller 0 is always the local player in multiplayer? This BP is run from the client.
This seems to support that line of thinking...
Strange. This logic is called on BeginPlay. I noticed that if I call the same logic again after the issue occured, it works fine. So I added a delay of 1 frame before the logic is called on BeginPlay, and now it works fine.
Not quite sure what's going on under the hood 🤔
@potent cradle use get controller
get controller/get player controller seems to act weirdly on listen server vs. dedicated
get player controller = used for local multiplayer
Unless I am doing something wrong on possess, my 'get controller' did not work on the listen server.
listen server client, that is
had to do some weird wiring to fall back. 'get player controller 0' on the listen server client pawn worked the way that 'get controller' worked on the client pawns. but again, that may just be something wrong
hmm,. what i use myself is get controller
cast to ur player controller
in widgets i use get owning player controller or get owning player pawn
I also may just be somewhat confused with the PC server/client instances and using the wrong one to possess on the listern server
i dont know,. game mode should handle spawning
event postlogin
In this video we take a look at the finished project and step through each of the features that will be covered in this series. We show our functional Main Menu and its options, a lobby where players can chat with one another and select their characters for the game, some serv...
this is a old tutorial
but explains a lot of good information
sigh this is still the worst resource you can use.
@narrow prairie
They do sooooooo much stuff totally wrong
@potent cradle BeginPlay of what?
BeginPlay of a pawn that you are possessing?
That would be too early. Cause BeginPlay calls before you possess. you need to use OnPossessed or whatever the event is called. Also viewtarget should be handled automatically if you didn't turn that off.
@thin stratus i know it might not be the best resource, but i was more about onpossed part
if u have a better resource, pls enlighten us
For starters my network compendium
After that you can dive a bit into that tutorial series but I'm still afraid replicated playercontroller arrays in the gamemode might confuse peeps.
what would that even replicate to?
nobody 😄
@thin stratus BeginPlay of my character, indeed. Which is the same blueprint that is used by the two other actors that are spawning.
Sweet! Good tip. Thanks!
Oh, actually, that only seems to be called on the server?
If I put a print after possessed, there is no output visible from the client, only the server
Yes that's server only. Client RPC helps here
If you have a access to C++, then you could use/expose the OnRep_Controller function, which would call on the client.
@potent cradle
@unique kelp Yeah, nobody, it's complete nonsense. They also have RPCs in widgets in that tutorial.
Server possesses -> Server calls an RPC OnOwningClient -> Client does camera magic?
If you have a access to C++, then you could use/expose the OnRep_Controller function, which would call on the client.
BPs for now 😄
What is the best way to start with multiplayer, what tech should i use? I see there are different ways to reach a multiplayer game goal. Photon Networking, Unreal Multiplayer, Steam multiplayer etc
UE4's built-in networking is all you need
Steam etc. are just backend services that work behind the scenes
Okay, could you send me a url where i can learn it? So maybe you would recommend a specific video or something else for learning the concept and Usage of it 🙂
That worked Cedric, merci 🙂
@twin juniper to be honest, usually if you're asking that question it means you should probably start with something simpler. Multiplayer is a minefield and not really not easy, starting with it straight away usually ends with getting nowhere.
There are example MP projects on the UE4 launcher you can look at, Cedric has a network compendium which covers the basics and then some
Most online tutorials are out of date as soon as they come out, including Epic's own ones to be honest.
Ive already did a lot of networking Projects. but not in Unreal Engine. Ive learned the basics of blueprints and other stuff in UE4 so i think i can start learning networking in ue4
follow UE4's starter tutorials to start with. I don't have a link though, there's a lot of content out there
Maybe look at the "multiplayer shootout" sample project in the launcher
i am not a beginner in the Development of Games. Just a newbie in UE4 but my knowledge is "enough" i guess
How does one use ReplicateSubobjects to replicate an array of subobjects? Just iterate through the objects?
Like this?
for (UObject* Obj : MyObjects)
{
bWroteSomething |= ActorChannel->ReplicateSubobject(Obj, Bunch, RepFlags);
}
Channel->ReplicateSubobjectList(Array, *Bunch, *RepFlags);
e.g:
{
bool bWroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
bWroteSomething |= Channel->ReplicateSubobjectList(Slots, *Bunch, *RepFlags);
return bWroteSomething;
}```
ayy
thanks
Does it work for replicate a property of a replicated struct?
The array is located within a struct of my component I marked as UPROPERTY(Replicated), so would doing bWroteSomething |= Channel->ReplicateSubobjectList(MyStruct.Objects, *Bunch, *RepFlags); cause any issue?
i wouldn't do that
i would iterate ever object, not sure how well it handles Array of Objects
I checked the source, that function is basically a templated iterator that calls ReplicateSubobject
can anyone explain how dedicated server works in unreal, does dedicated server works outside of network (not local?). so for example i want to create a simple game like online multiplayer, i want to play and join any user from worldwide, what is the initial steps to create multiplayer game?
i want to create a real online multiplayer game (not local). what is the steps to start?
should i need to host a server?
@meager spade any guide? please help
if anybody here has done work with xbox sessions with ue4 please pm me, i have an issue that i'm not sure how to resolve
Hey guys , so I'm having an issue with seemless travel and getting players from a lobby into a match.
Currently if i load into the match with just one player (that being the server) everything works fine.
if i try load into the match with two players ( the server and connected client) the UI doesn't get loaded and no inputs are registerd on both players. Resulting
in the pawn not being able to move.
Everything else concerning the game mode works as intended, the players load in and spawn in the correct places to.
Didn't know if anyone had any ideas, run into something similar or could point me in the right direction? i can provide screenshots of the blueprints if needed.
Are you by any chance using 'get controller (0)' or 'get player (0)' @spring pasture? I know we've run into a couple of issues similar to that where that was the root cause
when i use seemless travel to load the map i believe i am yes
ill try it without , thanks 🙂
can anyone help me get it so it show the map name and server name correctly plz
does anyone know how to create a simple online multiplayer game (not local multiplayer), like user can play and join game via session at anywhere
ok so i watched this tutorial: https://www.youtube.com/watch?v=TPakLkxc6f0
Hey guys, I still cant make the volume louder ..
Anyway this time I show you how you can:
- add Steam to your project
- Host a Game Steam/ LAN
- Search for all Servers
- join servers
Stay tuned on Facebook:
https://www.facebook.com/PyroDev/
___...
so my question is does steam multiplayer works local or worldwide anywhere?
Anyone tried to get UnrealInsights to work, I'm running 4.25 from launcher, loaded the UI.exe. When I load a project I don't even see anything appear as a live trace target. I'm running the exe on the same machine as well.
hi guys i want build server like rust or Conan games for my game and can't find any tutorial anybody can help me ?
i want to create dedicated server
please tag me if u answer my question TY.
thanks i will check it later if i will have problem can i ask you my issue ?
@ocean geyser
srry for my eng if i write wrong words 😑
im not super familiar with making a dedicated server as ive never done it before
Anyone had issues with SteamSockets and non-seamless map changes?
Oh, good, so I'm not alone 🙂
If only I wasn't having trouble with seamless travel at the moment :|
sigh
seamless travel works fine
its non-seamless thats problematic combined with steam sockets
Seamless travel works fine, except in our case, after a 2 or more map changes, UE4 complains about netguid and other such stuff and weird things start to happen.
Started in UE4.23.
Before that, fine.
Not sure what changed 😐
I actually worked around the non-seamless issue, but then the packaged server would crashing if 2 or more people were online and you changed the map.
Very confusing.
On map change, SteamSocketsNetDriver changes from looking for SteamSocketsP2P to SteamSocketsIP when looking for an address to bind to.
If you log off Steam before the map changes, then log back on after the new map loads, it finds the correct address.
Kinda silly, but it works 😐
heyo, I've been trying to figure out an issue for a few weeks now but I can't for the life of me figure it out. I'm trying to make a weapon selection menu and it works as intended up until you try to actually select a weapon. I can't figure out how to get my player reference to not be null whenever I play on a dedicated server. Here's an image of the widget BP that has the selection code:
I know that event construct is a client only event, but how do I get my player ref to set properly?
Get Playercontroller [0] > Get Controller Pawn > <do stuff>
Unless you have multiple local players, that should be fine.
NetGUID errors usually come in 2 flavors
well, 3
mismatched version
managing to send a server RPC via a component destroyed on server that client didn't get an update about yet
and when you override IsNameSupportedForNetworking and don't keep the names in sync
didn't work @mystic pilot
still comes out as null
it works fine when on a listen server but once I switch to dedicated it says nope
Not sure what is going on then.
Player controller will have a controlled pawn in most cases, even if just spawns one client side (for spectating).
getowningplayer->getcontrolledpawn
provided you plugged in the owner when constructing the widget
or better yet
just expose on spawn the player and plug it in when constructed
@cerulean escarp Was suggesting you don't have a player ref, but instead just get the controlled pawn as you need it.
I don't know when your widget is created.
It may be created when the player controller is spawned, but is yet to have a valid pawn or has a different pawn.
Hey ... I was wondering if anyone could help me figure out how I did this. Everything was fine and then suddenly I fire up 2 players.... and the animation is only playing on one network client and not the other. No difference if I am client or server. I just have no idea what I did.
variables that drive the animation BP probably aren't being updated from the server to the other clients
like current velocity is being read by the server but not passed on to the other clients, so only the host sees the movement
dedicated server doesn't run animations by default
^^^
would or wouldn't?
What I mean is ... I am locally controlling one player... but somehow variables are being replicated to the other player but not across the net.
and there it is
GetPlayerPawn[0] is the local player on clients, or listen server
or whoever logged in first's pawn on dedicated server
use relative paths for references, always
in this case replace that GetPlayerPawn[0] with TryGetPawnOwner
and it will work just fine (provided there is only one error)
basically
when owning client interprets that GetPlayerPawn[0] locally, its his pawn, its fine
oh man ... following unreal tuts ... said getplayerpawn [0] will always return the correct player, except in the case of couch multiplayer
when another client does the same, it gets his locally owned pawn, instead of the one that should be playing the animation
there is only one good use for GetPlayerController/Character/Pawn[index] in BP imo
GetGameMode->GetNumPlayers-> for (0 to NumPlayers - 1) GetPlayerWhatever[index]
that is iterating over all players, server only
well... obviously you are right... but I swear this stuff was working until yesterday and then blammo.... thanks ... I will work on it.
it worked when there was only one player
Thanks man it's working now. I know I sound crazy but I've been using GetPlayerPawn[0] all over and it's been working. I'll go through and fix them... Thanks for the lesson
there is a node
TryGetPawn
specifically for BP Anim Blueprints
which you should use
So you're saying that TryGetPawn is for BP Anim...
and GetOwningPlayer is for Widgets...
and GetPlayerPawn is just there to F you up... ha ha ... got it.
UdpSocketBuilder: Failed to subscribe UdpMessageMulticastSocket to multicast group 230.0.0.1 on interface 0.0.0.0 FUdpSocketBuilder: Failed to create and initialize socket UdpMessageMulticastSocket (last error: 0) LogUdpMessaging: Warning: StartTransport failed to create multicast socket on 0.0.0.0:0, joined to 230.0.0.1:6666 with TTL 1 LogUdpMessaging: Warning: UDP messaging encountered an error. Auto repair routine started for reinitialization
Getting these 4 errors every second and it hitches UE4. Don't think this is normal?
How do Multicast functions work, Do they run on every single client locally?
basically yes
So on a multicast implementation if I get FirstPlayerController it will get the local client that it's running on?
unless you have dedicated server
For example if there's 3 players in the game, 1 Server, 2 Clients. On the Multicast everyone would get their own controller?
in which case you're fucked
if you get first controller via GI, it will return a null
since there is no LocalPlayer around
ah right yea that's fine
the crashes you will get will force you to get into the habit of running any appropriate "checks and balances" in all of your RPCs 
Mmkay, So another question. Does BeginPlay() run for each client when a replicated actor spawns if they are in relevancy range?
BeginPlay runs on each actor. period
awesome
net relevancy range doesn't affect it
o ok
if actor is not loaded from the package it doesn't exist
on clients
in which case it gets spawned and calls beingplay when it becomes net relevant
and by the time it does, all its replicated variables will already have replicated, and replication callbacks would have executed
ah awesome
I bound an input action "OpenInventory" to a function, in player controller. It works fine on singleplayer, and when I hit Tab, inventory can be opened.
But why does this InputComponent goes null, when I run multiplayer? It crashes on start.
Can you replicate an actor component?
yep
Just mark it as such
@chilly mist input bindings should be setup in the virtual SetupPlayerInputComponent() function. The component is routinely created and removed, and it's never created for a non-local player.
@rare gyro is this a time stamp mismatch ? what might the a good way to mitigate this ?
@chrome bay Got it thank you! I moved it into Character's SetupPlayerInputComponent and it works. I need to check if PlayerController has such a function.
I think it's called something slightly different there
SetupInputComponent() or something
Oh yeah, you are right.
But this looks very tricky. How can I figure this out by myself, about the rule of input component binding?
Well you can't really.. just one of those things