#multiplayer
1 messages · Page 23 of 1
Development speed of course
And no Fortnite really has almost all of their things in cpp, they only expose designers stuff to BP
If I had for example a replicated health value, and I knew it would only go from 0 - 100, and there'd be no decimals. Is there any reason I shouldn't leave it as a byte?
Like managing FX in weapons
Abilities so they can customize this or this for this weapon
But that is designer stuff
They still have a bit of things like giving weapon at startup in BP like Lyra does
But nothing to do with the core logic I said they have almost all of their actors in cpp
Even if they have a few actors like jump pad in BP it’s all subclassed from a GameplayActor class in cpp.
Which makes sense again to have more freedom on replication stuff, lazy loading stuff etc etc etc
You will always end up with stuff that does decimal damage
Like falling damage
Poison
Etc
I don’t know if your game does that but you get it
couldn't I just clamp it to int and then convert int to byte?
maybe I should just not replicate the health, and only send updates as byte
You can if it needs to
and then unpack the byte back to the health value 🤔
byte is fine if that's what you want
If you know nothing will do decimal damage then yes go for it
Isn't that done by default though with serialization?
I have no idea xd
Ok it doesn't seem like ints are net serialized, while bools for example are
That is doable though if you slap your int into a struct
Honestly I'm thinking I don't even need a struct
nevermind I do
alright cool thanks
Update: All POD types are net serialized, it's just that bools are net serialized in a special way
So you don't have to do anything @short arrow
You can use something like bitflags if you feel you are replicating too much variables that relate to each other
But the act of packing/unpacking is done for you
all I have to do is set it as net serialize and it packs and unpacks seriously?
is it's just super simple like that?
No. All you have to do is have it as UPROPERTY(Replicated)
wait what @fathom aspen
no way it's that simple
it just works right out of the box like that?
I don't have to do
enum
{
WithNetSerializer = true
};
?
That is for custom structs you want to custom net serialize
Even structs has their own default net serialization iirc
But if you want your own, for let's say, make structs replicate atomically then you do implement your custom net serialize
Is building server with linux or windows platform better in unreal engine?
Which is recommended for professional use and have fully support?
@fathom aspen damn what don't you know? Lmao seriously. There's like you and 5 others who just blow my mind
He's a wizard for a reason 👀
Hi All, I have a reasonable background in C/C++, C#, and Golang (as well as others) but am interested in seeing what may, or may not, be possible in developing a UE5 headless server for a type of P2P mesh cluster design in Golang so that the nodes effectively balance out the connections and spread the "world" in addition to removing single-point failures that may result from the current head server crashing. I have been reading the UE5 documentation but am still a bit new to UE5 although I really love what I have seen. Thanks
Is there any particular reason whenever I call a multicast event my dormant actor wake's up for a frame and then goes back to dormant... ?
I'm not calling force net update or flush
Check UNetDriver::ProcessRemoteFunction, there's prolly a flush net dormancy call there...
(on phone rn so can't check)
If I get it right, the actor is placed in the level?
Linux but if you have to ask.....
The thing is that the client is trying to ack the net guid client side but the actor hasn't spawned yet, so an actor channel will fail to open and iirc it will remain closed. BeginPlay on static actors is fired from GameState, so you can delay it for them, and it seeme legit (I bet most games do it). The other funky approach would be to fire a server RPC when BeginPlay fires client-side but don't do it 😄
Delays are usually avoided in MP, but sometimes they are crucial, i.e., early game.
Is there really no way in BP to set network smoothing mode in real time? It messes up my mantle and makes it jittery, but i dont want it entirely disabled.
No. That sounds really weird, cause you want a stateful behavior. So no RPCs involved.
There is a good chance that might be a case.
The thing here you are only delaying BeginPlays for preplaced actors, nothing else.
Can't think of any other approach at the top off my head.
This is the function that dispatches BeginPlay on actors: AWorldSettings::NotifyBeginPlay()
Slap a delay in there
How much is a question of investigation and it depends
You mean a split screen game?
Hmm.
Double checking, you have bNetLoadOnClient set to true
Right?
No, it also doesn't make sense if you think about it. You need a reference to an actor to be able to fire a BeginPlay on it 😄
BeginPlay is fired client-side on static/preplaced actors when GS replicates, and at that time all static actors should have been loaded from package I believe
Maybe that's a bold guarantee that UE does, so you can take advantage of it actually
Best you know if you test
Always remember that UE is full of landmines, so you never know about them till you face them
Is it not replicating at all, or just not running the OnRep?
Might be it, but it was fixed: https://issues.unrealengine.com/issue/UE-24280
They are also talking about sublevels that are always loaded, but the persistent level is always loaded afaik so that is no exception
But again fixed
I am not using "#include "Engine/NetDriver.h"" 🤔
is it still relevant?
Of course you don't, the engine does it for you.
The NetDriver is the one that gathers properties for replication and routes RPCs
Is the multicast reliable or unreliable?
unreliable. it's super weird though
the server never leaves dormant all, but the clients do?
Okay here's the thing. Looks like the actor is awaken from dormancy, but I can't seem to find where the channel is closed and it goes dormant again
The NetDriver code is a nightmare
But it's 100% in between the lines, so that's normal.
I don't think that is the case for property replication or reliable multicasts
Can you make the multicast reliable and let me know what happens
Though it sound more natural for the net dormancy to be flushed even in this case
it was like this regardless of whether or not the health was replicated, I set the health variable to not be replicated and made a reliable netmulticast event to see if that did anything, same result. I tried unreliable and still same thing. It updates to clients no matter what
I wonder if I'm the problem
but there is absolutely no flush or force net updates in the project currently on my side
You are doing all this in cpp right?
Regardless of the issue, you don't set a replicated health property with a multicast
it's not replicated, and yes it's all done in cpp, blueprint calls the function though
Double checking cuz dormancy is bugged in BP
And again what you're trying to do is done with property replication
You set health on the actor
And flush net dormancy
Relevant connections will get the update at the time
Others will get it once they become relevant
I hope that image is a little helpful
This image is telling me you should do property replication instead
Multicasts will break
Connections that aren't relevant won't get the updated value once they become relevant
Which is 100% the behavior you want to avoid
I agree, I was trying to see what worked though and it seemed like none of it did, property replication is what I started with :/
I'll revert it back and see if it magically works. fingers crossed
And you should stick to
@royal sinew this has nothing to do with multiplayer, and crossposting is against the rules I'm pretty sure :p
This sounds for something like #graphics yeah. Also I would suggest removing the other posts if you post there as you may get some angry moderators over posting in like 5 channels 🙂
hey everyone, whats th most optimal way to add client side prediction to a physics based pawn? seems like i dont have control over chaos execution
hard as fuck is what it is
I have a multiplayer physics based game but don't do prediction as my pawns are super chaotic and unpredictable
They are player-built vehicles so yeah, no thanks on predicting that with any amount of consistency
It helps that they're slow and tank-like, not zooming around like F1 cars
not zooming around like F1 cars
and im working on wipeout clone
i guess ill look into chaos vehicles sources
Anyone ever have that feeling that you want to do a million things but are too lazy to start or know you'll never finish it? xD
Classic daily vibes
I want to make a proof of concept of some weird kind of "host migration" system for co-op games that I thought of. But I know I'll just likely abandon my very cool spaceship game thingy in doing so :c
RIP for the spaceship
btw there was a cool host migration discussion here a while ago
I missed it as I was at vacation but I skimmed through the most of it
Well maybe host migration is not the right term, rather a save system for when a host crashes/disconnects so you could continue in your own version of the world.
Ah that I see
Yeah oddly it's called host migration too
But I was referring to seamless traveling to a new server
In some way it is, but it just feels weird to call it host migration 😆
Anyways that was also talked about a few times here
I saw the seamless travel discussion from server to server a bit ago yeah.
The key is to make sure clients are recording the server state overtime which also sound like an overkill
There's a plugin on the MP that does it, no idea how good is it though
Why is that a plugin? That should very much be a thing of just not replicating specific things only to specific clients.
And becomes a fostering environment for cheaters, but the host could cheat anyways so what's the point heh
What I was also considering is making snapshots of the server's state and sending those over every so often. But not sure if that's any better honestly than just sending all state at all times.
No more need for Dedicated Servers! If the host leaves, the game can continue
Ah yes because everyone uses dedicated servers.
yeah I think it's just fucked, I switched it back to replicated property with no replicated events and clients still receive the update
I'm starting to think it wasn't just a blueprint thing
If we're referring to the dormancy thing, I would be very surprised to see that broken as Fortnite I believe heavily relies on it.
Without flushing net dormancy?
It's like it sometimes works and sometimes it doesn't, twice now it's worked and twice now it hasn't. All in different projects lol
I do the same thing everytime xd
yup
I get people buy that plugin but it feels like something you can do your self within a few days max with C++, all it seems to do is just use Unreal's built in serialization system to save and load actors etc. and do the actual reconnect part.
But I guess that's plugins in a nutshell, saving you those couple of days 🤷♀️
are you talking about net dormancy? That's a plugin?
No the host migration plugin Wizard linked earlier.
Yeah I also use it a lot without issue
I don’t know if you showed code but in the case you hadn’t do it
Yeah it really comes down to whether you have the time and energy to do it. I would take it as a challenge and then probably buy the plugin to compare/learn (also depends on reviews etc.)
Btw did we already hear more about that new replication system?
Sadly nothing. Not that I've seen/know it made it to the 5.1 preview
😦
Header:
public:
UPROPERTY(BlueprintReadOnly, ReplicatedUsing=OnRep_CurrentHealth)
int CurrentHealth;
UFUNCTION(BlueprintCallable, Category = "Health")
void UpdateHealth(int Health);
UFUNCTION()
void OnRep_CurrentHealth();
UFUNCTION(BlueprintImplementableEvent)
void MCHealthEvent();
};
constructor:
ACPPMasterBuildpart::ACPPMasterBuildpart()
{
PrimaryActorTick.bStartWithTickEnabled = false;
bReplicates = true;
bNetLoadOnClient = true;
bAlwaysRelevant = false;
NetDormancy = DORM_Initial;
CurrentHealth = 100;
}
step 1(blueprint): https://gyazo.com/602d18f84ff6ebc9b68836c54a9747bb
step 2:
void ACPPMasterBuildpart::UpdateHealth(int health)
{
if (GetLocalRole() == ROLE_Authority)
{
CurrentHealth = health;
}
}
Sorry it's so huge
nowhere in this setup is flush net dormancy called
Is this placed in the world from within the editor or dynamically spawned?
It's spawned by players, but even if I don't use Initial and use Dormant All instead I get the same result
Nice. I've been trying to reproduce for the past 10 minutes wondering why clients weren't getting the new value repped down, to discover I forgot to replicate the property 
The consequences of not touching any code in a while
So it works fine for me if the actor was preplaced
Let me check what happens if it was dynamically spawned
But even then DORM_All should not allow any updates.
Yeah not even Initial. Unless you FND
Even Initial becomes DORM_All after the first FND
At this point I'm not sure why would one use Initial over DORM_All or the other way around
It's fucked right? It's not me?
I'm just saying I can't see how they are different
Now my client freezed FSR
Ah lol mixed GameModeBase and GameState classes
So it works for dynamic actors too
Now time to check if it's fucked up if was done in pure BP
I feel like initial is more of a safe bet to make sure that if people place replicated actors in a map it doesn't consume your entire network xD
sup guys, whats the menu today?
Pizza 😄
net dormancy doesn't want to work pizza
Always +1 for pizza 😛
whats ur netupdate rate?
I mean Dave Ratti said that they have all these preplaced props in Fortnite as Initial, but I wish I could ask him why they weren't Dorm_All
I'm just waiting on Wizard to confirm if it works for him lol.
I just wasn't there 
I've actually been trying to get it to work for 13 hours now, I think wizardcell went to sleep and woke up already
I haven't slept yet..
.
Because if they were dormant all Wizard they constantly need to open and close actor channels for props. That's just bad.
my net update frequency is 2
0? that will never work
With initial it's open then. I see
Unless I misunderstood the entirety of dormancy lol.
But I don't think that is the case, as if they were open then that means they can replicate fine
so pushup ur netupdate freq and retry, although it shouldn't be ur issue
It just says if they were in the map, without stating whyyy
Man I wish Unreal's documentation didn't suck so much. I can't even find an explanation about dormancy xD
You have to crack the source to understand why oof
the issue I'm having is dormant actors are still replicating to clients
without calling force net update or flush
I'm planning to write one that includes Relevancy, but I'm already demotivated
I'm on 4.26.2 source
I don't blame you 🤣
I posted the code a bit earlier
Yeah forgot to say I tested on 5 and it works great
I dont have ue4 by hand... but ive used and abused dormancy in such version and i dont recall such issue
shits hitting the fan for whatev reason... huh
By the way, can you make sure the dormancy is right in CDO?
I have feelings you hot realoaded
Considering you're on 4
And you're new to cpp
how is this possible 🤔
where r u testing????
thats a log on a dedicated server
Anyone knows what file implements ReplicationDriver.h?
The .cpp? 👀
Ah it's ReplicationGraph.cpp
are you testing locally?
wait nvm I'm dumb.
no that was actually on a dedicated server
had the server running on a vps of mine
connected from my pc
right, good so not connecting to 127.0.0.1
Hmm yes. Seems okay
nope
ue just hates me I guess
connecting to a vps in germany
But wait. Why is it not AlwaysRelevant?
It's checked off
because not every actor needs to know about it from far away
So you removed the bAlwaysRelevant line from here?
ugh i need the engine to double-check the code of how the ping gets calculated and to see what would be the cause for such case @clear island do you have the engine at hand and able to explore how the ps calculates that? remember that we are on a server context
bAlwaysRelvent is false there
yea I have the source I checked the function, seem normal to me
most of the times the ping returns just fine
I'm going to try with 0 net update frequency
yes thats just a getter, but u have to check how that value is calculated
no this will never work
and break everything
I literally just want it to not update until I tell it to
Don't!!!
hmm yea that I wouldn't know since I'm not familiar with the UE source
from what I can tell it already doesn't work, and is broken
no idea where its being calculated
I'm so frustrated it's been almost 14 hours lol
🚑 You still have deja vus ha?
kinda late now for me, but would you like to learn a bit to do some source explorations when such things happen?
Is it possible that it just updates when there's free space available?
I think I found it tho
I just did a find usages for "SetCompressedPing" 😄 maybe theres other ways I guess 😛
hehehe its okay!!
It is literally setting itself to awake when I change the property, and then back to dormant... Something has to be flushing it
so now... lets try to understand when this can happen @clear island 😁
flush net dormancy and force net update do put the thing awake for a whole second
and then puts it back to normal
the thing is I'm not calling it anywhere
i guess u know that already
I'll be honest I dont really understand much of what that "RecalculateAvgPing()" function is doing 😄
hahaha aighty i think this requires a bigger picture
looking at PingAvgData I could understand it stores the last 4 seconds of ping data
but I cant see a case where the final result of the average would be a negative value 🤔
correct but remember that execution context matters
so u are printing this value in the server
so we know that for some reason the value of such variable in the server
reaches said value
yep
so we gotta check how that value gets written on the server
but still how could it ever return a negative value
do we know the execution context of recalculatething
hmm could it happen maybe if the server was lagging?
?
that I dont know
right so this is where the big picture comes
is this like a super issue that u need to solve now?
its inside the PlayerState so I guess it could be either client or server
no not at all
I was just checking todays server logs and I saw that value
okaay then we can probably tackle it tomorrow when i get some more time, gotta go to sleep now and pc is off haha
and it surprised me
Okay BPs are really bugged. If you set a property in BP it will rep down to clients no matter what the dormancy was. Same property if was set in cpp it won't unless you FND @short arrow
now that I look at that function again I'm noticing this
so its clear now the excution context is the server
well actually no, nvm
thats an "or"
could still be either client or server
So it's working all great in ue5, and would wager it works the same in 4.26+
No idea what's going on there for you
but oh well not important for now
yeah but it only calls the cpp function, nothing get's set in bp :'(
that's what I mean because I have this exact setup in a different empty project and it works fine
By the way, can you try specifying the value in cpp?
I mean it's similar right down to the bone
I tried that, I even made it so you can't insert anything into the function, it would just automatically increment the health starting from 100
still replicated to clients
Ah then the project got messed up for some reason
Again are you sure you are not hot reloading?
I hot reloaded a few times, but it usually just crashes the editor anyway and then I have tolaunch it lol
Good ol development editor
At this point I would just leave this buggy project and jump to other working one and not HR anymore
🧠
basically he means delete binaries (intermediate, yada yada...) and don't hot reload anymore 👍
is hot reload gone in 5.0 ? lol
unfortunately not
I thought it was. Or you mean the LC producing similar but still non-destructive issues?
Because that is my take of 5
Not referring to LC.
Hey guys, maybe an easy question for some, but I'm trying to follow a tutorial about UE multiplayer with EOS Online Subsystem. (https://www.youtube.com/watch?v=UlX3umztFDk) I followed it (I believe) perfectly but I'm getting an error when I try making functions. I make public functions but they can't be used in other scripts. I also try to include different plugins, but I can't use the code from those plugins...
Oh so it's still there 😱
hey u need to add their dependencies onto the build.cs
also probably missing a couple of includes
whats the error?
mind sharing the error?
Got a lot of them
370
Ready for the winter I see
hahahahah
But does it not compile or does it just show "errors" in the IDE.
hmm
I don't know... what you mean by output log, but I'll search it on google I guess
I already did that to normally :(§
It's the last part
So this is the output log? That is the error list.
I left VS a while ago so I could be wrong
And honestly at this point it's #cpp
Well I got rid of the error list, but don't have an output log no where
And I still have the errors xD
I think my code is just not including the libraries
Hi all, does anyone have a link to a tutorial on making clothing that will scale with different characters is size? I have a good set of clothes that I want all characters to be able to use but they are all slightly different in size (Multiplayer)
Deal.
Now I get where my MP questions at though 
Probably the same one that came over here
I wonder how this is MP though? If it works in a non-MP environment then it will work great in MP
Where's my #clothing at?
Reason I put it here is I have players that will morph their characters to the size they want, then if they make or find a piece of clothing, I need it to fit the morph of that character, thanks for the reply I will have a look in that channel 🙂
he,llo
does it make sense that my struct array variable became too big (too many array items) so it stopped replicating to clients? lol
Yes.
How big is each item?
Good question
but I feel like
the whole actor stopped replicating
but maybe not.
Idk.
man , games are complicated
I'm scared
what if someone finds another major bug like this on release
okay, I think I get what happened
I think a different array reached the max array memory
and that made the whole actor replication break kinda
cleaning that array fixed the issue
so what should I do
I have like a big array
that I want to sync to the client every few minutes or so
should I just make it into a multicast event that updates the var on the client? instead of a replicated variable?
how can I know why my server is crashing
Hi, Is it normal that variables are replicated without sync with main flow? When I try change a replicated variable and after send multicast event this event works faster on clients then replication data. Is it right? Or do I something wrong and wrong interpretate my log?
replication is not guaranteed to happen instantly or even in the order you set variables (i think order is determined by where you list them in GetLifetimeReplicatedProps?) The client is also not guaranteed to get every update to a variable, it will just eventually sync
the only time you can know for sure that one thing will arrive before another is if you send reliable RPCs, in which case those always go in order
Thanks
Hello I have a question/problem, I have an ability where when you active it, it will show a particle affect on the ability's instigator/user, and everyone else, but only the ability user can see the affect, the problem is, the particle just wont spawn on the other players, I know this is a replication problem, but idk where I went wrong, here is my bp, thanks in advance
What's the GetAllActorsOfClass for?
Despite printing the DisplayName of what your other Variable should already be, you aren't even using it
And what is "Chakra" that you are passing along the RPC?
Also that is Overlap driven, does this Actor you are in exist on everyone?
If so then the Overlap already happens on everyone.
If not, then you need to ensure that the Chakra thingy is also replicated, otherwise you can't pass it along with an RPC
how do I get the error message of a network error?
that is on the GameInstance
when I do that "ToText" I get "Pending Connection Failure"
But I want that error string, in this case "Incompatible Version"
that message is set on the GameMode during PreLogin
ok I just realized this is not possible in blueprint, I'll do it through cpp
horribly noob question: If characters have the ability to have multiple layers of clothing. its it better to make skeletal meshes to merge for each variation or is there a better way to layer the meshes on the fly and avoid collision problems?
@scenic dome I would suggest asking in #epic-online-services , there's also Epic staff in there. Probably a better place to get an answer 🙂
This in specific doesn't seem really multiplayer related. Seems more like something for #graphics perhaps? 😄
Thanks @twilit radish - yeah it touches on so much, but graphics might be best
Is there a way how I can remove the "character sliding" effect when the joined client has low fps/slow internet connection? It's impossible for him to move because the server will just start moving him in a different way based on his previous inputs and he will start sliding to the sides.
Alright I'll try there then , thanks
Hello, I have a problem; im trying to make an ability where you can see an emitter on the ability user and actors around him, I also want it to function as, if your not using the ability, you cant see your emitter, im doing this by spawning an emitter on other actor in a collision, problem is, everything is going haywire, its spawning the other actor on top of mine, and the person not using the ability can see rtheir emitter, here is my bp, does anyone know whats going on?
hello, anyone working on linux use a network profiler?
i tried running this one with mono, but didn't work https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/NetworkProfiler/
however, i am able to generate profile files with netprofile command
hi, I'm new to multiplayer. I've got an actor that randomly spawns in a couple actors at runtime. The issue is the spawned actors are in different locations for each player. How would I spawn in the actors on the server itself so they appear in the same spot for every player?
Check if it's the server before spawning?
How would I do that in c++, I know blueprint has the IsServer node, but I can't find anything similar in c++
This is happening because the collision block your player is colliding with exists on every client and the server, so when a player interacts with it, the collision also hits everywhere that pawn is (all clients and the server have a "copy" of the pawn) thus spawning a ton of particle systems.
I might be misunderstanding what you want, but if you only want the emitter to be visible to the players that have the ability, you should execute the spawning on each client and check if the client has that ability set. Begin overlap() -> !has_authority -> get player controller 0 -> bUsingAbility() or however you want to check for it -> spawn emitter.
https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
Is a really good source to understand how unreal does their multi-player stuff
100%^
Are you using ue4 or ue5?
5
There's an enum you have to check I believe. Let me find it. They changed it lol
Role == ROLE_Authority
just call HasAuthority()
you can't access Role anyway, it's private. You'd need GetLocalRole().
I've used HasAuthority and now the spawned actors only appear on the server, not client. I have enabled replication on the spawned actors. They only have a static mesh component. Do I need to do anything else to make them visible to the client?
yes, the actor needs to be marked as replicated
I've set bReplicates = true in the constructor of the spawned actors
sorry, missed that
for basic replication that's really all you need - SpawnActor needs to happen on the server, and the actors need to be marked as replicated. I'd suggest posting some relevant code (potentially both the bit spawning the new actor and the actor itself)
this wasn't the problem
I fixed it for him 👍
This is the spawning function, this gets looped x times
FOreValue OreValue = *OresToSpawnArray[OreNum].GetRow<FOreValue>(OresToSpawnArray[OreNum].RowName.ToString());
AOre* Ore = Cast<AOre>(GetWorld()->SpawnActor<AActor>(AOre::StaticClass(), SpawnLoc, Rotation,SpawnParameters));
Ore->OreValue = OreValue;
Ore->SetMesh();
Ore->MeshComp->SetRelativeScale3D(FVector(UKismetMathLibrary::RandomFloatInRange(.75, 1.25)));
This is the setMesh function in the spawned actor. It reads in a static mesh from a datatable and sets the mesh of the static mesh component equal to it
void AOre::SetMesh()
{
if(GetWorld())
{
MaxOreContained = OreValue.MaxOreContained;
if(IsValid(MeshComp))
{
MeshComp->SetStaticMesh(OreValue.Mesh);
}else
{
MeshComp = NewObject<UStaticMeshComponent>(this);
if(MeshComp)
{
MeshComp->RegisterComponent();
MeshComp->AttachToComponent(GetRootComponent(), FAttachmentTransformRules::SnapToTargetIncludingScale);
MeshComp->SetStaticMesh(OreValue.Mesh);
MeshComp->SetWorldLocation(GetActorLocation());
MeshComp->SetGenerateOverlapEvents(true);
MeshComp->SetNotifyRigidBodyCollision(true);
MeshComp->SetCollisionProfileName("BlockAll");
}
}
}
}
He was trying to make a mesh become visible on client side without the whole server seeing so i showed him he needed to just not replicate it at all and make the visibility check client side (Replicate the code for the spell and make separate code for the single player visibility)
two notes - one, you can do SpawnActor<AOre> and get rid of the Cast
two - is the mesh component set to replicate?
no
it won't pickup changes to it from the server then
so either set it to replicate or make SetMesh into an RPC
k, I didn't know it could be replicated, the docs say it cant
docs are wrong about that, you can tell by looking at the source for UStaticMeshComponent - multiple properties (most notably the mesh itself) are setup for replication
not everything in it is replicated but the important part - the chosen mesh to render - is.
ok, thank you for your help
Ahh okay. He was doing the opposite of what I thought. Makes sense
They aren't telling you they aren't replicable but they aren't replicated. Meaning replication is turned off for them by default.
So they are just part of the CDO (Pulled from the CDO client-side). Replicating the SkeletalMeshComponent for example would break the CMC.
do functions that cast not replicate? I have a HP and SP UPROPERTY that is set to replicate and I have a function that increases hp/decreases mana, but for some reason when my healthregen function gets called by timer the hp/sp will reset to the previous value
int32 AStatus::StatusHeal(ACharacter* PC, ACharacter* Enemy, int32 HP, int32 SP)
{
if (PC)
{
APlayerCharacterGASWithAbilities* Player = Cast<APlayerCharacterGASWithAbilities>(PC);
if (HP && Player)
{
if ((Player->Health < (Player->MaxHealth)) && (!Player->Death) && (Player->Health > 0) && (Player->Mana >= 3))
{
if (Player->Health > Player->MaxHealth - 6)
{
Player->Health += Player->MaxHealth - Player->Health;
Player->Mana -= 3;
}
Player->Health += HP;
Player->Mana -= 3;
}
}
if (SP && Player)
{
if ((!Player->Death) && (Player->Health > 0))
{
Player->Mana += SP;
}
}
}
if (Enemy)
{
AEnemyCharacter* EnemyCast = Cast<AEnemyCharacter>(Enemy);
if (EnemyCast->Race.Equals("Undead"))
{
if (HP)
{
EnemyCast->Health -= HP;
}
}
}
return 0;
}
i call this on beginplay
this is what it looks like, look at the hp/sp bar
https://imgur.com/a/JkvkfyI
when the mana decreases im casting the ability to increase hp
When you change the hp/mana, are you doing it on the client or the server? If I recall correctly, the server has the final say on the value.
yeah, i just realized this. has to happen on the server
hello there,
I am working on a nameplate functionality using the tutorial link given.
he is doing a RPC on server. and then server is doing a RPC multicast.
but I want to avoid multicast RPC.
is there anyway to do.
I am pretty much new to multilayer implementation.
thanks in advance.
Old Project: https://bit.ly/3h9Dpg4
New Project: https://youtu.be/TYDack1ifbM
Join the fun: https://discord.gg/32qgNwm
I haven't watched the tutorial but if you don't want to do something you should be able to just not do it
Really though multicast seems like the wrong thing to use anyway. You would be better off just using the player state since it's replicated for you and contains the player name
thanks for this information.
hope it will helpful.
The name would be a TextRenderComponent attached to the player pawn
I am using a widget and attached to head of player character.
but if this is the way to avoid multicast.
then I'll do it.
thanks
Ah it's doesn't matter if it's a WidgetComponent or a TextRenderComponent honestly. It's just that a TextRenderComponent seems more natural and gets the job done faster (though you don't need localization).
Yeah multicasts are of course not intended for this
Another sad day for YT tuts
lol
thanks for the information.
FFS
Wondering what bKeepNonOwnedActor means? All they saying down there is "we don't own this actor"? Who are we?
TArray<AActor*> ActuallyKeptActors;
ActuallyKeptActors.Reserve(KeepAnnotation.Num());
// Rename dynamic actors in the old world's PersistentLevel that we want to keep into the new world
auto ProcessActor = [this, &KeepAnnotation, &ActuallyKeptActors, NetDriver](AActor* TheActor) -> bool
{
const FNetworkObjectInfo* NetworkObjectInfo = NetDriver ? NetDriver->FindNetworkObjectInfo(TheActor) : nullptr;
const bool bIsInCurrentLevel = TheActor->GetLevel() == CurrentWorld->PersistentLevel;
const bool bManuallyMarkedKeep = KeepAnnotation.Get(TheActor);
const bool bDormant = NetworkObjectInfo && NetDriver && NetDriver->ServerConnection && NetworkObjectInfo->DormantConnections.Contains(NetDriver->ServerConnection);
const bool bKeepNonOwnedActor = TheActor->GetLocalRole() < ROLE_Authority && !bDormant && !TheActor->IsNetStartupActor();
const bool bForceExcludeActor = TheActor->IsA(ALevelScriptActor::StaticClass());
// Keep if it's in the current level AND it isn't specifically excluded AND it was either marked as should keep OR we don't own this actor
if (bIsInCurrentLevel && !bForceExcludeActor && (bManuallyMarkedKeep || bKeepNonOwnedActor))
{
ActuallyKeptActors.Add(TheActor);
return true;
}
That is part of the code of persisting actors on seamless travel
The better question is: When will an actor have Role < Role_Authortiy? (away from the player related ones: Pawn/Controller/PlayerState)
I managed to make an actor to has bKeepNonOwnedActor == true by making it:
- Preplaced.
- NetLoadOnClient = false.
But that's dumb. Not sure when I will have such an actor. Seems to me they are referring to a specific type of actors
I have actually used that setup, but pretty damn rare tbh
IIRC what it does is cause the actor to not be loaded by the client as part of level startup, but will sort of "spawn" the actor for the client and replicate it down
So it's almost like you had a spawner there or something
Can't imagine why I'd want to keep it for seamless travel though :/
Unless you were going back to the same level or something.. IDK
Ah I didn't make it Replicated. If I did it would have persisted right?
Ah yeah, I would think so
Cause with NetLoadOnClient set to false the client has no idea it's there
reallly odd case though to bring that accross
Oh maybe there's more to what we did then
Yeah I see
Oh yeah sorry, this was a replicated actor that was pre-placed in the level. But them being pre-placed caused some issues for clients, so we marked them as bNetLoadOnClient to false, which would cause the server/client to treat it like a "spawned" actor rather than a preplaced one essentially
Correct, it would have a dynamic net guid I guess?
Yeah I would assume so
no idea why you'd want that to persist on seamless travel though
Another totally different question, does the Outer affect if an Object gets to persist to the destination level?
To put you more into context: I'm trying to understand why UUserWidgets are persisting a seamless travel. So it turns out that happens because their outer is GameInstance. If I Rename them so their outer changes to be something else, say Character, then they don't persist.
yeah that makes sense to me
we only use GI for stuff that should survive level/actor lifetimes like dialog boxes etc - but gameplay widgets are always assigned to the controller that's looking at them in our case
By assigned you mean owned or outered?
Yeah, although we do explicitly kill them off in our AHUD when it's destroyed as otherwise they would also persist with the controller
I'm sure widgets never used to survive level transitions in ye olden days
Lyra uses LocalPlayer as the owner so I assume it has the same problem and they have to manually clear somewhere
Right. If they are outered to the PlayerController and the new level class of the PC is same as old then the PC persists and so does the widget
yah
Plus they're referencing a bunch of level actors and stuff usually, so we always just kill them
Also if I look at this:
/**
* called on server during seamless level transitions to get the list of Actors that should be moved into the new level
* PlayerControllers, Role < ROLE_Authority Actors, and any non-Actors that are inside an Actor that is in the list
* (i.e. Object.Outer == Actor in the list)
* are all automatically moved regardless of whether they're included here
* only dynamic actors in the PersistentLevel may be moved (this includes all actors spawned during gameplay)
* this is called for both parts of the transition because actors might change while in the middle (e.g. players might join or leave the game)
* @see also PlayerController::GetSeamlessTravelActorList() (the function that's called on clients)
* @param bToTransition true if we are going from old level to transition map, false if we are going from transition map to new level
* @param ActorList (out) list of actors to maintain
*/
virtual void GetSeamlessTravelActorList(bool bToTransition, TArray<AActor*>& ActorList);
You can see this part: (i.e. Object.Outer == Actor in the list)
So their has to be something with the Outer
oh yeah, figures - would be components and stuff I guess
But what is puzzling is that it's the Object referencing the GameInstance/PC, not the other way around? Why they aren't getting GCed?
So I used this obj refs command and it turns out they are being referenced by the slate widget which isn't GCed.
But that still doesn't explain the behavior I'm getting

I just don't think there's a mechanism for automatically killing widgets when the level changes, since they aren't bound to the level in anyway
Unless they are "outered" by an actor or something that lives in it
Hard traveling does it by binding to a delegate that calls a function that does it
Yeah that's why they only persist in seamless
Oh HARD travelling, gotcha
And only under the condition of Outer being persistent
At this point I'm pretty sure that any UObject that is outered to a UObject that is persistent will also be persistent
yeah
We manually clear them up, I expect we'd have the same issue if we didn't probably
Quite literally:
void AShooterHUD::Destroyed() { CleanupWidgets(); // blah }
But keep in mind the HUD is persistent up to the point the newer HUD is created
So Destroyed fires but a bit late
I would probably do it on FWorldDelegates::OnSeamlessTravelStart delegate
The thing is that I can't still prove why this is the case. Seems like the outer refs them back in return but still I can't prove that either...
Hi <@&608320500170620938> , I am trying to spawn a character on my map. The "possess" functionality doesn't seem to work on the client side but. I tried adding delay but still it was of no use. Please help if possible.
This is the event graph
I've been here for a few years and never seen that ping 
Whatever the thing is you are using GetPlayerController(0)
That is only making the first player possess
We know that is event graph but we don't know what class it is
This is the level blueprint
Oh no.
I tried the same in the game mode
You don't use the level BP for such a thing
Not that you use it for many things
Reason being the level BP isn't replicated so you can't fire RPCs there anyway
And you have timing issues
Same like GameMode
But the good news is you don't need RPCs at all
And you do need GameMode as that is where the engine spawns pawns
So more or less you are going to go the engine route
My suggestion would be to read Cedric's Compendium found in this channel pins and you should be able to solve the problem by yourself
Another two notes:
- You should avoid using delays when doing multiplayers.
- You should know that BeginPlay usually fires on server and client so splitting the two execution paths is generally done using a SwitchHasAuthority
Ok.... Thank you so much...!
how can this "authority only" option be enabled in a function created from a blueprint?
you meant netmode == server ? that's right ?
Silly NetMode isn't exposed to BP, so you will have to do your own function that you just attach it to your custom BP functions
I literally meant what I typed. That covers all the cases written here
All types of servers
Listen, dedicated and SinglePlayer
Well, thank you.
Or you can just use IsServer
It's exposed to BP and does somehow what I typed
It does the not equal operator though
HI guys, I have the following BP to toggle between character movement modes. It works perfectly fine except for the use controller roatation yaw bit, which does not seem to replicate client -> server. It worked perfectly fine when I initially set it up, I don't remember having to do anything special to get it to work. Any advice as to where I should start looking for the solution?
Not that I do any CMC, but my initial guess would be that you might want to set that variable on server (too)
Yeah you are right, just did a quick RPC and worked no problem. Really odd - I must have somehow removed the code that replicated this before. Many thanks.
I'm looking at disabling movement when GamePlay effects apply an Immobilized tag.
Will this code behave nicely if implemented in a GetMaxSpeed override of CharacterMovementComponent sub class or is there a better/simpler way? I was also looking at just setting the MovementMode to None as a possibility.
float USSPCharacterMovementComponent::GetMaxSpeed() const
{
ACharacterBase* Owner = Cast<ACharacterBase>(GetOwner());
if (!Owner->IsAlive())
{
return 0.0f;
}
const int32 ImmobilizedTagCount = Owner->GetAbilitySystemComponent()->GetTagCount(ImmobilizedTag);
const int32 ImmobilizedRemovalTagCount = Owner->GetAbilitySystemComponent()->GetTagCount(ImmobilizedRemovalTag);
if (bImmobilized || Owner->GetAbilitySystemComponent() && ImmobilizedTagCount > ImmobilizedRemovalTagCount)
{
return 0.0f;
}
const float MoveSpeed = Owner->GetMoveSpeed();
return MoveSpeed;
}
I set MovementMode to none when I want to disable movement, but there might be better practices for GAS. I would also consider asking in #gameplay-ability-system
Should I link to my post if I want to cross-post or just copy it whoesale, hope it doesn't feel like spam if I post the question multiple places.
Good to know that it isn't an unheard of way of doing it though.
Both options are good. The latter would just force peeps to see it so it's better.
And no you are not cross posting at this point
Why not just return Owner->GetMoveSpeed(); ?
You mean condense the two last lines? I'm not sure why I wrote it like that, maybe leftovers from lines gone.
Also, why do you check Owner->GetAbilitySystemComponent() in the if expression, but not when getting the tag counts?
You should rewrite this function almost entirely!
No idea, good call. I think I can just assume it to have an AbilitySystemComponent.
check() it to be sure.
For instance, you can check bImobilized and return early.
Then check the Owner. Then check the Owner->GAS.
I have to do it a lot. 😦
Review or rewrite? 😄
But those always lead to good places and never hurts feelings of developers! 😄
Absolutely!
I vote for #coding-standards 👀
This one coding standard said to use virtual or override. I cried inside. Luckily it wasn't ours.
A bare-knuckle fighting pit where the winner decides! This week: capitalization rules are on the line!
I usually rally the support of my fellow coders!
Why discuss when you can just refactor the entire code base whenever anyone steps out of line, then revert their revert of your intrusive refactor?
Ah, that's a good place to be!
why cant RPCs have a return type? is there a way around this?
Because they are asynchronous.
Having an immediate return type doesn't make sense.
The way around it is to make a second RPC which sends data back (or use onreps if it's server->client)
It's like sending a letter and expecting a response the second you put it in the letterbox.
so if i wanted an rpc to return a bool i would have a second rpc that send data back in what way?
Correct.
but you said RPCs cant have a return type?
i'd need an example to understand what youre getting at
{
Client_DoSomethingResult(true);
}
void Client_DoSomethingResult(bool bResult)
{
// Voila
}```
i see
You can't perform a network request synchronously, you're sending data from one PC to another which takes time
(an arbitrary amount of time also)
Hey, question. What do you guys think is a good project/feature to make to in general gain more knowledge about multiplayer? I feel like the silly spaceship game I'm working on just isn't really learning me anything new or pushes me in any way. Except me just getting triggered by Unreal's UI system lol. I'm trying to improve my knowledge of this all but I'm just not really sure what to learn that would actually be good to know 🙂
Write blog posts. 👀
Blog posts are underrated I knew it 
Anything that comes to your mind honestly
You will feel the pressure that this will be seen by many people and you will spend much time just cracking every bit of the thing you're exploring
Even basic systems that you think you understand, will amaze you by the pitfalls and secrets they have
How to make my own fully predicted server authoritative spaceship vehicle
That is nice but tough as it touches on prediction. You'll get reach though I assure you
Hehe imagine packet loss with a blocking RPC
No such thing as packet loss with TCP am I right 😛
Hehe
Write*
Honestly? Just do a simple wave based shooter.
Forgive my sleepless head 😛
That's essentially what my spaceship game is 🙂
Find ways to make it push you harder. 10x your enemy count. Add power ups that dilate time. Add a black hole bomb that sucks everything in
Make it a network or split screen game
There's lots of value in taking even a simple game all the way through to a releasable package though (even if it's free). Soooo much to learn from the final 10% of a project. It's where you really see the impacts of decisions made early in development that back you into a corner. All the ins and outs of adding the tiny bits of polish that take a game from just playable to a smooth fun experience
But yeah, if you find the project isn't pushing you in ways you want, I'd look at spicing it up, not scrapping it
Yeah, what Boris said 😅
Easy, try shipping it.
Put it on Steam, build a store page, get bug reports, fix issues, etc.
Not for everyone, but a great learning experience!
I vote for split-screen. You will be able to answer the few questions that are left unanswered here @twilit radish
I think those are pretty good ideas. Both making something that's more challenging instead of my lazy implementations I've done so far honestly and trying to actually make it a full working thing 🙂
Not sure if I will actually publish it on Steam but the idea of having a version that in theory could go on it sounds like a first step 😄
Thanks for the input all!
Does anyone know if an actor can have issues with RepGraph if it's not ticking ?
Doesn't matter
mmmh okay
i'm facing a weird issue then
I guess i'm giving weapons too early that pawn had not time to be added to rep graph
possibly. if you're using the dependency system, it will silently fail if you add it to the graph before the parent actor
Facing a weird issue since i implemented the shooter game example for rep graph, my players does not see other players weapon
So yeah it might be that
I well implemented my weapon actor to it, exactly like ShooterGame so idk where is the issue
That looks like Lyra not ShooterGame?
unless you're doing massive online game rep graph is pretty pointless anyway tbh
In my own version of repgraph I keep anything that is dependant on it's owner/parent in a pending list, and check that list whenever a new actor is added
I merged my project to Lyra
My project was based on ShooterGame, then implemented GAS etc....
So yeah it's lyra but not lyra 😄
the whole weapon logic etc are not the one from lyra
it's more like the one from UT4/ShooterGame with GAS implemented in it
just wanna experiment ngl
i better learn those systems now than having one day the task to implement it in a professional situation and having no clue how it works nor how to implement it
Yeah fair enough, that's probably the issue anyway
Pretty common problem when you're spawning actors that also spawn other actors as part of their startup/init process
yeah i'll try to give the weapon 5sec later to see if that's it
but that's very weird cause i'm spawning the weapons in Pawn's Possessed function
it should be initialized etc since that
Hard to say really
Okay i know where is the problem 😛
It's when the simulated has to call Equip function on other clients
That's what i'm doing for late joiner or rare case where player does not see other player weapons
So i guess i should call the Equip function directly (since it handles the RepGraph delegate)
Has anyone ever used the built-in spectating system? It feels like a mess and I'm not sure if it's just me not understanding it correctly or it actually being a mess. PlayerController has a state for being a spectator (or playing or being inactive) while PlayerState also has 2 states for spectators ('is a spectator' and 'can only ever be a spectator') but they don't nicely seem to get updated. Then for some reason GameModeBase has a bStartPlayersAsSpectators that only ever prevents someone from spawning the default pawn and doesn't actually change any of the state. Very confusing lol.
It's garbage legacy stuff from UT/Gears
But probably never going to be culled because no doubt many licensees sorta depend on it
Got it. Then I'll just write something my self 🙂
Maybe one day we'll get UE to remove a bunch of cruft.
It's usable but only when jumping through hoops tbh
No doubt people can do something more specific for them
Is it possible to make my weapon actor dependant of the owner for the replication ? It seems like my bEquipped is called way too early, my character had not yet been added to RepGraph that my weapon has been created, spawned and fully replicated 😐
It is but you have to handle it gracefully in replication graph
See here: <#multiplayer message>
Isn't there a way to copy the movements of the car without using repetitive motion? The 2nd user agent hangs a lot when using the replicate move.
Good day guys! can you tell me text chat services like vivox or photon that work well with Unreal engine ? I am testing streamchat but so far not so good results , photon and vivox only have voice chat as far I can test. Thank you so much in advace to all of you!
btw I cant use Eos chat because the game wont be in the Epic store by the time.
You dont need a game in the epic store to use EOS afaik
ohh really?!
99% sure, but double check
I was given that for granted ! I will double check that! thanks!! if that so it will be awesome!
good luck :)
"Epic Online Services will work across any engine, any store, and are designed to be integrated with any major platform. With a single SDK, you can easily access any of the services offered by Epic." Ohh boy! thanks @gleaming kite !!!
glad I could help
Quick question, why do Anim notifies not fire on the server when triggered by a client? The client is playing the anim infornt of the listen server so it’s not like it’s being culled or anything. Strangely though, anim notifies that are triggered by the server fire on all clients and the server
Also all clients fire the notify so it’s not a replication issue, it’s just that the server doesn’t fire clients rep-notifies
I hightly doubt that your anim notify is replicated
just the animation is playing on both sides so the notify happens on both sides
Well yeah it’s not. But the issue is the listen server isn’t firing anim notifies for client meshes.
How is the animation being played? Is the listen server playing an animation on the clients mesh?
From the host POV, does the clients mesh play the anim?
It’s just driven by the cmc in an anim graph. But yes, the clients are playing the animation from the host pov
If anyone has any tips on this it would be much appreciated as I’m struggling to find a working solution. I suppose I could rpc to the server but these notifies are firing multiple times a second at times (footsteps)
Ok, I found a fix by setting bOnlyAllowAutonomousTickPose = false; on the Mesh and commenting out TickCharacterPose(DeltaTime); in MoveAutonomous() on the CMC.
It seems like the listen server doesnt really play client animations but a weird netsynced version of keyframes. I'm sure its not synced anymore but for my use case its good enough.
I was having a different issue (But similar solution) which was trying to fix 'laggy' view the listen server has of other clients
I followed this link to fix the issue:
https://www.reddit.com/r/unrealengine/comments/a0n455/listen_server_host_sees_clients_jittering_fix/
12 votes and 5 comments so far on Reddit
Sup guys
Do you know, is there a way how I can hide smth for a player that is hosting listen server?
I want to hide things ONLY for host and not for other players of course
Checking the Role might help you here: https://docs.unrealengine.com/5.0/en-US/actor-role-and-remoterole-in-unreal-engine/
Thats what I used to fix it too :) Thank you. Do you have any info on the Bandwidth part of that thread? I dont know if setting MaxInternetClientRate=50000 would affect things negatively
Hi, I'm spawning an actor during runtime, adding a static mesh component to it, setting the mesh, and then enabling replication on the component. Both client and server can see it when I do it in blueprint, but not when I do it in c++, I can only see the actors on server
Creating and setting the mesh^
The blueprint and c++ versions both create the same actor class, which has replication enabled in the constructor
The actor gets spawned at a random location so I can't just have each client call the spawn function individually
Just curious, why does the Ore actor not already have a static mesh component?
Also, most of those component properties are not replicated
So server and client will have different collision settings, different physics settings etc.
About the only property that is replicated is the mesh to use
whats the best approach then?
I've got it to work properly now in c++, turns out the spawn parameters were messing it up
Still interested in what the best practice is for replicating components
I'm having issues with my dedicated server build. I created a Docker image that builds my server based on the one at unrealcontainers.com. The build and everything works fine, but when I run the docker container the server seems like it doesn't quite finish starting. Here are the logs - https://gist.github.com/Coop56/f3233f7b73fbe3ffd09e28e5e2c46c22 - notice how they seem to just stop and never create a socket bind. Normally I'd expect to see something in there like Created socket for bind address 0.0.0.0 on port 7777 but I don't have that in my logs. Can't connect to the server either. Here's the Dockerfile if that might be helpful. https://gist.github.com/Coop56/0257e926747ad046865f3302d5ec8f28 I'm running the docker container with docker run -d -p 7777:7777 image-name. It's hosted on an Ubuntu 22 droplet on Digital Ocean. I opened up port 7777 with ufw allow 7777. Anyone have any ideas?
Working on predicting root motion (not using GAS) with my own ability system and having jitter every time I do so. Currently my custom ability system applies the root motion on the client, and I am then integrating with the CMC to have the network move data also call that root motion on the server. For simulated proxies I am replicating an object that just applies the root motion on PostNetReceive, and I'm using the bNetOwner flag in ReplicateSubobjects to avoid replicating this object to the owning client. I have checked with logging and the root motion is successfully running on the owning client, server, and simulated client once each, it looks smooth on the server and simulating client, but the owner has some snapping around that occurs pretty consistently.
I am really struggling to understand the cause, as I have implemented things pretty similarly to use Launch Character and to be able to teleport within the CMC's prediction system and those work without a hitch or any net corrections... It's just root motion stuff that causes jitter.
I can post code if that helps but there is a LOT of different stuff involved and I'm not sure exactly where things are going wrong
Best approach is make it a default component with the appropriate settings as an asset. If you can't do that, you'll need to manually replicate any additional properties that you want to sync down to clients.
Hi
I created a widget in the form of world. but somehow it doesn't show up
does anyone have a solution? (in stand alone, BP can work)
Does the actor not show up, is the widget not visible? Also what calls the "OpenWidget" RPC from Client -> Server?
widget not visible even after i trigger it
what is RPC from Client -> Server?
i still beginning in multiplayer so I don't know the meaning of RPC
The "SR_OpenWidget" event is what I was referring to.
As in what is actually calling / triggering that event 🙂
ok, thank you!
i learning from https://www.youtube.com/watch?v=2GYicrkCElA
but this time te BP set in world
Hey guys, in today's video, I'm going to be showing you how to replicate user widgets. This means you can display a widget on one players screen, or everyone's screen.
Blueprint Interfaces: https://youtu.be/m90ZkbtPA9s
#Ue4 #UnrealEngine4 #Ue4Tutorial
00:00 - Intro
00:...
So what my guess would be is that you're calling the RPC/Event on the actor directly, which likely isn't owned by that player. A client needs to own the actor to be able to call a RPC/Server side event on it. I quickly looked at your tutorial and the person in that video uses the third person character (which is owned by the client) to send that RPC/event to the server. What I would recommend you do is either use the PlayerController or also a Pawn/Character and put the interaction event from Client -> Server in there and then from there do the multicast/event to all players on your UI actor 🙂
I would prolly Reset them before doing the travel. See AGameModeBase::ResetLevel for reference
BeginPlay won't get called for sure. And I don't see the part where same class is mentioned there. But if you want BeginPlay to get called, call it yourself in APlayerController::Reset.
That will call it server-side
Call it in ClientReset to call it client-side
You have to reset them yourself
Reset doesn't do anything really
It's a convenience function for you to implement
I don't think you need to destroy and respawn your controller really
If all you're doing is reloading your level
Even seamless travel doesn't reloading them by default if they were the same class
That is left for you to do
And oh yeah that same class part is if you are seamless traveling correct
Right, but if you are traveling to the same map then they are same class, and I don't see a value in reinstantiating them
That if they were the same class
Then you will have to make new classes
Or edit engine code
It's a good practice to make different classes fwiw
For different levels that is
Yes
You will prolly at some point have different logic
So you are ready for that moment from now
The same level will be handled differently. You will have the same PCs and reset them
Or you reinstantiate
Just how you see best
You can recreate the engine functionality. Though you have to be careful. I would prolly just Reset them
It will stay in GameMode. Some other GameMode function will call it prolly
I can't know who that will be
Will have to look at code
No worries. As long as you know what you're doing and you are not reinventing wheels, then you're good to go!
Wizard I hate Unreal
It's biased towards GameModeBase 😂
I'm trying to spawn and possess my own pawn instead of using the default system, but for some reason BeginPlay gets called directly when spawning the pawn while when the default system does this it only does it after things like ownership have been initialised. Which in my case makes IsLocallyControlled fail for just the listen server host.
Yeah that's right.
BeginPlay gets called usually before the pawn is Possessed
Ah you're referring to the vanilla behavior
The new system is me just doing this:
APlayerShip* Ship = GetWorld()->SpawnActor<APlayerShip>(PlayerShipToSpawn, FoundSpawn->GetActorLocation(), FoundSpawn->GetActorRotation());
Controller->Possess(Ship);
```But for some reason whenever the default GameModeBase does this it works just fine with BeginPlay and IsLocallyControlled.
But when I do it with the above code it has different behaviour for the listen server.
I mean I'm pretty sure even in vanilla you can't guarantee that is the case either
In vanilla they do it kinda like this
And that's why it confuses me
Why does it work really consistently when using the default behaviour but when I do the exact same thing it's different xD
Unreal just hates me 😔
I assure you the default behavior doesn't work for me lol. Unreal is just playing games with you 😛
There is a race actually here
Possess and BeginPlay
I'm just going to change it to what I did with my other project, OnRep overrides everywhere 😄
I mean the best I found is to call a client RPC when Possess fires and then check IsLocalllyControlled, etc.
But why would I call an RPC for that when I can override a method?
There's a replicated property for the owner.
It's default Unreal behaviour.
I don't think I'm following. You are doing things in BeginPlay but IsLocallyControlled is failing because the pawn hasn't been possessed yet
Correct.
So what my solution in a different project was is doing this:
// Client side detection of when the controller gets set...
virtual void OnRep_Controller() override;
// Overriden so the server...
virtual void PossessedBy(AController* NewController) override;
PossessedBy gets called on the server, and OnRep_Controller on the client.
Right.
I was going to say my other method
Which I haven't got to try yet
AcknowledgePossession
for client
GAS compendium mentioned it, as you have to initialize things for server and client and I still recall that
For server they use PossessedBy which is 💯
Anyway either this or yours sound better to me than calling an RPC. But you know for BP peeps it's inevitable 😔
Thanks for your help
So Wizard. Your AcknowledgePossession gets called based on the same OnRep that I override xD
Also I hate the code for PlayerController. It basically copies the code of AController and then proceeds to not call the Super in this specific method :/
Here like why:
https://github.com/EpicGames/UnrealEngine/blob/46544fa5e0aa9e6740c19b44b0628b72e7bbd5ce/Engine/Source/Runtime/Engine/Private/Controller.cpp#L342
https://github.com/EpicGames/UnrealEngine/blob/46544fa5e0aa9e6740c19b44b0628b72e7bbd5ce/Engine/Source/Runtime/Engine/Private/PlayerController.cpp#L743
PlayerController overrides that method from Controller and then just yoinks most of the code instead of just calling the super or similar x)
But yeah either Acknowledge or OnRep works for this purpose.
I bet most if not all of that code hasn't changed since 4.0
Probably lol.
I still want to see if there's something that triggers on both client and server though. Instead of needing 2 methods.
xD
:o
It seems to get called both server and client yeah.
Time to test it out
It's not virtual :c
It is
Oh wait nevermind.
I was looking at void DispatchRestart(bool bCallClientRestart);
😮
Will I get credit when you release?
Some person from Discord.
Special thanks to:
"The wizard person from Discord"
No worries, glad helping you.
I mean.. The compendium definitely has helped a lot too 😄
Though:
APawn::Restart > Compendium
Haha
Okay enough offtopic :D
Let's be honest here
Ok so real talk. Anyone knows a good article or similar about proper ways of doing interpolation? My current system is definitely not as smooth as I would like to.
The gamedev.tv course?
Store start transform and velocities, arrival transform and velocities, and go CubicInterp / CubicInterpDerivative on those on Tick
But that YT tutorial said Tick is bad
Thing is I don't use velocity, it's a direct move and stop but other than that it's basically what I do right now. I was reading a bit already though and my issue may just be that I don't have any kind of buffer. The packets currently come in and immediately get forwarded and the client immediately lerps towards that target. So the problem with that I would assume is inconsistent packet flow.
currently working on that. Really nice page, thanks a lot
No worries, here for questions!
You need to measure the average replication rate, then on tick you'd interpolate the location when you received the last transform toward the newly received transform, over that average replication time
And you kinda need velocities to have realistic smoothing
But this I think still doesn't solve the issue of inconsistent packets right? If I average out the speed at which the interpolation goes you will still run into cases where you don't have any data left because of inconsistent connections.
That's why you use the velocity, because then you simply keep moving
With the often true assumption that movement will keep going on for at least half a second
By that time if you don't have updates, you are getting weird results no matter what
The point of averaging the replication rate and using the velocity is that you're going to recreate a smooth trajectory from a slower, unpredictable source
I can't say I ever saw a proper page about Interpolation and Extrapolation for Movement. Something that explains this maybe in 2D with all values involved.
There is a nice page about the concept of this, but not walking one through the ideas behind an implementation
just use physics, interp + extrap for free 😄
James, leave
run away
The Krazy Karts parts of the udemy multiplayer mastery tutorials explains quite well
That sounds very much hidden in some random course though
It doesn't handle listen server smoothly but other than that it teaches how to implement rollback/replay/interp for a new movement component
By now I have the feeling that either no one wants to explain this or it's seen as so simple that everyone who can't come up with te code themselves is deemed an idiot
;_;
The opposite really, nothing about it is simple
And few people actually implement their own network movement
If it was this simple no game would have jitter issues lol.
Yeah I know, but if it would be broken down to 2D movement on 1 Axis, it could at least be made somewhat approachable
Well, I'm not saying it's "simple"
But the idea about interpolation and extrapolation is probably the same in most games
Including how it's done
This doesn't strike me like something that can be reinvented 50 times
According to the Rocket League video in the pins they supposedly dynamically change the rate at which they interpolate based on how many packets they have left in a buffer. Not sure if they still use this though.
Not reinvented no, but... I used to have a clean, simple multiplayer floating pawn movement with proper rollback replay, but it ended being 90% implementing specific features from the game that you have to handle speciifcally
I think most people end up with the same conclusion
pretty much tbh
Like I had a pick up animation that inevitably ended up being a "turn off simulation, do your thing locally and then we'll talk about resuming MP movement"
You can't exactly make that generically
Also I'm not joking when I said use physics btw 😄
But the example doesn't need dynamical rate changes
I don't teach multiplayer by letting someone look at UT
my floaty boys have been physics for a long time now
and the free interp/extrap does a lot of heavy lifting
I'd rather die than use physics tbh
Doesn't physics totally remove the ability to play back moves?
Do we refer to velocity with physics or what do we consider 'physics based'?
Welp, I went through the trouble of making your floaty boys with vector math
physics here means engine physics
by physics I mean checking the "simulate physics" box essentially
And I can say I hated every minute of it, but it made me a better person, in regards to knowing that I will never do that again
They were kinematic for a long time, essentially CMC's approach. The problem I had was solving collision with more complex bodies, it became so difficult and expensive to do myself
Physics here means he freaking sold his soul
Same here, for anything like floating movement it's the call IMHO. For vehicles.......... well you're fucked.
Vehicles as in wheeled
It depends again
Yeah wheeled vehicles is literally what made me make the transition
Just implement your own deterministic fixed timestamp physics engine 😄
Formula One? Physics + Client Auth
James buggy Hell Let Loose vehicles? Server Auth with Corrections 
floating bricks were quite easy to solve collision for in a reasonable way, since 99% of the time they aren't touching anything. Wheeled vehicles with moving parts and constant contact just became a minefield
Shots fired
(just pulling his leg)
But also didn't Fortnite do that? (client auth part)
You're not wrong though 😄
HLL Is server auth but we get away with it because the vehicles feel crap almost by design
And they're slow/sluggish
FN is client-auth physics yah
At least, it was when Epic guy told me a couple of years ago - they just went really hard on anti-cheat but didn't detail how
The moment even Fortnite gives up is a danger sign lol.
Honestly. there was a time where I really loved Multiplayer. So much that I wanted more people to make it, thus the Compendium.
And I still love multiplayer, but I have long noticed the huge difference in FUN multiplayer and COMPETITIVE multiplayer.
And the competitive games are just not fun to make.
I felt bad about not being able to find a solution for years until I realised people dedicate their entire careers to it and still haven't found a solution
I'm currently fighting cooldowns for GAS in a fast paced moba brawler
I just hate it
Competitive MP I would only touch if it was turn-based
The company I work for has a MP turn based game 😄
Although I don't actually work on the game it self as in programming or whatever.
MP games are pretty "heuristic" in nature in turns out - and that's a trigger word for me
Gimme whacky multiplayer like Plate Up or Overcooked
Give me nice closed-form solutions anyday
Or something fun like Unrailed
It's also that UE opens a new door of "How is that not a thing and why is it so much extra work?" every few days/weeks.
I never realized that stuns + CMC don't actually work out of the box, cause the SavedMoves have no idea about the stun.
How can anyone make BP MP Games ;_;
By having no authority and just praying some delays work lol.
That's kind of the average technique if you look in here 😅
It is, and I would probably go for that all day
I mean, not the delays
But the praying
It just depends on the game I guess.. Like you said competitive games suck and co-op and all that stuff no one cares about cheats as long as it works.
Hear me out: turn-based games! No cheating, no delays, nothing complicated
Want it competitive? No problem
I'm sure it comes with its own problems
But yeah, real time sucks
Somewhere on the todo list is predictively spawning projectiles
Shoot me please
Like, I don't care about the damn spawn delay ;_;
lmao
Man
I'm so sorry
"oh no the player did not in fact fire, you didn't see nothing"
And then you look at games like Overwatch and even they just didn't freaking care
Don't get me started on Dead by Daylights delays
Their programmers must have some unique skill of convincing designers that it's not worth the time
I can probably rant 2x as long as I can share knowledge by now
Next life
Games like WoW are probably even more chill
They just show you all the effects
Doesn't matter the ability never fired
Health just not going to move
f u
MMOs usually have zero chill about net quality
Here's the new update
Yes you teleported
So what
Explosions go brrrt
absorb my c o n t e n t
The Division sounds like a fun one to work on according to their developers.. Several hundreds of players per server with in parallel processed worlds and on top of that PvP 😄
Division was famously prone to hacks too when it launched
Due to too much client auth
I remember them weapon hax
Can't beat the Splatoon hacks
Remember peeps, they made a second one of that
I still like the simplicity of lag switching
In Dead by Daylight
How bad is it?
Right now, no idea
It used to be "players can change weapon names for other players" bad
IIRC
I never understood GTA 5 cheating tbh
From the outside it seemed like everything was client auth
I can't imaging a scenario in which they would allow clients to spawn money
GTA 5 is supposedly true p2p from what I can find online quickly.
So I guess all clients just accept the nonsense of other clients.
Because it is 😅
From my experience of about 5k hours in GTA 5 online I can pretty confidently say that the 90% of the logic is completely client authoritative lol
Unbelievable :D
While using the Steam Subsystem what should the other client expect after calling SendSessionInviteToFriend ?
Do I need to handle that myself or will there be a steam popup message saying xyz invited you to a session?
Currently I don't see anything like that
IIRC you need to handle it yourself
ShooterGame has some code that binds to callbacks in UShooterOnlineSessionClient
Hmm although that seems as though it's only for accepting an invite, where the callback is for receiving one I can't find atm
Hi, I am unable to use player state while on multiplayer server, the cast fails to my custom player state, how can I solve this
Probably it did not replicate yet
Why not just pull the value from the same PlayerState in the GameMode's SpawnDefaultPawn stuff?
Semi sure that PlayerStates exist by then.
Are we not going to talk about the RPC on BeginPlay?
I think that's what Stranger was referring to.
Also I have a setup like this and I simply save that value in the PlayerController too and override "SpawnDefaultPawnFor" or so in the GameMode
No, Stranger means the PlayerState Object hasn't replicated yet
Which is fair, that's what OnRep_PlayerState is for in C++.
But the RPC in general is redundant.
