#multiplayer
1 messages Β· Page 54 of 1
tick is only executed on server after open new level!
Pawn!
And what is your PIE play settings, dedicated or listen server, how many players?
Are you sure you're connecting to a server
in the Entry Level, there is open level function to join the server opend. so i click the play botton in the Entry map level
If ip is wrong, server is not open or anything, you'll stay in standalone mode, which will make you authority
before joining server
So your macro would exit from the server output execution pin
aha~!
Are you able to see that you're being connected here?
It would print a bunch of logs saying someone is connected
This one when join to server, holo mother is the default server map
but problem happend in the next level that is LV_1
How/where do you change level?
I open the LV_1 by this code from the holo mother, every level's pawn is same
Well, that should be the issue
Your input for Key 1 is being processed in Client, not server
Which means you're opening a level in client, this would disconnect the client from server
If you want to change level and carry your clients with you as well, you need to call OpenLevel in server
additionally,
This causes you to become standalone again and makes you the authority, for the macro
additionally, this one is the moment that i open the LV_1 level!
Oh my god~~~~~~~!!!!
I never thought about it!
Oh,,how? can you expalin me more?! just make event function executed on sever only one time?
When streaming sub level is also same?
How can i carry my client when change level?
but my client move to sub level of holo mother, and i move to LV_1 as persistant level....client and i not in the same level..but you mean the client in my computer?
Thank you very much. Thanks to you, the problem I've been wandering for 3 days has been solved.π π₯° π
I'm not sure about this one. But for entire map changes, if you do it from your client it will disconnect from server, if you do it from server, only then you can keep and carry your clients with yourself
Oh i got it completely!!!! I didn't recognize well about where i make code like pawn and level
how to know a client is connected to DedicatedServer in BP
I mean I want to know im connected to Dedserver or ListenServer
Don't think there is by default. Normally shouldn't matter. Only way I'd think if you really need it would be a basic RPC from client controller to server and back to check, and possibly cache the state.
Level Set Transform is not working, level is always loaded in 0,0,0 not as i set
Hi, I'm trying to package my game on oculus quest and when I switched to OnlineSubsystemOculus from OnlineSubsystemSteam I'm getting the following error when trying to host a session as a listen server
2023-01-19 16:51:21.225 18389-18434/com.company.game D/UE4: [2023.01.19-15.51.21:225][219]LogOnlineSession: Warning: Oculus: Can't start an online game for session (GameSession) that hasn't been created
I'm trying to plug my input axis into animation bp without replicating that float value.... is it already replicated somewhere?
For anyone who may come across this, I used this simple algo to determine a localized velocity and used that to determine my right/left axis input value without replicating anything extra:
FVector::DotProduct(-Character->GetActorRightVector(), Character->GetVelocity());
It's probably the case where it's locally controlled AND has authority, that is, listen server or standalone
Hey all. I have a 'ChildActor' component on my Player Character, and I am trying to pick up an item, and then have it set the Child Actor to a specific BP. This all works fine, except when i try replicating it to the other player, so they can see the person is holding it.
I have the Child Actor component replicated, but if I check the 'Replicates' option in the item BP, it doesn't show on either screen. If I leave that unchecked, only the player that has the item out can see that they are holding it. Anyone know how to achieve this?
Hey would something like character level (like league of legends only relevant for the time of game) be stored in the game mode , game instance or character or playerstate?
how do I get something unique per actor (like unique name or id)? I made a save game system but it dosent work with WP, loaded actors have different names I feel
i have setup EOS subsystem for my project and it all works well until you try to join a session. It just finds a session joins it (or at least the join session node gets a success) after that my menu with host/find session buttons dissapear (as i have setup with my nodes) but after a bit of waiting it just comes back but now i cant press host or find session, if i do they instantly fail (i have made sure that the hosted session is live via the devportal). Does anyone know why this happens? (im on ue 5.1 and using advanced sessions plugin)
I feel like #epic-online-services may perhaps be a better place for this, there's also Epic staff in there helping out π
Do please post some more info like how you are exactly doing it there though because it's usually extremely difficult to figure it out based on a description.
If you're referring to dynamic actors that are being spawned they don't have a persistent ID. Usually if you want to connect it to a unique ID you do that your self or use an existing ID. With for example players you can use their platform ID π
ah i see, ill post it in there with more information (didnt even see that channel) thanks
If you want other players to access that data you can store it just fine in the Player State yeah, as that's shared across all clients and the server. If you only want the server to know about it then I would use the Game Mode.
Personally I find the pawn/character more something to be used for things like health etc.
Make sure that the actor that owns the component is replicated / the component it self and that the actual actor template being spawned is also marked as replicated, additionally if that still doesn't work try marking all as "always relevant" to see if it's not just a relevancy issue.
But as a disclaimer the component sucks as it does some weird things. I had issues with it in the past within actual builds that didn't occur within the editor.
Say I'm building a persistent world, is it common to save actors like players, objects, npcs, so on. So if I restart the game it can load "stuff" back in the correct positions with correct variables?
If it's a persistent world, yes. I'm not sure how you want to persist anything beyond a restart if it's not saved somewhere π
The way games do it's usually different but it all comes in the end down to in some way storing the data that is required to rebuild the world upon a restart.
Survival games as an example usually split up their world into "chunks" which then get loaded dynamically based on where players are, bringing it all into memory at once and having to load an entire world like in Minecraft would be way too resource intensive. Some games can however totally get away with this. Think of perhaps a colony sim where you only have a small town to manage or whatever. But it simply depends on your needs.
@twilit radish ok, yea. I'm on the right track π now though, if I create a save object, it could handle all the saving, but I feel that it's maybe safer to use a couple different save objects, is that true?
I can't tell you, really depends on your game. You could split up your world into a fully dynamic system like Minecraft for example. You could split it up into a few distinct areas if you have a hand crafted world that's not too big or you could dump it all into one file if that's possible. In the end it comes down to how much data you put in there.
@twilit radish hmm ok.
@twilit radish
I mean netstartup (statically placed) actors , I found out when WP level is loaded actors have different names
something like this:
"BP_ProvinceLootBox_C_UAID_D45D641E2674305D01"_1722036828
I guess they add random id to end of the name
π€
thats actually fun cause afaik this way they generate a new name entry evertime π€
question about dedicated server, must tuto create 2 maps, one for server and one for players. On the server map, they are removing all static mesh. Why? and why we need 2 maps
are you on 5.1?
yea
so every time the cell loads these actors get a different name?
or the name is stable between loads and only this ID is generated the first time they get unloaded-loaded
I just load level (dedicated server, listen) and they have different name
I guess the UAID part is diffrent I have to make an new map and check
Not a single idea what you are talking about
Please rephrase
why we need to duplicate the map for server and game default map?
Thank you! ill use player state then it does need to be shared!
Because the Server might be a Dedicated Server and hence not need to start on a MainMenu_Level for example.
thanks u are right
have the improvements to replication that epic did for fortnite been implemented in ue4/ue5?
@limber gyro You might need to be more specific than that.
What improvements are you talking about?
Hi, when an actor is deemed no longer relevant it's destroyed on the client but is there an easy way to have an actor not destroyed but stop replicating?
well they can hold 100 players, i was wondering if u can hold that many players "out of the box"
considering a game of the same kind
or if u need to go and change stuff
u should be more specific with what u want to do, i feel like u are probably going at it the wrong way
but is this because there was improvements from fortnite? or was it like that from before?
ive seen people on the forums try like 30 something and have no issues
You may want to look into Dormancy. This stops replication to a connection for a given actor without destroying it.
Improvements from Fortnite made it easier to achieve for sure.
But Fortnite is not the reason its possible.
i know that in theory with optimisation it can be done
probably more
im just not very aware of those limitations since ive never dived into that kind of game with many players
You need significant understanding of how to design and optimize game systems in Unreal to achieve 100+ players.
so i was trying to get a feel for how easy it would be
It is not easy.
That doesnt mean it cant be done.
If you arent a seasoned developer/programmer, you will likely not achieve it.
what number would u say one could realisticly get without optimisation out of the box?
Thanks for replying!
Yea just reading about it now on fortnite. I'm just trying to start using replication graph at the moment and so do you know if there are any differences with how Dormancy behaves?
Also, is there a good article about best practice for using dormancy? I see calls like flush net dormancy but I can't tell if that's the correct thing to do over just setting dormancy to something else
That entirely depends on the game, its features and how good of a team you have developing it.
lets say a game like unreal tournament
There are so many factors that contribute to the performance of a game.
Its quite literally impossible to predict
On a broad scale
Games are designed to run with a specific number of Players.
UT is exactly the same.
Its designed to play with small numbers of Players.
Its unlikely that there is a single article that explains it all in detail.
The best thing to do is just read the Source Code.
i've been working on a overwatch style shooter for a while now and i got all the matchmaker and stuff done BUT ive been entertaining the idea of doing a small mmo after and i have no idea how far a multiplayer shooter is from an MMO, ive heard that MMOs are the hardest thing ever to develop tho
I have a higher chance of jumping to the moon than you do of making an MMO on your own.
well some dude did it on unity
Classic unreal development π₯²
Are you that dude?
i see that u work on ashes of creation, how did u guys go about the server?
did u use anything from unreal at all?
Intrepid likely have multiple extremely experienced network engineers handling their Servers...
so is that custom architecture a separated c++ programar that just sends data?
if i am allowed to ask
The bottom line is, unreal is not designed for MMOs out of the box.
yes i know that, im just curious if they have actual game logic being handled by an outside program
anyone have a resource/guide on separating the simulation tick rate from the network tick rate in unreal?
there's an MMO being made by some company which uses unreal; maybe they have a tech blog, or if you email their media contact, you can point out that the broader unreal community is really curious about challenges of building MMOs on unreal, and a tech blog might attract a bunch of talent
every one could use some tech blogs about MMOs
i feel like individual engineer will never be able to talk about it
theres nothing out there afaik
because of PR/IP reasons
i really had to dig deep to get some resources for a c# matchmaker, i cant even imagine where to start if i were to do a custom mmo server
it really is a pain when u have to rely on documentation and faith
I donβt think youβll find many if any resources on proper MMO stuff. The reason being that itβs extremely specific to the games and just overall difficult. The Division 2 has custom software in able to support hundreds of players on a single instance according to them and that stuff goes far to optimize that. Also with a team of people.
You'll find lots of tutorials on e.g. an inventory system, but you won't find tutorials on like, optimizing replication to meet your server frame time budget, because your server's frame time budget is specific to your game
it would be nice to have some simple examples from epic tho
docs alone can be daunting
not the inventory stuff, the replication stuff haha
https://technology.riotgames.com/news/valorants-128-tick-servers the section on replication
those u can find tons on youtube, they are good mostly to check if the have a better algorithm or if the do things in a more clever way
speaking of tick, whats the default tick rate on an unreal server?
I think it's 20 or 30 but is configurable iirc in some ini file......I need to work on this tonight actually
client tick is based on fps tho
thats quite low, i might need to look into that also
ehhh, it depends right, higher tick mitigates actor-advantage, but other ways to mitigate actor advantage could be to increase the length of actor-actor engagements, like giving players more health, or designing maps to provide more defensive advantages
tick rate is kinda a "fairness" mechanism in some sense I think, although it has other benefits for overall quality
I just want to make sure network ticking is independent from simulation ticking and that the client/server network tick rates match
but maybe what I find will help you, dunno
What do you mean by Simulation?
Physics simulation?
I guess the general state? So physics, game logic etc. versus actually sending the data.
Hey guys. I tried to Google it and search here but I'm not sure I know the answer. I'm working on a prop-hunt like game and I'm a bit stuck on possessing. I managed to trigger possessing on server, pick from multiple characters, random possess for newly connected players and it works fine BUT the server delay is annoying. I trigger the possess on server but it takes like 50-200ms even on local dedicated server. Sadly, it seems like there is no way to possess on client ... or is there?
I was thinking that instead of possessing different character I could instead just check the mesh I'm looking at and copy the properties. You know, the mesh, size and so on but stay as the same character.
This is exactly what you should be doing.
Having an individual Character class for every prop type is a naive approach and just asking for trouble.
Yep, noticed π
.
not exactly physics; physics can be enabled for a simulation and you can have physics related events or state, but I mean, like, the non-rendering stateful information related to the game; like you might have 200fps rendering rate, but your simulation rate might only be 10 or 20 ticks per second; if rendering is faster than simulation and the simulation involves movement for example, then rendering needs to interpolate the positions from the simulation....in a client-server model the server doesn't render, so it only has a simulation tick rate, and usually that is married to the client tick rate (they're the same) because it's easier to reason about, i guess it's just a convenient word for separating the rendering (always local) with the parts of the game that are communicated across the network
is physics sleep, rigid body sleep replicated in multiplayer?
I have like objects on the client side that don't seem to want to sleep at all, especially when they are near or stacked on top of each other
they just keep wiggling around, and it's causing fps drops
Do I have to force rigid body to sleep on the client side?
maybe, might also be this: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Physics/Substepping/
hello, can anyone recommend a good resource for learning how to do networking in UE5 "the right way"? I'm working on a new project and I've never added networking before, hoping to find some kind of solid resource so I can have a good mental model of what's going on
Read through the Pinned messages in this channel.
ah, thanks, sorry I'm discord-dumb
Cedric the Networksplainer.
Even Rocket League is now getting an anti-cheat.. Sad times for developers π
https://www.reddit.com/r/RocketLeague/comments/10g5ods/update_on_bots_in_online_matches/
5,125 votes and 959 comments so far on Reddit
Does any one know, how to manually make any actor gets disconnected from NetDriver, so when netDriver Destroys it should not destroy the actor on Clients ?
I add a actor class to BeaconNetDriver, but when beaconNetDriver will end, it should not destoy the class with it, I tried NetDriver->NotifyTearOff(actor), but this did not work.
TearOff doesn't destroy the actor, it should actually do the exact opposite.
If called on the server, it stops updating it and lets the client do whatever.
Has anyone ever tried to replicate a TMap in unreal 5?
yes
does it work?
I remember back in unreal 4 it didn't. And also tried with an array of TPair, and same
yesn't
ahaha explain pls
you can replicate it, but its terribly inefficient
bool FHT_MetaTagContainer::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
bOutSuccess = true;
bOutSuccess = Map->SerializeName(Ar, MetaTag);
if (Ar.IsSaving())
{
uint8 bSerializeMap = KeyedMetaTags.Num() != 0;
Ar.SerializeBits(&bSerializeMap, 1);
if (bSerializeMap)
{
uint32 Count = static_cast<uint32>(KeyedMetaTags.Num());
Ar.SerializeInt(Count, MAX_uint8);
for (TPair<FName, FName>& Itr : KeyedMetaTags)
{
bOutSuccess &= Map->SerializeName(Ar, Itr.Key);
bOutSuccess &= Map->SerializeName(Ar, Itr.Value);
}
}
}
else
{
uint8 bSerializedMap = 0;
Ar.SerializeBits(&bSerializedMap, 1);
if (bSerializedMap)
{
uint32 Count = 0;
Ar.SerializeInt(Count, MAX_uint8);
KeyedMetaTags.Empty(static_cast<int32>(Count));
for (uint32 Idx = 0; Idx < Count; Idx++)
{
FName Key, Value;
bOutSuccess &= Map->SerializeName(Ar, Key);
bOutSuccess &= Map->SerializeName(Ar, Value);
KeyedMetaTags.Add(Key) = Value;
}
}
}
return true;
}
Jambax was posted this a few years ago
oh okay a custom netserialize
well for that I prefer to have an array of custom struct
but thank you for the enlight
I feel like it should be doable to implement a FastArraySerializer that then dynamically adds and removes from a map based on a callback no?
i was reading a post on the ue4 forums on how to set the tick rate, the thing is, its for the ipNetDriver
[/Script/OnlineSubsystemUtils.IpNetDriver]
NetServerMaxTickRate=30
if i am using the steamNetDriver, does this work?
do i need to put that line under the steam net driver?
how would that look?
@limber gyro Give this a try, but obviously with whatever value you want it to be. Seems to be what the engine is using for DefaultEngine.ini
[/Script/SteamSockets.SteamSocketsNetDriver]
NetServerMaxTickRate=30
Although not sure if that actually overrides the default value or not π€
When I want to test the multiplayer in the editor,To test the function OnHit() , If I test the client-related editor first, it doesn't work, but if I test the server editor first, then test the clients, it works for the clients as well., anyone know why?
quick question, If I set bAlwaysRelevant to true on an actor, net cull distance is basically ignored right?
hmm I see
Not entirely sure what you mean with "client related editor first"?
It seems that they only start working when I first click on the server editor and then go back to the client editors.
when you want to test the multiplayer in editor it open as an example 3 screen for you for 3 players
getting some weird problems and just to test, I set it to true to see if they still happen, but when I set bAlwaysRelevant to true, all is good π€
obviously I want to avoid setting it to true
but
it seems to cause issues when attaching actors to mesh sockets?
Presumably you have replicated movement on?
when an actor re-enters net cull distance, it gets recreated, but it seems its replicated state, is now different
Make sure whatever you're attaching it to is also replicated
Otherwise the "attached" actor won't be able to resolve it's attach parent client-side
oh hmm thats interesting
I'm attaching the actor to a car
but the car is client authoritive, so it doesn't have "Replicate Movement" set to true
guys look at it , OnHit function ,first not work for client , but after I go to server screen and then come back again to client scrren , it start working for clients as well
since its handling the replication itself
So how do other clients know where it is if it's not replicating movement from the server?
no, it is replicating movement to the server, I just meant its not using the UE "Replicate Movement" checkbox
this is unchecked
Yeah but how is the server then telling other clients where it is?
Client A sends movement to the Server - how does the Server send that to Client B, C, D etc?
hmm let me check the code I bought this plugin from the marketplace
its sending unrealiable RPCs
it works pretty well
Yeah that's bad then
The engine already supports this btw. You have to send movement to the server from the client-owner, but what you are supposed to do is have Replicate Movement "ON", and uncheck "replicate physics to autonomous proxy" on the cars root primitive.
So long as the authoritive client has possession of the car, that will work
things just get weird when the actors re-enters net culling distance, all other cases work very well
There's a good chance late join won't work either
theres similar issues yea
its not broken completely its just that the socket gets rotated somehow, when the car re-enters net culling range
Yeah so it doesn't really work then. The first problem to address is using RPC's to send the vehicle state to other clients, that should be a replicated property. If you follow what I wrote above, you don't even have to do any real work for that
the driver* socket
You also want to make sure character movement and character movement smoothing is disabled when the player is attached to the car, otherwise that will interfere
You'll probably need to make some small additions to the character movement component to do it proper
yep that I'm already doing
doing SetComponentTickEnabled(false) when I attach the character to the car socket
on the CMC
that isn't enough
really? damn maybe thats the cause of the rotated socket issue then
because its enough when all players are in net cull distance range
but when a driver takes a car far away and comes back
when the players see him returning, his driver socket is rotated
for some reason
We basically disabled PerformMovement() and SimulateMovement() whenever the capsule is attached to something IIRC
btw when I attach the driver, I'm also possessing the Car
but for passenger im just attaching to the socket and thats it
I noticed I had to disable the CMC tick for passengers
for drivers I haven't done that since I'm possessing the car, so Im hoping thats ok, maybe?
also this vehicle system has its own "kinematic like" physics, I believe thats why unreliable RPCs were chosen, instead of replicating variables
to send them at the same time its ticking the physics simulation
That's even less reason to do it tbh
It's also pointless because you'll never get those RPC's at the simulation rate anyway
isn't the replication rate tied to the server tick though?
And in a "real world" environment, it'll look terrible
It is - but no garauntee you won't exceed the available bandwidth, or packets get dropped etc.
Which is why stateful replication is so important.
I can tell you on reliable authority that kinematic vehicles are a waste of time
source: I did it for years
well I didn't create the plugin myself just bought it, but thanks thats useful information
but yea now that I think about it, I believe this vehicle system will never work unless the car is set to always relevant
Here's what we/I've done in the past:
- "Seat" actor replicates the "Occupant".
- "Occupants" are notified from the "seat" when the enter/leave it. This drives attachment.
- After they have attached, movement is aborted and all input consumed. Smoothing is disabled.```
It's important that the "seat" actor has an equal or larger relevancy range than it's occupants
that is very similar to what I've done so far I think
seat variables are replicated
The most important part is that ONLY the seat replicates it's occupant - not the other way around, and not both
Otherwise you have endless race conditions
So there needs to be a single point of authority
And if entering a seat performs the attachment, you must disable attachment replication otherwise those two concepts fight each other too
what do you mean with "Attachment Replication" and "Smoothing" ? I just disabled the tick on CMC
I mean quite literally in our case:
{
// Do nothing
}```
I'm doing the passenger/driver attachment on rep notifies
oh
Right - but the characters existing replicated movement will fight with that
I didnt even know this was a thing
but I disable CMC tick then I do it
Doesn't matter
replicated movement is independent of the character movement
It sounds like what you have is basically lots of conflicts between what the engine already does and what you're doing
so that empty OnRep_AttachmentReplication will fix it? or do I need to change anything else on CMC I'm working with a source build anyway so if theres anything you recommend changing let me know
I wouldn't change CMC directly, I'd make your own specific one for you project and make changes there
yes, but only when the vehicle re-enters net cull distance, all other cases work perfectly
Editing engine code should always be a last resort, especially stuff as low-level as that
Yeah but it only works until it doesn't π
So it doesn't really work
I don't know honestly, there's a lot of ways to approach this
Doesn't sound like it's the only issue - but just note that with replicated movement on, the engine will already replicate what you're attached to and with what offset
We use our "seat" system to drive attachment on clients instead, we ignore the attachment from movement replication
what I dont get is why the socket offset/rotation would change on its on own when the car re-enters net cull distance
Depends how you're attaching it
I need a reality check. If a NetMulticast function being called from the server only ends up running on the server that means the object the function is on is not set to replicate, right?
Or it's not relevant to the clients
yea I'm doing this too, rep notifies do the attachement, I only didn't know I could disable attachement replication but I'm going to try that
Ok. Follow up question: Anything special I need to do to get a component (attached to a character) to replicate? I've got
SetIsReplicated(true);
in the constructor
Also FYI, we attach the capsule and mesh independently:
GetCapsuleComponent()->AttachToComponent(SeatIFace->GetSeatAttachComponent(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, CurrentSeat->AttachSocketName);
GetMesh()->AttachToComponent(SeatIFace->GetSeatAttachComponent(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, CurrentSeat->AttachSocketName);
Nope that's fine, although components prefer SetIsReplicatedByDefault in constructor (for some reason)
I guess it kinda makes sense that maybe there might some collision fighting, I just dont get why that only happens when the car re-enters net cull distance
Also why you need to disable smoothing, and you must make sure character movement is turned off at the same time as you attach client-side
I'll give it a go. I think something might be a little wonky with my component .. in the editor I'm seeing duplicate properties for the defaults
Might be a livecoding thing, reboot editor
how do I disable smoothing?
working with a source build π
We've overridden the SmoothClientPosition function to avoid potential issues
None of this requires source changes
And it's very common for projects to make their own specialisation of CMC
oh cool I can just override it nice
Especially in MP
The TL;DR is attaching characters to stuff turns out to be a lot more work than you initially think
But our CMC is still ticking when attached
yea I should really do it, I've been putting it off but this issue got me scratching my head, all working up close, but leave and enter net cull distance and things break
Fixed the issue, thank you!
We just have it "handle" the seated state in a different way
so you said you dont do kinematic car physics, so what are you using instead, server authoritative physics vehicles?
yea I spent like a week figuring that one out, alot of trouble to get the ordering right, ie: attach on the server, client received that attachment info but still had not disabled collisions/CMC tick in time = vehicle goes flying π
but eventually figured it out
yeah the ordering is super important, takes a while to get it
until net cull distance comes in π
But it becomes easier once you have only a single property controlling the whole state
yep, learned that one the hard way π
When lots of them are fighting, it's basically impossible to avoid issues
You're telling me you don't want to spend months if not longer on trying to get client predicted server authoritative physics based vehicles working Jambax? π€£
server side is best but yea with no prediction thats a no no for me π
another thing I was recently thinking, but not directly related to this, if my game is gonna have alot of vehicles in the world, maybe I'd benefit from using the replication graph, but then I had this idea: can I not just override the IsNetRelevant function and when that returns false, I set net dormancy to "Dormant" ?
Ok, guess I've got another question. I'm attempting to replicate a USplineComponent, something I've never tried before. And it seems like .. it just doesn't work. Points get added server-side and I noticed my ReplicatedUsing function wasn't firing, I figured adding points didn't flag it as having changed so I instead manually call a NetMulticast function. Server has the correct number of points, client does not.
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Replicated, Category = "Component", meta = (AllowPrivateAccess = "true"))
USplineComponent* TrailSpline;
void UAC_TrailComponent::TrailNodeTimerTriggered()
{
// This check is redundant but just to make it clear this only runs on the server
if(GetNetMode() == NM_DedicatedServer)
{
UE_LOG(LogTemp, Warning, TEXT("Trail Timer Ticked"));
TrailSpline->AddSplinePoint(GetOwner()->GetActorLocation(), ESplineCoordinateSpace::World, true);
TrailSplineUpdated();
// Number of points updates appropriately
UE_LOG(LogTemp, Warning, TEXT("SERVER: Spline Updated. Points: %i"), TrailSpline->GetNumberOfSplinePoints());
}
}
void UAC_TrailComponent::TrailSplineUpdated_Implementation()
{
if(GetNetMode() == NM_Client)
{
// Number of points never changes
UE_LOG(LogTemp, Warning, TEXT("Spline Updated. Points: %i"), TrailSpline->GetNumberOfSplinePoints());
}
}
I guess I don't need to use a spline but it kinda encapsulates what I'm doing pretty well so I'd like to if I can
@pure vigil The spline component doesn't replicate any of it's properties
I guess I could also just send clients the location of the point to add and have them add it themselves. Just seems cleaner to replicate the spline .. though .. probably more network intensive than it needs to be
And note that what you're replicating there is a reference TO a spline component - not the component itself
Fair. My brain has trouble sometimes keeping that all in my head
If you wanted to do it, you'd basically just replicate an array of points and apply those client-side with an OnRep callback
"hose"?
Oh, those?
TArray<FVector> ReplicatedPoints;
void OnRep_Points()
{
SplineComp->SetPoints(ReplicatedPoints);
}```
I thought you were using some kinda multiplayer lingo I had never heard of, got worried π
No need to replicate the component itself, or a reference - unless it's created at runtime or something
I think maybe I need to rethink what I'm doing anyway. My idea for this was having a large map with players moving around creating "trails" as they move. The trails would be persistent, at least for a time. But .. these trails should be netrelevant even if the player is not. And having this be done from the player means this won't work
bleh. ok. back to the drawing board. Thanks for the help though, good to know the approach for splines was just wrong
Each point of the trail should have it's own network relevance, no need to make them all "alwaysrelevant". Which also means these points need to be individual actors, placed in the world. Don't like that.. it's gonna flood the world with actors.. but I don't see a way around it. Each point doesn't necessarily need to have a reference to the next point but it might be nice to be able to save the location of the next point so someone following the path could have an indication as to what direction to go. I think I can still use my component to spawn these path point actors. HMMMM this seems messy! but I can't think of another way. Sorry for the brain dump.
A lot of the time stuff like that is purely client-side
Well, I need all other players to know about the path created by all other players
You can do it, just have to be mindful of how much you send. Split areas into zones and replicate those etc.
An actor for each point would be uber excessive
That's what I was thinking. Only reason I was thinking of an actor for each was to ensure they were relevant when they needed to be.
I know relevancy is calculated based on the actor location so even if I have an actor with components that stretch super far away, those components will only be relevant if the actor is.
Just spawn actors for "zones", make the actor relevant for a bit larger than it's zone area etc.
Many ways to approach it
Hello guys !
Im looking for some creative and talented people to create the best Melee Battle Royale in gaming history!
dm me!
High ambitions and do you pay people?
Because talented people wonβt work for free on another guyβs vision
Im not looking for money so i cant pay this much.
@twin juniper #volunteer-projects
ty
I would not use components for this at all. Subobject replication is not free
Yeah I'm .. re-thinking the whole implementation
Single Actor, always relevant, timestamp + location paired with weak pointer to player for each player
Clients can then construct non replicated splines from there, or whatever you prefer to display the trails... or just leave footstep decals that time out on their own
Definitely cleaner. Thanks for the suggestion
how do i post there π ?
Is there a surefire way I can know that clients have finished creating and synchronizing replicated actors? I need to know that all of my clients have entered the level and are finished getting synced before GameState starts its work. I see that ULevel has bAlreadyInitializedNetworkActors. Can I rely on that?
I have a bunch of statically placed replicated actors in the scene tree that seem to take a while to get made on clients.
There isn't, could be in any order
statically placed stuff should always be present though
Might not have it's latest state
Unless bNetLoadOnClient is false for some reason
Would the fact that we're not starting on the level in question make a difference? We have a main menu level where you form a party and the host becomes the server, and then server launches everybody into the game level.
Wouldn't have thought so. Presumably just a server travel?
I think so. I didn't write that part.
The only strategy I can think of is that I know how many of all these actors there are supposed to be, so just have something at a higher level watch for some event they kick out when they do BeginPlay and keep track of how many report in to know if they're all done.
how is a WP level loaded in server ?
i have been making save load system, I load state of the world in AGameMode::InitGame. for normal levels its ok because all are loaded when InitGame is called but not WP
WP?
WorldPartition
hey, can only actors and components be replicated or is it possible to create an object that only exists through reference variables in a component and have it be replicated the same way said component's variable and behaviours would?
i have no idea wat to do about this.
if ( bWasSuccessful )
{
// travel to server here.
UWorld * World = GetWorld();
if ( World )
{ //W:/0000 0000/__U__/MenuSystem/Content/ThirdPerson/Maps/Lobby.umap
World -> ServerTravel ( "/Game/ThirdPerson/Maps/Lobby?listen");
}
}
its not moving me to the lobby
and the weird part is . it does find steam but doesnt take me to the lobby map
ok . managed to fix it . fukin christ . wanted to blown my brains off.
[1] World -> ServerTravel ( "/Game/ThirdPerson/Maps/Lobby?listen");
make sure that this doesnt have typos
[2] add LastSessionSettings -> bUseLobbiesIfAvailable = true;
add that after to LastSessionSettings = MakeShareable ( new FOnlineSessionSettings() );
[3] in project settings add the maps . to the package build . under project - packaging , advanced.
[4] in defaultengine.ini in config make sure you have that set for steam. dev app id and all that bullshite
question in regards to dormancy. for testing i set an actor to be dormant all (actor made in blueprint) and i do tests by changing replicated information on said actor and i noticed it replicates down to clients. i had read something about in blueprints an actor set to be dormant will get awoken when you change a replicated variable, replicate everything needed, then go back to dormant so i tried setting all the actors to be dormant in c++ by iterating over all teh actors i want to be dormant and setting it as dormant and that had the same effect. is this the intended effect? if memory served right with c++ actors this has a different result where the actor would remain dormant even if a replicated variable changed
Correct, in C++ you have to FNU/FND for it to actually replicate
You can and there are at least two ways: https://docs.unrealengine.com/5.1/en-US/replicated-subobjects-in-unreal-engine/
Thanks
What function is called on the player controller when the pawn has been replicated?
OnRep_Pawn
loool thank you!
does anything know how to enable lyra to use online network or lan for steam? The default is restricted to offline
When I set a variable to be replicated, does its value get sent every packet or only when the value is updated?
Only when updated and then it depends on the test of the actors settings
only client 1 should be move to LV_1 level , I first time to use client travel, this is on UE5.1
Which command should be used for?
when Client1 moves to LV_1, others move to another level..
hey devs , how to test staff for dedicated server locally ? there is no such thing
The Play As Client option will run a local dedicated server in the background that your client will automatically connect to
Just a quick check, you are aware that on any given UE Server, there can only be one map active by default, right? Not counting the TransitionMap. But you can't have Clients on different maps, unless they are not connected anymore.
I didn't know that...
You said "by default". Is that means I can have clients on diffenrent maps by setting some options?
Then, where and how can i do that?
then when "Client Travel" is used?
Can I create multiple servers and communicate between them?
(I want to make clients have diffenrent map...so..)
Of course.
Just not with the standard client/server/replication system. You'd have to implement your own communication.
βClient travelβ is used to switch the map on the client to some different map to bring it in sync with the server.
But yeah, without your own server or modifying the engine itβs not supported.
You can always have the clients all on the same map, but in different parts of it with different levels streamed in and out. But that's a whole other issue.
each level is too large to use level streaming, so the output is slow.
Unreal might not be the engine for you then!
Unless you can add your own communication layer on top.
I'm infant in UE...communication? for connection between servers?
Yes.
Servers cannot talk to each other by default.
If you want multiple maps, you need 1 server per map and if you want those servers to generate some shared experience, you need them to talk to each other somehow.
Are you trying to make an mmo?
million dollar question
Having to deal with synchronizing things between multiple instances sounds like an absolute pain lol.
If you are trying to make some multi-node server mmo-style game, UE is only going to be half the battle.
Um..Not the things like mmo...How can i make communication layer between diffenrent servers? or which keyword can i search with?
Socket? Websocket? UDP? TCP? Pigeons?
(for that last one https://en.wikipedia.org/wiki/IP_over_Avian_Carriers)
C++ or any other programing languge are needed for them?
Absolutely.
Youβre going to need C++ at bare minimum depending on what you do.
If you aren't very good at c++, you won't be able to achieve your goals.
You're going to need to do a lot of c++.
Also I would still not recommend it, youβre either going to make something way too complicated with multiple servers or need to decently modify the engine it self to support a custom server / networking or to support several worlds. Itβs just not simple.
You wouldn't have to modify the engine to get servers to talk to each other, you could just keep it in a subsystem in your project.
It's still not easy!
Assuming you go that route yeah.
I have to find in different way..thank you!
I wonder if we should make a hall of fame
For those questions/users/ideas/etc
Blur the names but show each new one the ever growing list

Afternoon all, hopefully an easy one, but driving me nuts, what causes IsLoggedIn to be true. i have some projects that will show logged in even though they have no online functions, i have online projects that show isloggedin as true aswell, which stops the eos login prompt coming up.
hey guys , just a quick and noobish question , why if i am calling jump locally the actual jump movement got replicated to all clients and server just fine ? i would understand it if ue "Jump" function was a multicast event and if i call it on server , but here it is just a regular function and i am only calling it locally but it got replicated to everybody fine , why is that ?
Because the character system has a full networked system built into it. Which is also the case for the jump function.
Probably better to post that in #epic-online-services , also make sure to provide some more details in there. Show some of your code / BPs for example π
That's evil... I'm in! π€£
Am I making a mistake by not using the gameplay ability system and doing my own custom solution?
"a mistake" - no. It's a tool, you can use it if you want and it can help you do certain things quicker / easier or similar. But you can be just fine without.
Yeah I just feel like adopting other peoples systems can be harder because you don't have as deep of an understanding of it as you would your own hand built system
The thing however is that it's an already established system, you learn how it works and you can use it. If you want the same functionality and build it your self you're going to have to figure out what works and what doesn't. But yes, often you have a less deep understanding of how it works when you didn't make it your self. But that's not necessarily always a bad thing as on the opposite side it saves a lot of time to not have to make everything your self π
Yeah I get that. GAS just has a decent amount of boilerplate you have to set up that makes it hard to even start working with the system
I haven't actually worked with it yet, but it seems like the consensus is that it's pretty difficult to get into at first
That's kind of a lot of Unreal systems in a nutshell haha. But like I said, if you think you can be fine without and do things just as quick or quicker by all means go for it. GAS probably has a lot of stuff you'll never need. But if you think it can be useful, give it a try and see if it's any good for your case or not π
I mean I am working on a moba for context, which is why I was on the fence about it
Thanks for quick reply, ignoring eos, was just a question of why is logged in would but true on a fresh thirdperson blueprint level. bp wise just running this in level blueprint, nothing else has been touched.
From what I can find it seems to just indicate whether or not someone is connected to their native platform, for Steam as an example it's described as:
Checks if the current user's Steam client is connected to the Steam servers.
This is what I don't get, id expect it to always default to isloggedin false, fresh install, adding eos still says logged in. i'll add steam subsystem see if it does the same.
hi all, I'm working on a co op game and have player cmc properties bIgnoreClientMovementErrorChecksAndCorrection and bServerAcceptClientAuthoritativePosition set to true to let clients handle their motion, despite that I still get corrections from server. Am I misunderstanding the use of these? I'm logging their value and logging corrections and see corrections coming in despite both vals being true on client and server
Those are the correct properties and it works fine for me. From what you said it should be set up correctly. In my case I run an init event off beginplay inside the character (runs both on the server and the client) which sets both of those values to true or false depending on if I need the corrections on or off.
thanks good to know I'll verify my setup. what is your usecase btw?
curious to hear a situation it works in
I have an issue while with steam on a dedicated server. With steam subsystem off, everythin working fine. But when I turn it on, IU have this error:
Login request: ?Name=PlayerName userId: STEAM:765611XXXXXXXXX platform: STEAM
[2023.01.21-16.27.34:529][652]LogNet: PreLogin failure: incompatible_unique_net_id
[2023.01.21-16.27.34:529][652]LogNet: UNetConnection::SendCloseReason:
[2023.01.21-16.27.34:530][652]LogNet: - Result=PreLoginFailure, ErrorContext="PreLoginFailure"
I use a dedicated server (tho no extra systems to it just yet). The exact usecase is to let clients jump onto a bunch of physics objects that arent replicated, which they'd otherwise fall through thanks to the corrections.
If you need clarification on the blueprint setup, let me know, tho it really is just as simple as we discussed earlier c:
I have a replicated variable using ReplicatedUsing that gets updated twice in rapid succession. And .. what looks like is happening is that the OnRep function only fires when it is first updated and the second update is ignored. Is there a built in limit as to how frequently ReplicatedUsing functions can fire? (I realize what this means is I should find another way to approach this and not update it twice in rapid succession but I would like to understand what's happening here too)
Hi! Is RepNotify safe? I heard it can be not called in some situations, like when actor too far or something like that. Is it true?
Are you sure it's not the second value which is triggering the RU?
Variables aren't updated straight away nad it's entirely possible you are simply changing it too quickly. The first change never gets replicated.
Hmmmmmmmmm tough to tell. And it's updates to a struct so I'm not sure how Unreal handles that. I doubt it re-sends the entire struct every time..
Variables will only be replicated to "relevant" actors. Once they are no longer relevant, due to distance or whatever, replication stops.
Ok, thank you!
And yes that means there are scenarios you need to be aware of when using relevancy
theres an example level somewhere that demonstrates the various scenarios, networking or advanced networking in example levels
I think they are part of the example content?
It appears you are correct. I have a weird situation made even weirder by what I'm doing with it. My variable is an array of structs, the struct has a FVector, a timestamp and a bool - it's coordinates and a bool to say whether it has been "processed". The server (on a timer) will add entries to this array, a new FVector and always sets the bool to false. The server will also remove old entries based on the timestamp.
When the OnRep function is called, clients will go through the array and (for now) draw a debug sphere at the FVector location but only if the bool is false. They will then (locally) set the bool to true. I wasn't sure if that part would work, thinking possibly the bool would be overwritten but I have confirmed that doesn't happen.
The problem comes in when the server removes an entry. Suddenly new entries are being added with the bool as true. I believe this is because an old entry is removed, a new one is added in its place and somehow the clientside-set value of true persists.
Here's an example
Server timer triggers
Add a new entry at (0,0,0)
Client Entries updated (OnRep called)
0 - (0,0,0). Bool is false. Draw and set bool to true.
Server timer triggers
Add a new entry at (0,0,1)
Client Entries updated (OnRep called)
0 - (0,0,0). Bool is true.
1 - (0,0,1). Bool is false. Draw and set bool to true.
Server timer triggers
Old entry at (0,0,0) removed
Add a new entry at (0,1,1)
Client Entries updated (OnRep called)
0 - (0,0,1). Bool is true.
1 - (0,1,1). Bool is true. ((THIS IS A NEW ENTRY AND SHOULD BE FALSE))
So.. The entry at index 0 was removed by the server and a new entry was added to the end. The OnRep function only gets called once and updates the clients with both the removal and additions.
The client already had 2 entries previously, both index 0 and 1 were set to true. And even though index 1 got updated with the correct vector, somehow the bool remained true instead of being properly set to false
Set it so that the bool doesn't replicate?
Didnt see that yet but I will check π
That's possible? How??
Bp or cpp?
cpp
Just don't put uproperty on it...
Also though.. I'm not sure that fixes the issue. Because if the value WAS replicating, it would be false. The server sets all the bools to false.
It seems to me this might be a matter of unreal networking trying to minimize the amount of data sent
You want your client to set it to true, right? Not the server, from tbr perspective of the client.
Yes, each client should be setting them to true. Not sure if this is abusing the system.. modifying replicated variables clientside
Not at all.
Ok. I confirmed removing UProperty from the bool didn't have any effect. Well, I did a livecode.. let me compile in the IDE and restart the editor to be sure
Live code won't change that, I think.
Ok. Just had enough weird things as the result of livecode that I wanna be sure before continuing.
Ok. Double confirmed removing UProperty from the bool didn't change anything
I feel like.. Unreal is recognizing that the array is the same size (clientside) and instead of actually removing/adding elements, it is just replacing values in the array to save on packet size. But even though it updates the coordinates correctly it misses the bool somehow. ...
I could be way off on this.
Maybe.
You could always try rpc broadcasts instead 8f regular replication.
Total control!
RPC or multicast?
Oh. I've always heard RPC used more to mean client to server communication
TIL
Can be either way.
I think maybe one workaround would be to have two separate timers, one for adding and one for removing and ensure they're offset. It feels messy though and seems like it could lead to timing issues, especially with lots of people
If I go the RPC multicast route, I'd have to manually tell clients to update when an element is removed and again when an element is added.. hmmmmmph
There's still no guarantee that there will be replication in between the timers.
True. bleh\
Why when to remove? It's after a set time, right? Clients have clocks too.
Because it seems to me the only reason the issue is happening is because the client is told to update the array but the array still has the same size
I guess I could try to remove the elements clientside before the server has a chance to tell them to do it
But it would require me to be checking the timestamp very regularly and there would still be the occasional time it doesn't line up
It seems you're just using the wrong approach somehow. Maybe you need to rethink it from scratch.
What is the aim, exactly?
I completely accept that. This is already re-work #3 or 4
I'm creating trails/footprints that follow the player
The idea is that each vector there will be .. something.. in the world to be able to follow the player. Either a decal or something else I haven't decided
Right.
But I don't wanna draw the decal over and over, hence the bool
Why do you need to do this on the server at all?
So for starters, that doesnt need to be replicated
So scratch replication, scratch all your problems
you simply calculate the footsteps on the client
It's a big world and player A might not be relevant to player B
So why do you even need the footsteps if they aren't relevant?
I would use a client side anim notify for this.
Yes you need to work out what you are doing wrong, because you are most likely going to run into the issue again
Because if they get close enough, they should see the footprints they left
but you also need to think about what needs replicating and what doesnt
well are the footsteps permanent? and regardless player relevancy is the wrong thing here
because you may stumble upon footsteps of another player even if they arent in relevancy range
in which case your system just doenst work
Not permanent but a decent duration. Yes, I want players to stumble on footprints of players even if they aren't currently relevant
and if this is a 2P game you are overthinking it
Then you cannot obviously tie it to player relevancy, so your approach is flawed to start with
I am not tying it to player relevancy at all...
Place decal actors, set them to replicate and be done with it? Give them a lifetime and they'll auto delete.
This
That was one approach I was thinking about, definitely. That seems much more straightforward. I was just trying not to flood the world with actors, this was my attempt to make something cleaner..
though obviously failing
I guess I should have mentioned before, all the code I'm running is on a single actor that is set to always relevant that monitors the players movements
not on a player that will be network culled
it keeps getting worse the more you describe the "cleaner" solution
π
you now have a manager type class that is directly relying on other spawned classes
instead of having one single classes that is handling all of this
you place actors with a lifetime, you have all of the code in one file. done. modular, self-contained
it doesnt get simpler than that
and the fact that you are on rework
I believe someone else here steered me away from that approach calling it "overkill"
#3-4 should have signalled you are doing something wrong
or "uber excessive" might have been the term
Everyone here is a stranger on the internet
take advice with a grain of salt and apply your own reality context
Yeah, it's tough because my testing environment is super limited.
Like.. I have no idea how this will work with 10 players. Works fine with 1.
Except ours, because we're always right. π
Actually I often attach the reality check to advice I given on other topics
because my life context is starkly different from that of others, so that needs to be taken into consideration
talking career and such. Good coding guidelines are spot on
because the context is mostly the same for everyone
Unreal is pretty good at networking. As long as those actors never move, or do anything, your networking will barely notice it.
This ties into the point of not doing premature optimization - especially if you just dont know
optimizing when you do know something will be a problem due to past experience, is fine
Indeed.
Plus, I can have the network culling on those actors be super low. It's a top-down game so players wont need to see them unless they're like right on top of them
Like spawning 100 replicated actors every tick... I can tell you without ever having tried it that it will be a problem
You can have thr network distance culling on everything be super low then.
Yeah, I've been burned before. Doing a ton of work that seemed fine for one or two people then testing with 10-20 and finding so many issues I didn't know how to even start fixing it
Let the burn scars teach you to be more careful, but not to the point where you live your life ruled by anxiety
something somethinig
haha
Just don't regen your landscape on tick and you'll be fiiine!
I definitely have too much of a compulsion to try to do everything the right way to prevent future issues which as I say that I know is completely futile
and it has prevented me from finishing ... any project, really
99% of projects are never completed. Or even get off the ground.
Especially revenue share ones.
Ok. Scrapping this manager actor and going back to spawned actors which I liked better anyways. Thanks for tolerating my questions and taking time to understand the situation
π
what could cause an actor not getting destroyed/recreated when leaving/re-entering net cull distance?
I have a player pawn that I'm attaching to a car and I'm possessing the car
when he drives far away, this character gets destroyed when he leaves net cull distance and recreated when he enters the net cull distance which is correct, but not the car itself that he is driving
anyone know why?
(also the car is not set to always relevant)
do clients have any events for when any given pawn in the world is possessed by a new controller on server?
i was going to use reset but i think thats only for owning client
hm going to try OnRep_PlayerState
I want all players to go to the next level when one player presses enter
OnRep_Controller
and also, there is a AController::SetPawn function, gets called from both Posses and from OnRep_Pawn in the Controller
its a good place to put in common server/client logic in one place
PlayerState will typically arrive a bit later, as the PS Actor has to replicate in order for that one to fire, and it has low default NetPriority
being a ViewTarget is one reason why it would happen
I checked and can confirm it was not relevant
as in, IsNetRelevantFor() was returning false
their networking has a few differences from replicated actors spawned at runtime
they don't get destroyed when not relevant
they are always net addressable, and don't need to be replicated to be net addressable
meaning you can send a pointer to a net static actor through a say, RPC, and it can always get resolved
hmm makes sense
that comes from them having consistent, unique names as part of the package
I would never notice these quirks by myself, there's definitely cases where I'll be spawning these vehicles by code and others where I'll be pre-placing them
but this explains the current behaviour then
this explains so much now
the vehicles I'm using do client prediction, so when the driver goes far away with the vehicle, imagine he was turning left the moment before getting destroyed by net cull distance, this causes the vehicle to be always turning left on the other clients, until the driver comes closer again
so I was wondering why tf is the vehicle not getting destroyed too, but I guess I'll just play with render cull distance
unfortunate that there's no client side event for when an actor goes outside of net cull distance
you can try turning off bNetLoadOnClient on preplaced Actors to get them to behave consistently
haven't tried doing that, but that is the first thing i'd try if i had that problem
ok I tried that, and it worked, thanks!
any potential side effects I should be worried about?
i don't see any
awesome
Am I able to serialize a UObject that has a TMap across the network? I think the answer is not because otherwise I would have heard about it somewhere...
serialize using what technique?
ah
so you're making a struct that replicates a UObject that is not replicated by itself?
No, the UObject is just a pointer in a dynamically spawned replicated ActorComponent
And yes the UObject is not replicated in itself
No, the advice would be to have an array of keys and an array of values
Yes that's what I feared π₯²
Again, that is simple
so there is an additional breakpoint point here
AddUnique for a small overhead
So basically the TArray would be able to serialize just fine, right?
yes as long as you handle replication properly
it would be advised to have them as replicated arrays inside of a container that is itself properly replicated
that would be the simple setup that is guaranteed to work
If you do something deviating from that you need to compensate accordingly
Correct, but I'm trying to evade any replication on the UObject itself or even the TArrays that will replace the TMaps
Whats the use case for replicating them?
Hoping that deserialization will just map the data right on client
The data is pulled from a SaveGame that is managed by the host and I want to replicate it to the client
The whole data is just plain UObjects
function on the SaveGame object itself that serializes it into a TArray<uint8>
and another that is able to initialize it from the same array
Correct, using this technique https://forums.unrealengine.com/t/uobject-serialization-to-pass-as-rpc-parameter/668133
I mean thats just sending the binary savegame data over the network. Thats assuming no post-deserialization actions need to happen and that its all plain data
sec
pretty much yes
Okay cool
As I said, caveat here is, no post-deserialization actions required
as long as when you read the data thats all you need, then you are good
make sure they are all UPROPERTY as thats what it checks when serializing
unless you have custom serialization
and also in this case you are totally fine using maps
since you are not actually using replication
you are sending the raw data over the network with an RPC, entirely different use case
this is highly inefficient, so just doing it once like savegame is fine. not recommended for during gameplay usage
π
I have a similar system with custom serialization to send editor data in real-time to a build on iPad
so designers dont need to wait on new builds to test changes
its a bit more complciated than that, but thats the high level overview
hit a hotkey in the editor and all the changes are now live ... yay magic
Yeah this is done only once to initialize a standalone client that is joining a server host player. Basically there is a Saving System in place but I'm trying to make it work in multiplayer with least effort possible π
But for my use case, yeah I'm replicating the raw data not sending it through an RPC like mentioned in the linked post
Uhm
is the Raw byte array a replicated variable?
Correct
I prefer the RPCs here, replication can fail
Would that explain it?
So not just that it can fail, but also
that your array wont be replicated as you think it would
replication is going to be eventual
so your array gets piece-wise replicated in chunks
I strongly recommend sending the data through an RPC
we had a fun release day, we have an Actor that is used for mission setup in the lobby, carries all parameters for procedural generation and persists though seamless travel
when we tested the game, we'd always meet in lobby and decide what to playtest
then the players came, and it turned out of the session owner changed the game difficulty, that Actor would just stop replicating to anyone joining the lobby after that
Someone did not tell the lead engineer about subsystems? π
its better this way
it takes more then a little hackery to replicate a subsystem, and in campaign play there can be multiple mission setup actors
anyhow, it was an engine bug with a result that our map generation parameters were not replicated to clients
resulting in complete map desync
Yeah tbf Im talking with context thats not vanilla UE
Makes total sense, I will need to send that RPC to the locally controlled instance and the remote host then
I got a system that lets you reliably RPC from anywhere, and its less boilerplate code than normal replication
Thanks guys for the insights, and it feels good that I can keep the TMaps π
And doesnt even need to be uobjects, so i got some normal c++ structs, its very neat
I want to open source among other things when I have time
Theres something I want to take out maybe that was project specific at the time, where we had locally simulated FPS elements
so it would split between server and client logic
My new boss is very keen on open source, so that is great news, I havent had that before. Now just gotta cross fingers that the company keeps being funded π
if I have a replicated TArray of Actors, are the RepNotifies only called when this array is added or removed to?
or are they called when an replicated property inside the actors is changed?
Only changes to the array itself
Yeah
thanks for info. does this apply to clients who dont own the pawn? I'm surprised onrep_controller would fire because these clients dont have controllers except their own
Single line of code for defining name to payload mapping:
MAPPING_IMPL( Weapon_OnHit, FWeaponOnHitData );
Call site (this being a client-owned actor, in my case usually the character):
HANDLE_RPC_SEND_STRUCT( Weapon_OnHit, *this, Data );
Handlers:
void ExecuteOnServer_Weapon_OnHit( ACharacter& Character, FWeaponOnHitData Data ) { ... }```
So those handlers can be defined anywhere, the calls are resolved using ADL. That allows for various different gameplay systems to be neatly organized in their own code with no direct ties to the client-owned actor that actually handles the RPCs. The Character param is just because some of those systems need to know what actor they are for/from.
but if you need to know from your simulated proxy pawn that it is possessed, you're generally doing something wrong
if this is for something like adding a widget component with a player name above the pawn
you can just attach the player state to its pawn and keep the widget component on the playerstate
simplifies things
I like it! ||open source when?||
I see you are a fan of bracket whitespace. Top man.
When I have time (TM) π
First thing on the open sourcing list is my blueprint corruption hotfix plugin
I already have the greenlight from the bossman. Just working 80h+ weeks atm to make sure we keep being funded, then I am taking a break
then eventually I get time to open source various things, cos the CEOs a supporter. He is purely amazing
Is he also working 80 hours a week? π
I think he does more like 60, to be fair he is a generation older, I heard bones get brittle and such with age
π
Hehe
Speaking of which I should probably get back to work π π
The small issue of a deliverable deadline EOD tomorrow
I travelled on Friday, and the keyboard I brought with me didnt work, so I had to remote desktop into my machine from a laptop ... just so i could have a working keyboard
Origin of setbacks are not from slacking off on Discord! Assuredly!
π
Hi, does anyone have any experience with beacon classes? I'm trying to set up a party system that works from the main menu, but I'm not enterally sure how I can get the client to connect to the host properly, where I'm having the issue is actually finding out what needs to be fed into the Host ID of the ConnectToPartyHost function.. I was told you could use the hosts unique net ID but that doesn't seem to be working, anyone have any ideas how I can connect people together correctly?
How should I decide if an RPC should be reliable or not? I assume the difference is that reliable RPC's are ack'd and unreliable RPCs are not?
Why would I not just mark everything as reliable?
Sometimes some events might not get called properly, If its marked as reliable it'll keep sending requests until it gets ran, unreliable wont, so making something reliable is used to make sure it gets ran because it absolutely needs to be
Right, so why not mark everything as reliable? I am struggling to think of an example where I would be OK with a request silently, randomly, failing
The more I think about it, the more I guess it makes sense to start with everything being reliable and then if there are issues down the line with bandwidth or latency then maybe go back and start setting things to unreliable. Unless there is something I am missing about this whole system, but it really seems like it's essentially just a TCP vs UDP type of situation here
if you change the position of something every tick, and send an unreliable rpc
the other end doenst need to get every position update
high frequency, not important: unreliable
ah, that is a good point
generally speaking you simply use replication for those
but unreliable rpcs are there, in case
the usual use case is reliable rpcs
gotcha, ok, I keep reading things telling me not to always use reliable RPCs so I was probably just overthinking it. but that type of situation it does make sense
yeah, I can't imagine even in the worse case sending more than a few a second per player
as in, when not using GAS. rpcs when you start firing a weapon, not RPC for every bullet that you shoot , when you have a gun that shoots at 1000 rpm
just be sensible and you will be fine
yea, that is reasonable. does GAS stand for something specifically?
GameplayAbilitySystem
ah, that is something I have yet to encounter
Hence why I made the note, it has its own learning curve
and so I dont get dirty looks from someone that would interject saying you should just use GAS instead (!)
π
π
Use GAS
when I call a multicast on the server, it will run on all clients and the server but which first?
does it run on the server first and then all clients? or the other way around?
The server runs it first because it can call it local. What client runs it first after that is impossible to tell because of random latency.
But the server has no latency towards it self so will just run it instantly I assume.
I see
i'm trying to figure out a way to ensure that a game client is up to date, in order to prevent outdated game clients from playing online. how would i go about doing this?
Release on a platform like Steam.
The alternative is that you produce your own method for ensuring your game clients are up to date.
An independent program that acts as a Launcher is a typical approach as well.
figures, thanks for the answer
the way I do it is when connecting to a server I send the build version (a variable I increment every update) of the client, and on the Gamemode class I just check if the client version matches the server version and if not, I reject the connection with an error message
simple mode for this is to filter out all the session results that don't metch your network version
FNetworkVersion::GetLocalNetworkVersion
and have your build server inject the changeset ID via a config variable to be used in the version generation
I am ready to publish (almost)!!! I am unsure if I should go for SteamCore Pro on the Epic Store, or use the classic Steam Advanced Sessions. Does anyone have feedback or advice on this?
not really almost ready to publish if you haven't figured our your session interface months ago
are you using c++ or blueprints only?
not sure then
we tried UWorks for a time, which is very similar to SteamCore i think
but we also discarded it years ago, just simpler to do the whole thing in c++
You too huh? ;D
interesting, okay. Ill look into C++. Im a psychologist, not a computer scientist, so I pretty much only know R/Python. Im sure ill learn something new
both ShooterGame and Lyra come with complete network/session code iirc, just needs to be configured
and Epic does not mind you stealing that
Yea p much if you want it all 100% BP you are shit out of luck unless you use steamcore, otherwise Online Subsystem Steam is perfectly fine and has everything you need
main problem with doing anything network related in blueprints is when something goes wrong you can only curl up in the corner and cry
as your most powerful debugging tool is PrintString
ay ay ay blueprint debugger is kinda clutch
that breaks too sometimes 
and you can't really start session stuff from the editor either, so you don't even have that
^
you actually can thereβs a unit testing command to enable sessions in PIE
on a dedicated server, you can only print string everything
actually works well enough for if you just wanna do quick PIE testing
testing in editor is unreliable tho
thatβs valid
plenty of things that work in the editor that don't seem to work in packaged games :<
the struggle
This has been very helpful but has exceeded my ability comprehension at this point. thanks all! i will stop being a child and start using c++ lol
that is why nothing that tends to break packaged only is ever in blueprint here π
oh no dont tell me that
oh yes
Well I know the packaged version of my project works fine over LAN, so maybe that counts for something
there is one more caveat to consider here Chroam
when you are testing your game, you are using it the way you imagined it should be used
which makes you uniquely terrible at testing your own stuff
Absolutely, Im a Human Factors Psychologist so Ive put a great deal of thought into that π
when average Joe drops by, he won't be so kind
but im not free from bias
and the game will break
best thing you can do is setup tests :D, tests donβt care about your feelings
Unless the game integrates emotion as a real time variable π
for me when it comes to multiplayer games one thing I learned when introducing a new feature is to test the following cases:
- Make sure it works on the server (usually checking in the editor)
- Make sure it works on simulated proxies
- Make sure it works on autonomous proxies
- Make sure it works with high ping (pktLag= 500 usually π )
- Make sure it works for players who join late (very common for me as I use dedicated servers)
- And finally, one I learned in the last few days, make sure you test what happens when actors go in and out of net cull distance π
if I cant make all those scenarios work perfectly just for me when testing, I never even setup testing sessions
and when I do, then there's a ton of new stuff I didn't even think about before that testers find out
but those first scenarios I mentioned are usually a pretty good start
How important is Net Cull Distance actually? Thats one thing I am worried about because I havent bothered trying to understand LODs and all that jazz.
well if you have big maps, is a real pain in the ass
it has nothing to do with LODs
you can always set all actors to relevant but thats a bad idea
replicated actors that aren't relevant are destroyed on clients, and respawned when they become relevant again
for games with small maps I think setting all as relevant is fine though
but if you're making a game with big maps, thats not really an option
When you say "big", are we talking about like Stormwind size or Skyrim size or like GTA5 size
well for me games with small maps would be overwatch, valorant, rocket league, usually team games
but yea any type of open world map, you need to use net cull distance
if you have alot of replicated actors that is
Okay cool, so like Blizzard World is considered relatively small
not familiar with that
Thats a map in OW
oh I see
What if you had static meshes arranged in a blueprint actor. Suppose you built a house in a BP_Actor and put them all over the (OW map sized) world. Are you saying you need to use net cull distance for these?
This has all been very interesting. @fossil veldt @winged badger @clear island If any of you have published material, message it to me and I will purchase it soon to support your work.
I'm not familiar with the map as I dont play overwatch, but you can always set actors to be always relevant and if later down the line, you see its taking up too many server resources you can disable it and do the tests with net cull distance enabled
although usually if you cover the use case of players joining the server late, I think alot of the issues with net cull distance coming into play might already be worked out
there is even relavancy system upgrades like ReplicationGraph to handle that better
I wish there was some tool to quantify processing load for each thing, or even a meta-measure of all things.
yea the replication graph is super interesting, unfortunately not much documentation about it
there is
unreal insights
I use it alot to profile my dedicated servers
you can profile cpu and memory
mindblown I will look into this soon. I appreciate your great wisdom.
no problem, im still very much of a beginner, been using UE for almost a year now and I can say most of my issues have always been me fighting with the UE game framework, or finding out about some weird quirk that is not mentioned anywhere in documentation
the concepts I can understand, since I've worked in webdev for a long time, so some of the programing I find easy to understand, its just the game framework itself it takes some getting used to
Yeah thats relatively similar for me coming from a statistics heavy area, equation terms and variable manipulations are easy but the computer science concepts break me. (and most of my UE experience is for developing research interfaces for my colleagues laboratories which dosnt help). Good luck!
This, oh my fucking God this. ππ I can spend all day trying to find bugs to my new implementation. The moment we put it out there's a 50% chance of some tester writing a bug report about it
God you worded it so perfectly
QA staff is underrated man
its even worse if you're using dedicated servers you cant test those from the editor
cant test all those cases of players joining late
its a pain in the ass
and since you need to have a source build to even use dedicated server sometimes even stuff you buy from the markeplace wont work because it hasn't been tested with dedicated servers
you can do a somewhat reliable test in editor for hot joining
just need to enable the feature in editor preferences
you can do late joins from the editor?
yeah, search for join in editor preferences
its under experimental still i think
you get a button to hotjoin a new player after you start PIE
Oh yeah testing with late joins is essential man, gotta have that turned on
you dont understand what I have been doing so far to test dedis
Be careful, editor will crash if you add a client while you're breakpointing
Crashes a few other times too when I added a client
thats interesting, will give it a try
seems to be working good, one step closer to doing reliable dedicated server tests faster
yes, but it will run on client 2's game
when a player starts the game, say a new client joining
its GameState will replicate that the game has started
and that will dispatch BeginPlay on that players world, locally
but that means for every actor in client 2's world, including the client 1's pawn in client 2's world
well you need to remember that on a multiplayer game, there is a "copy" (for lack of a better term) of each player character on every client's game
so for client 1 to see client 2 in his screen, he recreates a copy of it that is similar to the one on client 2's screen
I'm oversimplifying here, but the point is: BeginPlay will get called on every client
you can check if the client is locally controlled or a simulated proxy
and do things based on that
so you want to set those only for the character that is being controlled by the player
there is a function: IsLocallyControlled() you can use
it returns true if you are controlling that player
I want to make all clients to go to next level when one client clicks the key 1
I don't know well how to do this by using server.
after doing this, hands tracking is not working.
Could you check if this code is right for switching level of all clients at the same time?
np π
you want to read up on seamless travel
I came to know seamless travel used for chaning map in another server..is this not right?!
no, seamless travel is same server, different map
and when server executes it engine will pull your clients along for the ride
Oh, then That's what i want!
Could you guide me a little bit more about seamless travel?
console command should be written like this --> ServerTravel/Game/.../LV_1(<--map name) ??
and should i make this code as "executed on server"?
https://wizardcell.com/unreal/persistent-data/ From stickies
I'm doing on UE5.1,,still available for this?
and i have to server travel 7 times becuase i have 8 number of levels
Thank you very much, Hands tracking is working well again! Am i doing right like below?
Datura, It's so helpful for me! Thank you very much!
hi, i'm learning about dedicated servers. how does your dedicated server build know what to do such as what map to run? i'm thinking the server build could load a lobby map upon startup and when players retrieve the ip and connect the server then server travels to a map where the game takes place. then after the game ends it'll travel back to the lobby map.
In the project settings is a "server map" setting. That is the map the server will load on default (i.e. skipping the main menu). In there you can code logic to have the server change maps and travel all the clients to a new location.
ah ok. good to know. thnx!
lyra actually does this.....
LyraWeaponStateComponent.h::56-57
server reliable RPCs every time client-side hitreg fails or something; I didn't read all the details
I think I'll remove it
Advice of the Day: As usual, never build a game on top of Lyra
Lyra is a technical demo/example game, and as with all of these, regardless of what Epic says, you should not use them as a foundation for a game, atleast if you are serious about it
Hi is it possible to control 2 characters with 1 client? I'm trying to SetMovementInput for my horse but it doesn't work (unless I possess him or use RPC)
thank you, this is good advice, I might try removing it and profiling the change in frame time on the server to understand more about the cost of a commonly used reliable client RPC
Also, I'm not sure that making a game using Lyra as a starter is a per se terrible idea, but the first thing someone must do, if that's their goal, is to read, understand, and remove everything in lyra which can't be justified as aligning completely with their performance/design targets...but people don't usually do this, it's exciting to start a new project, and takes a lot of discipline and effort to carefully read thousands of lines of someone else's code......
Its not about the performance, performance is never a thing until profiled
Lyra is the basis for a very specific tech demo with very specific constraints
Just like all tech demos, they serve a purpose. If you never want to make any major structural changes, sure whatever, but as soon as you are trying to add things that lie outside of these constraints you have a problem. It is best to start clean to know what you have, define your own requirements and constraints, add to that what you need
Through server travel, I'm moving clients to different level at the same time. instead of this, How can I make each player move individually at a specified time?
Now i'm doing like below
This is because sequencer playback should start at the same time on all clients, but the level loading completes at different times, so sequencer playback is out of sync.
I'm not sure about your question, but it seems like you could add logic to only begin your sequences playback once all players have loaded and are ready
Each client uses a different device, so the point at which the level opens is different. However, Sequencer was set to autoplay as soon as the level was opened. However, all clients are in one place. So, all players' sequencers must be playing at the same time. However, the level loading time is different for each client, so the start of the sequencer playback does not match.
I would like to adjust the timing at which all players move through the level slightly differently so that the sequencer plays at the same time.
If I understand you correctly, why not disable the sequencer autoplay, and then hold an array of booleans or something that starts false and becomes true when each player has finished loading the level, and then when they are all true then start the sequencer playback on each client at a single time?
and when players load the level, before the sequencer playback begins, you could add a 'Waiting on other players to load...' screen or something
Oh! I'm infant in UE, Thank you so much! Is there a function to know when a level has finished loading?
I believe something like PostLogin() is called when a client finishes loading a new map
Pawn: Created by GameMode inside AGameModeBase::RestartPlayer(), called by AGameMode(Base)::HandleStartingNewPlayer(), called by either AGameMode(Base)::PostLogin() in case of hard travel, or AGameMode(Base)::HandleSeamlessTravelPlayer() in case of seamless travel.
Between that and this page https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
I am not 100% sure if this event is called after seamless travel for already connected clients, but it seems like it is
perhaps someone else here can attest to that
Thank you for good material. I'll take a good look at it
And in case you do C++, GenericPlayerInitialization is called for both.
HandleStartingNewPlayer is also for both and is BP accessible
There is no such engine function that tracks all foliage/actors being loaded. You will have to track that yourself
_> grumbles why do we need to use a source build to build a dedicated server grumbles
grumble grumble
Because the people that don't need them would like to save a bunch of disk space :3
Cues EOS sales pitch and no need for source builds for dedicated servers if you just use EOS with ListenServers
That would totally not be why
Oh thank you but i can't do C++..π«
Thank you! I'll try it
https://youtu.be/SNNH7uJo40A
I am trying to implement Teleportation functionality in Shooter Game sample of UE4. The problem is how to get the facing direction of player.
Should I use Deproject Screen to world as the programmer does it in this video, or is there a better way?
Also should I call the functions that he called in Blueprints but from C++, or should I use blueprints as last resort.
Rather than using the complicated input blueprints like in the video, I just plugged the T key to TeleportPressed event that sets its bool to true and then used UpdateCharacterStateBeforeMovement to set the destination to transport to. Is this right? And then now all I need to do it set teleport destination correctly.
Previous Video: https://www.youtube.com/watch?v=DoZyH86n_gs
Source: https://github.com/HarryPearce/JetpackTutorial/tree/TeleportTutorial
Epic's doc on character movement component
https://docs.unrealengine.com/en-US/Gameplay/Networking/CharacterMovementComponent/index.html
hey, sorry for tagging, but just giving an update on this as I finally found out why the socket gets rotated when the vehicle re-enters net cull distance, its because I have the CMC component tick disabled
I disable the CMC tick when I attach the passenger which works fine to prevent the CMC from fighting with the vehicle movement, but when the vehicle comes back into range, the character CMC is already disabled, which causes the socket to go into weird places/rotations
I guess I have no other way to go about it than to create a custom CMC
It is never too late to learn! π
Is there any good resource to learn the basics of a multiplayer fps in C++? I tried the legacy sample from Epic but besides the fact I think it is quite outdated, it lacks basic functionalities, like crouching, and when a character aims down sights the other players don't see any change on their screen (to name a few), I checked even paid resources on Udemy or the Epic Store for example but I couldn't find anything
Check the pinned resources. You just need to learn networking in general.
seems like even disabling PerformMovement, SimulateMovement and SmoothClientPosition still causes the issue
hey, if I create an instance of a class inheriting from UObject, can the client send that UObject to the server or does it have to also already exist on the server in order to be replicated?
cause I'm planning an inventory system and I'd like for inventory items to be UObjects, and for the player to be able to send his current inventory to the server when he connects
That sounds like a terrible idea
Making the client the authority of what the inventory should be
Sorry, that sounded much more harsh than I meant it to sound
I know but in my case having the save data on some server isn't an option
I'm also fine with clients cheating in items this isn't a commercial project anyway
Well I am not sure if that is supported. I would be surprised if it is. I know that you can replicate UObjects as part of an actor or actors replicated subcomponents method, I also think with some work you can technically make them work with RPCs, but I have never seen it tried the other way around for just plain UObjects
That's generally anti-server/client model, so I wouldn't be surprised if it wasn't supported
I mean if it's not possible from server to client in any way I don't see how any multiplayer game in unreal would have an inventory system, and if it is then it's probably possible from client to server as well
It is possible from server to client
how then? do you pass the UObject in a RPC or something?
I haven't looked into using RPCs on custom UObjects, I just have seen people talk about doing it with some work. I've never needed to use RPCs on them. I have replicated them from the server to the clients using the replicate subobjects method in C++
and the client wasn't aware of the uobject's existence prior to the replicate subobjects thing?
Right, but that's a the role of the server, to spawn replicated actors when needed
Generally if you have a dedicated server, you would have some backing storage of some kind to keep a record of the player's data
whether that be savegame or a custom Db
I don't have a dedicated server, this is peer to peer
I haven't used p2p and have only used dedicated server / client model, so I don't know what all is possible with it.
Not sure if p2p still falls under the listen server model within unreal engine
Right
I'm aware of how a listen server works (generally speaking), but wasn't sure if p2p falls under that umbrella still
might anyone be able to help me with some replication problems to do with launch character?
just read through this and it seems replicating subobjects is possible at least from server to clients
at this point I'm thinking of using subobjects only for inventory slots, with items being structs containint a reference to a dataasset with the "constant" data (ie item stats), and a list of structs inheriting from a "itemcomponent" struct that'd contain data that changes (like durability) and callbacks defining what to do when an item with that component is equipped/unequipped by a character
True p2p doesn't happen in Unreal unless you go nuts and implement it yourself
Hey guys I'm having a basic replication issue with a player character.
Replicate Movement is of course checked, both instances of the player are the same actor so there's no difference in configuration.
I think the issue might be that the camera or some other component transform is not replicating from the client to the server, but it does replicate from the server to the client.
As a temporary catch all, I do have Component Replicates checked for all player character components.
I'm assuming you're using Control Rotation? Try using the Base Aim Rotation.
I'm using Add Controller Pitch/Yaw Rotation. Is that what you're referring to?
For Base Aim Rotation, I only see a Get Base Aim Rotation
And then the camera set Use Pawn Control Rotation
Yes, that's the one that'll give you proper pitch values.
It's less accurate than Control Rotation, but it does the job
What do I do with that Get Base Aim Rotation? Obviously it grabs a rotation but how does that replicate or change any rotation?
The one is replicated the other isnt
Thats as simple as it gets
Read from it to make your character look up / down. I didn't see any code in the video that shows how you're making your character look up/down.
That's the screenshot yeah. And then the Camera Component is set to Use Pawn Control Rotation
You dont set the control rotation, you want to add input on the client
the rotation is replicated for the base aim
You handle everything else based on the rotation in the ABP
I'm not at all saying you guys are wrong of course I'm just not understanding yet.
Get Base Rotation obviously just gives you the current rotation but doesn't actually rotate an actor or component.
If Base Rotation is replicated, how do I modify Base Rotation? I don't see a Set Base Rotation or something