#multiplayer
1 messages · Page 33 of 1
I moved it out of BeginPlay after you said that. Just replaced GetPlayerCharacter with GetController and then ripped that whole portion of code out and copy-pasted it anywhere where I needed the reference in the class for now, just to test
oh wait wait wait
let me check on the blueprint though
I forgot about blueprints, only checked through my C++
It's okay I'm not RIP'd yet. My C++ codebase is much more extensive than my Blueprint codebase
Uh weird. It looks like the culprit was my custom character controller itself, but there's literally only 2 functions in there and I don't understand how either of them is an issue
Yeah they are clearly not the issue, I see
That's not what I said lol
I said I don't understand how either of them are they issue
Presumably one or the other (or both) is the issue
I could try figuring out the issue if I saw code
You mind if I DM it to you rather than posting it here?
My DMs are closed for help unfortunately
Alright
So this code works with creating a listen server, but when a client tries to join the server--the game crashes.
This is in a widget blueprint, and the session is set as a variable in a separate widget blueprint, where the joining logic resides (JoinSession node)
In the other widget blueprint
Am I incorrect to think one ue dedicated server only has 1 map loaded. If I started a match of 8 people in a map that server is taken. Then the machine itself can have many ue servers running on it. am i missing anything, or is ue able to multi-instance maps?
I'm trying to get a listen server working, not a dedicated one
I wonder if the code is correct but some replication errors are happening when the map loads
No one was replying to you and your question (session questions) should go to #online-subsystems
thanks @tender jay I figured so but just making sure when scaling out I'm understanding overhead of the service. part of our design is similar to gw 1 where once you leave a town you may only have 1 player or up to 8. more stuff to think on 😄
FWIW you can have sublevels
There is also this: https://www.unrealengine.com/marketplace/en-US/product/multiworld
hey hey Wizard been a bit since we chatted, appreciate the response I checked out multiworld but "the standard UE5 network-replication for multi-player games is supported on the Main World (Secondary Worlds are not replicated);" would be a blocker. Ill take a look at sublevels, never thought I would be concerned about small number of players x many servers 🤣
Oh that's good to know, will keep that in mind for the future 😄
sublevels is for designing though not playing runtime scenarios unless im missing something
Yeah, but you could make each sublevel as a level in itself. So you end up having different "worlds" under the same server
very interesting I do think this is something i need to share with our other designers ty ty
anyone know a good way to "predict" RPCs? Not sure of any other way besides making server wait a certain amount of time like ping of one of the players with most ping (but clamped). It would be fine if calls came from client as then could just predict, but for server only and client has no idea it is going to come?
What do you mean exactly? You cant know a message is coming at a certain time before it arrives....
Prediction is usually initiated by the Client when they perform some action expecting it to be accepted by the Server.
I guess I mean to have a function execute at given server time for everyone.
Without downloading plugins, or using C++ to expose the api, is it possible to get custom settings from blueprints for multiplayer when creating a session? If I use the Set(FName, FString) (in C++) to set for instance the rank or gamemode, is it possible to set and get those in blueprints? I have not seen any option for it yet.
I'm not sure if anyone has experience with networking fighting games but how much of the engine needs to be modified to support full determinism, in the case of rollback netcode? I recently learned that in this case, floats can't be used at all for gameplay, so does that mean having to rewrite physics, GAS and state machines? I'm so sorry if this is too open ended,
rollback doesn't require full determinism, fyi. It makes mispredictions less likely (thus improving the experience) but whether it's enough to make a difference really depends on the game.
But yes, if you want full determinism you're going to be resorting to a lot of custom stuff. You don't need to modify the engine per-se, but you'll at least be using a separate set of structures to contain your world state than what the engine provides.
What do you need determinism/rollback for? Isn't that for lag/desync?
it's for lag compensation and network prediction
Ah nice. I should really find more resources to learn about this stuff
Also worth noting the existence of the WIP network prediction plugin, and chaos has some determinism stuff iirc
big oof. thanks for the response 🙏
I'm not familiar with rollback - but if you need to rollback some frames to reapply input, then quickly resimulate again, and achieve the same game state in both computers involved, I think it needs to be deterministic - maybe if there is an authoritative server determinism can be skipped, but then the server needs to send some kind of state back to apply in clients I think
If you want full determinism, you need to build a completely deterministic simulation outside of the engine for pure game logic and then use Unreal on top. At least that's how GB did, roughly
Do you mean iris in 5.1?
there's like no info on iris really
😠
where is my unreal engine video on YouTube
Hey ! I'm having a little issue with replication, and although i've watched quite a lot of tutorials, I can't explain what doesn't work.
I spawn an actor, on the SERVER, when a player presses a key.
Later, if a player interacts with with the spawn object, I cannot find out how to destroy it. The spawned actor is fully replicated.
Here are the screenshots. Thanks in advance !
The first screenshot is from my player controller, the second is from my spawned actor blueprint.
Spawning works well, the issue is about the destroying part
What about if you disconnect the argument and plug in Self?
Maybe it’s getting destroyed on the server but maybe you need to multicast or something
Guys How to notice when I Lost connection on client ? So I will send him to menu?
bcs I was joined in session I disconnected internet and I stayed there
in map
The same result happens
In what sense? It should only exist on the server, so the replication should work, shouldn't it?
I guess yes but you can try to do a multicast just I case
I am not on a pc to test it
If you destroy an actor an the server and it does not get destroyed on clients, then the actor is not set to replicate, or not set up properly to replicate.
If an actor should get replicated, then you should declare that in the actor’s constrctor.
Also, only actors spawned by the server (and set to replicate) are replicated at all.
If a client spawn’s an actor, even if set to replicate, then the actor is NOT replicated, meaning it only exists on the client that spawned it.
Found it in unreal forum I don’t know if this helps
I am trying log out from session on with my player ( session is made on dedicated server) and I am getting still this error what can be problem?
btw multimap dedicated server is not beneficial not logical even if supported, u don't get much other than sharing collision data and saving some memory.
unless its a light server that just broadcast events to 4 clients and you dont want 1000 of UE instances to take gigs of memory
Hi. I wrote some blueprint to spawn the default pawn manually. However so there seems to be a difference than when i set it in world settings. For example, it seems this local player returns false, and it returned true when spawning automatically...
I spawn the pawn in gamestate.. Anyone knows what i might do wrong?
You're doing two wrong things at least.
Server RPCs will be dropped on actors that are not owned by client, i.e. GameState.
GetPlayerXXX(0) nodes are avoided in multiplayer, especially when you're on server.
Read the multiplayer compendium pinned in this channel
Same goes for you, server RPCs will be dopped on actors the client doesn't own.
They are usually handled in actors like PlayerController/Pawn/PlayerState
Thank you for the feedback. As soon as i can try it i'll do as you said.
Thanks for the answer 👍
@fathom aspen Would u like to explain the best way to manually spawn pawns?
E.g. would i have to spawn from playercontroller?
No. I would stick to how the engine does it, by handling that inside GameMode.
Say AMyGameMode::RespawnPawn(APlayerController* PC)
And you would call that function OnPawnDeath
OnPawnDeath will happen server-side, so no server RPCs involved
Actually, i want to spawn my pawn when my custom terrain load is complete
You already have a function in GameMode that spawns pawns
I actually have a event OnTerrainGenComplete inside GameState.. Would i be able to spawn from there?
HandleStartingNewPlayer that is
I see
Do what it does, or defer calling it until your terrain has loaded
When and from where is HandleStartingNewPlayer called?
GameMode could listen to it and spawn pawns when it's broadcasted
I won't make GameState spawn pawns
It's not that it doesn't work, it's just bad design
Good question, check this: https://wizardcell.com/unreal/persistent-data/#gameframework-objects-creation-order-and-calls
Yeah i understand
You're looking for 12. Pawn
Guys how I can find out that my internet connection was dropped? For example I am joined to the session and I will turn off wifi, I will stay on map I need return player to player menu but I Dont know how to find out there is no more internet connection I tried it by looking what ping will be after inrernet off by this blueprint , but I am still getting normal ping 30 -60 i dont understand how I can get ping if I am disconected
First of all you're using GetPlayerXXX(0) and that's bad
You don't use these nodes in multiplayer at all
To get PlayerState in this context for example you do
GetOwningPlayer->GetPlayerState
so I am bassically getting ping to my own computer here ?
AFAIK players will auto disconnect when their internet drops. But if that doesn't happen, then session stuff might have to handle that
You are using a node that shouldn't be used
its happening but 1-2 min after disconnect but sometimes not we were testing it when internet dropped my friend didnt see mi immediately but I was still on map and he was stucked, after 1-2 minutes I got kicked and returned to menu
but sometimes it didnt kick me I dont understand
I need make it like my internet drop and after 10 sec I will be immediately kicked to menu
with warning internet dropped and dont know how
so how then properly get ping to my server?
GetOwningPlayer->GetPlayerState->GetPingInMS
But that's from widget
You don't let widgets dictate a player should disconnect
Widgets are just placeholders that display state
Your session should probably handle this stuff
And session questions are the next two channels
and this is good solution for getting ping to widget?
It is
alright I try ask below
U mean something like a timer to listen right?
I don't know how you load your terrain, but you should be able to tell when it "has loaded" to broadcast that delegate
Hmm so i guess ineed c++ for that right?
Well it's not just that but too many other things
BP is too limited for multiplayer
For example you might end up making it an AsyncTask, and I don't think is viable in BP
Just were like a fast snack test 😄
Actually spawning seems still a little complicated in my point of view
It is not if you know what you're doing
😅
I did it like you said but its still showing normal ping without connection
weird
Just to be sure, i do need to set the default pawn to none as i want to spawn manually?
Correct
Right so thanks for the advises
Hi!
How can I control the server player, eject player, and then control the client player? F8 doesn't eject the player.
Thanks!
Ejecting the player is not moving between windows though
To move between windows you could just press the Esc key
Or the Windows key
Escclose both windows, and I don't think Windows key will do anything better.
Now that you edited your question, to eject a player you need to EnableCheats and then ToggleDebugCamera in console comand
And for mouse control you need to do Shift+F1
I just got idea , if I can get real ping, now its working cant I just send player to main menu? when ping wont be available it means internet is disconected. and my solution is then so easy
You can do whatever works for you 🤷🏻♂️
i've seen some high profile games "ship" as what appears to be the Test build, so they keep the console, profiling etc. Conan, 7D2D and ARK are some of them that come to mind...
(Unless they are just modifying the source build to force include those modules in the "shipping" build)
Actually - there seems to be a ALLOW_CONSOLE_IN_SHIPPING option, so they are probably enabling that....
According to the documentation the cheat manager does not work in shipping build. But are it doing it, have I missed a hidden checkbox?
apparently its fixed in UE5 according to the Epic staff reply there from Ari
yeah - seems to be an error in the documentation :suprised pikachu:
hey guys im a complete beginner to networking in unreal engine. im trying to make a simple fps game. I used RPC calls for BeginFire and EndFire that calls the Fire method and whilst everything seems to be working correctly on the server. clients however arent showing the same result
void AWeaponBase::BeginFire()
{
if(!HasAuthority()) { ServerBeginFire(); }
Fire();
}
void AWeaponBase::ServerBeginFire_Implementation() { BeginFire(); }
bool AWeaponBase::SerberVeginFire_Validate() { return true; }
The Fire function just draws a debug line from weapons muzzle location to eye view direction
What is the result you get on server that you can't on the client? Seeing the debug line?
correct, when i fire on the server as well as other pawns display the debug line. but on clients including the controlled pawn doesnt show any debug line when trying to fire
I would say that you at least should see your own debug line even if others can't, that Fire() function is called whether you have authority or not
How do you setup/spawn your weapon actor? Do each client own the weapon actor they hold?
through character class, I replicated the WeaponBase class in LifeTimeReplicatedProps and on input call these functions
Is the actor itself set as replicated as well?
yes
Hi,
I'm running into a strange issue where a delay node in UE 5.03 on a server will start but never will tick down. If I set a delay of 5 seconds it will start at 5 seconds and stays at 5 seconds forever. Any idea why and how I could fix this?
Is your game paused?
no. gamemode is also set to not pausable and even made sure the gamemode ticks even when paused.
GameMode won't matter there. Timer comes from the world's TimerManager. Not sure what else to check besides TimeDilation and Pause
What is triggering that delay node?
I'd fix the replication issues when you disable movement replication.
No idea honestly.
Hi, like I wrote yesterday, I have troubles to travel to another map after I logged into a dedicated server. I'm using clientravel from playercontroller, but I'm unsure if I have to insert something like $IPADDRESS//Game/Maps/SecondMap or something else. Can anyone help? Thanks.
Travel to another map after logging into a dedi server? What exactly do you mean with that
Hi, I mean, after I enter in the server default map ("loadingmap" in this case), can I unload this map and load another one?
how do i know my OnRep_ happend right after creation if actor ?
using GetGameTimeSinceCreation() == 0 ?
or maybe anyother way
🤔
You could have a non-replicated bool that is set to true the first time an onrep is run
Yes if you ServerTravel to that other map
can someone tell me if a USceneCaptureComponent2D works on a dedicated Server without a graphics card?
I'm not sure what you mean, but a dedicated server doesn't do any rendering/cosmetic stuff
It's headless
mhh, yea thats what i feared 😄
just realized that my dedicated server atm for one function needs to take a screenshot 😄
Possibly you want to do it locally, on client
it's sending an email with an attached screenshot, atm i do it serverside to not have the authentication on the client
I've read that if I use ServerTravel all connected clients will follow, shoud not I use ClientTravel?
Tested it with begin play and even there no chance
I mean I'm not sure how important the anti-cheat is in this case, but you could probably do some verifications on the server
so either i need to sync the render target to the server, last time i did not have success with that >.> or need to trust the client which feels worse
You can't ClientTravel to a map that is not loaded by the server, or you will be standalone, which you clearly don't want
Only one map can be loaded under a server
Thanks @fathom aspen, so if I want to have two different worlds, I must have two different servers, is this correct?
By default, yes. Or you are welcome to modify the engine
Ok thank you very much.
You can have sublevels if you want, and each sublevel will act as a level per se
Do you mean something like level streaming?
That is indeed strange. Hard to help. Must something specific to your project
Ok I see. Thanks again
I mean there is APlayerCameraManager.FTViewTarget which considering PlayerCameraManagers exist on sever too, so you can use it to validate.
Though you have to make sure APlayerCameraManager.bClientSimulatingViewTarget is set to false, so the server has authority over setting view target
But it doesn't seem that the character is owning that weapon actor, so server RPCs will be dropped. You can own it either via FActorSpawnParams.Owner or SetOwner
I check the player one more time and found that I return if has authority is false but call server fire before i return
now client can fire but for some reason when trying to get muzzle location which is simply just gets socket location by name, would set it at vector zero...
What's a common rpc count for an RPG ability
I'm at 3 with an unreliable multicast for effects
2~3, but you could try batching them if they are all done in one frame
Well it's start animation, effect consummated (includes mana payment), and then a VFX message
I suppose I could combine the VFX with the effect consummated because they happen at the same time
Is it preferable to send one big event with lots of parameters instead of two rpcs
Thanks
I have a parent actor Actor In Space that has as Child Actor an Orbit Actor AOrbit. As soon as I set AOrbit to replicate, the multiplayer breaks: the connecting client freezes upon join. Not even AOrbit::OnConstruction is called (that's where I put the breakpoint for debugging)
I don't use ChildActorComponent, just Owner and the Children array (setting the parent actor when spawning the child actor with FSpawnParameters Params; Params.Owner = SomeActorInSpace;)
Where do you set AOrbit to replicate?
Share code?
Look inside the logs?
AOrbit::AOrbit()
{
PrimaryActorTick.bCanEverTick = true;
bNetLoadOnClient = false;
bReplicates = true;
//bReplicates = false;
bAlwaysRelevant = true;
AActor::SetReplicateMovement(false);
Root = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
Root->SetMobility(EComponentMobility::Stationary);
SetRootComponent(Root);
Spline = CreateDefaultSubobject<USplineComponent>(TEXT("Orbit"));
Spline->SetMobility(EComponentMobility::Stationary);
Spline->SetupAttachment(Root);
SplineMeshParent = CreateDefaultSubobject<USceneComponent>(TEXT("SplineMeshes"));
SplineMeshParent->SetupAttachment(Root);
SplineMeshParent->SetMobility(EComponentMobility::Stationary);
TemporarySplineMeshParent = CreateDefaultSubobject<USceneComponent>(TEXT("TemporarySplineMeshes"));
TemporarySplineMeshParent->SetupAttachment(Root);
TemporarySplineMeshParent->SetMobility(EComponentMobility::Stationary);
}
ah of course, I'll check the logs
AActor::SetReplicateMovement(false); I'm not sure how this works
bReplicateMovement = false
the logs say:
[2022.11.18-20.31.34:181][ 12]LogMyGame: Display: BP_RockCylindric_C /Game/Maps/UEDPIE_1_Spacefootball.Spacefootball:PersistentLevel.BP_RockCylindric_C_1: OrbitOnConstruction: not authority
[2022.11.18-20.31.34:181][ 12]LogWorld: Bringing World /Game/Maps/UEDPIE_1_Spacefootball.Spacefootball up for play (max tick rate 0) at 2022.11.18-15.31.34
so contrary to what I said, the OnConstruction does get executed and the problem might be there, still.
that shouldn't matter though
What logic you have in there
Whether it does, or it doesn't this is not how it's written
so the Parent Actor spawns the child actor in its own OnConstruction. This causes some headaches because OnConstruction is called a lot. For replication, I don't want the child to be spawned in OnConstruction and I might still have to make sure that I really don't do this accidentally
I'll double-check
SetReplicateMovement speaks to Push Model
I don't think there is any PushModel at compile time
Or at the time of construction to be clear
I think that would be SetReplicatedMovement and that one triggers a warning when called in the constructor
SetReplicateMovment really only sets bReplicateMovement
Because it's meant to be called at runtime
And it marks the property as dirty and could have another side effects
as I said, different function. note the "d"
I wouldn't call it myself in the ctor
Also OnConstruction gets called on both server and client AFAIK
And you're replicating it too
OnConstruction is not the function u want to use
You could for example use PostInitializeComponents with checking for authority/NetMode
https://docs.unrealengine.com/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/Actors/ActorLifecycle/#spawning this path of calls will be processed on both server and client
Maybe my problem is that one of the "Actors in Space" is actually a pawn that then gets possessed.
The other actors in space don't cause trouble. I can't verify that their orbits are replicated properly (because the game crashes before I see them), but by passing through my code with the debugger, I know for sure that the pawn's orbit causes the crash, and not the other actors'
Why does RootMotionSource have a Duration if RestorePreAdditiveRootMotionVelocity just restores your velocity back every tick the root motion source is active?
I want an additive root motion source that is meant to continuously increase your velocity
I believe under some conditions clients don't run the construction script
Not home to confirm
That wouldn't make any sense in the slightest.
The actor is being created.
UCS has nothing to do with client vs. server. As Duro said it's literally an actor being created on a machine.
The path I linked earlier has to be executed for the actor to spawn properly
how costly are replicated variables vs server RPCs?
It's not a matter of cost, but which to use. You don't choose one over the other because of performance, but because which fits the particular circumstance.
Also they could be structured different, so it's hard to find a general answer.
But generally speaking I believe replicated variables consume less resources.
Hi, does all playerstate have a pawn ?
They have a property called PawnPrivate, but there's no such requirement that it will be set.
Mhh if i set a pawn to each player and i never unpossess/destroy, how a playerstate can have a null pawn ?
Relevancy. If the players are far away from each other, then the pawn may not exist on all clients. Should always have a valid reference on the server.
Ok thanks !
Anyone know why my game crashes whenever I run it in standalone?
Check the logs
Hi!
It seems that with OpenLevel each player appears in a different level. How do I fix this?
Thanks!
You ServerTravel
Using ExecuteConsoleCommand(ServerTravel MapName)
Also has to be done on the server
Thanks. I have two players, they have to set up their names before move to the next level: there is an empty level with a blueprint widget to set the name, and when they set it, they will travel to the next level. Reading the documentation about UWorld::ServerTravel it says: All connected clients will follow. But if one player hasn't set his name yet, it will travel also, isn't it? Thanks.
does anyone know how the replication of the WheeledVehiclePawns in the vehicle template works?
I'm looking at the code but I don't see any replicated properties
Well, is it replicated at all?
I'm going to re-read that part in the compendium.
yeah surprisingly it is
I'm guessing it's "replicated" by checking "replicate movement" on the actor, though, not actually implementing it
I tried it a couple months ago by setting more players but the template doesn't have multiple player starts so it spawned the others in the ground which made me assume they weren't
no no it handles replication somewhat correctly but the autonomous proxy feel sucks if it's lagging
That's my point though
Handling autonomous proxy at 100 ping is the hard part
For pretty much any movement
yup it's really terrible
and I'm trying to think of it but I can't figure out a good solution
it's for a school project and we only have 2 months left
(and I'm the only dev)
I'm thinking of basing myself on the template and trying to improve it if I can
The good solution is rollback+replay and a few months of hard work
Hoping the physics engine is deterministic enough
I could do that but idk how I could simulate a physics step
The realistic solution is fully client-auth simulation
As in keep everything on the client, have it upload the velocity, inputs, transform on tick, implement some cubic interp on other clients
Hope no one cheats
Still hard
we have a "multiplayer programming" teacher that never touched unreal or made a multiplayer game I'm afraid of how he's gonna grade this
Fortnite does precisely that approach, if that helps
nah that's easy honestly but hope no one cheats should imo not be accepted in a multiplayer game
Last I heard anyway
really?
Presumably there's a massive amount of server-side checks
they just validate to check for cheating? or check of tampered clients?
yeah
well maybe I should do that then tbh
still I don't know how it works in the template now I can't find the replicated code but since the vehicle doesn't move until it gets an answer from the server I guess the input is handled through an RPC
should I just use physics without the wheeled vehicle? (my vehicle doesn't even have wheels anyway)
Probably best to use physics + client auth, quality wise
thanks a lot
Most vehicle implementations are client auth, yop
Especially in games where it matters, like racing sims
yeah, I was watching a course by gamedev tv and they were using a system to save a move history and replay it but it was using their own physics simulator (which can't handle gravity, ramps or anything)
I once started a coop race in F1 and the game thought it was a wet race while my friend had a dry race. And yes I did slip away while the bots were on dry tires just flying through the wet track
Move history is what the character movement component does
yeah I can see it work well for simple physics
But that's not a thing for most complex physics
Especially if you really use physics
Chaos might support it somewhat though
support what? :0
The problem is basically that you would need to save the whole physics scene
Cause when replaying you'd need to also replay the rest of the physics shit
That's why CMC doesn't support physics at all
that's quite cool but this sounds like it would be so heavy on the server
Yeah it's totally unreasonable
Hell Let Loose has vehicles server auth
But that's not a sim and frankly doesn't care about delay and corrections
But most other racing games are client auth. F1, iRacing, Trackmania, Assetto Corsa ( or however you spell that )
Or. They are so arcade that the car is just a sphere in terms of collision
hmm I wonder what type of server side checks could one do for such cases
I don't understand why the vehicle template isn't client auth though it's so painful to try it in multiplayer with any ping
Trackmania doesn't do any but the game only really cares about world records which need proof. They export a full replay file containing all input etc
and I still can't figure out where their replication is done, rider isn't allowing me to jump to the components outside of my project so I'm exploring very slowly
And even there were lots of cheaters who modified the replay files
Or played the game in slow motion
Cheaters gonna cheat
sounds doable but not feasible for small teams to review all replays I guess
Rider should have a setting to include third party code
You should be able to jump to plugins and engine code just fine
I forgot where it's enabled
Very community driven, yes
Can't remember either
The F1 bug that I had also raises the question if one can easily cheat wet races by making the local game think it's dry
But who cares about that game anyway...
Ultimately if you cheat and you get reported with video and replay proof you are f'd anyway
when it comes to vehicles I just decided to buy a vehicle system off the marketplace, I cant be bothered dealing with all its complexities, not even talking about the cheating aspect of it but more the networked vehicle physics
The thing is, you can network a lot for vehicles. After all they are mostly just vector driven
They might have a few more state variables, like tire data, grip etc, but you can fully network them
But it's not fun for the driver if they get corrections
Not even a single one
At least in sim racing that is
yeah makes sense, even though technically the physics state would be simple to keep a history of in F1 no? but I guess just making a very complex physics system makes it too expensive to replay moves
You have to diff between physics and just vector math
I wouldn't use physics if I want it networked
Not sure about chaos ATM though
yea but the physics part is hard part imo, looking the same for players in a consistent manner since UE physics are not deterministic by default
I would not bother predicting actual physics
Again not sure about chaos
But pre chaos def wouldn't bother
Yeah chaos might work. I haven't read into it yet
How does it handle reconciliation?
no idea, I just bought it 😄 but I know the collisions are server side
It must keep track of the moves for ping and replay reasons
Wonder what they all keep track of
Fixed timestep is one of the requisites for determinism, but not the only one.
I really like it, but there's still some issues when it comes to colliding with players because CMC's replication and this vehicle system have different replication intervals from what I learned
to there is some replication fighting going on at times
Collision between two predicted actors is going to cause issues either way
which I have reported so atm I'm wating for a fix on that
One of the two will be wrong
When you drive into a player, the player might already be gone
Cause you only see the ghost that is more or less a full RTT late
when I drive into the player the collisions are pretty ok, its more the other case thats the problem, when the player runs into the vehicle
So either the server trusts you and the player on their end dies even though you missed them on their screen
Or other way around
Right
Does it just freak out?
Strong person
only happens on the front of the vehicle
Can't you disable the pushing?
because character replication seems to "push" the vehicle down, and then the vehicle replication kicks in and pulls it back up which results in that
hmm not sure how to, but I dont mind being able to push vehicles with players body, gives that gta 3/sa/vc feel to it 😄
I created a passenger type system , when the player enters the car I'm disabling the CMC's tick completely and that prevents the replication fighting from happening between CMC's and the vehicle rep system but in the other case from the video above I cant do that since I'm still moving the character
Hi, anyone knows how to manually spawn the player pawn by a event?
How would i call `Event Handle Starting New Player After my custom terrain is loaded?
Any clue where I can inject a fake input vector on the serverside to mimic inputs coming from the client?
I mean I'm reading the code in the meantime etc etc, but advice is always appreciated
just call the function and pass a vector? That's all the client is doing to the server, so you can do that yourself for the "same" result
PlayerInput is just acceleration
You can either change acceleration or the velocity vector directly
The issue I'm having is that it's protected, and there's a pawn with a whole bunch of stuff in it that is derived from Character. I really want to avoid modifying the engine which is what afaik I'd have to do to access a protected variable. In general I'm kinda writing my own movement component anyhow because I wanted to have some esoteric oldschool movement mechanics, so it's something that'll fix itself eventually and yet
I'm working for an employer and I recently wrote an AI system that is meant to feed inputs to pawns, the issue is that the pawns spawned also belong to dummy controllers spawned on the server side. My best guess is that since there's no clientside versions of these Controllers, the whole back and forth between client/server versions of UCharacterMovementComponent can't happen.
I am in the process of writing my own stuff that would address this, but I need to deliver results(tm) on a system that is meant to be marked as completed. Which works in PiE but the CMC fuckup I created completely bricks the movement on a packaged server
Thats why I'm kinda digging for a way to get CMC to gobble down my inputs in whatever cursed way I can given the current circumstances
I'm thinking as to what should actually cause this, because CMC works in Standalone games right? And in PiE there shouldn't be a client version of the controller either because it's just a local player that gets created on the server side.
@thin stratus I'm sorry for the ping, but just one question - what fundamental difference between a packaged server and a PiE server produces these different behaviors there? Given my cursed setup (which I promise I'll fix, I'm just lowkey drowning rn)
Because of course there would be a difference, I'm sure, but I think maybe switching ownership around on the pawn may resolve this temporarily while I put the fires out?
So
One thing after another
You should be able to just modify Velocity
I can't recall that being protected
Difference between packaged server and pie should not affect the cmc
The Tick function of the component only goes through the whole client code if it's a client autonomous proxy
The only other paths are simulated proxy and then server itself
@civic seal
Ownership might not solve this as only a possessed pawn gets autonomous proxy iirc
Characters controlled by AI in a Multiplayer setup have no client prediction etc. You can only rpc to the server and feed the CMC with data there, but that has no prediction and reconcilation then
The CMC is very much build for the single controlled character situation of a traditional unreal tournament
you are absolutely 100% right and I have not a single clue how I missed that
surprisingly it does, at least in my case. I just assumed I broke things by not using them properly, which I was gonna fix by writing a version for simpler minds lmao.
That's why I was trying to figure out exactly what it was that I broke
but considering that I simply needed a bandaid, I think I can get away with my crimes by just altering velocity
until I clean up this mess
Honestly my assumption was that I somehow got the serverside controller (which has no client counterpart) to think it was waiting for the input from an autonomous proxy and thus refuse the input from the serverside. Again, this does not happen in PiE
I've been reading up on how CMC works as a whole just recently, my knowledge is spotty at best, but thats just my guesses
Not sure. I didn't follow the ai stuff much in the cmc
Regardless tho, I do appreciate your nudge towards the velocity thing.
Oh I wrote my own caveman AI
Maybe that's what is used so input are not even taken into accohnt
Account
Fwiw breakpoint CalcVelocity
The way it works is it's a separate object that gets a playercontroller spawned for it which is identical to the one players use. It's on the server side only
And see what is actually used for the ais
roger, will do!
I want to travel to a level for the first time. Do I need to use non-seamless?
Thanks!
No. But if that's the first level the connection loads then yes.
It occurs when the players leave the Main Menu Level and enter on the game's first level.
That's hard travel, because these two levels are different servers.
different servers?
Unless by Main Menu you mean you have all players together, pretty much like a pre-game map
I don't know what I'm doing. Main Menu level is the first level when the player starts the game. I don't know if this is a different server. When the player sets his name, he enters into the first level.
Yes then they need to hard travel 100%
The game map/session is hosted on a different server that they connect to
Any server that you connect to the first time will end up in a hard travel
Suggest reading the ways in which a hard travel must occur: https://wizardcell.com/unreal/persistent-data/#travel-seamless-vs-hard
I though both were on the same server.
Now I'm testing with the Editor, and one is a Listen server and the other a client.
A seamless travel could occur if say for example you make them travel to a newer map from that map they are already in.
When you travel you should specify a URL. You can either specify a server url or a map. You can't specify the game map from MainMenu level and hope that all other clients will connect to it.
It just doesn't make sense
You need to have a server hosting the game map so they can connect to
I'm new on this. Anything hasn't sense to me.
When they are connect to the game map, say you want to make them all to move to game map 2 then you could seamless travel for example
Makes me curious how Apex handles this with parties.
Apex isn't made with UE right?
No. Source Engine if I recall correctly. But I mean how you'd manage that in Unreal.
Yeah, I haven't played it in a while, but I would guess they use the so-called beacons in Unreal
I think beacons are already part of the EOS framework, and they are so powerful when it comes to party stuff
Do I have to use sessions for every multiplayer game I make?
OK. So I need to use it.
Funny enough, Epic even started using Sessions for Offline gaming recently in UE5.
Well you also get created a GameSession by default, which is like an interface with sessions and stuff
Offline, single player map for example.
It's less useful for Steam. Not sure if EOS is using it, but consoles have specific online/offline requirements for stuff. So I guess it's easier to just make a session to handle holding the same data you'd look up if you were looking for connection info.
Where can I learn more about this? Yes, the compendium is really interesting, but I've read it twice and I don't know how to use sessions (because I don't know what they are). Thanks.
A Session is just connection info. It holds information a client would need to connect to the host and join their map, and also extra info based on what the game wants to show in their session UI.
I don't understand what the host is or why they are on different servers. Now I have one player in a Listen Server, and the other one in a client. Who is the host in this scenario? And what are the different servers here? Thanks.
When you're testing in editor, you're not getting the real experience.
Play In Editor forces any clients to automatically connect with the server, whether that's a listen server (play as listen server) or a dedicated server (play as client)
In a real world scenario, a player would boot up their game and not be connected to anything.
If you're using listen servers, then a player would choose (or in some instances, you make the game choose for them) to host a game, and that is where you would then establish a session.
Once the session is established, other players could then find said session, and have their game connect to that session.
The host typically refers to when you're using listen servers and it's the player who's copy of the game is acting as the server. Other clients connect to the host's instance.
is it possible for a multicast to get lost in the void and soemhow never make it to a client ? even with reliable
yeah if your bunch size exceeds max bunch size (had that happen to me lol)
or if the reliable buffer gets filled
or if you get disconnected 😄
but remember that multicasts are only sent to relevant connections
luckily all my players are always relevant 
by the way, i got that up and running, but i still ended up using the paragon approach as doing a world override in that start play is significantly more overhead @pallid mesa
i have a stripped down uobject that can play killcams and return back if you ever would want that for some reason
I do! I would be interested in a blog post or some sort mainly to share knowledge amongst the community
so if you can make it accessible to developers across the world by the means of a post or a github sample project it'd mean a lot for me as an advocate for open source solutions
yeah i plan on doing that very soon, i am keen to finally contribute somethign useful to the UE community 
😄 huuray!!
just lmk when you do
and dont postpone it too much
because what ends up happening if you do is that you never get to do it
XD
very true, and only thing delaying me currently is i've still not fully got my head around the functionality yet, even though it works perfectly, and if i write a blogpost for it i wanna make sure its all factual/good info in there about everything - since there's a ton of stuff going on
1 thing thats crazy about that paragon sample is how messy it is though, literally like 40% of the code in there is unused and ripped directly from UT
and the rest is also just weird
also many things need to be done on next tick otherwise it just crashes with random errors every time, but trying to truly understand why thats teh case
what you can do is to start writing as you work on polishing the system
thats what I do when I draft create a system
what is the max bunch size, and the reliable buffer size? :D asking for a friend
wait the buffer is not relevant, I am using unreliable RPCs for the big chunks of data
the current maximum size is 65536 bytes (64Kb)
and the realiable buffer size is 256
iirc
@prisma snow
great, thanks a lot. I think I'm good to go but, never bad to check xD
oh wow, I am only at 12Kb in the worse case scenario I think
My first test with the networking system we are doing went well but it is pushing bandwidth quite a lot
what was it?
any instance of streaming massive amounts of data
yeah I see
I am RPCing big arrays of ints, to sync positions of units in RTS context
but the updates are batched and broken into chunks
so it's max 200 structs per RPC, each with ~4 int16
probs we can diminish it a bit more still
BTW, if I send a 0 value for an int16, does it get compressed so that it is not 16 bytes in the final package?
Hi guys, I'm trying to figure out how to replicate destroying an actor where the client looks at the actor on their screen and then asks the server to destroy it. Sadly, so far this only works when I play as the server in PIE - it replicates successfully. But when I'm playing as the client, asking the server to destroy the actor does nothing.
For the record, the client asks the server to spawn the object to. It's basically some building functionality where the player can place down objects. The player makes the request to place the actor, and that all replicates nicely. Destroying the actor from the client isn't replicating when the RPC is made by the client, though
Not sure if this is the problem or not, but I'm curious: if the object you want to destroy is targeted by hitting it with a line trace, and you pass that targeted object onto the server to destroy, does the server know automatically to destroy that "same" object on all clients? Or does that not really work?
Just to check, who owns the actor? Some RPCs do not get called on server if the authority is not correct, so mught be worth checking
I've been wondering if this is the issue as well. Not sure I fully understand ownership yet, but since the client only asks the server to spawn the actor I assume that means the server is the owner.
Does that mean the client doesn't have authority even to make the request of the server to destroy it?
If you're calling the client -> server RPC in the spawned actor, and the actor is not owned by the client, the RPC will not go through.
Who is making the first RPC (the one that works and succesfully spawns the actor) and who is making the 2nd?
Both by the client
which class?
It's a component on the player pawn
To place the actor, the client provides a location, rotation and class to the server, and the server spawns it
What Datura said is key
To destroy it, I'm hitting it with a line trace and passing that hit actor onto the server with a request to destroy it from the same component on the player pawn
Are you multicasting anything?
The instance of the class that makes the RPC has to be owned by the client I think. The network compendium has a nice table with all possible cases and outcomes
I've tried switching from Server to NetMulticast on that function a number of times, neither works
So right now when spawning it, you're doing something along the lines of:
Mouse Click > Go into Component > Run On Server RPC > Spawn Actor?
yes, exactly
and when trying to destroy you're doing the same?
Mouse Click > Go into component > Run On Server RPC > Destroy Actor?
Correct
You're sure you have the component marked to replicate?
Can actor components themselves replicate?
Yep
Hmm, let me check
They need to be marked to replicate if you want to RPC through them, receive replicated variables, etc.
Well, in the player character blueprint the component was not set to replicate. I just hit that checkbox and that didn't change anything, unfortunately
The actual functions are all done in C++ though, and iirc when I tried to set up replication of the component in the cpp class none of the replication variables were recognized
Maybe they are different for actor components though?
Checking the docs. Apparently there's a function, SetIsReplicated() for actor components, instead of just the replicates bool
@sinful tree that doesn't seem to be it. Putting SetIsReplicated(true) in the constructor of the component doesn't make any difference. The object still doesn't get destroyed
(also tried SetIsReplicatedByDefault(true))
You were saying the functions were defined in C++ too, were they properly set up to be replicated?
well... probably not I guess, right?
There's got to be something I'm not understanding. I can post some code though
Here's where the client asks the server to destroy the object:
void ULHPlayerConstructionComponent::DestroyPlacedObject()
{
if (ObjectHitResult.bBlockingHit)
{
AActor* hitActor = ObjectHitResult.GetActor();
if (hitActor)
{
APlaceableObject* hitActorAsPlaceableObject = Cast<APlaceableObject>(hitActor);
if (hitActorAsPlaceableObject)
{
Server_DestroyPlacedObject_Implementation(hitActorAsPlaceableObject);
}
}
}
}
void ULHPlayerConstructionComponent::Server_DestroyPlacedObject_Implementation(APlaceableObject* objectToDestroy)
{
objectToDestroy->OnDestroyed();
}
Here is the code that then gets called on the objectToDestroy:
void APlaceableObject::OnDestroyed()
{
Server_OnDestroyed_Implementation();
}
void APlaceableObject::Server_OnDestroyed_Implementation()
{
DoSFX(destroySFX);
DoNiagaraFX(destroyVFX, GetActorLocation());
Destroy();
}
Post the .h for these functions.
.h for the functions on the construction component:
void DestroyPlacedObject();
UFUNCTION(Server, Reliable)
void Server_DestroyPlacedObject(APlaceableObject* objectToDestroy);
.h for the objectToDestroy:
void OnDestroyed();
UFUNCTION(Server, Reliable)
void Server_OnDestroyed();
UFUNCTION(Server, Reliable)
This is what I meant when I was asking if they were set up right 😉
Everything looks ok at least to my eyes.
Last thing I can think of is if the Placeable isn't marked as replicated, but I think you have that covered if you're seeing it spawn on clients.
The placeable is marked as replicated. This is what's in the constructor:
bOnlyRelevantToOwner = false;
bAlwaysRelevant = false;
bNetLoadOnClient = true;
bNetUseOwnerRelevancy = false;
bReplicates = true;
NetUpdateFrequency = 100.0f;
NetCullDistanceSquared = 1000000.0f;
NetPriority = 1.0f;
Thanks a lot for your explanation. The problem is that people talk to me as if I already knew many things, but it is not like that. Thanks again.
omg I fixed it
The issue was the dumbest thing. In the RPC's, I had written Server_DoXYZ_Implementation, when I should have just written Server_DoXYZ 🤦♂️
D'oh >_<
thanks so much for your help though Datura
at least I know this method was right other than the dumb suffixes
Hey everyone, I got me questioning: is there a rule to when to use Reliable RPCs
When you need to make sure it gets through.
Generally anything on tick, like movement inputs and such are unreliable. Doesn't matter as much if some are dropped. Interaction where you press the button once on the other hand you probably want to be sent reliably.
Humm... I see
thanks buddy
Can anyone suggest a tutorial for the combat multiplayer battle royal game?
Or any course from udemy or from any platform
Do you understand the basics of networking in UE?
Yes
Also we connected 7 person with steam subsytem
With Advanced session plugin
I understand that point i need to make replication always for work to my multiplayer blueprints stufss
Ok, if you understand the basics, then tell me why would a server RPC be dropped when fired from an arbitrary actor?
That's not the answer, no.
I would suggest you look into pinned messages of this channel and familiarize yourself with them
For combat?
Combat isn't all that special in battle royal. It's just an FPS/TPS but with a bunch of people
I have been looking at how Unreal handles network compression of some types - for example, FRotator converts floats to int16. I also know that bools are packed into just 1 bit.
However, I'd like to see how ints are handled in general - basically, I want to know if a int32 representing the number "3" will occupy the same size in a package, than for example a int8 representing the same number.
Which engine files could I look into?
Hi - When you load a map in a multiplayer project, where do you put the code to load a loading screen so that it appears to all players?
Widgets would be a client-side thing. Usually widgets are managed throught the HUD subclass
That I know. I want the loading screen to appear before the main map loads and I want to stop it after it's done.
hello, i need help.
i followed a guide for a synced network clock, but my results are far worse than theirs.
can someone tell me the formula to getting an accurate time from these?
I guess they all end up calling SerializeBits, but not that I tried checking that one. I would debug that and see what happens.
You could use MoviePlayer for loading screens: https://unrealcommunity.wiki/loading-screen-243mzpq1
yes, that is the guide i followed, but they get an average error of 0.01 and mine is 0.1, thats quite a big difference
do i have to do something with the values those functions give me?
You would have to do what is told their.
I will let myself summon @pallid mesa considering he wrote that
COuld it be done in blueprint?
are you using the short round trip time one
or the moving window with the circular buffer?
Maybe if you use this plugin: https://github.com/truong-bui/AsyncLoadingScreen
They use MoviePlayer too, but you don't need to code
this one
so it depends on the frequency that you are using, and on the size of your circular buffer
play around with these values until you get a desirable result
in the example i provided in the post I was using 1 second frequency and a circular buffer of 10 elements
how are you measuring the error?
because the actor isn't in ownership chain to PlayerController/Pawn
thanks, I'll do :)
Correct, to PlayerController, i.e. has no net owning connection
You passed the basics of unreal networking exam
that's not how you use it
or how you test it
mainly because you are eating latency time by the time you want to print it on the server
the way you have to test it is on tick
since tick executes on the server and on the client
so you can have a parallel print of timings
and the one you'd use is GetServerWorldTime
you don't need to add the delta
sorry for the high latency responses, I'm not paying much attention to discord lately 😅
remember, that in nteworking latency is your biggest enemy
and this clock tries to leverage that using NTP techniques 😄
so if you want to perform a proper test you need to do as I said and see tick printing the values (no need for an rpc there)
so - in a client/server scenario, i'm tracking down a standalone-only bug. i wanna have a server run, but be able to keep recompiling and launching clients and autoconnect them to a server
i've always just launched the editor as debug game, run standalone with -waitforattach, attach to both, eventually load, start messign around
can anyone reccomend me a less painful way i assume there is one ?
To have a script that runs as standalone?
But what does -waitforattach do?
wont startup the server/client until you attach teh debugger
pretty useful to find initialization issues
Oh that's amazing, always wondered how could I do that heh
Should the server open a port on listen server to allow other players to join ?
Oh what does this do? (feels like I missed a lot of those)
I think it's a console command though
do the server must open port on listen server ?
is there option that doesnt require to open port ?
To use #online-subsystems ? They do these stuff for you after all
is EOS Completely free?
for Epic online services creating and joining sessens what to do if the server disconnect ?
do epic online services work with any platform or only with epic games ?
Why's the linetrace not damaging the enemy player?
It has a trace going from the top of the saber to the bottom in the game
But it doesn't seem to work
There is no need to use a multicast here. Once running on the server you can execute the required code to apply damage and then have the server call a multicast to display the effect/play audio.
Also, you need to supply the "Apply Damage" node the reference to any actor you want damaged in the "Damaged Actor" pin.
Also like you said it's using multicast I don't think apply damage can be called on multicast needs to be on server
True but is it my collisions or something thats messed up causing it to not display the effects
If you're only spawning the effect & sound on the server, then no clients will see it. You do need a multicast, but all it should do is spawn the emitter & play the sound, and you only call it from the server when you want others to see the effect & hear the sound.
It doesn't even hit the player though aha
Check what your line traces are hitting? Verify what the world locations are on the server vs. what the world locations are on the client. Check if there is actually a return value on your trace. If there is, verify if the hit actor is actually a Phantom_BP (you can take Hit Actor and drag it into a print string node for example)
when host disconnect you need to change the host to any other client connected to the session by random if there is more than 2 palyers
Hi!
I'm developing a multiplayer game for the first time. The game starts on an empty level with a blueprint widget to let the player set his/her name. When the name is set, all the players have to go to the same map. Now, I'm using OpenLevel, but they don't go to the same map. One player is a Listen Server and the other is a client. What do I have to do to travel all the players to the same map? By the way, if I'm asking this again is because I still don't know what to do. Thanks!
Hello! We migrated our project from 5.0.2 to 5.1 and we have this weird behaviour of what could be a potential bug.
The rock of the left is component of an actor, the rock in the right is a static mesh. The character teleports when a montage with root motion is running and touches the floor of the Actor (most likely when is in walking movement mode, since when is flying replicates properly). We are seeing from client perspective. The glitching character is the server. It also happens with AI and replication is based on GAS.
Any clue of why this happens on top of actors would be awesome, or if I should proceed with a bug report.
bug or epic devs edited a function you're using, could also be some weird issue during migration
I had issues which required me to duplicate a blueprint after migration
because it would get corrupted or something (really unsure)
I found the issue and the fix, but not the whys. If you delete the SM component and reconstruct it will fix it.
I can't compute the connection between the SM and root motion replication, but the bug is fixable with just that, deleting and adding a fresh SM
yeah, got also a couple of classes with unchecked replication
and in 5.0.1 was checked
like, really, really random
a couple of weapons here and there
it cost me like 10-20h for sure banging my head against a wall because I thought my code was bugged after migrating
I haven't migrated my project yet to 5.1 as it seems it's not a good idea yet
and still finding odd things, with the dilemma of considering if is from my side or 5.1 side
I'm giving it a couple of extra days
I almost got all the things back to normal
I'm waiting for 5.1.1
I've had this in 5.0.3 - during development a random class Blueprint suddenly "unticks" the replication and overrides the default c++.
I've been using Blueprint source comparisons to find the issues when they occur.
Now I know it's not me unticking that box
I always thought I am insane
and doing it without realizing or something
Hi, Anyone knows how to manually spawn the PlayerPawn when my custom terrain is loaded? I have a event inside GameState that is fired when the terrain is loaded.
Luckily bulk edit makes this job easy! But annoying non the less
Ive tried spawning my pawn like in this video from my PC, however i got a issue..
https://www.youtube.com/watch?v=H0JZnWdY0k8&ab_channel=Kekdot
🧑🏻🚀Support us on our 💲Patreon for awesome benefits: https://www.patreon.com/kekdot
In this video we take a look at how we can spawn characters in multiplayer in Unreal Engine. We take a look at installing a function in the Game Mode that will locate player starts for us, which we then use in a Game Mode function that will spawn our players. Th...
I have a general question, was looking in to some lyra code and noticed that in some cases lyra does not declare GetLifetimeReplicatedProps in the header file, but implements it. How does this work exactly? I always assumed one had to declare it in the headerfile.
Inside my gamepawn, how can IsLocallyControlled be false?
It seems like i'm controlling on the server? why?
Because there is no such a guarantee that the pawn has been possessed on BeginPlay
Tx 😅 i was confused about something
Its kinda obvious @fathom aspen though but thanks
Hello ! I need answers please ! I'm working on a special inventory system (a moba inventory like) and i'm keeping track of items being purchasable x times, so a player cant buy this item anymore if it has reached its buy limit. But how should i keep track of that ? i was doing it in the game state but i'm not sure if it is correct.. I was using an array for this
looks like that
I'm not sure what a moba inventory is, but that seems to me like a shop in mmo. GameState seems reasonable, but it's always relevant, and I don't think you are able to always buy from that shop. But if it works for you as a prototype then it works
a moba inventory is when you cant throw away the items from ur inventory. Only an add-remove system for the inventory but yeah def similar to mmo shops
what did you mean by "from that shop"
am i missing something ?
Are you able to buy items at any given place in the game?
Yes, there are many shops ( 6 i think) in the world
and each one is totally similar to another one
So they are actors
yes
Why would you have their logic in GameState?
I mean just the item max stacks in the world would have logic in GameState
am i wrong ?
bc it is replicated
Each shop (actor) can access gamestate
i believe
oh ok
i'm a bit confused sorry
so i should move this code into their respective blueprints ?
i mean in the parent blueprint
Also each shop could have its own buy limit that you check against
If you are blindly implementing these stuff in GameState you could end up in having a unified buy limit
thats what i'm looking for haha
😳
Yes but it was just an example
I'm not that familiar with your end goal as last time I played moba was in 2017
RIP Paragon
Hey guys I got a quick question;
I use a vehicle from the marketplace that has full replication going on, so many multicasts and all for all interactions. But my game will be a single player game so actually don't need it.
Would removing all replicated BP content improve the performance or does it not matter if there is no server connection? To me it seems like a lot of extra code running for nothing.
It wouldn't. You would probably end up having less memory, but not something noticeable at all.
5.1 issue if you get crazy about replication. I can confirm that specific classes, with no clear pattern, can override properties when you restart the editor. i.e I got a class that turns off replication property every time I restart the editor.
and I can also confirm, that while the change of a SM in editor fixed the root motion no rpc properly, once is packed, any SM component will break root motion rpc, even if in PIE worked
Here you can see the bug. This is recorded from client, the bug is visible in AI when using root motion and listen server player when using root motion too.
The shrine is a SM (Nanite) that belongs to a replicated actor.
This behaivour is visible in actors migrated from 5.0 to 5.1, as long as is and Actor + SM.
I fixed this teleport on PIE, replacing the SM by a new one. However, once is packed, the teleporting behaviour comes backs.
Funny point is that I died because velocity (impact) after a small jump from the shrine, usually in this happens from way higher velocities.
If anyone is migrating a multiplayer project to 5.1, with walkable rpc actors with SM, would love to see if you can reproduce this behaivour when AI/listen server uses root motion on top of those actors and you watch as client.
Does #if WITH_SERVER_CODE work with listen server? I get some mixed answers where some are stating this does only work for dedicated servers.
And if it does not work for listen server is there an equivellant variant that I could use?
No reason ti shouldn't?
sounds like a good candidate for a test
Actually first time seeing that macro looking in to LyrasHealthComponent, still consider myself a beginner when it comes to UE. But continue looking in to this it seems UE_SERVER macro is for dedicated only while WITH_SERVER_CODE works for listen servers as well.
I'll just assume that's how it is and add a mental note to self.
maybe wrap some ue log with the macro, and see if it is getting executed with a listen server
Do you see UE logs in packaged projects? It's when it's packaged some said that the block of code did not work as intended on listen servers.
mmm I think you can on debug packages, maybe on development as well.
If logs are not a good fit, you can also put another dummy thing to test inside the #if, which is easy to notice
Indeed, I'll figure something out, appreciate you!
Don't forget you can do things like !UE_CLIENT as well.
Is there a collective name for these types of macros? Maybe I could find some blog or something listing them all with explanations?
There is so much to take in learning UE, always great to find good sources of documentation.
I still can't fix this issue
Idk, usually I use the checks isRunningServer() or isRunningDedicatedServer() if I recall correctly
there is also a NetMode enum that can be queried, cannot remember the name of the function
In this case he's trying to completely exclude code, not just create different code paths.
ohh ok my bad
Exactly, it's the HandleDeath logic, guess that's why they would want to exclude it.
However
Remember that just because something is compiled as a listen server, doesn't mean it's always running as a listen server.
It can be a client too.
So you need both code exclusion and code paths.
Don't pull variables across execution paths. Clients will not know what that "Location" value is as they never performed the line trace. You'd need to add a vector input to your multicast and feed in the value from your hit result when calling it. Then on the event output plug it in to your spawn emitter and play sound nodes.
Question in General, is it necessary ( in most cases ) to change the bandwidth max and such in the Project Engine ini ? Its now set to max 10kb… isn’t it really low?
Are there any available macros/templates for compile time server or client branching (as opposed to runtime if statements)
Patreon: https://www.patreon.com/SneakyKittyGaming
Discord: https://discord.gg/W5g6pZXfjh
Ultimate FPS Template Plugin: https://www.unrealengine.com/marketplace/en-US/product/ultimate-multiplayer-first-person-shooter-template
In this video I cover the use of if defined which will allow you to keep code out of the client build for security and o...
My client crashes with that error which is probably related to networkphysicsprediciton, do you have any advise?
does client can read and write gamestate and player state ?
@tender jay thank you the gamestate is one for all the game and each player has his own playerstate . right?
How do I make an actor (an FPS counter, created via a UChildActorComponent on the player's Character) exist only for each client? If I can only make it hidden to other players, that's fine, but since it's running every tick, I figured that not creating it at all would be better.
@tender jay So on gamestate and playerstate no need to set variable to replication?
You do if you want the variable to be replicated
First of all don't use ChildActorComponents at all
Second of all what is an FPS counter?
It just prints the inverse of DeltaTime on a looping timer.
And why is that an actor?
It's a VR game, so I'm doing it via some TextRenderComponents in an actor attached to the wrist.
Instead of a basic widget solution
It's one component for the rate, and another for the title "FPS" below it, so I did an actor.
True, in screenspace
@tender jay thank you
does onpostlogin get called when the server login?
It does for host and for every other player on hard travel
Disconnection bookkeeping I would say
Correct, I wouldn't subclass it really if it's not match based
But the disconnection part could really make it into any game
I still wonder why it's not part of the GMB
Oh yeah, that's right
I should start getting into the habit of recalling that SP games exist
I wish I did by now
But real talk, I would if they subclassed baseless GM
What is "baseless" GM? I know regular Game Mode and GameModeBase, but not that one :D
damn xD
hahaha
makes sense but in the context of OOP I wouldn't figure it out xD
Also I didn't know your compendium, have to read it
Great news, will be here for any questions 🤓
Treaty of Alliance when?
#multiplayer peeps are going to ddos it now
Nice, I already read the URL portion. I remembered it existed, seems a good option to store player choices from my lobby screen to the game (team, color, faction...)
Easy, 10^32 options to guess
Yeah that's one of the notable questions peeps here ask and it's where I suggest them it
We are double hexa now
Haha nice. I remember reading about it much time ago, the first times I researched multiplayer, and I was doing online UI. But then we have been working on other stuff, had in mind to research again when connecting the UI to the actual game
Much better than manually saving the options in local GameInstance or something like that
Of course, but to be fair I'm more biased towards having a local saving system, pretty much a LocalPlayer Subsystem
Because the things you are saving could get really complicated
And I find URL options useful more for basic data types
But yeah it's a self-preference
The options are really endless, and I would suggest you read it to the fullest and then reconsider your own preference
Mmm I see, didn't consider using a subsystem. Tbh it's a topic I've not researched much, I'm more worried with the core of the game for now.
But a nice and well made setup from menus and UI until the multiplayer game starts will require thought and design in the near future :D
when I use get playerstate .what is playerstate index ?
You don't use that node
Neither you do use any node that has the index part when getting game-framework actors
There are always other ways to get the actor in question
How do I show the winner of the game on text in a widget?
This method only works locally
Of course because widgets are local
First of all remove that node like said few messages away
Replace it with GetOwningPlayer
Actually this is not how this is all done
You are using PlayerController and it doesn't exist for other connections on client
You have been told that before
PlayerName is already part of PlayerState
You use it instead
Interacting with widgets in multiplayer doesnt make any sense to me
The name of the winning PlayerState will be broadcasted to all clients
It will if you listen to advice
Through what means
Player7 wins, they have the name "Wizard", then the GameMode tells GameState this happend, GameState in return has PlayerArray which it iterates and sends client RPC that access HUD which displays the widget with the name "Wizard"
Glad I won that game
gg
how to get owning playerstate ?
From?
From which actor class you do that?
player controller
Unexpectedly it's through a property called PlayerState
I think its will get the servers playerstate
Yes, you're on server, that's normal
for Example I if I store players names on players states I want to get this players name
from his playerstate
PlayerName should be stored on server and replicated to client
So you have your name on both sides
yes server who stored them
but I want the client read his name
how can I make the client read his playerstate
They will if they use PlayerState property
No matter if they do it server-side or client-side they will end up getting their PlayerState
Name will be available on both sides
thank you so much
@fathom aspen I want the srever to chane the clients variable not the servers one
I think the srver change his player state like this
Already told you not to use that node
what node to use
Just PlayerState
I reported already this bug, but just have this video for the record about the root motion issue in 5.1
Boxes are just normal actors with a cube inside. Ground is a Static mesh. RM in AI/Server is erratic on top of the boxes (actors) and updated properly on top of SM (grass floor). Captured from client side on steam.
worth mention this is a new behaivour didn't have in 5.0.2
- on PIE works, packed doesn't
I have no idea How I can check if I am connected to internet , so if connections will drop I will tell.player he is offline, any ideas?
If I do save game to slot in ThirdPersonGameMode (Dedicated Server) where save file goes? To Server folder or? Shipping build
A new update on this new 5.1 teleport root motion behaivour.
Now all characters use vanilla movement component. There are two actors with a white box static mesh. In the first one root motion replicates as expected, in the second one the teleport glitch comes back.
Funny point? Well, they are both exactly the same actor with a cube.
would it be a smart idea to use a replicated bool value for status effects such as a stun and on rep them to multicast an animation
hello people, what would be the best class and method ( i guess between character and player controller) to create a UI after server travel ? i tried OnRep_Controller, Restart, OnRep_Owner but thex don't work as expected
Try this
Since GameMode exixst only on server then the server should be the one to create that save and he will store in in his build folder
I did that,
{
Super::Restart();
FCharSavedData CharData = Cast<APlayerStateBase>(GetPlayerState())->CurrentPlayerChar;
if(IsLocallyControlled())
{
UE_LOG(LogTemp, Warning, TEXT("MTD char Restart") );
CreateHUD();
}
}
that was one of the first thing
The restart may happen before spawning of the HUD, so in my case, I try to create the player UI in two places, first time after the player gets restarted, and if HUD was invalid and we failed then I try to create the player UI after player controller Begin Play (on the client) happen
Are you using the HUD class?
no, should i? so yeah you do a second check and if HUD is not there you create it, i'll try that thanks
I'm using the HUD class to hold the logic of creating and managing widgets
You don't need to spawn it, just set it in the game mode where you set the default pawn class or default player controller
and that HUD will destruct on servertravel if i have another HUD class set on the other game mode?
Yes, each game can have a different HUD, in my game, I have one HUD for the main menu map and another one for other maps
does unreal engine 5 support online multiplayer deterministic physics?
no
💀
thanks, switching to HUD class i quickly solved that spawn issue, is there some "right" way to remove what's been added to viewport just before the ServerTravel (valled by server) do his job?
Just have the HUD keep track of all widgets and remove them when it's destroyed
No, although Chaos has an (experimental?) async tick option, that makes physics more deterministic than otherwise. Depending on your needs, might be useful or not
nope i need full determinism
would it be a smart idea to use a replicated bool value for status effects such as a stun and on rep them to multicast an animation
even if Chaos was deterministic, Unreal engine isn't by default, so full determinism is bordeline impossible.
What it is possible though, is to make a separate module in another thread, that ticks independently from the engine, and build your game logic there, and only use Unreal as a rendering & input/output system.
yep, simple solution, worked as a charm, thanks
Hello, I've done the impossible and I managed to somehow desync Character Movement between Server and Client
I have a character that when hit, Calls a function that applies impulse and sets velocity to bounce off stuff based on reflection normals.
90% of the time it works well, but in some crazy cases(lots of obstacles, rounded reflection surface) the server and client bounce with different velocities and client doesn't "snap back" until a random moment (usually hitting an obstacle on the server), which for some time generates a butterfly effect (server bounces off stuff, Client also does but as he's in different position he goes into different place, also sometimes bounces when server doesn't, and suddenly the character's position on the server and client differ in thousands of units before randomly snapping back)....Does anyone know what can be the cause for such big desync?
I have no idea How I can check if I am connected to internet , so if connections will drop I will tell.player he is offline, any ideas?
hi, can someone answer this two questions
-
is logic to have windows server package, and android astc clients?
-
can i have different plugins in clients and in server?
thanks
you can make a simple api request and see the result code, or request response you should be able to know, i tend to use VaRest
isnt there any native function of ue? in c++ or blueprints dont you know?
hmmm propably yes if you will build package with ticked plugin it will include it in client then if you untick plugin and will build game as server u dont have it there so propably yea
best way is to try it
I didn't do it because varest worked fine for everything i did, but i'm sure you can implement directly in c++
i cant paste the link, dont know why but search for "unreal c++ http rest request"
u mean do it from c++ with varest?
but then I need make this function on event tick with varest
and if destination won't he accessible then flag it as internet lost
right?
if you do it in c++ you dont need the VaRest plugin, and yes there are try and catchs or request response into to know if it failed
i just don't really know what is ussual way to notice player that he lost connection and based on this information print it on monitor and try to reconnect him, that's why I am asking I have no idea what is best way 😦 so i will try make it via varest tho @whole grove @oak hornet or better tips ? firstly I thought there is native function for it in unreal BCS in log of standalone after no internet connection I get disconnected from session and there is message connection lost but I dont know how to detect it in code
If I wanted to pause a multiplayer game (dedicated or listen server) - conceptually I could just do an RPC to the server from the PlayerController, have the server "pause" the game there, and then do an RPC to each playercontroller client to "pause" thier local copy as well?
Does "pausing" cause any strange things to occur with replication? i.e. will I be able to simply broadcast "unpause"?
gonna check it on pc I can't open it on mobile , I did search for it maybe u won't believe me but I really did
i checked it but after my internet drops I am still on "map" and I can move
I don't know but when I was testing it sometimes after 2 minutes without internet I was automatically kicked from session to menu and sometimes not I don't understand this logic, also I will try this destroyed() what u sent in link
true
What would you consider a low frequency timer
Is there a function that gets called when the player array is updated in the game state?
I don't think so, but maybe you can use this function instead (in Game Mode)
I mean when my player score changes for example
how do other players know that my score has changed from replication ( or any other replicated attributes )
Via OnRep_PropertyName functions
OnRep_Score for example
I have two players, one as listen server and the other as client. Both are in an empty level with a blueprint widget to set their names. When a player has set his name, he presses enter and I run this code:
When the player on the server runs the Open Level node, the level on the client reloads (it reloads the blueprint widget), and now it runs as the server.
Do you know what I am doing wrong?
Thanks!
I'm not sure but try this node
No, because I have no idea about what I'm doing. I think I trying to use a lobby where all the players land and then go to the game. By the way, I haven't use it because in the documentation say that it will travel all the players to the new level.
Thanks.
Sorry I made a mistake this node is part of a plugin.
But did you create a session and join it with the client successfully?
No.
Imagine I want to do a first screen where the player set his name. Once set, he goes to the game. If I'm using a Lister Server architecture, with one player as a server and the rest as clients. What steps do I have to do?
Thanks
First, server need to create a session and travel to the map, after that client need to search for that session and after finding it, client can join
Do you want the player name to visible to other players as well?
OK. So, the server create the session and let the player playing in the server set his name. After that, the player in the server, will join the session?
Yes, but that is already done. Thanks.
For example, while the player is in the main menu (and has not joined any session) get the name, save it in the game instance, then search for the session, after joining the session, use a Server function to send your name to the server, after that server should multicast it to other clients
after creating the session, clients need to join first
Does the player on the listen server have to wait for the other players to join the session?
No, until the server broadcast the session they can find it and join
Thanks. Will the player on the server join the session? or he doesn't need to join the session?
something like this
And I guess you need to enable the Use LAN if you testing in the editor
Modify the Public Connections and Max Results based on your need
I have a lot of things to learn.
OK. The player on the listen server will set his name, and after that the server will create the session.
There is a plugin that gives you more access to the steam subsystem from the blueprint, you can use it if you developing for the Steam
https://github.com/mordentral/AdvancedSessionsPlugin.git
OK. Great! Thanks a lot!
when you replicate an actor, does it replicate the entire actor across the network or just a ptr to it
like for example : i have a gun varaible in my player, its replicated
Just a NetID
after the client set the name, use a server RPC to send that name to the server, after that from server set this name to a repnotify variable on a replicated actor (like a player character), then other clients will receive the name and after that, you can do whatever you want
All related to the name is already done. I'm only worried about how the player on the listen server will join the session and when to create that session. Thanks.
First create a session and open a map, now you have a session to join
then on the client try to find sessions, after finding the session join it
I'm not sure, but I guess in the editor in order to test and connect, you need to enable Use LAN
⬆️
Thanks
You can change a replicated variable on the client without telling the server, and the next time server updates this variable, clients will receive the update as well
For example, you should replicate the player's health so that the server decides to kill the player or not and the client only receive the health value to display it on the screen
You normally do not trust the clients to tell the server any values. The server can normally determine most values on its own without client input. In the rare case where you do have to trust client input, you should limit what they tell the server and validate what they are asking.
Therefore, any values that are fine to set on the client only are things that should not be gameplay related and can be cosmetic. Example: The player opening & closing UI - the server doesn't care about this really, you're setting values on the client when doing so, and it shouldn't impact gameplay at all.
Hey, I dont know if there's a channel specific for this, but I'm looking for a tutor to help me with multiplayer. I posted a request in CodeMentor can I share the link here?
Probably best to put it in one of the job board categories. #instructions
alright, thank you
can someone tell me how does unreals get ping in ms node work?
from the player state
is it accurate?
Define accurate?
how often does it update and how does it determine said ping
i cannot find information about this on the net
It seems to update via UNetConnection's ReceivedPacket.
#sourceCodeTime
I found ping accurate enough to be useful, but I wouldn't rely on its accuracy for something that needs precision
if u need timestamped precission feel free to use the synced clock™️ at my blog
ohh noice, maybe I implement it in our game later, we have a timer but...
but now with more circular buffers 
Anybody else having 2nd gamepad not working after upgrading to 5.1?
Hey there, I'm wondering if you did something special that got Iris to work when compiling engine from source?
I did similar to what you did, and got it to compile fine, but when debugging I always get UE_WITH_IRIS=0. Maybe I need to add IrisCore to a dependency modules list?
though I kinda hated this one because for lag compensation and such, you don't want to account for RTT
you can use the gamestate one in such case @lost inlet therefore the "non destructive bit"
you know, tools in the toolset
with the default one, you do have to adjust the update frequency a lot because otherwise the clock drift is very real
I had to make it more frequent and actually add ForceNetUpdate calls because it would sometimes be wildly out of sync
clock drift also has variance done via GS
after this, it functioned for the bullet hit validation on a previous game I worked on
so you were force net updating GS every time a shot was fired?
