#multiplayer
1 messages · Page 184 of 1
you can also set the bullet as replicated and spawn it on server RPC
that's what I would do
Multiplayer steam online works for my game locally but not online. Any common reasons for this? Is there anything particular my friend should do?
host want open ports and allow in/out connections in firewall
hi if you dont care about prediction simply spawn the projectile actor in the server and let it replicate normally, ur projectile actor would need a projectile movement component :3
then to interpolate the projectile movement you might want to override postnetreceivelocationandrotation and hook the pmc interpolation method over there
Is it bad idea to try coding deterministic lockstep on top of built-in UE networking? Here's what I thought I could do:
- Every client reliably RPCs from player controller to server (host) with current input.
- Server reliably RPCs the input to all other players. This way every player can maintain a growing list of input structs from every player
I'd then make a ticking object that executes a "lockstep" at fixed intervals, unless not all inputs have arrived for the current "turn", in which case it just waits. Actors would observe the game state and e.g. interpolate their position in tick method so that game looks smooth. What do you think?
And I suppose I can't use built-in pathfinding and physics then, right? If I wanted that, I could maybe use recast and detour with every float across its codebase replaced with software float implementation, like cpp_bin_float from boost maybe?
if your lockstep is based on a discrete turn and not in the current frame count, might be easier
I thought I could make it track time and execute a step, for example once every 100ms? Or some other duration?
mh i would honestly try to integrate something like ggpo
specially if you need something quite sensitive
just found a ue4 port https://github.com/BwdYeti/GGPOUE4 maybe you can find a good use of it
Oh, neat! Never heard of it, ty!
I'm just tinkering for learning purpose, nothing major though
Really want to get to know how this stuff works
ah wait! ggpo is for a p2p rollback based network https://snapnet.dev/blog/netcode-architectures-part-2-rollback/ 🤔
and... you want lockstep, which is fairly different, as you need deterministic input simulations
there is an old post from the community that goes over some of these problems in UE https://forums.unrealengine.com/t/lockstep-network-model-and-ue4/1531
since deterministic simulation is quite complicated, you'd be better off replicating state
what if I want prediction
there are multiple solutions for this, one of each is shown in Unreal Tournaments repo, you can see what UT does within its repo, just look around "fake projectile" https://github.com/EpicGames/UnrealTournament/blob/cc3df7642980e2541fe2d7842f0782bae6c70cd5/UnrealTournament/Source/UnrealTournament/Private/UTProjectile.cpp#L371
the other approach has been commented here before, look around this #profiling message
its an interesting approach where i believe you send request to such central system, and since formulas like verlet are semi deterministic, you can get quite decent results by simulating the projectile locally and then replace it from the server spawned one once u instantiate the "real niagara" one... prolly matt could give more insight on this
Wassup everyone i have a issue that i cant figure out so i have a shooter game and i have aim logic i made a cross air widget (little white dot) and i want it to hide itself when aiming and then be visible when not it works on the client but i don't know how to make it work on the listen server screen can anyone
help would be appreciated it
Why is my widget not updating to my value on the client. In my code,
void AMainMenuPlayerState::PollMenu() {
if (Menu == nullptr) {
TArray<UUserWidget*> WidgetsFound;
UWidgetBlueprintLibrary::GetAllWidgetsOfClass(GetWorld(), WidgetsFound, MenuClass);
if (WidgetsFound.Num() > 0) {
Menu = Cast<UMenu>(WidgetsFound[0]);
if (Menu) {
Menu->PartyCreated.AddDynamic(this, &AMainMenuPlayerState::OnPartyCreated);
Menu->PartyCommitted.AddDynamic(this, &AMainMenuPlayerState::OnPartyCommitted);
}
}
}
}
void AMainMenuPlayerState::OnPartyCreated() {
ServerCreatePartyID();
if (Menu) {
FText PartyIDText = FText::FromString("PartyID: " + FString::FromInt(PartyID));
Menu->PartyIDText->SetText(PartyIDText);
}
}
void AMainMenuPlayerState::OnPartyCommitted() {
FString PartyIDString = Menu->PartyIDTextbox->GetText().ToString();
AttemptedPartyID = UKismetStringLibrary::Conv_StringToInt(PartyIDString);
if (JoinParty(AttemptedPartyID)) {
GEngine->AddOnScreenDebugMessage(-1, 15.0F, FColor::Yellow, "Party Created");
}
}
bool AMainMenuPlayerState::JoinParty(int InAttemptedPartyID) {
if (AllPartyID.Contains(InAttemptedPartyID) && !AllPartyID.Contains(0)) {
return true;
}
return false;
}
void AMainMenuPlayerState::ServerCreatePartyID_Implementation() {
AllPartyID.Add(UKismetMathLibrary::RandomIntegerInRange(1000000, 9999999));
PartyID = AllPartyID.Last();
GEngine->AddOnScreenDebugMessage(-1, 15.0F, FColor::Yellow, FString::FromInt(PartyID));
}
the value of PartyID updates and shows on the widget for the server when I call the OnPartyCreated function, but when I do the same for the client, the value of PartyID does update, but the value shown on the widget is 0. What do I do?
Is PartyID a replicated variable?
Yeah it is.
OnRep?
No, just replicated
How does the client know when to update the widget?
Do you mean how does the function that updates the widget get called?
What I mean is, your OnPartyCreated looks like it updates your widget. When does the client know to actually trigger OnPartyCreated?
My widget has a button that broadcasts a delegate and the callback is the OnPartyCreated function
You are only rotation the player in the server machine
Actor rotation isn't replicated by default afaik
Ok, so then it's just for requesting the creating of the PartyID. How does the client then know when a new value is received/update the widget with the new value?
I thought it would just create and update the widget with the same value, and replicate it to the server using the Server rpc function.
Is there a way to control which IP address UE uses when testing joining a session locally (server & client are running off 127.0.0.1)? I have a hyper-V network, which my game project doesn't use, and I can see in the logs UE trying to connect to that adapter instead of just using 127.0.0.1.
In other words, I don't have a way the client knows when a value is recieved.
OnRep say hello
I'm not sure what I'm doing wrong. Basically I'm not sure how to properly get reference to the Player State I think? In the Game Mode I have logic that after player posseses Pawn, I get Player State from it and by interface send event there to set variables (inside PlayerState). Then in Player Controller I'm spawning building, and I need to send PlayerState of that PlayerController reference to the building, so then the building can read Team Settings from PlayerState. Does it make sense?
[2024.05.26-19.50.36:454][248]LogLoad: LoadMap: 106.437.95.404,192.168.1.10,192.168.1.78,123.45.808.1,127.0.0.1/ShooterMaps/Maps/L_Convolution_Blockout
So should I just update the widget in the OnRep?
Two options:
- Have your widget create a bind for the field that you want to display the value. This isn't great though as it's basically refreshing on tick for something that probably isn't changing all that often, but it is easy to get working quickly.
- Make your variable OnRep and have the OnRep update the UI or call another event dispatcher your UI can bind to so it can update itself with the new value.
Ok, I created the rep notify and now it's working. The variable is getting displayed on the widget in the client like it's supposed to, but now whenever the server creates PartyID, the widget is displayed on the client
[2024.05.26-19.52.20:721][758]LogNet: NetworkFailure: ConnectionTimeout, Error: 'UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 0.38, Real: 3.00, Good: 3.00, DriverTime: 20.46, Threshold: 2.00, [UNetConnection] RemoteAddr: 192.168.1.10:7777, Name: EOSIpNetConnection_0, Driver: Name:PendingNetDriver Def:GameNetDriver EOSNetDriver_0, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID'
[2024.05.26-19.52.20:721][758]LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 192.168.1.10:7777, Name: EOSIpNetConnection_0, Driver: Name:PendingNetDriver Def:GameNetDriver EOSNetDriver_0, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID, Channels: 2, Time: 2024.05.26-19.52.20
[2024.05.26-19.52.20:722][759]LogNet: UNetConnection::SendCloseReason:
[2024.05.26-19.52.20:722][759]LogNet: - Result=ConnectionTimeout, ErrorContext="ConnectionTimeout"
So of course it times out and doesn't work, because 192.168.1.10 belongs to the hyper-v network
Is this Get Player State variable already reference itself if I'm getting it in the player controller?
On that note, why is there no smart bind or OnUpropertyChanged delegate?
No, it is replicated. When i try to rotate another actor on server, it rotates on everyone. But it doesnt work on my character why idk
I'm calling event on Starting New Player in the GameMode, I get Player State from Player Controller, and call event in the Player State by interace. I have set the event to be run on server inside Player State, yet, the variables are not updated after debuging them they are all set to 0. Should I call the server event from player controller, and the interface event should be inside player controller? Like the Run On server should be inside playercontroller called to Player State? What I'm missing? I even tried to set the numbers to be default to others and still everything is basically like 0000.
Okay, so setup was good actually if anyone is curious. I forgot to Set struct inside Player State... xD
this was missing
Also if I understand it right, I don't actually need to Run On Server event here, because it's called already from Game Mode which is server, so interface is enough?
Why do you need an interface here?
Automatically wanted to avoid casting, but I know that the player state is already in the game. I don't have good reason 😄
but thanks for reminding I could just cast here
Doing a little project to checkout ability system and was curious about best way to handle character selection. So fighting game, Players in lobby character select screen. Currently I just have it so when they click on a character it deletes their currently controlled pawn, spawns new one, possesses, and everything ready. Then travels, but this feels strange. Should I handle this is some other sort of way? I thought I saw ~~PlayerState ~~ GameInstance mentioned for a similar situation before but couldn't find again.
Edit: Ok working on paper so have not testing but I think my plan is to have the selection stored in PlayerState. Then on the GameMode I override the default pawn spawning and get the selection choice, then use that to handle creating and possessing proper character.
what the hell, why have I got an enemy that works differently if theres another player in the server omg
testing as client, but just one, my enemy works fine as its supposed to, but when I test with 2 players, I can slow it down in its tracks by shooting it. I know no ones gonna know how to help with this specific problem because its my scripts but why the hell would something work differently depending on how many players what
oh right of course, THE FPS DIFFERENCE

was using a launch character node, but set to 0,0,0 since I was testing without it, turns out it still makes a difference based on fps even when all 0s
I hate launch character man cmc is so bad that it has to make actors "jump" just to push them I hate it
why does no one talk about the fact that we must call the function that isn't _Implement for a RPC, but the one that's written in the .h
WHY???
It took me 3 hours
--
Is it good to do a server RPC, when a bullet is shot? Could it be hacked or is it better to do some kind of validation?
So I've got a player's unique net ID, how would I go about kicking them from my session?
how can i make the ai percept multiple players instead of index 0 which is the server
You want to probably check that Actor is a type of Pawn instead
You can do that by comparing its class
Instead of comparing it to a reference of an object (like the 0 Index Character as you have it now)
what is the blueprint of the pawn is it get player pawn?
i tried assigning players on postlogin as an array in the gamemode but wasnt sure how to implement it
How does replicating a class work? Like if I have a reference to a actor component and it is replicated.
It Depends ™️
Its covered in the network compendium that everyone is told to read three times:
Also if you use Rider - it handles this for you automatically. Just another +1 for Rider for me 🙂
You RPC from the client they fired the gun, and the "direction" (since they could have moved their mouse slightly before firing, so the server will be lagging).
You can validate on the server if they are allowed to fire (gun cooldown, not stuneed, and enough ammo etc). You can also validate if the location they are shooting at is probably valid. i.e. not on the other side of the map too far from the room they were in 2 second ago.
The client tells the server what it wants to do. The server decides if it is allowed.
Ownership needs to be set on the server for replicated actors. If the owner of the actor is defiend as an actor that is owned already by a player (ie. Player Controller, PlayerState, or their controlled pawn) then the client is allowed to send RPCs to the server through their newly owned actor, and the server can send Run On Client RPCs to the client that owns it as well. There are additional replication conditions you can utilize on variables that are based around the owner, There are lots of other things tied to ownership as well, like Owner Only See or Owner No See, and some bits with network relevancy.
Replication only happens one way, from server to client.
Any values you change on a client will only be changed on that client.
Yes it does, I just mentioned a bunch of things that ownership can change in regards to replication.
The only networking thing a client can do, is send an RPC to the server.
Replication conditions... Relevancy...
That changes how things replicate.
Maybe give a thanks when someone answers your original question, instead of debating what else they said 🤦♂️
I was messing around with Iris and suddenly got this message
Disallowed to write first packet in batch, with Iris this is not good!
Is this imply that I should replicate variables manually? Or do I messed thing up too much?
what does "replicate variables manually" mean? Iris is mostly a drop-in replacement
Is there a particular reason why we cannot replicate functions directly and instead have to make a custom RPC event, and then call the function off of that?
Is it because functions are holding up the frame until they complete, and so we can not do that for multiple ms whilst we wait for the Replication to finish?
Not really sure what replicate function means in this context?
Having these options on a function
Ah. This is a BP thing because in BP there is a clear distinction between events and functions in that an event can never return a value. RPCs cannot return values, so there's not much point to making it a function.
Ah I see! Would this be different in C++ then?
Yes/No. C++ doesn't really have a separation of the terms. An "event" is just a function returning void. You still cannot return values in an RPC.
Gotcha. Thanks for the clear explanation. It is good to know the underlying info 😄
I don't know, maybe something like manually mark them dirty and push them?
So as far as I tried, push model and normal replication work well with Iris. Things that doesn't work is only fast array.
And now this "disallow" thing, really don't know where it came from
try using the Iris fast array
FIrisFastArraySerializer instead of FFastArraySerializer
Iris completely replaces the underlying serialization and iteration stuff for replication, but the surface level api is almost all identical
it has some very, very esotiric small differences
like how some replication tasks are ordered etc
honestly it's probably fine to use for most projects but it's under development still
Yeah, so far so good, I really don't have to change anything to work with Iris
big benefits for projects that need the speed but it's almost certainly going to cause some small thing to not work how you expect
Just too little (none) document on Filter and Priority
yeah... you get to read the code :/
I would suggest using an engine source build with new stuff like this, they will not care to make it extensible
in their defense it's a bit pointless to make nice docs for something that you aren't even supposed to use yet
Yeah, no big deal. I think Iris is for the new metaverse thing they are pushing
Create some Filter on my own, just not sure if that's best practice
And feel kinda weird when don't have to mark things dirty to rep anymore
Anyway, "disallow" thing just stop all my variables from replicating with initial bunch
Just one class affected, even when I commented all relate net code, everything else is fine
nah, it's just a better networking backend
it's technically less bound to the idea of uobjects and aactors I guess
I'm sure it would be useful for simulating 20000 bored apes or something, I dunno
you can still use pushmodel stuff with iris
if you have any custom NetSerialize they may need to be replaced with Iris serializers (good luck)
there's an example serializer but it's a lot harder
Be optimistic, how about a fully destructible game with 100km city that replicate in realtime? Or even better, a REAL MMO?
No way I'm touching that shit
Iris is supposed to be a real pushmodel. With the old pushmodel it still had to iterate all the actor channels to see if they were dirty. Iris was supposed to avoid that, so that only dirtied actor channels got checked. Much less iteration code overall.
a fully science-based dragon mmo... (ancient gamedev meme)
Can someone good on EAC tell me pls?
#epic-online-services message
On a note to this. You already can make an MMO out of Unreal. It's not about the worlds. It's about the backend. I mean take a normal MMO with areas. Each area is a different world. You can do this already. Several games have. Tying them together is the fun part.
I think when people say MMO they mean like, a few thousand players running on one box
but in reality a lot of "mmos" have highly instanced servers
the backend databases of course are another matter, I have no clue how to approach that
Isn't that the reason things like Nakama/EOS/Playfab was born?
I imagine, yeah
Like... they promise to not crumble under few ten thousand players?
definitely a thing ripe for third party solutions
I am facing a weird issue I haven't run into before. It seems my Server RPC from the owning client isn't actually arriving at the server? This is all in BP.
I have verified it doesn't arive thanks to a print string after the server RPC event. I have also verified that the RPC is being sent from the owning client with a print string.
Anyone have any clue what I should be looking for?
Want to implement some security in my multiplayer game. It's Listen Server.
Obviously I can't implement 100% security for the player that will be the host, but at least for the other players I want it to be foolproof.
The clients are sending RPCs to the server. On the server, I want to check if the Client that sent the RPC, meets certain requirements, before executing it.
How much control do clients have over game code. Like can clients choose the parameters that pass in with the RPC. Specifically I want to send with the RPC a variable of the player controller, that sent that RPC. Can the client send a different fake player controller, like a player controller of another client?
As a wise person once told me; Unless you are willing to spend 1000's of dollars and hours on security, don't worry about it.
As for a more technical answer: AFAIK there is no direct communication between clients (everything runs through the server), so no they cannot pass the player controller of another player.
an easy way to do multiplayer security is just handle all client actions as inputs and handle all logic on the server
I don't know if that's a wise advice, but it's a convenient one, so I'll take it without an ounce of salt.
Its like @tardy fossil said. You can handle easy security by treating the clients only as input and run all the logic on the server, thus making sure that the clients get no chance to manipulate any data whatsoever. This does need to be balanced with how much traffic you are generating with this approach, as this at some point, will start to cause network lag.
I take great comfort in knowing that most people won't bother cheating. Those that do will find a way to do so (even games like Overwatch and CoD suffer from this).
For in the future if anyone reads this back. Turns out the actor I was calling this server RPC from wasn't owned by the owning client, so the Server RPC got dropped. I will have to run it through the pawn or player controller instead.
is it a good idea to use forcenetupdate? especially in code that is heavy on framerate such as for loops which drop framerates for a few seconds and can possibly desync values of variables
Where are you calling the server rpc? Remember ownership
As client your rpc will get dropped if you run it on actor that you don't own.
Oh I just scroll up lol, u did figured it out
this is exactly what i am facing as well is there no workaround for it? i need to pass my client side variables to a server rpc, but i need to do this without owning the actor
You don't need to worry about this kind of security usually. Clients can only RPC through actors you let them own. Default ownership is their PlayerController, PlayerState, and a Possessed Pawn. You don't need to pass a player controller for any reason because the RPC won't run unless the owner is set on both client and server. Your ownership chain will always route back through to a PlayerController or null, as PlayerControllers are the main net owning actor.
To avoid cheating, most times you just do some very basic checks on the server and this is enough for a lot of games.
RTS example. Player wants to tell his 12 units to attack something. Simple check on server is to see if that player can even see the attacked unit. If not then don't allow it, as this can lead to cheating via sending troops to attack through FOW which paths directly to a base they might not have scouted yet.
FPS example, player shoots another player. Usually this is a client telling server they shot something. Because server auth is laggy, and no one plays a laggy FPS. A lot of people do this via rewinding. Saving positions mostly and doing some simple basic math checks to see if the hit 'might' have been possible. This is tricky to get right but usually it's vague. Mostly just to avoid allowing a player to snipe someone from across the map through three solid walls.
For other cases you need to rely on client side solutions such as Easy Anti Cheat.
FPS example of this is auto aiming. You cannot accurately detect this on a server. Clients don't send every look update to the server and there isn't really much authority there. Reason being is that server auth is again, laggy. People buy expensive monitors to avoid laggy FPS games, they're not going to put up with networking lag. So your only choice is to detect this locally. Software like Easy Anticheat allows you to detect and ban players for certain things like this which cannot be correctly done with server authority.
Route it to actor that you own. Eg controller, character, player state
Example: on button click in widget -> get character -> server rpc
how can I, the actor where i need the RPCs to run on are vehicles around a level, and they are static ( not possessed by players )
Just gave an example above
Also you can give ownership (must be done by server) however, this is not recommended
And an actor may only have one owner
Done via set owner node (again has to be done by server)
one owner is fine, but can we not give ownership on client side?
just to that the client rpc can then call server rpc
That doesn't make sense
The server should be the one to decide who owns what
And even that is not recommended because it just become easier to cheat, afaik
this only runs when i possess my vehicle, otherwise if i hit the vehicle without possessing it, it wont fire
and im guessing this is coming down to ownership, because i checked on begin play, the owner of the vehicle is AI_controller_0
You can set owner, or you can route the function somewhere your player own. Those are the only choice imo
Why do you need to server RPC the client hitting the vehicle? It hits on both sides.
Yeah going back to the talk yesterday, you should really handle those collision and deformation locally
i need to pass the client side hit variables to the server, because the server one returns a different value
What is this for exactly?
procedural vehicle deformation
Is it really off by that much though? Both should be roughly the same even if slightly different?
i can do it locally, but i still need to pass client side variables to server, if I take the server side first then pass it to clients via multicast or rep notify, the deformation does not even occur
most of the time a bit different, and i had checked on 2 clients, the deformation appears to be the same but one client always has one part of the car deformed a bit differently than the other
minor differences, but that aside, the major problem is rep notifying the late joiners, because when they join they see fresh new cars that are totally undamaged
I meant on the server. If it's close enough to the clients then it shouldn't matter that much.
it is close enough to the clients yes
Avoid multicast for anything that needs to be in sync. It will never work.
ok ill not use multicast at all for this
Dirty way is just OnRep an array of hits. 🤷♂️ Resimulate it with each onrep.
Hopefully the resim isn't too expensive.
the for loop is expensive as it drops the framerates ( on bps )
If the result is simmiliar then just do everything locally. You will get responsive feedback.
For every collision on the server, store the hit data in an array.
When late joiners comes simulate deformation using the array and call it a day.
There really isn't a good way to do it otherwise. 🤷♂️ I mean even just the resim part is kinda 'eh'. A lot of games fake this heavily by premodelling destroyed areas. Much faster on CPU and GPU at runtime to do than a full damage resim.
if you attach a replicated actor to another replicated actor, this attachment is also replicated right?
These variables are replicated so I'd assume this to be the case but their OnRep funtions don't immidiately update attachment so I'm not sure
/** What we are currently attached to. If valid, RelativeLocation etc. are used relative to this object */
UPROPERTY(ReplicatedUsing = OnRep_AttachParent)
TObjectPtr<USceneComponent> AttachParent;
/** Optional socket name on AttachParent that we are attached to. */
UPROPERTY(ReplicatedUsing = OnRep_AttachSocketName)
FName AttachSocketName;
It is
ok ty
i dont think i can use the is locally controlled in this, because from what i have tested, the hit results return Server: locally controlled = true . and the moment i possess the vehicle pawn, then the results are Client0: locally controlled = true
Switch has Authority
Authority for Server -> Code runs in server
Remote for Client -> Code runs in client machines
collision can be handled locally, meaning there is no networking here
the network you can do is to store the hit data if Server (using switch has Authority)
which is replicated
When a new joiner comes, you can re-simulate using that replicated array
Switch has Authority -> If Authority -> Simulate Deformation -> Add Hit result to Array
If client -> Simulate deformation
This is authority over the object, it does not mean “run on server”
Any replicated actor will have server as the authority
only time client have authority is when they spawn the actor locally
Right but you should be careful with context there and make sure you know what it’s doing
So doing a check here with switch has authority will filter what runs on client and what runs on server
In this case maybe yeah
not maybe
figured out the aim offset pitch replication haha just a little update.
Merely trying to prevent the confusion of switch has authority = server 😊
I just rep notified the array. and now i get this type of a message in the dedicated server log
LogOutputDevice: Error: Ensure condition failed: !IsBunchTooLarge(Connection, Bunch) [File:D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\DataChannel.cpp] [Line: 1161]
LogOutputDevice: Error: Attempted to send bunch exceeding max allowed size.
O.o How big is the array for each vehicle? That takes a LOOOT of data to overflow.
that's not what I said lol, the part that took me 3 hours was this:
When CALLING a RPC, you must be calling the one without the _Implementation
its just taking the vertices of the mesh, so its around 30k vertices just for the body
thx
so looping 30k into the array
Oh. I meant that you should replicate the things that caused it. Each client can redo the simulation locally with that simple info.
HasAuthority = Is it your machine that spawned this actor?
How would it be possible to do a Client RPC (from the server to a client), how to know which client? (I suppose that we would have to send the player controler or smt like that)
Could you give me some examples of the following? !
So if an Event is ment to run on server, and If I want to update the widget map for the client, it won`t because it comes from an event that is running only on server?
Hiya, I've got an issue where i'm trying to test multiplayer with one client being the listen server and the other being a client, however the second game doesn't spawn correctly and the listen server client does, and when I close one client the other fixes itself, any clues what might be wrong?
what is ur code like
Hopefully this is readable/useful, this is the code to set the camera for the player to look at my main menu
I'll take a screenshot of the ingame differences
Left is correct, right is wrong
and if I close the left window, right then fixes itself
where does this take place at? playercontroller?
Yes
Set View Target with Blend
How do you setup unreal to launch like this?
Having one server and two clients and each one has individual window
I have it like this - Launch seperate server set to true but it's not working
New Editor Window PIE
How do I make a component visible to the client and not others?
visible or only exist on the client? If the second just spawn it without authority
visible on the client
then I guess replicate the isVisible or whatever it's called on the component and do a RPC multicast to set it to false if not the owner? At least the way I would try it
if the client owns the object you could use only owner see
Sorry just bumping this, any ideas?
So its not the spawning that's a problem, it's set view target that's not working properly?
It appears so, yep
It's not spawning in the camera on the clientside
The first thing I'd try is to make sure that is only running locally
Islocalcontroller -> branch
Also if you're running that code in the controller then there's no need to connect get player controller right?
This is in the level blueprint rather than the player controller 🙂
I'd also setup an isvalid check for the camera you want to view
Clients are slow to connect and sometimes code runs faster then the object can be created
Lastly have you made any changes to the default camera manager?
I haven't no 😅
I have a feeling it's probably better if I put the code in the player controller, will feedback if that fixes it
I'm trying to debug one simple thing and it gives me mixed feeling.
-
Player Controller - I call from Player Controller from local client to show it's own Player State name.
-
First host/client matches.
-
Second client matches.
-
3rd client shows 1st host/client name?
What kind of magic is that...
to be even more funny, from time to time, the last client debug works properly!
the red debug is from Player State itself when it get's created
I satrted up as a client instead of the listen server and this is the message log I got
You should try again and add a has authority check, make sure only the client is running the code and not the dedicated server
And see if you get those same error logs
Hello, I'm looking for some general advice on replicated timelines from anyone who may know. 👋
I was working on an enemy that rotates on a repeating timeline. The timeline fires SetActorRotation() on update. This looks choppy on the client so I was about to start tackling that when I spied the Replicated button in the timeline settings. I've never used this feature before and I thought since the rotation of the actor is already replicated, replicating the timeline would only cause problems.
However, on enabling Replicated in the timeline, I see that the rotation on the client is now nice and smooth. 🙂
This seems too good to be true so I'm here to ask if there is a gotcha here I need to look out for. Are replicated timelines expensive? I'm wary.
Any advice would be appreciated.
Cheers.
On the begin play of the player controller it creates a widget without mentioning the owning player, does this one replicate the widget for the client ? Because I try to acces it as the client and get the reference to the widget of the first character 😦
Widgets are in no way ever replicated.
so I need to create onee for the server and one for the client separatly via begin play of the player controller?
don't create widget in beginplay, it's called for every controller that joins so you end up getting duplicates. use something like void AMyPlayer::OnControllerChanged(APawn* Pawn, AController* OldController, AController* NewController) { Spawn Widgets here
this also has a blueprint implementable event in your player class
ah you mean from begin play to pin this event like you said?
like to make it separate event?
Neither of those solutions are that great. Should use AHUD class's beginplay to initialize your UI. Whatever it needs to display for the character, it can bind to things or wait for the character to be read to bind to what it needs and work. Gameplay classes like character and controller should have zero references to your UI.
UI is really hard to maintain unless you treat it like a layer on top and make a decent, structured API to manage it.
oh I see what you said, I think I tried it but didn`t work, but this way, is it good to place multiple different widgets in the AHUD?
And also how do I get a refrence from the AHUD in game for each player?
Depends on what you need. I use CommonGame and CommonUI these days. So I simply push a widget to a layer when It's needed. User controls or it's own handing deactivates and removes it based on it's intended use. I don't really manually manage widgets like that anymore.
You can get any player's HUD via getting their PlayerController and calling GetHUD
There is one on each machine for each player.
ah yeah
but basically the reason I want it to do it this way is because of the way I handled the minimap
Basically when a player passes a trigger, it calls tthe minimap in order to switch it`s focus
my map is like binding of isaac style
didn`t think of any other way 😦
Minimap can bind to whatever is running triggers. There's also the GameplayMessageRouter plugin for more generic game wide events like that.
out of curiosity, how did you add CommonGame to your project? I just copied the code directly from Lyra but I'm wondering if there's another way
You can copy the entire plugin.
and if I want to store a refrecene that I create the widget in the AHUD, where should I save it, in the AHUD or in thee player controller?
Literally just grab the entire Plugins folder and drop it in your own project. Good set of tools.
oh got it, I thought there was a way to install it directly within the engine like the other plugins so it would be easier to get updates
I have a que slot in my inventory so my OnRep knows what slot to update in the widget. But there's no guarantee that OnReps arrive in order right? there's always a chance you might get a later one if a player is spam picking up items? I mean it works and I even added a Queue but still seems things could go south
AHUD most likely. Controller doesn't really need anything else in it. You'll already be putting enough net code in it to fill it up well.
There might be a git for it? Not sure. I always keep Lyra updated anyhow so it's not a big deal to copy them for me.
There is no promises there, no. You'd need to also replicate with it the slot or something. But honestly managing something like that is a nightmare. Making server care about which order the client's widget displays things in is a recipe for disaster. I'd scream at my gameplay programmer colleagues if they made me manage that in a widget with all of the sorting and filtering you need to do in an inventory.
That doesn't really fill me with hope 😅 Well how does something like fortnite handle it? You need to make sure that whatever you are clicking in your inventory widget matches the actual server inventory array I suppose 🤔
Depends on whether you're doing set slots. But for most systems, UObjects mostly. The order of the inventory in gameplay code should not matter. An array of UInventoryItems is infinitely easier to simply sort and filter than any sort of struct based system.
yeah my are set slots and a struct
i try to save the refrecene for each player of the map and as you can see the minimap has thee same name for both server and client, but the name of the player is different, what do you think ?
over engineered tbh
In what way?
I don't know whats exactly your issue but the approach you are taking looks fundamentally wrong
the server shouldn't be aware of any UI components at all. the UI subscribes into your components and then these components will tell the UI when it needs to update through a generic "interface". an easy way to do this is with delegates but there are other methods
if anyone was wondering, in multiplayer each client has it's own list of player controllers and player states, so even if they are really different numbers (1,2,3) when you call from each client, they sort that list starting from them, which can lead to some black magic like this
Hi, I am using this blueprint to teleport players to another sub level, the thing is that every player will be teleported and not the only one who start the event. How can I fix it to teleport only the interested player?
That shouldn't teleport everyone unless all of them overall
You do need to be aware of the fact that the other actor pin isn't guaranteed to be valid or the original value anymore if you use latent nodes
You may want to save the actor that overlapped and block the overlap until everything is done
I have two client but both of them are teleported, even tho only one client start the event
I hope you are testing it with "run under one process" unticked
where to set that? I have no idea
in editor settings
just type it into search box
if you have it ticked print messages are displaying on all game processes because it is one "engine"
so if you do
if(IsLocallyControlled()) or something and then AddOnScreenDebugMessage it will print out on all clients
although yoiu checked for local controller
so you basically tell me that everything should be happening on the server, right?
i try to get the reference for the second players hud but cant acces it 😦
don't
?
You're approaching this all wrong. Link your initial post where you said what you're actually trying to do
here
https://wizardcell.com/unreal/multiplayer-tips-and-tricks/ I think you should read this, HUD is relevant only to owner, it do not exists on the server
up theree
@odd hamletWhat are you actually tryign to build
Nothing in the UI is relevent to anyone else. All UI is local only
So I want a minimap just like in binding of isaac, in which each characters has it`s own widgeet minimap, but both have different possitions, and I would like to make the minimap update when the client passes through an trigger box, but it only does it for the server, not for the clients too
but the trigger on box collision was pinned from an event which wasn`t replicated
I made it multi cast i think it might solve it maybe
no
OK from the point of view of a single player, what do they see in this minimap?
they see where they are, and where other players are as well I suppose?
Every client already has all the info they need, assuming all pawns are relevent all the time
on a clients computer, they already know where the other peoples pawns are, and where their own pawn is. That's enough info to draw the minimap
So the server is supposed to see that if in it`s vicinity of his room, theere are other rooms, and basically he is supposed to see the room in which his teamates is
show a screenshot of this actual minimap
i'm failing to see how it's any different than the normal minimap in any other game
I made it this way
, the red squares are where other rooms are located basically, and in the center it`s your position basically
Why the server? Why is the server special?
well you said in the pov of a single player
but my game Is not to be played single player
yeah but how am I supposed to update the minimap for the client that is my problem basically
i cant reach to update thee clients map
you don't
the client machine updates the minimap locally using the info they already have
the server doesn't know or care about anyones UI
yeah bro but it`s not an event tick
each time a player crosses through an trigger box
basically i want to execute a function from my widget minimap that updates the map
i don`t really understand the way you want me to implement it
Then update a repnotify variable on PlayerState or Pawn called CurrentRoomID or whatever
hmm, you think this is the best solution?
RepNotify_CurrentRoom -> ok now we know the room changed
The best solution for now would just be to check stuff on tick and get it working before worrying about efficiency or performance
yeah tried on tick before and it didn`t work, and now I am trying this way
Just make sure to think about things from the POV of any player
if all pawns are always relevent, then every machine knows where every pawn is
the player state gets easily reference to it`s own hud?
if it knows that, it knows what room they are in, assuming they know where the rooms are
yeah
you can't update other players hud and send info from another player it ALWAYS must be: SERVER UPDATE -> CLIENT RPC / MULTICAST -> UPDATE HUD
or OnReps as adriel said
or just replicated variable territory
where you are is state, prefer repnotifys for state
do all clients know about all rooms all the time? Or do they only know about the ones they've been in or are near?
no, basically from the game instance I get the struct array in which I store information about each room
and basically I am going through it with a for loop
why game instance
this is it
the room location, the trigger array for the room, and the objects of the doors exactly
what IS a room?
Have a look at the screenshot I posted, it literally says that in the comment there
how would I do something like "Kill everything in that room"
yea I know lol, I made a rookie mistakes :3
thee space where an Enemy is getting spawned,, once clear you get to other rooms to kill other enemies
and in order to spawn the enemies i use the triggers
No i mean what represents a room by ID in your system?
Are there Room actors, room indexes, room GUIDS, what
yeah an actor
thee room itself is an blueprint
ok so put a replicated repnotify reference variable of type RoomActor on characterpawn
set it on server when they go in a new room
the repnotify can tell the LOCAL minimap to update
voila, any time someone goes in a new room the minimaps will update for everyone
When I equip a weapon, I have left hand IK that goes where it needs to. This is calculated on the server so it can replicate to proxies. Is this a kind of thing I should just skip the owner and let the owner calculate it so that it is instant? Or should I still wait for the OnRep from the server?
Yes, you should predict Weapon Switching.
Ok cool. Thank you!
Hello, a question, I have the Dynamic Sky, I want to change the value to variables from the client through a admin panel, but not working
What is wrong?
put breakpoints or prints and see where the execution stops
does it make it all the way to setting the weather?
All the nodes are executed and the Weather variable also changes, but, customers do not see it
does chaingint the weather asset usually work?
assuming Weather changes on server then it's a problem with the plugin if it's effects aren't replicated out
i modify the value of the variable in the details
Ultra Dynamic Sky/Weather does replicate, and it seems you're pushing it to server and owning clients, but not multicasting so it replicates to all. is OW_SetRain for the clients that are in the game and SV_SetRain is for the server to set it?
I'd say try to start by setting SV_SetRain to Multicast and then OW_SetRain to Executes on server
@torpid whale
cause if you were just having it set specifically on the server controlling it all you would just need to multicast it, but since it seems like you're letting clients set it as well, you need to do both of those.
Hey! How do you "lock" a session using steam subsystem? Basically, I don't want players to be able to join lobbies that have an active game going on
Does this make sense?
If Component Replicates doesn't replicate the properties of the component from the server to clients, what does it do then?
Just because a component is marked to replicate doesn't mean everything about it replicates, just that it can replicate if it has anything that's set up to support replication already.
If you want to replicate the light value, you'd want an OnRep float variable in your actor that you then use to drive the light's value.
Any reason why this wont enter "Server Custom Event"? I put a print after the auth switch under remote to make sure that Client 0 is going through but stopping at Server Custom Event :\ reliable is checked for all of the replicated events.
For more context this is a replicated container, when the owning player hits the close button in the widget it calls Close Animation. I was just reading somewhere, do I need to call an event to the PC first instead of directly to this container? So widget -> PC event close container event -> container close event that toggles animation?
Can anyone give me insight on if getting the GMCv2 is any good?
I have a pawn class that I need to replicate movement smoothly (a spaceship floating kinda pawn)
Likely because this object "BP Parent Loot Container" isn't owned by that client. You can only send Run On Server RPCs on actors owned by the client, like their PlayerController, PlayerState or Controlled Pawn, or any components of these actors, or any other actors that have their ownership set to one of these.
Normally an interaction "Run On Server" event would be sent on the Pawn or PlayerController passing along a reference to the actor the player wants to interact with, then when running on the server it communicates to the actors as it needs.
I have it. zero regrets. But that doesnt mean it is right for you.
you should be able to do this with CMC - so GMCv2 isnt going to fix bad practices if you've implemented it wrongly
but I do find GMC discord to be very helpful
ive tried using CMC and have better luck just using a pawn tbh.
I did get it sorta working with CMC but now when I get in the spaceship the ship just rotates around in place and I cant control it.
not sure what happened
and it just isnt smooth with cmc
Yeah I tried joining that server but you have to purchase before you can talk there..
In 5.4 with c++ you can also try out Mover fwiw
okay well I fixed the spinning collision issue
I just cant make him move though
I've been thinking about trying mover but I would have to learn c++ also
Well one of your problems is that you are attempting something that most likely needs c++ either way
Yeah especially movement in multiplayer isn't a really a blueprint thing despite the very basics that CMC already provides
why can I add movement input to my actual character but adding movement input to the spaceship in a character class doesnt work
GMC exposes stuff to BPs iirc, so that could help. But I don't know to what extend
The spaceship needs to be possessed I assume
If it's possessed (server side) then addMovementInput should work just fine
it is possessed server side but doesnt work
Given it's a character of course
Pawns for one have no movement component by default and the ones you could add all have no multiplayer support. At least not to the degree of the CMC
yeah but i can move the pawn class version but the character class version i cant move
Tricky to suggest anything without knowing more.
i possess off this interface
I may just be missing something that I updated in the regular pawn class
since I duplicated it awhile ago and made it a character class
and I've changed stuff in the regular pawn since then
You can try printing a bunch of stuff, like the current movement mode of the spaceship
To see if that is messing around
Or the input vector to see if it gets any input at all
I can try that, its default is flying which I assume thats what I want?
Yeah
Other than break pointing the CMC in c++ and seeing where it gets stuck I would have no clue atm on what else to suggest
Might also be worth checking if possessing the spaceship as the default pawn works
it seems to only print client values
On tick?
Is that spaceship placed into the level?
yes
Then it should exist on the server just fine
hm.
Gotta walk the dog now. Can check back later
there was a key on the print string messing it up
my bad
and I couldnt move from setting simulate physics. But id like to simulate physics for my thruster unless I think of a different way to do that
Hi, how can I create an actor component only on the owning client? I want to create a component that will spawn particles locally for the player
just have logic to spawn it like normal but guard it with something like IsLocallyControlled() or some other way of checking its the appropriate client
ok, thanks
Has anyone come across some iris examples or documentation? I am reading the source, but with example it would be easier.
when i try to call a server RPC from pawn on client side its getting droped (No owning connection for actor)
but since the pawn is owned by the player controller, the owning connection should be "owning client" right ?
edit : Im calling an interface event, this event implementation on the pawn calls the server RPC.
when i do : ListenServer on Client1 Pawn the RPC gets called
when i do : Client1 on ListenServer Pawn it gets droped (i guess its because Client1 doesnt own the ListenServer Pawn, in that case idk how i could make this work)
Pawns are owned by the player that possesses them yeah
But ownership is replicated, so if you call a server RPC too early, it may not go through since both server and client check independently
for now i made that the interfaces get called on server
what i was doing was :
Locally press input & shoot a linetrace
if hit call the interface event
in the interface event call the server RPC to process the shoot for rewinding etc
Is it possible to get Dedicated Servers Mapname & Port in Blueprints? Or only in CPP? I'm guessing I need to get the arguments used to start the server?
store them in the game instance of the server, and have a RPC to get them
Can't anim montages be played from a different actor/class?
Specifically I want to play an anim montage for one of my characters, but do it from the GameModeBase Blueprint. This is because instead of making tons of RPCs for different montages on different actors I need to play, I want to have one Multicast RPC in the gamemode, and by calling it, replicate the montage I need from any actor I need.
I correctly pass the skeletal mesh and montage references with the RPC, and the RPC does execute (checked with print string), but the montage doesn't play.
GameModes don't exist on clients so you can't call RPC's on it
The Multicast RPC in question is called from a server.
So I call a server RPC
on an actor
and that calls the multicast on the gamemode
Doesn't matter, it's a multicast which won't route to any actor on the client
GameMode doesn't exist on clients, so the multicast has nowhere to go
But I have Server RPCs inside the Gamemode Blueprint that definitely work without issues. Is it only multicast and owning client that won't work in the gamemode?
this is linking the compendium time
If you call a Server RPC on a GameMode from a client, it will not work
assign owners and such
If you try to access the gamemode on a net client, you'll just get null
I call a Server RPCs from the server.
Then it's not an RPC
so yeah, they'll work
So I call a server RPC
on an actor
and that calls the multicast on the gamemode
Same logic
I call server RPC on an actor
and that calls the server RPC on the gamemode
and that works
Because you own the actor
you know RPCs are meaningless server->server
The actor RPC goes to the Server, the gamemode RPC goes nowhere it's just processed locally
you're already on the server
Just told you
Fuck it let me simplify it for you
A multicast on the game mode will not work because the game mode does not exist on a client. It not existing on a client ALSO means you can't call a Server RPC from a network client.
define "everything I do"
and yeah, the multicast on a game mode will do nothing for the reasons Jambax has already explained
I think the more appropriate question is why would a game mode, which has no physical representation and is a server only thing care about a montage?
Montage should be on the character, or an ability, or some other thing relating to the character that it's being played on.
There is that too yeah
and I couldnt move from setting simulate physics. But id like to simulate physics for my thruster unless I think of a different way to do that
careful, by default physics is not replicated
you can replicate it in project settings, but if you want an absolute lack of jankiness, da best would be to use a deterministic physic engine such as bullet
This would be less of an issue as long as no collision / bounce are involved
@summer rivet from what i experienced so far, if you dont mark a component as replicating, like an actor not set to replicate, the component will only exist locally where it got created (so on server if the component is attached in class), so no replicating vars or RPC possible
(from <#cpp message>)
ok so these should be easy questions.. I hope lol. simple networking action. Actor with a Render Component on it using a sprite. Single player I spawn the actor, set the sprite on the render component, and profit. Multiplayer, I do the same and it only spawns on the local machine (which makes sense). I create an RPC for a server call and do the code, the blueprint is created on the client and server as expected. the code I run to set the mobility on the component is changed on client and server. the code to set the Sprite on the component does not seem to take hold on the client. Actor and Component are both set to replicate, and I can verify its working as without component replicates on the render component the mobility change doesnt take hold.
so should I assume the render component - Sprite property doesnt replicate and if so, how would I change it correctly on the client
you would spawn the actor on server (and mark the actor as replicate so all clients gets the actor in the world)
you would make the sprite to OnRep
and set it on server
make the sprite to on rep?
Yeah
all bp
then its easier
thats the issue here
So class has sprite variable, and that is an onrep. In the onrep just get the sprite comp and set the sprite
the OnRep function will get called on server and clients
Create a sprite variable, i dont use one that exists yes?
Correct
Yeah. It's wack imo.
thats what I was assuming, but it feels weird
(make a custom class )
but if its not an auto replicated property I guess you have no choice, and without checking source you cant really know what is set to replicate can you?
Not really, no.
yep I assumed that as well...
which led to 30 minutes of wtf debugging
so in theory then without a custom class, you cant just programatically spawn in a paper sprite actor and set its sprite over networking huh?
Inside of the onrep, the variable will have already been updated on the client, as an FYI
Server :
MyVar = SomeAsset
Called on Server & Clients
OnRep_MyVar
Component->Sprite = MyVar
yep yep
I guess making a custom class in C++ and handling it that way would fix this as well, blah
on rep is good also to handle latent joins
yeah this is all simple mathmaking and 1:1 stuff, no late joins so the code is "simple"
trying to just test random things at this point to figure out what I should replicate and what I should cheat
didnt expect checking a box to not actually work 😛
it would be nice if there was a tag in the tooltip that had this info in it
Well, to be fair, it works just like actor replication. Just more things are actually replicated for you under the hood with actor replication.
yep it works fine now. so, lets say then I only need 2 properties to be replicated on a component. Would it be smarter to just not do the component replicates and do onrep way?
Yeah, pretty much.
or is replicates component smart enough to be efficient?
It depends on the property honestly.
Mobility and Sprite in this case, only set once
to rep properties in a component it needs to be replciating
OnRep them
since for whatever the f*ck reason you have to set mobility on a render component to change the sprite...
Just have two vars in the class itself, CurrentSprite and SpriteMobilityMode and then make them onrep and update the component when they get replicated. Then you don't need the component replicates checked at all
Networking is fun 🙃
hmm
ugh
but the render component not replicating means it doesnt move when the actor moves lol
thats weird but expected I guess
its the parent technically I think is the issue
its a paper sprite actor, trying it another way for fun
yep, reparented it to actor and put a scene component that replicates as the root
works as expected both ways I guess, without the replicates the transform doesnt replicate if its the root as the paper sprite component
Yeah, that part makes sense.
im thinking that would be the cheapest? just replicating a scene component and everything else is on rep
Generally speaking - stateful things should be in OnReps
It isn't only for late joiners either. It also affects net relevancy.
Generally, you'll find yourself having a number of OnReps for common visual things
Equipping a weapon? That's an OnRep
Changing a material? That's an OnRep
yeah im trying not to premature optimized but I figure with networking its smarter to start when I can
I have a feeling Im not going to be able to get away with pure bp just due to some of the timing issues I am seeing
It's generally advised to use C++ with networking stuff honestly. I think more of networking is locked behind C++ than some other parts of the engine personally.
twoish more questions I think. right now im setting two onrep variables in a row, with the second needing the first to be done before the second works but randomly they dont finish in order (which makes sense). chances are I will just pass them both or something else to make sure both are valid before using but is there a better way to maybe handle making sure stuff is sent and received before moving on?
trying to just see whats built in before I hack together stuff because why reinvent
Bundling it into a Struct for a single replication. Or making each OnRep call a checking function before proceeding.
yep yep
ok so im not far off on my thoughts 🙂
and the other weird one which seems to have stopped, I was setting view target on begin play in a bp that is in the level at the start. it works fine on the listen server, but the client doesnt change cameras it just stays in the normal pawn view. if I delay a few frames, works fine. So is there a function I can hook into thats in BP thats called when its completely setup or am I missing something weird? I know how to work around this, use a proper pawn, but... initialization I have a feeling is going to be an issue down the road in networking
its random too lol
if i set it to dedicated server mode, randomly 1 of the clients will get the correct camera change lol
Beginplay issues. Technically the only thing really required for beginplay is that the game is ready and the GameState has replicated. Which means you can end up with a Beginplay of the level before the Controller or it's sub actors like the camera manager are ready.
There is an event in the pawn you can use, like, PawnChanged or something like that
Pretty much, you want to set the view target when the pawn is newly possessed
Welp
but.. why and yeah having begin play fire before stuff is actually loaded makes stupid sense
I do most of that with widgets. Widget sets the player using it's controller's view target when menu changes.
Widgets aren't created til AHUD's Beginplay, so client is all set up and ready by then.
yep alot of this is just due to poor coding in this sandbox project, but its making all the edge cases come to light
So you're trying to have the camera target the sprite actor?
nope theres a game manager that has the camera right now, its in the world when it comes up
i know the correct way is just to have a proper player pawn thats in the correct location and camera
but this is more finding out that begin play doesnt mean squat in networking lol
So, GameManager has the camera and it is trying to set the blend view to the player when the player finally spawns?
maybe? Its just got the set view target node on the being play in the game manager. Im guessing the player pawn is just not in the level when this code runs lol
because no easy way to force spawn order lol
yay for race conditions
Is the GameManger just a regular ol' actor?
You can use the GameState to register the camera and player as being ready on the client. If they're both ready, set the view target.
GameState is what calls begin play on everything, so it'll be present
ok last probably stupid question but its only stupid if I dont ask it. Assume 2 player tetris, syncing piece movement over multiplayer. would it just be fine to sync the actor with replication or is there a smarter way?
Replication
I had the stupid idea to just sync input, but havent tried it yet because it seemed stupid but I wanted to try it anyways lol
That, you should be able to just check that replicates box on the actor and the transforms should be sync'd more or less.
I wouldn't sweat it personally.
yep movememnt is synced right now between the 2 clients and seems to work fine
I can't imagine you'll get into the hundreds of sprites range. Unless you're doing like, Tetris Royale I guess.
nah at the most movement for a few sprites, and the rest would be fixed positions once resting
lets say one of the players "scores a line", assuming the same code is running on both machines and movement is replicated, it should visually show the same thing on both machines no?
Yup
im sure I am overthinking it but also trying to figure out the easiest way to keep things in sync and prevent the basic cheating. probably just going to ignore the latter as much as I can
The easiest way to prevent the basic cheating is to only do the scoring on the server
listen server setup soo...
gg
yeah, it is what it is
The other simple way is to verify that a move was even allowed.
I guess the goal is to then make the items that are replicated as light weight as possible and handle as much as I can on each client with just the replicated stuff being the driving force of the result
Like, was it really possible for that L block to go from one side of the map to the other?
But that is more involved.
I do check for valid moves right now when moving, so setting up a threshold for checks every so often shouldnt be a big deal is my thought
okdoke. despite wanting this to be in BP as much as possible, im thinking breaking out the core stuff into C++ is smarter in the end. I already have to use C++ for Steam DLC because Epic
yep yep. Its a 1:1 game so that will make it a little easier, and I know I cant stop dedicated cheaters.
considering movement can only be in 1 space increments I think doing sanity checks on if a move was valid wont be much lift
I guess making the server also the one that gives out future pieces is required as well lol
yeah, mostly dont expose too much data to the client
yep yep, already trying to split up data and visuals as much as I can to make that easier so no worries there
dont make the client be able to call without check function that create stuff
some script kiddie could find a way to call these by himself
yep yep, nothing should be client side except for input and visuals as far as I am planning
yeah
the hard stuff is player movement
cant do it server side only, or it will be slugish as hell in fast enough games
thank god, the CMC handle that part
well, other hard stuff is what requires 'dexterity' from the player
can be hard to tell if the mouse move comes from a hand, or from a cheat
even in lan people find way to cheat these
Like, aimbot in mouse firmware and stuff like that
when we have this typical branch as seen in video examples:
if HasAuthority run someFunction else run ServerSomefunction
can we just always call the server version even if server or does this cause some issues in the backend?
Like there's cases where I know I want things to just always be server so the branch seems kind of pointless
You can just call the server verson. If you call it from the server it'll just run locally anyhow. The check is useless.
Hello, quick question. Is there ny best practice guidelines regarding line trace weapons in multiplayer, such as trace origin, etc.? Should I use actor eyes, or replicate the camera and use that?
Not sure you'll get a solid answer on that. You'll find a lot of games do this with a bit of client auth. Server auth is laggy and won't reflect what the user actually sees. So client just does a "hey I hit this thing." Server does some checks to see if it might have been possible before accepting it.
So. How you choose to pick the trace start is up to you. Center of viewport is common to find intended target in first or third person views. Other stuff kinda fakes it so it looks mostly accurate. But either way if you don't allow a client to do this on their own then it feels bad. No one likes input lag.
Hmm, okay. When you say, 'some checks', what sort of checks does that imply? Could I simply do the same trace on the server to validate?
Really depends. Like I know Jambax did some stuff with rewinding. I don't know how involved it was but as far as I understood it you save old placements for a second or two and on hit, use the timestamp to get the placement and see if the hit is relatively close. Basically avoid obvious shooting through walls and such.
i have a strange issue with a clients behavior
when i run a game for a one client, these events works perfectly
but, if i run a game for a multiple clients, these events works correctly for the last client only
any ideas, where to seek a problem?
can i trust the AHUD to spawn on begin play for all players exactly what it needs or is it a bad habbit?
also I have to notify you that what you said works
and that you are a genius
What would be the best approach to replicating control pitch information for first person? Replicate the camera and just do a server RPC setting the camera pitch for non locals (This is my solution because I have the arms attached to the camera)? Forget about replicating the camera and just replicate the pitch of the arms (I would have to detach the arms from the camera)? Is it overkill to replicate the camera component?
why not just replicate the root thing which is just a rotation
there is already a replicated pitch
its really dumb that it's only the pitch but it is there
Sorry, I am not following. What root?
your arms and camera and all that derive from some rotation. Typically ControlRotation but can just be any old rotation variable
THAT's what needs to be replicated
but don't reinvent the wheel, there's already a function to get some replicated pitch value
The problem is likely because you're multicasting, and that multicast could be getting triggered from a "Begin Play" somewhere which may fire before all the clients have joined.
As this appears to be something UI related, this could likely be handled entirely locally, without the server needing to tell the clients to do anything.
I think I get it. Thanks!
So I'm having a problem where no matter what I do, I can't seem to get the player state from one client to another. Really, what I want to determine is what the team of the other client is(just a struct var that is indeed set to replicate). From all of my reading, player states should always be replicated and available. Here are a couple of the methods I've tried, but to no avail. Any ideas? https://blueprintue.com/blueprint/cth4ux9o/
@idle coyote , So you would like to get get the player state from a client to only one specific client?
Yeah, basically I have a "King" spectator pawn that I want to be able to get the team of the player they're clicking on. Currently trying a method where I get the game state as we speak. Sort of working on a RTS/FPS weird fusion Idea I had
why are you asking the server
the team should just be a replicated variable
It is, but just querying it from a break hit after a line trace returns None.
In fact, I can get the team of the "King" pawn but none of the other clients.
So I have to ask the server
Maybe I'm losing it in the cast?
show your code without any rpc nonsense
@idle coyote , as you stated here.
You could use the build in array "Player Array" in the Game State to get all the Player States of the clients.
Yeah, I can. Except it still shows all of the other player's teams as None
Just tried it 😦
show when you're setting that team variable
It should be as simple as setting a replicated variable called team on playerstates
then when whoevers driving the King pawn around clicks a player, whatever that means, presumably clicking their pawn, you can get from the pawn to the playerstate to the team
Actually, you just helped me realize something. The code for setting the team is all local and doesn't involve any RPC or anything like that. So I think that change isn't getting replicated to the other client.
who decides the team?
The player from a UI menu when they join the match. Let me show you https://blueprintue.com/blueprint/0teohuud/
The general form is this:
Client wants to tell server something -> run on server event
Server wants to tell clients some STATE -> replicated variable
Server wants to tell clients some transient event -> multicast or run on client rpc
yeah if it starts in UI it needs to make it to the server somehow, that's a run on server event through PlayerController or Pawn
Awesome, thank you. I'll keep that in mind.
Just implemented it and it worked. This is my first multiplayer project and the lesson that the server is god is starting to engrave itself in my brain.
god when it should be and needs to be is important as well
Basically I just made a simple event on the Player State event graph(run on server) that you call from the UI menu and it sets the team and then replicates it everywhere.
Should probably have some additional authority checks somewhere(the game will probably have situations where you shouldn't be able to switch teams regardless of what requests the client is making)
I have an actor that I'm spawning via SpawnActorDeferred() on the server, setting a replicated variable, and then running FinishSpawning(). When the actor is initializing on the client, for example, in PostInitializeComponents(), the variable that I set is nullptr. I need this variable to complete initialization. Are there any standard ways I can delay the actor initialization on the client until after everything has been replicated?
in the level i have an actor with a SceneCaptureComp2d and camera, to place a list-only components (2d sprites) to minimap
sprites of the static meshes (walls), which is persist in the level, always placed at the minimap correctly for every client, with an Event BeginPlay event at the level blueprint
but, sprites of the characters, and sprites of the pings (help, retreat, etc), is not placed to minimap at Event BeginPlay, its always Custom Event
and these events works (print-string tested), but dont actually add sprites to minimap with a Show-only Components list, for a clients except last, when there is more than one client (2 or 3)
these custom events fired, when a characters is spawned (1 sec delay change nothing), and when ping actor is spawned
so, static actors, which exist at the level from the beginning, is adding sprites at BeginPlay correctly, but characters, which spawned in the level after being chosed in the menu are not (and pings even later)
so, i dont think its because of some clients is not connected correctly yet
there's some replication problem, but i dont see where
actors, which exist at a clients and the server uses multicast event, i dont think its wrong, but i dont know much about this stuff, sorry
i hope i provide some details
Multicasts fire only exactly when they are requested to.
If you are triggering a multicast on a begin play somewhere then that begin play can absolutely fire before every client has properly connected to the game and won't fire again unless they're called to.
It also shouldn't be necessary.
You have Begin Play of actors that you can use to trigger whether or not they get added to a minimap that is local.
There shouldn't really be a need to multicast that.
The ping? yea that can be multicast. If you wanted a ping to persist however, then you'd need to have some system in place that utilizes variables, so even someone later on joining could potentially see said pings.
Multicasts fire only exactly when they are requested to.
yes. i dont use multicast after begin play
and there is a paradox
sprites of the static meshes added to minimap correctly at begin play of the level (for every client)
but sprites of the characters (and pings) is not added even when client is pick an own character and join a game, where all events is called manually, not at the begin play
but for a one client all is fine
Would anybody know why an animation montage would fire an anim notify twice on the server? It is reproducible with any animation and any animation notify. I trigger the montage using a server ability, and each anim notify triggers twice on the server
anyone know why ping in game is significantly higher than my network emulation settings suggest it would be? Here I am simulating 30ms incoming and outgoing latency on the server so I would expect the client would have somewhere near 60ms ping but PlayerState->GetPingInMilliseconds reports around 80ms ping. It scales rather strangely with simulated latency, for instance 5ms incoming and outgoing latency results in about 45 ms ping
Are you playing in Client mode in editor?
Does anyone have tips for debugging weird loading issues with World Partition and dedicated servers?
I have a project tha works perfectly with a normal level but when I try to play my WorldPartition level I get things like: crashes when connecting a PIE client, not loading at all on packaged client, and even on a vanilla new Open World level, seeing errors and not working.
How do I force the packaged client + server to load all chunks all the time? Maybe that could help me.
try with net.PingExcludeFrameTime 1
also keep in mind that the network settings are about BOTH sides adding more time
so if the server outgoing and the client incoming are 30, that's 60ms for extra the packet to reach them just one way
(oh, you have server only on here)
thanks I'll take a look at this
i wonder if that would affect any of the client interp timing stuff that uses ping
this is something I haven't looked into much but... does a.EnableQueuedAnimEventsOnServer=1 have any effect?
Hello guys i have client only anim notify which is referenced by animation files which are included in server builds, i dont want to that notify included in server build can you guys help me? What is causing this situation? Thank you
can i trust the AHUD to spawn on begin play for all players exactly what it needs or is it a bad habbit?
All players?
Hud is local anyway, one will be created in your machine when ever the code runs
i have 2 players, but sometimes for the client it doesn`t spawns a widget perfectly as it should
That still sound vague, need more info
Hi everyone,
I'm having an issue with my Player Controller in the lobby. I'm trying to execute a "print" function, but nothing is displaying on the screen. I can't figure out why it's not working. Could someone please help me?
Thank you in advance!
Are you using that PC? Check your world setting in the problematic level.
Yes, I have indeed configured the game mode
Maybe you have print to screen setting disabled? Check your log for sanity sake
If display settings are disabled, how do I re-enable them?
An educated guess tells me, if your widget relies on knowing something, such as some replicated values like ammo or something, you can’t be sure that will be replicated across when the hud is been created. So you need to do checks and display those parts once the relevant data is there
Not sure but should be googleable. I never disabled it. Also you are testing in editor right?
If your issue is related to not getting the right or updated value on replicated variable.
OnRep tells a client when a variable is updated.
You can create widget right away, just make sure to update the visual with OnRep. Don't use delay, there is no guarantee when the info comes from the server, it all depends on your latency
This is why Lyra uses a node to wait for things to be ready. Can't always expect things in order, or with timing on networking. Too many things affect it.
Oh, wait. My bad. Lyra is overengineered. Shouldn't use tools from there.
Trusting anything to be present on BeginPlay is a bad habit in general
Not sure why that replied to you 😄
There are probably better ways. I dunno. But this isn't the worst. 🤷♂️
rep arrays need to be smaller than a certain number?
this the player controller?
im just appending the same array from the server side then storing those to a replicated version of the same array variables
One of Lyra's characters.
why would it even say this, ive got nanite enabled on the mesh and total verts are around 30k so the vertices variable should also mention that i guess.
yes
is there anything additional that needs to be set for SK mesh replication. I check for weapon meshes in both a Static Mesh Component and Skeletal Mesh Component. When it's a static mesh replication works fine but with an SK mesh OnRep seems to fail here EquippedWeapon->SK_MeshComp->GetSkeletalMeshAsset())
The mesh isn't a replicated property on skeletal/skinned mesh components
of course it wouldn't be 🙄 what would be a way to do this then? With statics you just set replication and doesn't even require a multicast
usually the mesh is already set in the blueprint and the server just spawns it
well no because I don't spawn any meshes until I need to TSoftObjectPtr<USkeletalMesh>
I mean I guess I can try another replicated mesh slot and set it on spawn...
Anyone got a clue on why the replay system does not work properly in a fresh Lyra project (5.3+) when running from the client (record gameplay from ShooterGym). When the player changes weapons animations stop working.
How do i do in such way that from the first player minimap from the hud i could show where the second player is, in his widget in the uniform grid panel, in his images plates, around an image to arround an blue border ( likee in this first picture) , for also this also should be from client`s perspective, but with red for the client to see the server location(2nd image), and when they are both In the same location, to have it to be like in the third picture, both red and blue mini squares
Alright, I am slowly losing my mind trying to replicate a player name for a widget that each player has hanging above their heads in the game.
In the player state I save the player name in a variable.
In the player controller I send the variable that was saved in the (valid) player state to the pawn, so that the pawn can RPC to the server, with the player name value, save it to a replicated var in the pawn, and then set it to the widget component.
Issue is; The server player can see the clients player name. The client player cannot see the servers player name. What am I missing here?
Did you try using OnRep, so when the client recieves the replicated variable it would set the player name in the widget component.
Yea I did, and I just now tried it again to see if I was missing anything, but the issue remains the same sadly
Current flow:
Player state retrieves player name -> Player controller on beginplay cast to Pawn with the variable from the replicated player state -> Pawn sends Server RPC with variable -> Server RPC sets OnRep variable -> OnRep function uses the variable to set the text in the widget.
Try getting the player state on pawn on begin play, Get the name then set the widget component, all on client side
Also another question is why are you doing all that, can't the player state just directly set the name on the widget component using an OnRep, the player state replicates it variables to all other clients.
If you have to follow that flow, then instead of on begin play of the player controller, you would put the logic in the OnRep of the player name from the player state
Ah this works
🫠
Let me wrap my head around this for a minute
Okay, so if I understand this correctly now;
Because the player state is replicated on its own, any variables within are also replicated to all versions of itself on the other clients. And because that is the case, the pawn, can grab the player name from the player state, without ever running the risk of grabbing different player names, because it is the same throughout all versions of the player states.
Right @ancient adder @olive basin ?
You can't grab the wrong name/properties here, when getting the playerstate in the pawn you are getting the one associated with that specific pawn/player
Not quite, unless I am misunderstanding what you are asking.
The player state exists on the server, and all the clients. What this means Client 1 will know about Client's 2 player state and vice versa, unlike for say a player controller, where the server knows about every Client's player controller, but each client will only know about their own player controller.
In regards, to why you don't risk grabbing different player names, the player state to pawn owner hierarchy goes something like this.
PlayerState -> PlayerController -> Pawn.
Because of this, each pawn is associated with a specific PlayerState instance, and when you access the PlayerState from a pawn, you're always getting the PlayerState that owns that pawn, regardless of which pawn you're accessing it from. So by getting the player name from the player state at begin play, you are getting the player name that belongs to that specific pawn.
But of course that only apply if the pawn is owned by a player or AI with PlayerState, otherwise the PlayerState will be invalid
Ah right now it is clear for me! Thanks so much @olive basin @ancient adder , this makes a lot of sense now 🙂
anyone got an idea how to overcome this? when i OnRep my vehicles vert count array, it gives me this message in the log whenever another player joins the session
is there a decent way to replicate large arrays?
this is all im doing inside the component hit event
Why do you need to send mesh vertices over the network in the first place?
Almost certainly way too much data
those vertices update the procedural mesh - they contain the info of the vertices which were affected by the hit
So what do you suggest how should I rep notify the changes of the vertices ?
I wouldn't, I'd probably replicate a small fixed-size array of hits and rebuild the vertices locally instead.
Is there a way to divide the updates / update in intervals to the on rep?
I think the point is that you should not replicate the verts to begin with
But simply the hit data so the client can do the same logic locally
Anyone Know why 'Owner No See' and 'Only Owner See' doesnt work on imported static meshes?
The Sphere and Cube have the same settings as the mushrooms of the same color yet the 'see' settings dont effect it
Hi everybody! How can I make this function replicated on network
when the player spawn a build everyone must see that
Is the event that calls Spawn Build Ghost set to 'Run on Server'
I can do things locally not a problem - in a dedicated server session with 2 players when I hit the vehicles around they deform for both the clients , but for late joiners they don’t see any changes at all, they see brand new undamaged vehicles. For the late joiners the only way to display changes is to pass the verts info to the on rep, whether you OnRep the array itself, or a simple Boolean, the node “update mesh sections” is the one that confirms changes to the procedural mesh , for server or client. And that node needs an array of vertices to be added to it.
no I'm not using any rpc function right now
I’m not a wizard with any of this shit, but make sure the actor is set to replicate and have whatever event runs that spawn build ghost run on server
okay thanks
What they're suggesting I think, is to pass the hit information as a state, and once late joiners arrive, repeat the hits locally for the joining client(s). The vertices won't be exactly the same I assume, but accurate enough.
Otherwise you could probably fragment the vertices data like you suggested, but you'd still be using a lot of bandwidth, so I'm not sure if it is worth it for 100% accuracy.
Sorry if all that was already clear and I am just repeating what they said, but I really don't think sending the vertices directly is the "only way" as you said.
Do OnRep functions execute on the server?
In BPs yes, in C++ no
Alright got a really annoying issue that I'm struggling to come up with a "catch-all" solution for... Basically when our movement abilities were setup, they were given different classes (i.e. Dash, Flight, etc) that all try to change player collision to match a specified list of parameters.
The issue here is that these objects rep down to the client through the CMC in an un-reliable order. So the client might change its collision to something that doesn't match the server's collision because it received dash first and then flight.
I have tried a few different things, including using RPCs to change the collision. But the problem with that is that the client in some cases is receiving the RPC and the OnRep for an object in the same frame and in that order. So the RPC has a nullptr. I tried delaying by a frame and then calling the RPC as a hail mary, but that honestly just ended up causing more problems lol.
Anyone have any suggestions I could try to explore? Feel like I'm banging my head against a wall that probably isn't going to give lol.
When I press the 4 key, it calls a server RPC that sets a bool to true. After that I step through each character instance and it is only true on 3 of the 6. This is a dedicated server with 2 clients.
-
Why is there 6 instances of the character? I have the 2 local controlled and then I have the proxy version of each. Then I assume the last 2 are on the server?
-
After running the server RPC to update the bool, why isn't it updated on every instance of the character?
2 Clients, 1 Server
Each Client will produce 3 Characters in that setup.
1 Authority (on Server), 1 Autonomous (on the Client itself), 1 Simulated (on the other Client)
How much time goes by before you test for the boolean value after the RPC? @brazen anvil
seconds
Where is the RPC and the boolean, on which Actor?
I assume on the Character, so the 3 out of 6 makes total sense
Yes it is on character
Client 1 pressed the Key, the RPC goes to the Server, sets the boolean and it replicates to everyone.
Which means it will be true on the Authority Version, the Autonomous Version and the Simulation Version.
But the other Character of Client 2 obviously won't have the boolean changed.
So the othe 3 instances are still false
Got it. Thank you
On a side note to this. Be careful with relying on networking state from pawn's beginplay. If you spawn a pawn later to possess for some reason and not at the beginning of the map where beginplay is delayed, Pawn's beginplay will run before it's possessed.
Yea that makes sense. Right now there is no planned flow where this would apply, but in most cases I do have failsafes in place when certain network logic is called on beginplay of anything. Mostly in the from of print strings that only print to the logs, so that I can follow the flow there
Hello, how do you change the active net driver UE is using for networking?
Ini files mainly.
EG
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
+NetDriverDefinitions=(DefName="BeaconNetDriver",DriverClassName="/Script/SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")```
This should let you pick per platform. EG this ini would be used with a game shipped with Steam. You'd have a different build with a different ini running on EOS, or whatever other platform.
What if I don't have any specific platform config? It usually is ProjectRoot/Config/MyPlatform/DefaultSomething.ini. However, I don't have any MyPlatform directory. If I want to change the net driver for playstation specifically, would I need to create a new directory and config myself?
There is a specific Platforms folder you use for any plugin/config overrides that are for platforms other than your core one.
So under ProjectRoot/Platforms I should create Playstation (is it the correct name?) directory and a PlaystationEngine.ini which has that, but with the net driver I want?
I'm not sure how much I'm allowed to say here. I don't think folder structures for the engine break the rules on that since it's generic for any platform. But basically
ProjectDir\Platforms\PS5\Config\PS5Engine.ini
Alright, thank you
Watch this video, https://www.youtube.com/watch?v=ssRRyztsNqM, I remember Dan talking about what you are describing
Dan walks through the core concepts of Networking / Multiplayer in the Unreal Engine editor for anyone who's interested! No coding experience required, video done live on my Twitch stream :D
Includes: Relevancy, Replicated Properties, Rep Notify's, RPCs, Client Prediction and more!
The first part covering the "theory" can be found https://yout...
Hello all, would one say that UEngine::OnNetworkFailure is enough to handle scenarios where a host force closes their game or crashes while clients are still in a session?
or is there more/better handling that can be done here
Yes. Usually people handle it using
UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName = "NetworkError"))
ENGINE_API void HandleNetworkError(ENetworkFailure::Type FailureType, bool bIsServer);
but that is triggered by that function you mentioned, so it should contain every network failure.
UEngine::OnNetworkFailure is kind of deep relatively to BPs, so I guess that's the reason people usually use GI
danke 👍
What should actually be used and put in the player controller?
I am doing a hacky 3d pathfinding system by attaching flying pawns to 2d pawns that path on the ground. I just update the vertical velocity component of the flying pawns as appropriate and they follow the 2D path of the ground pawns. I am using 'attach actor to actor' (on server of course). I have however run into a problem, where the colliders of the flying pawns are swept twice: once because they are considered part of the 2D pawns and again in their internal logic. Since collision is the largest cost in my game so far, I'm wondering if anyone has any suggested workarounds for this?
What's a standard way to save player unlocks for a Steam game? i.e. players have unlocked levels/abilities in a multiplayer game. Where should that be stored?
Is there a way for an actor on the client to know when one of its subobjects successfully replicated for the first time?
Hello, how can i prevent the character of a low fps client from skipping animation frames on the listen server?
How does subsystems work in a multiplayer context?
They are completely local
What are some good exercises to practice RPC's? I can't seem to implement them. The subject is still foggy.
Try simply building a Door that can be opened/closed by any Player.
You should learn RPCs and Replicated properties (including OnRep) to achieve this appropriately.
me about to do the door system
So for example, I have two clients and a server player close to each other. They are each standing on their own small landscape. I want to pevent them from seeing each other.
For actors I can set net relevency which will prevent items from spawning on the clients. For the server I'll need another option here.
For the landscapes... I'm not sure they have net relevancy? I could have them stream with World Partition and set the runtime grid to be very small? The server will load them anyway because the players are streaming sources. I'm not sure if that will cause them to load on the clients as well?
Anyone have any information on how to do this? Culling objects, custom camera far clip distances, etc?
How would a door networking system would be implemented btw? Just the architecture main idea..
The best way would be to have a door actor with a replicated variable bIsOpen. In the OnRep for bIsOpen, play an animation for opening the door.
the trick part is the in between
Personally I'd try to record the required open angle and lerp from the current angle to that one.
when the door is moving, I would like to be still able to revert it
Then when the animation starts, set a bIsOpening flag to true, and set it to false when the door finishes opening. When you want to open the door, check if bIsOpening is true, and don't do anything if it is.
If you want to close the door while it's opening then do the same thing, but instead of doing nothing if bIsOpening is true, start reversing the animation.
that's probably what I will do, thx
When you "use" the door flip between the 2 required angles, probalby like 0 and 90 or 135 or something.
using the relative rotation too
Yeah, you can do that in an animation, which will also give you a lot more control of the visual effects of opening the door (sound, particles, etc.)
Use a timeline that you play or reverse
But it also limits you by locking into an animation and not being able to use custom door angles, which is common in a lot of games.
What do you mean by custom door angles?
Like if the player can walk into the door and push it open?
ofc
Having control of exactly where the door rotates to. Controlling it directly, rather than "open" and "shut".
I'm not sure why you'd need that kind of control during runtime. If you want a more responsive door, you'd be better off just using physics to push it around. But most doors I've seen in games just switch between being opened and closed
Like I say, that's very limiting!
I'd argue it's a lot more limiting to have to hard-code the possible states of a door, and then manually interpolate between them
Isn't that what you're doing with an animation?
Sure, but you're hard-coding the only two states that a door should ever really have, and you're doing it in a way that let's you control everything about the door, as well as trigger any external gameplay effects during runtime with anim notifies
Absolutely, animations are great.
Depends what you want out of a door.
Seems it's not an "open and shut" case.
😂
it's not
I’m confused why the order matters here. Your local clients should be changing their collision based solely by the OnRep of dashing, flying etc.
Don’t replicate the collision as well. You know the collision is set by each client based upon the state.
general movement component!! where is it? I couldn't find it in Epic market
Search for gmc should show up
my god it is so expansive !
I have multiplayer open world car game, and the client car movement is lagging, do i need GMC ?
damn it is so expensive I'm getting more questions to my mind than when i started the game.
why in Epic market I see already made cars with multiplayer ready for use? i mean how it is ready without GMC?
You don't need to pay for it, could always make your own? Networking vehicle movement (even simple) isnt easy and alot of work goes into how you interpolate the data between updates, watchdogs had a nice video on https://www.youtube.com/watch?v=_8A2gzRrWLk.
It can be alot of work to have nice networked vehicles
GMC is not physics. How is your car being moved right now?
Question,
When using an interaction system and interacting with another player, how can I retrieve that other player's controller? Trying to setup a system where I could send request from one player to another.
You wouldn't, at least not from your client like that because controllers only exist on server and owning client
But if I use the player controller to run the code, wouldn't that work?
Of course you can use a server rpc to run the function but I was just saying, you wouldn't locally
Oh ok. Yes, I was tracking that part. I just do not know how to structure the RPC.
I think it depends alot on the platform you plan to ship on with how the friends list API will work, I know OSS has some kind of global interface for common things related to online play but I havent deep dived into that yet
If you are choosing a player to interact with, VIA a line trace or overlap or through some kind of UI, then you're probably getting a reference to their pawn or playerstate. You'd RPC that reference to the server. From there, the server can do whatever you want with the pawn or playerstate reference, including getting the controller.
I find it easier to just write it down in paper first hand. Which code should run on the server, which code should run on client.
When should the data is send from client, what to do when the data is replicated on client, what to request from server etc.
way to start with the dark souls of gameplay programming
Can someone explain to me why I don't have anything displayed on the screen on the server side or on the client side?
What is the context here? What is the end goal? Is this BP class even being used as your player controller class?
yes
Can someone help me a replication issue? I have my weapon switch on run server and my holster weapon on both run on server and multicast
(ROS)
(MC)
did you check your game mode blueprint? and what about the two open-ended questions I asked
I could think of 2 possibilities, You're either not using that blueprint or printing is disabled
Is this a really important concept? a door?
yea doors are deceptively hard as shit
well depends on the game tbf
I think there will be 2 replicate var, the angle and the number of player in front of it...
but usually doors have much more to them than "lol animate le angle"
like loading and more
replicating the actor too
much more????
yea, typically has a decent amount of complexity / additional work related to level streaming, and doors usually can't be latent other than an animation
because it's pretty much a portal
so you have the time between pressing F on a door and being able to see on the other side to load your level, plus multiplayer complexity if you have MP
so usually you need to do some clever preloading before you get close enough to the door for example, so that when the player presses F it's already ready to become visible
Doors is hard
what's not visible?
everything should always be visible
depends on the game
doors are typically used as soft loading screens
for what's the other side of the door?
yes
I mean, even without loading anything, doors are annoying. Cause when Player 1 opens the Door, depending on how you wish to animate it (with the Character grabbing the handle etc.), Player 2 might also start doing the same from the other side and then things break and one of the players is "wrong".
ex: in fornite, the door for each house, doesn't load something the other side
yeap :D
Games like GTA5 for example mostly do these "swing open when I run into you" stuff and they are more visual fluff than actual doors
trueee
replicate the movement lol, done
Absolutely not "done"
ha ha if only
why?
Because of Ping
needs prediction
If you make the State of the Door predicted, then only one of the two clients can have a valid door state.
cause one of them opens it, it sends it to the server and it replicates back to the other client.
That other client might be thinking the door is still closed
If you make it server auth, then the both players might have a bad day depending on the situation
This isn't as easy as you might think :P
yeap
I don't see why prediction would really matter here, since it can be maximum delayed by 100ms
as i said originally - dark souls xd
It's not only a door issue. Any kind of interaction between 2 players is like this.
If the door would only count for one player, then it wouldn't be that difficult
I'll probably do a GTA 5 door type then lol
Just imagine 2 players standing on each side of a sliding door.
The door is closed, both players look at each others head.
Now if we predict the opening for one of them, then what would happen is:
Client 1 causes the door to open. They will instantly see the door opening.
The Server will after receiving the call to open it start sliding the door open.
And then Client 2 will get the replicated data.
So Client 1 will see a free headshot first. If Client 1 now shoots, who do you favor?
Client 1 cause they should hit what they see as truth?
Client 2, cause this would be unfair to get a shot through a door that is still closed on their end?
Maybe the Server? Causes somewhat of a middle ground.
Maybe don't predict the door opening and let the Server decide?
Then both Clients would see the Door closed while the Server is starting to open it already.
Now if one of them shoots, you can either trust the Server, which means the other client will get a headshot through the door.
Or you check what the state of the door was when the client shot, resulting in it being a shot into the door (that sounds pretty good, right?).
But this scenario only works if both clients have the same ping.
What if the first Client has faster internet and receive the door opening stuff first? etc. etc.
And you can apply that to tons of stuff
Multiplayer is a shitshow
aight thx
that's mostly for door stuff, and guns
It's one example of Player to Player interaction.
- Two Players trying to pick up the same Item
- Two Players trying to enter the same vehicle
- Two Players bumbing into each other (e.g. see "Bang on Balls" game)
- Two Players generally dealing damage to each other
- One Player dragging the other
Can probably come up with a lot more
Howdy folks.
Does anyone know, if net update rate of an actor affects how often the client-to-server RPCs for it are actually sent?
I'm fighting with an issue, where the actor has somewhat low network update rate (2 times per second), and sometimes, an important client-to-server RPC for it gets skipped, because client had lost the ownership over it already
Well the RPC in question is marked as reliable, but it still happens
Yeah that was my second idea, just wanted to make sure that I'm digging in a right direction
I'm not saying its the right thing to do honestly, I'd just use that for a quick fix if it works 😅
ah, no, ForceNetUpdate() does check if the local role is authority, which means server, and my problem is on the client
Isn't the client the owner at the time you call the RPC?
Ah I see the problem now, ForceNetUpdate() is for the server to call not client, How did I miss that
well, it is, but then it's not 🙂
it's a bit convoluted.
so basically, my issue happens when player fires a weapon with delayed projectile spawn, and if player leaves the weapon at very specific moment (which happens to be AFTER the RPC call), they do not own the weapon anymore, and the RPC to the server, that tells it to spawn the projectile, fails, because there is no net owner anymore
and that causes a desync in weapon state between client & server
it looks like the RPC call gets queued, and by the time it gets actually processed, client doesn't own the actor anymore and therefore the RPC gets dropped. It is really an edge case bug, but it is game-breaking.
that's why my first question was about the net update rate & it's interaction with RPCs
RPC's are independent of net update rate with the exception of unreliable multicasts, but there's no guarantee they are called before or after property updates are read in. If the net owner is read in before the RPC is executed, then the RPC will be "ignored" client side. If the Owner is set before the RPC is despatched server-side, it won't be sent.
ForceNetUpdate() simply resets the last frame time the actor was replicated but it won't actually send anything there and then, all updates will send during BroadcastTickFlush
So, effectively, my only option here then is to make sure that weapon retains the client's ownership over it for some time even after the client has exited it. Sounds about right?
At least until the following frame for sure
gotcha, thanks for the help
Just a note about how this works in IRIS for reference:
RPCs in Iris mostly work as they did before, with one key difference: these calls are now always deferred until the connection(s) targeted by the RPC are updated. This means that RPCs are by default always executed after the connection has applied any received replicated state data, whereas before, this order was not consistent and differed between reliable and unreliable RPCs.
So actually, my thinking is that if the RPC call is reliable, and you change owner after the RPC is made, you should really be alright
But then you might be making rpc calls before data changes and then they are invalid calls after the data has changed?
maybe but I guess the RPC has to deal with that, IDK. At least there would be consistency
It's a small difference, I suppose.
If the rpc is asynchronous like that, I would like a chance to confirm it's still valid before it's sent.
Or, if that's how it's going to work, then all onreps should be triggered after every piece of data is applied.
What the real difference is compared to how it works now I'm not really sure
Apply incoming data -> run onreps -> async rpcs are sent. Or some such.
I think this is only talking about applying received RPCs, not sending them
So as a client receiving an RPC, you don't know if it'll be called before or after property updates
Whereas now they will always be after property updates
Well, in Iris anyway
Not sure I'd feel entirely comfortable relying on that for anything anyway
Hah
yeah the project i'm working is on UE4, so it doesn't have Iris anyways
i guess I'll just make sure that owner is not changed even after leaving the weapon, for some time, like 2-3 seconds.
so that client will have some time window to send any pending RPCs
like, set the Owner back to the previous value in OnUnpossessed() or smth like that
and set a timer to nullify it
Is there a decent write-up on Iris or is it just a lot of going in blind?
Eye see what you did there…👀
I think total blindness tbh. I only bring this up BTW because I remember it being mentioned in the knowledge article they posted about it
I'd really love to see just a complete howto, start to finish.
Hey does anyone know if the bounding box on StaticMeshComponent is available on dedicated servers?
I am assuming yes, but just figured I'd check since I know meshes themselves wont be loaded/packaged.
by bounding box i mean: StaticMeshComponent->Bounds.GetBox();
It is
You will. When someone not belonging to Epic writes it. 😄
@fossil veldt could probalby do it!
wassat
