#multiplayer
1 messages ยท Page 156 of 1
Go over delgoodie cmc tutorial. It covers sprinting and jumping in multiplayer
Seen u attempt to do the sprinting outside the cmc, that ain't gonna work for multiplayer
I already did sprinting but he doesn't include jumping in there
atleast not in the playlist so I'm gonna check out his channel
ok
Hi so Im new to making multiplayer and I found tutorials that told me to make this as a basic multiplayer in the beggining of my game yet after packaging my game and a friend downloading it and trying to join it does not work
hi, im having a bit of trouble with ue5.2 im trying to create a local multiplayer join screen but whatever i do it doesn't seem to respawn to the second controller and some times it just duplicates the first player giving it control over the new player that just spawned
I'm planning to make multiplayer game for android. I want to authenticate with gpg(GooglePlayGames) or any other easy to login.
My Game will be dedicated server. (Or Listen server. It doesn't really matter...)
I've searched some options but I really can't choose..
- PlayFab / Playfab is looks good to implement dedicated server but I think there's no support gpg (GooglePlayGames) to authenticate and use their system (Like purchase system)
2.EpicOnlineServices / There's no support dedicated server but there's some support for google authenticate with redpoint eos - gamelift (I don't really know what is this)
Does anyone recommend me for choose multiplayer backend services?
Gamelift is more or less the same as PlayFab.
If you want an actual recommendation then I would recommend sticking with ListenServer and eos fwiw
So the only way to play a sound from server on all clients is to set up a multicast for playing sounds? 
Been using Play at Location/Attached but those don't work in mp 
I could just set up a multicast that calls it on every client at once... but is that really the best way?
Hey, is there a way to Spawn a replicated Actor on the server but tell it to skip owner? I need this for predict spawning weapon and equip to player's hand.
A Reddit post said Replication Graph can be used for this purpose, im checking it out
Look quite overkill for just equipping a weapon
You don't need replication graph for that. Just override IsNetRelevantFor
Extremely wierd to have an actor which is NOT relevant to it's own though :/
Prediction usually means the client is modifying an authoritive actor which it will get corrections for later
So there is no such thing as predict actor spawning?
No. You can spawn an actor client-side sure, but you are going to have to swap that out with the servers real actor if you actually want to do anything with it
But it could be depending on what i want to do with it. If i just spawn and equip a sword for example, i can just tell the PlayerCharacter to use the current machine's sword to hit
The replication is just for displaying in other player's machine, not owner
Is that make sense?
My first question is - does the 30-50ms delay actually make all that complexity worth it in the first place (chances are, probably not). The problem you've got is if the client spawns an actor locally, you have to be sure they will reliably clean it up when it's no longer needed. You also can't perform ANY network functionality on that actor.
So fine you might be able to equip your weapon, but until the servers' one arrives, you can't use it anyway. Just live with the miniscule delay would be my advice.
The only way you can do full prediction in this case is if the client already has the replicated actor, and they are just predictively modifying it's equipped state locally. Of course you need a decent prediction/rollback implementation to eventually sync it with the server
I can use it right after equip. I use GAS to perform an attack. The requirement is just a tag. When i equip the weapon in the client, it will grant the tag to the character, and GAS prediction will just play the attack for me. So there could be some frame that the player would be attacking with an empty hand, but i guess that's still better than the delay. Also, i guess players dont equip then attack immediately that much.
Mispredicts would also be extremely jarring here, you would just see the item dissappear in front of you
one cheesy way to get around the delay
is to basically have the server's version be sped up a bit by ping, to make it do the same thing at roughly the same time
a pretty common setup (to modulate the server side piece by the time the packet took) , but has some drawbacks where higher ping clients can do things faster form the perspective of others
not a good idea in most situations but it could help reduce a lot of headache if it's something difficult to sync up otherwise, I've thought of doing this for some of my personal stuff but never got around to that point
in a PVE game it could be totally fine
no i don't mean the server, i want to remove the delay in the client when they click 1-2-3 to equip
seem like big games like Fornite have that
is there anything that happens in the instant before the item is equipped?
perhaps a short animation like the hands moving down
you could immediately send the request then
and get the results back, then wait to actually apply them
yeah i get that, but why the hard way why i can just spawn it locally?
like there is no cancel on item equipping
Or prespawn all actor in the quick bar and make them invisible
I would argue it would be easier if the visual weapon was only on the client
and representative of GAS stuff
why does it need to be replicated? it's just following along the hands and what you have equipped
the state of it aside I guess
It need to be replicated so the other players can see
Or should i just call RPCs to other players
hell naw
why
because RPC's are not stateful
it's for the visual only (wait, i actually do collision on them)
What happens when a character walks out of relevancy range, then back in again?
Or if a client joins late
If you have collision then your prediction method doesn't work full stop
Ok i am just gonna spawn a fake actor then wait server real rep
The equip have a delay anyway
Game design baby!
Funny thing is, i just boot up Rust and Mordhau, and they have the exact same delay type
Most games do. It's not worth the overcomplication of prediction
Is melee weapon is actually harder to do things than guns? Because with guns, you kinda just spawn projectile, don't really need the weapon actor, they are just for the cosmetic
(NVM, i thought Rust let you pre-shot but after testing, it was 500ms minimum) (alright let's checkout our boi fornite)
hi guys, i wonder how the localized text variables proccess over rpc. For example if I send an rpc server to client for displaying an ingame notification text. Will client see that text in own language or server's language?
servers language
what if i use string tables?
Any FText sent over the network will be converted to a non-localised FString
does string tables solve the problem?
nope
You can't send the FText directly, you'd need to send specific keys so clients can lookup the localised message on their end
That key could be a lookup into a string table of course.
I got it thank you
this isn't true
FTexts are serialised over the network as FTextHistory, which will be localised if you're using something like FText::Format
CC: @tranquil fractal
Actually I'm using Blueprints. Does Bp using it this way?
Unfortunately I can't vouch for that. I was very surprised to see it worked as expected when the source string was from a string table, and formatted with FText::Format, no "lossy" conversions to FString
I think in the early days of UE4 it was sent as a string and received as an invariant FText
It's pretty heavyweight since it's essentially sending all the information to essentially reconstruct the formatted text on the client. If you have a more minimal way to get the message across then I would say go for that.
I will try thank you
My current setup is based on sending name variables over RPCs as string table key. Then Searching that id in string table on client.
Is sending name better than strings over RPC or should i always use strings?
Not really any different the first time, on subsequent sends then it'll use an index instead
(referring to names)
allright thanks
Is that recent? In HLL we always saw servers sending FText messages in their local language
// FTexts have creation history data, removed Key, Namespaces, and SourceString
VER_UE4_FTEXT_HISTORY,
whenever this was added
We did have a bug where our French publisher reported that bot names would use the server's localisation, but that was very much a .ToString() happening on an FText
But Sandstorm had a mutator system and they would only run on server and we had various utility functions to display an FText message to a client, these were always correctly showing in the client's language
Yeah maybe we were sending them as strings or something.. I can't remember now. I always had them down as sending as FString
Ah well, good to know ๐
you can look at FText::SerializeText, as long as you don't do anything to destroy the history in some way, it should work
I've been trying to understand how the Gameplay Framework works ..
and I'm noticing .. no one is overriding ReadyToStartMatch in example projects for some reason ..
I'd like to know if we HAVE to call StartMatch before returning a True within ReadyToStartMatch ?
I'm asking, because when my clients join the session .. their input works correctly while the server's input is ignored .. unless I call for StartMatch .. and I'm not if I'm doing things correctly
Not sure I get the question, what is "input" referring to? Actual movement controls and stuff? Does that need to depend on the match state?
yup
well I'm not sure how to debug it exactly ..
When the server create the games, the pawn can move correctly
But the moment the client joins, movement works on client side but not in server side anymore.
This problem disappears if I don't override ReadyToStartMatch or call StartMatch
It it possible to enable sending rpcs on non-owned actors. We don't need cheat prevention and it's kinda getting in the way of things.
It's not related to cheat prevention really, it's just how the engine works
No you can't
You will probably need to modify the engine to make it work
So better to either route through one of the owned actors, or own them
Ah, dang. It super annoying for simple stuff like buttons and dials where we want it to be responsive on the client and try to keep it relativly contained in a component while at it.
Server RPC your interaction and do the interaction locally
Or w/e is that you're doing
You can still call methods on things locally
Whether or not that is a good idea is an entirely different matter
The problem is that some of our interactions drag sliders and dials with mouse cursor and stuff like that. So it's not just a simple RPC.
I still find it as a simple rpc personally, but alrighty.
"TurnDial" method
Send RPC "TurnDialRequest" From client to server
Send RPC "TurnDialBroadcast" from server to all clients
So TurnDialRequest would be on controller or something like that?
The dial need to be owned by the client then? no?
I think you're confusing the concept of ownership, it doesn't mean that clients can't send RPCs to the server for those objects IIRC
Yes it does
If I remember, you can't broadcast if you don't own the object, but you can definitely send an RPC to the server to request something be done on said object
Are you sure?
You can only send RPCs from objects you own
Do correct me
I dont think so
I guess the elegant way would be to abstract the action of the interaction to some sort of class owned by the controller
kinda like gas
Or wherever you want it that a client owns.
Yeah, I see.
I find it fine to have a specific interaction type method every here and there.
One generic interaction style that handles most cases, then you can sprinkle in specific types as needed. As long as you don't let that explode to a bunch of specific ways.
I do stand corrected, my apologies.
It's routed through the server by being called on a client owned object
I.e. send the object you're interacting with to the server as a "request to interact" and run the rest of the logic there
Yeah
Gotta make a fool of yourself at least once a month eh? ๐
My OCD is burning from having specific interaction functions that are not abstracted- but this is a small project, most likely its fine xD
Speak for yourself ๐
They can be abstracted 
Yeah, but I think the abstraction would take more time than it saves.
Fair yeah
I tend to think of it as having a middleman in a transaction, same exact logic but "someone" else has to approve of it first
For better or worse anyway ๐
Anyway, thanks all <3
I am hitting a breakpoint (but I don't have a breakpoint set?) periodically in UChannel::SendBunch, and I'm not sure why. It breaks in the else statement at OutgoingBunches.Add(Bunch);, but if I just resume execution I don't get any output log message, crash, or seemingly anything bugging in my game (could certainly just not see it though). Also not sure if "breaks" and "breakpoint" are the correct terminology there, but the code execution is stopping at that line until I resume. Here's the specific area of code, and here's the full function on pastebin: https://pastebin.com/1iEb6AuR
{
uint8 *data = Bunch->GetData();
int64 bitsLeft = Bunch->GetNumBits();
Merge = false;
while(bitsLeft > 0)
{
FOutBunch * PartialBunch = new FOutBunch(this, false);
int64 bitsThisBunch = FMath::Min<int64>(bitsLeft, MAX_PARTIAL_BUNCH_SIZE_BITS);
PartialBunch->SerializeBits(data, bitsThisBunch);
#if UE_NET_TRACE_ENABLED
// Attach tracecollector of split bunch to first partial bunch
SetTraceCollector(*PartialBunch, GetTraceCollector(*Bunch));
SetTraceCollector(*Bunch, nullptr);
#endif
OutgoingBunches.Add(PartialBunch);
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
PartialBunch->DebugString = FString::Printf(TEXT("Partial[%d]: %s"), OutgoingBunches.Num(), *Bunch->DebugString);
#endif
bitsLeft -= bitsThisBunch;
data += (bitsThisBunch >> 3);
UE_LOG(LogNetPartialBunch, Log, TEXT(" Making partial bunch from content bunch. bitsThisBunch: %d bitsLeft: %d"), bitsThisBunch, bitsLeft );
ensure(bitsLeft == 0 || bitsThisBunch % 8 == 0); // Byte aligned or it was the last bunch
}
}
else
{
OutgoingBunches.Add(Bunch);
}```
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Hi, i would like to have a replicated subobject with the player controller as a net owner but i need bReplicateUsingRegisteredSubObjectList in the PC, is there a non intrusive solution to use the PC as owner to replicate subobjects ?
I found FGameModeEvents::GameModePostLoginEvent and can add subobjects here
But the user has to set the subobject replication in the PC manually :p
I will just make a warning if not i guess
hello, apparently PossessedBy is run on the server but the controller doesn't have the Pawn variable set yet, it's a few lines later, so i'm having the problem of trying to cache the pawn where it's not available. what's a better alternative function for that on the server?
Cache it after the function is ran. Also why are you caching it when the controller already has a reference to it?
How do you enable logging when testing a linux dedicated server? I run the .sh script and it starts up with some sort of log but its not the typical UE output that I see with a windows server.
I'm trying to dupe an actor component so that it replicates. While the dupe itself works locally, replication does not
UActorComponent* NewActorComponent = DuplicateObject(SourceComponent, DestinationActor, FName(SourceComponent->GetName()));
NewActorComponent->RegisterComponent();
DestinationActor->AddInstanceComponent(NewActorComponent);
Am I missing something some call to a function?
Explain the order and where you're doing this. I don't have UE in front of me, so I can't remember if this function is on the controller or pawn. There may be a delegate that you can bind to as well that gets fired off when the possession changes. Or when the controller changes.
i have my player character and it can possess a puzzle pawn, but when he leaves the puzzle pawn back to the player character i need to add again the UI for the player, which uses the pawn from the player controller
when it reaches PossessedBy the Pawn of the new player controller is null
so i don't have exactly a place to override to when that variable is set so the ui can use it in the same frame
if i do a one frame delay it probably works
but i wanted to avoid that
Where is possedby? In the pawn?
yes
That should be passing the controller. Why do you need the pawn of that controller?
You're already in the pawn
Set the UI up in the player controller
After the possession happens
OnPossession or something like that
In C++, there is a client RPC method you can override
but this menu is only relevant for the player character, the player controller shouldn't really know about it
in the sense that it has the tsubclass of to instantiate and do the createwidget
I disagree. Pawns shouldn't do jack all with UI except for some like, 3D stuff maybe
But anywho, if you want to have it on the pawn, have the controller call something like "setupUI" on the pawn when it does the possession
Or check if there is a delegate you can bind to on the controller
ok i'll look into that, thanks
another weird thing is the PreviousController variable in the pawn
when you unpossessed
You don't have to do it
I don't have your code
I don't have your architecture
I don't have anything about your project in front of me
All I can do is make suggestions based on the limited information you provide
of course, but the previouscontroller variable exists in unreal engine, it's not something specific to my project
ยฏ_(ใ)_/ยฏ
Figure out a way to use it or just ignore it.
I've never used it personally
Didn't even know it existed
worst case i can make my own variable for that
Pretty much
i just wanted to know if the previous controller was local
I thought multicast replicates to all clients so wouldnt that mean all clients make their flashlights visible (if the class executed in was replicated)?
And this is in a pawn class
Which doesnt replicate so how are clients even able to recieve information to see the client that turned on their flashlight
I understand that clients send requests to server and then server sends the information back to all connected clients in a replicated class, in which case all clients will recieve whatever the server is sending and executes it
but what makes multicast different and why is it able to be run on a non replicated class
This is what I understand from this:
Client presses f, sends request to server
server then executes the custom event that replicates to all clients
the client that turned on the flashlight is the only one that will recieve this as pawn class isn't replicated
so how are the other clients able to see the flashlight on?
nvm im dumb it does replicate
and im guessing replicating flashlight multicast executes for all clients but only changes stuff on the client that called it
which means only that client turns on their flashlight instead of all
So, I have this actor component tied to an AI Controller class, when I press 1 in player, I want to replicate color change of all AIs in map. I'm using a repnotify in the component and pressing 1 calls a run on server event to change the notify color, component and AI are set to replicate. Only server is changing color. Possibly because it's a dynamic material instance? Am I missing something here?
This is how the notify is being called
How do I repnotify a broadcast multicast dynamic delegate with multiple params?
Dafuq
What are you actually trying to do
If owning client
Client doesn't own the ai controllers
Trying to broadcast a delegate from server to clients
You mean the custom event?
@cerulean lintel put your rpc right after the input
On damage received, pass damage payload to listeners
like this?
still visible only on server
I'm not replicating Dynamic Material Instance, just creating them and replicating the color itself
So you want everyone to agree that "Damage just happened. Damage just happened. Another damage just happened"?
That should probably be multicast
run on server event in the thing with the input
Input -> Run on server event
Run on server event -> do the stuff
Yeah, I thought about using a multicast RPC but have been reading about people suggesting repnotify and was wondering how to do that
Aight, that makes it easier to choose between the two, thanks
will the updated color be visible for late joiners if not using reps?
info gets from client to server by run on server event
info gets from server to clients by replicated variables
if you want to do stuff when that variable changes, that's repnotify
yeah, I'm trying to modify the color with the notify
I noticed, if I change to jump, it's replicated, just the color is not working
this doesn't work because you're not on the server
none of that code runs on the server in your example
local client only, the one that pressed the button
I have a question with a simple code such as this
Why can other clients (not server) see the client sprinting
what do start and stop sprinting do?
Just increases player max speed by 1.5x and reduces by 1.5x
It executes on server but the server doesn't replicate back to rest of the clients only selected one
so the notify won't get triggered on the repnotify?
It has me confused because whats the point of multicast if I can just do this?
do you run on server event INSIDE THE CLASS THE CLIENT OWNS
that pretty much means pawn or playercontroller
What class is this in?
AI Controller
Those don't exist on clients
it's an AI Controller with the actor component (that owns the RPC)
Show more of this, show the parent class
which class has the input?
the keyboard 1 event
character class, but it's the local player
Who sees the client able to sprint?
local player is changing AI colors
Wait is it because character movement is already replicated to clients?
server and rest of the clients
@pearl saddle First of all, Sprinting will always be shite without C++ with the CMC
this is the component with RPC
You can't make that lag free
Mover 2.0 in 5.4 might allow BP users to do that
And then, if you do it in BP, you gotta use an OnRep varaible to set teh max speed
THe character shoudl be the one doing the client -> server RPC (the run on server event)
since that's what a client owns
Character:
keyboard 1 -> run on server event
run on server event -> get aicontrollers -> do whatever
why is the color a property of the ai controller though
yeah, it already is
that should be a property of the pawn
this is the player, calling the RPC
it's a property of the actor component, tied to the AI Controller
and does AIController even replicate?
I'm pretty certain they're on the server only by default
Can I set onRep on any owner server/client will it matter?
it is set to replicate, instead of using change color, I switched to jump, it worked
because jump is making the PAWN do something
the pawn is everywhere
got it
Server only
It's the same as with any other replicated variable
you can set it but it'll onyl do what you want it to do if set on server
But i'm confused because with multicast I set on client and it works
replication is server -> client only
gotcha, I'll move the component to the pawn then
That's not the point. Speed is a State
what does that component represent?
like this for example
Adriel literally wrote that a few minutes ago already
Input -> run on server
run on server -> set replicated variable
Repnotify -> do the logic driven by that variable
in your case
F -> run on server
Run on server -> set bool = NOT(bool)
Repnotify -> set light based on bool (play sound too maybe if you want)
I'll be using it for combat token based system, initially colors will represent engaged AI
set bool for rest of clients?
yeah if it's meant to be seen by clients then put it on the pawn (or maybe playerstate if your ai has them, depends, I'd pick pawn though)
just set the replicated repnotify bool
then the repnotify will run EVERYWHERE and that's where you do your business logic based on that bool (play sound, change light intensity)
I understand that
and you don't need to pass location, play the sound at WhereTheFlashlightIs
Isn't playing sound should be done through multicast? Due to lower priority?
thank you for the tips! I was confused on where to place the component properly for replication
The bool will be replicated and then a function will run locally. Priority doesn't matter in this case.
In that locally ran function, you play the sound
(Just assuming adriel already went over having a bool for the state for the flashlight)
So basically if I set it in client each client will have a different rep notify which would screw everything over
Client sets bool to true locally and then does a server rpc
Server sets the bool's value and because it is replicated, it'll get sent to clients
When client's receive the updated value, it runs the OnRep - in here is where you do the logic
weird, moved the component to the pawn, still not able to replicate the color
jump works though
๐คฃ
so regardless of if i set it in server or on client it will set on server. If thats the case then theres no difference between setting on server or on client. I guess clients would slow the process as it tells server to set.
You are making this harder on yourself
Replication only works Server to Clients
No matter what you try to make up here
If a Client sets a value locally, it doesn't replicate to anyone
The only benefit of setting it locally on the Client that ALSO ServerRPCs, is that you don't need to wait the whole RoundTripTime
im not making it up when a new client joins renotify goes off when it happens in client
The point of RepNotify is to call on a client when they are relevant (or become relevant) and the value changes
That's why you are supposed to use it for state
Cause an RPC won't trigger again
If you change a color with an RPC, you won't see the change on the new Clients
If you set it via an OnRep variable, the connecting Client will call the OnRep and thus change/use the color
RepNotify for State
but when youre out of cull distance you still need repnotify
RepNotify for State
so you can see changes when they come back into distance
Like, I can only repeat this
i dont understand what you mean by state
I think the repnotify wasn't the issue for the color replication, even moving the component to the pawn, still doesn't work
"State" is something you change that stays that way until changed again
Speed is State
A Name is State
The color of a cube is a state
The size of a cube is a state
None of this is something you change via an RPC
And with RPC I mean Multicast/ClientRPC
I was going to use repnotify for speed later
but i was on about the current repnotify (flashlight replication)
not the walkspeed
It doesn't matter what you use it for. Flashlight being on or off is also a state of course
yeah
but what i was asking is whats the difference between setting repnotify on client and repnotify on server if both methods seem to work
Setting OnRep on Client will not replicate to anyone
Exactly, if the flashlight is off by default and you did not use OnRep for turning it on late joiners will not see the flashlight on
That's the difference. RepNotify is just a replicated Variable that has a callback that calls when it changes. in BPs that a bit of a different callback than the one in C++, but it's the same idea
But since it's just a replicated variable
It still has to be set by the server to replicate
Client setting it won't make it replicate
The only thing that does is change the value locally
with the multicast wouldnt it replicate to all clients and server tho
Multicast also has to be called by the Server
I've made a comment on what i think happens
That's a redundant setup
Which you were already told
The Multicast is not needed
At least not for the boolean
but i thought for other clients to recieve this info ud need to multicast
at least for the sound
If the sound is a one time sound that shouldn't trigger again for late joiners then the multicast for the sound is fine
If I were to remove the multicast and just have server setting the repnotify it would do the same thing?
For the Boolean it's redundant
If we ignore the sound for a second, yes
wouldnt the server have to send this info back to other clients for them to see it
That's what the replicated part of the variable is for
oh
Server sets it and it gets replicated to clients
so i can just cheat out not sending any information to other clients by just using repnotify
as its replicated
If you don't need the OnRep function callback you can also just use a normal replicated variable
RepNotify is only needed if you need to react to the change
Yeah but the multicast is indeed not needed.
i do want other players to hear the sound though so im confused as to why i should get rid of it
The sound is a different topic
The Boolean is a state
The sound is just a one time playback
If you trigger the multicast and play the sound from it
And later someone joins
they wont hear it
Correct
but thats fine because you shouldnt be
Correct
That's when we are not talking about state
If you however were to enable a looping sound as long as the Boolean is true, then you would use the OnRep and the new Boolean value to start and stop the sound
Cause the sound being on or off is a state
yeah
So if you want to keep the sound with the multicast, it should be enough to love the set Boolean call to the Server RPC before you call the multicast
Just be aware that the Boolean can not have replicated yet when the multicast arrives
so this whole convo was about how setting repnotify in client is redundant when not taking into account the sound part
So if that's depended on each other you gotta sent at least the new value along the RPC, but still no need the set the Boolean locally
I guess. The Multicast yeay
...
There are times where you set the value locally on the client that triggers the server rpc
But only to predict the change
So the local client doesn't have to wait until the variable replicates back to them
The server still has to set it though
No worries. It's half past 11 now. So I will head to bed. This info is theoretically all written down in my compendium that is pinned to this channel
But I assume you either know about it already or even read it
One more question this is a quick one
when doing networking as a whole
do i really only need to understand repnotfy and rpc
not talking about backend
because i'd have 0 clue
No. Sadly not. You also have to understand what existing classes exist when and who has access to them. And also what data to put where
Which is also partially explained in the compendium
And ownership is a big topic
That's what allows a specific client to call Server RPCs to begin with
oh yeah i havent used that yet
but you wouldnt have important info stored in gamestate or playerstate
You really need to check the compendium. It exists so this stuff doesn't need to be repeated
You totally can. They are still subject to authority
It's more about who needs access to the data
The score of a player would live on its PlayerState so everyone can see it in the scoreboard for example
ah
im currently requesting server to send all info to each client using for each loop
๐
Mic on off?
repnotify
Yes
On the PlayerState
Client A talks so PlayerState of Client A will have that Boolean set to true
RepNotify changes UI icons or so
If they keep talking and someone late joins it will properly display for the late joiner
Your RPC will not
Same story
yeah
But now I shall head to bed. Good luck!
thank you
Here's a screenshot I yoinked from one of the pinned videos that I found pretty helpful
really usefull!
thank you SO much for this, one year later
i've already wasted 5 hours trying to get a duplicated actor component to replicate, and removing RF_WasLoaded from the new component finally got it to work
glad it helped even though I don't even remember why I had that problem lol
this is why i love this discord
I'm thingking about pushing other players or npc in a multiplayer project with cmc.
Let's say I use on tick and impulse to push npcs out of my character way. What I'm struggling with is, how can this be locally predicted since i don't have authority over other actors. And multiple people running the simulation won't even give the same result so the only reasonable way seems to be doing the push on the server which then update the result on clients.
This will probably result in delay, especially for high ping client. Are there any thoughts on how to tackle this?
Hey, i'm thinking about AI. In a multiplayer game, AI would be on the server and get replicated down, right? Is there any case AI run on clients? I guess there is no good reason to run AI on clients, so normally people not gonna do that
I have another question .
Is there a way to force OnRep on client even the value is not changed, for one time only, not setting the whole thing to COND_Always? I think i tried ForceNetUpdate but that didn't work
I was calling an RPC, but Client RPC will also sent to server player, and i want to send to only client
You can send an RPC to the owning client. UFUNCTION(Client)
Yeah mb, i mean the Server player
ClientRPC will still send to server player (if it's on the server)
then branch? if(IsLocallyControlled && IsServer) Don't
oh yeah. that probably work
also client RPC is not sent to other peers if it's the locally owned actor, that would be counter the design
Hello Everyone, I followed tutorial Docs about setting up dedicated server in AWS but instead of AWS I'm currently Using microsoft Azure
Every Steps has been done and I turn on Lyra Server in my VM but when I play Lyra Game and using console command and type "Open my Ip" I cannot connect, pls help
hello good morning good people
i have a question if i may
i recently uploaded a dedicated server to play fab to test a game ,when i launch the client build and click on the create match button the game crashes ...this is not the case with listen servers, so i was wondering if the server default map must be same with the lobby map before all playars are transported to the game map? please ill need help on this one thanks
in a nutshell how do i make my lobby work when using a dedicated server
Hey, How can I play a niagara system for everyone except owner?
I tried to call a multicast RPC with UNiagaraFunctionLibrary::SpawnSystemAtLocation(...)->SetOwnerNoSee(true); but still play to owner
Hey, it possible to use live link in a multiplayer setup, so that clients can also see the live link poses and not just the local client?
So i'm trying to setup repnotify for a number of items that might be picked up and dissapear before other clients join
im not sure why it's not working
the correct actor class is definitely being sent through
This is in the player controller and the actor class being sent through is from the player pawn
What's your expected result and what is not working?
i realised what i did wrong but it still doesnt work
one sec
i just wanted other players who join or are in current game to see the actor destroyed when whichever player interacts with it
Do you have multiple objects of the same class in the world?
Then you will need to change your approach. You won't know which object GetActorOfClass will return to you. So you'll destroy a random object instead of the specific one your player interacts with
I would send the object itself instead of it's class to the inventory
Even create an inventory item component and send it to the inventory and hide the object instead of destroying it, so when you want it to be visible again, you can just make it visible instead of spawning an actor again, which is probably more expensive operation
its just a one time use thing
But if you only have one object in the world and it's replicated, you should see that it's being destroyed with your current setup, I'm not sure what causes your current problem
Yes but if you have multiple keys or even have different classes that inherits from a base class for pickable items, and use GetActorOfClass with the base class, then you won't have control over which actor is going to be destroyed
Okay the current issue might be because you're setting array to itself
i did an append with a new array on controller
If you set a replicated variable to the same value, OnRep won't be called on server on blueprints
Yes you change it before you set, but when you set, you're setting it to it's current value
Can you try creating a temp local variable, setting the array to the temp variable, adding to temp variable and then setting the temp variable back to the replicated variable?
Is it still not triggering OnRep function?
Hmm, apparently blueprints also call OnRep on add and remove, so the whole temp thing is also unnecessary
Is your actor replicated?
Also for the destroy logic, you're doing it in the OnRep, which should work for all clients and server, you either need to filter it with HasAuthority to let only server destroy it and let it be replicated to clients, or even better, just destroy it before you add it to the array since you're already on the server there
So the logic should be better by taking an object reference as the parameter, adding it's class to the replicated array of owned item classes and destroying the object reference
Otherwise you'll either add null or an actor that's pending kill to your array since you destroyed it, or it won't be null at first but will be nulled later when you destroy it
thing is i need them destroyed in the onrep so clients joining wont be able to see the actors
So you shouldn't be holding the reference in the array but the class, or just hide them instead of destroying
anyone?
I am working on mobile game. Can someone tell me on how to possess widget BP with buttons (Obviously it's mobile platform) for character and pawn ? Like possessing character to car and vice versa
What do you mean by possessing widget?
I mean showing WB for different class
Oh if you mean different classes that are being possessed, then what I would do is listening for player controller's possessed pawn changed delegate. You can check your NewPawn class and decide which widget you want to show
Im trying to use the multi user plugin, im using a hamachi vpn server ip as the unicast end point, but its popping up this message when creating a multi user server
yeah it just wasn't possible to destroy them so hiding them worked for both
I don't think there is any necessity to keep game default and server default maps to be same. If you're crashing, there should be some kind of a logic you've implemented that is depending on one another and when the desired map is not there, causing the problem
just dont like it because it adds unecessary data
i guess thats why u do object pooling so u reuse the same one
I wouldn't consider it as unnecessary data, spawning and destroying actors when you spam interact and remove from inventory is more expensive, performance wise, than just hiding and making them visible again
Yep that's the point
i feel like object pooling is only important with mass spam tho tbf
like bullets etc
Also if in future you would like to hold states within your items (let's say you have a potion that can be consumed multiple times and destroy when maximum amount is consumed) destroying and spawning it again would cause it to spawn with it's default state, so you could do a hack by consuming it, dropping it and getting it back to use it infinite times
true
For the bullets example, you would spawn an optimum amount of them and let them wait in the pool, use whenever needed and return it back to pool again. For items though, since they can have their own custom states, you can't return them back to a pool. So it's not actually object pooling, I guess? But the optimisation you gain problem you solve by pooling bullets and hiding/making visible items in your inventory vs items in the world is the same, getting rid of unnecessary spawn and destroy calls
Hi, when I try to possess Server and Clients like this clients going good but possess function doesnt work for Server what should I do for it?
What's.. going on on there
might be time to move some nodes around if you need to play snakes and ladders to follow it... I've been there I guess
can anyone tell me whats going on here? is it a problem of my VPN or of my firewall ?
not 100% sure but I have a feeling its related to unreal's "Multi-User editing"
think ther lobby map is using the listen server flag
looked at the logs ill remove it
hi, im trying to throw a projectile in the direction of the player's cursor. problem is that it is only thrown in the right direction on the server and not the client. here's what i have in the projectile event graph (also, this is my first ue5 project)
Bro thatโs just sad then
You're using GetLocationUnderCursor on a multicast event. That function will return the local player's mouse position. So every player will set the direction to their own mouse. You should spawn your projectile on server with the desired location and rotation and let it replicate the movement instead of setting the direction individually on each client
will give it a try, thanks!
what is a good setting for these:
i have a problem where remote player movement is jittery when in collision with moving npcs... can these values help?
(what i mean by remote player, is that my player is connected to a remote host)
Just to emphasize, this only happens whenping is high, loike higher then 50ms
That's to be expected
Your local character is ahead of the server, whereas NPC's will be behind the Server. They operate in two different timeframes so perfect prediction isn't possible.
You could do something highly advanced, like prevent your local character walking into another NPC by estimating their future position based on ping/velocity etc.
Very difficult to achieve in practice
So, the only option i have would be to turn off collision with npcs
@chrome bay ?
i mean is there a way to tell that if something like that happens don't jitter just run it smoothly, regardless of the outcome
i don't mind players and npcs occuping the same space, that's not game breaking
if it comes to that
something like, do you best to handle collision, but if you run into a problem like i described, don't jitter, just let them penetrate each other
You can turn off collision yeah and/or modify player and NPC velocity based on the above idea
Could look at something like ORCA or RVO for avoidance
when it comes to turning off the collision, where do i do it... i never know
is it on the sever/client or both?
*server
Modify the collision profile for the character capsule so that it doesn't block other characters/pawns
Collision must match on both, just make it the default
No, you make it the default
Change it in the actual blueprint. No point doing it at runtime
RPC would also break relevancy
if i wanted to detect jittery behavior somehow on the client
If you had to do it at runtime you'd need a property and a rep notify
and then turn off the collision
You can't do it that way
The jitter happens before collision
The server is correcting your clients predicted movement because it thinks you walked into an NPC
So it's too late to disable collision
yeah, but, the situation here is that my character is moving into a npc persistently
right, so just turn off the collision permanently
because he's a melee character and want to get close
*wants
and the npc is moving as well
The only way you can stop the jitter is if the client can predict they will intersect and NPC and stop themselves from doing it
so i have a persistent jitter
so i'm thinking if i can detect the first jitter somehow
and then turn off collision to prevent future jitters
hmmm
do you have any idea what these do exactly, i read on the internet some people were able to tweak it to remove jitter
but i have no idea what are the meaning of these (they're from movement compenent)
Doubt it tbh, that's for penetration adjustment which is after collision occurs
the "jitter" is not client-side, it's your client getting a correction from the server because it's not allowing to walk into another characters' collision
The only way you can properly stop the jitter, is if the client doesn't walk into their collision at all
But since both operate in different timeframes, that's borderline impossible to do 100% reliably.
But a start would be predicting the NPC's future position based on your ping, and not allowing the client to walk there locally
Or, modifying the input vector during movement to force them to move away from the NPC
Hey guys I'm using the advanced sessions plugin and trying to update session but every time I do the current players returned is incorrect.
Ex. 1 player connected with 2 max players set updated to have 3 max players will return 2 current players even though no one additional players connected
anyone have any clue or idea why this might be?
@chrome bay thanks for your input... but how do other multiplayer games handle this ? and there is an abundance of multiplayer games in ue.It's not possible that they all do some custom made solution
wierd, i have my playerbase complaining about this jitter a lot
Treshold for complaints should be adjusted higher
I wonder if one could have some local collider with a bigger radius...
But i guess it would still jitter when server corrects, and doesnt know about the bigger collider
If used to stop / divert player input tho... hmm
Hey everyone, I'm working on a prototype for a sandbox multiplayer game where about 8 players are in a warehouse and are able to pick up / interact with different objects, use environment-augmented voice comms, and also trigger events that will effect the whole server.
I haven't gone into the networking side of things, but I hear UE5 has some limitations. Any suggestions on what my biggest difficulties here might be, or how I should approach this?
Not for that time of game
Fortnite runs 100 people on a server, in an open world. With many interactables and destruction/building.
are these 2 settings of the CMC for simulated proxies or autonomous ?
getting conflicting answers
Can you elaborate a little bit more on this?
What's to elaborate on? The information you provided will be fine in UE
You won't hit any mystical issue or anything like that.
UE will be more than suitable for that type of game.
Oh gotcha, I thought you meant that it wasn't for that type of game.
Any thoughts on P2P for this? I can see there being quite a few physics objects being tracked at once.
I guess my question is more along the lines of using UE5's built in multiplayer tools vs building something specifically for this
My main thought is it wouldn't be worth it. UE doesn't support P2P out of the box. You'd have a custom networking model
UE is a client-server architecture
Riiiiight. I'm learning as I go here.
๐ซก
Thanks for the input, i appreciate it!
Read the pinned posts
For clarity - P2P is often misidentified as just being able to connect with each other. But it's not that simple.
P2P means that you are connecting with each other and there really isn't a server involved. UE's model, there is always a server involved.
Even if a player acts as the server
It's just that the server is running on the same machine as a client
Right. Listen Server
Hi! Is there anyone who could provide a detailed description of these character movement variables, preferably with examples:
anbody know about this? ๐ฆ
delete all this
and?
First off, is the character being spawned server or client side?
reorganize this to make it more easily followed
right now it's like the timeline to Primer
I didnt get what you mean really, in code just basically going spawnactor in a foreach and after complete going another foreach to possess from PlayerArray.. already a basic scheme
๐คจ
if this is running on server then why is Set Players Camera a run on server event? and where does it go after the delay
Server RPC in the GameState is generally wrong
because of I am new and can forgot sometimes GameState working just for Server so makes all the events marked with Run On Server ๐ . andd Delay is just for "Do Once"s reset pin to make there more secure to not duplicate them mistakenly
Also is that Set node with the "Make Array" node your attempt at clearing the array?
Game state already not check events replicate mark right? so why will be a problem ๐ค
It's redundant to make that a ServerRPC
Clients can't call ServerRPCs in the GameState, and Server doesn't need it of course
I knoww Its just for me to can see when writing there somethings to dont forgot that area is just for servers ๐
Use comments...
๐ฅฒ really I just asked for possess
When is that code being called?
SetPlayersPositions > SetMapDetails-just costmetics- > and this event
not any open world or eg
just default events
What "doesn't work" about that possess call?
nothing happens when trying to possess server -0.player is server and not working and 1.player is client and it possessing-. Event OnPossess not trigger on server after this
and checked with printstring in foreach after possess, InPawn-getobjectname- and target -getobject name- is printing valid
I have a similar possess question! As a client, when I possess a character while moving, the old character on the clients screen gets desync'd and continues in a straight line forever but is standing still where it should be on the servers screen. Anyone know why that might happen?
When standing still there's no desync issues, both characters are using the CMC
Not at computer at the moment so can't check exact function name but maybe force a replication update after possession
I'd start by testing if you can reproduce in third person template tho because if you can't there might be an issue with your project that could cause other problems if you bandaid it
Sounds good! I'll look into it, thank you for the help!
how are you doing your movement input
I just copy and pasted the template first person character, I'll screenshot it rq
I know the client interact is redundant I forgot to delete it was messing aroudn with it lol
Oh you're adjusting the pawn's transform outside of the prediction system, that is always going to desync
outside of the prediction system,
ooo a new term for me lol guess that'll do it
I'll google how to use the prediction system, thank you!
And so begins years of frustration
Check what the IA_Move does when you eject
might be getting stuck on your last movement input
gotcha, one sec
Calling ForceReplicationUpdate on CMC might help too, but dunno, I don't think this is something Epic would have overlooked since possession is a critical part of their framework
Use APawn::IsMoveInputIgnored before all movement inputs
I did "Stop Movement Immediately" and it stopped the desync, so I think you're right!
bool APawn::IsMoveInputIgnored() const
{
return Controller != nullptr && Controller->IsMoveInputIgnored();
}
Wait no
That won't help here, but it might be good practice anyway
Appreciate all the help guys, really nice!
These are the checks I do before I process any input, which includes looking for a controller
bool UMyHeroComponent::CanProcessInput() const
{
const AMyPawn* Pawn = GetPawn<AMyPawn>();
if (!Pawn)
{
return false;
}
const AController* Controller = Pawn ? Pawn->GetController() : nullptr;
if (!Controller)
{
return false;
}
if (Pawn->IsMoveInputIgnored())
{
return false;
}
return true;
}
Oo that sounds like a much better idea than how the default template works. I'm still new so that helps a lot
how to go about making enemy AI movement not be desynced? im getting mega desync from how i have the AI movement right now but it's chasing the player , i increase it's speed and this really throws off where the enemy AI is and it hits the player when it appears to be much further away than it is etc
AI collisions occur outside of the prediction system, if they are moving and they touch a moving player, desync is guaranteed and is often extreme
You can either disable collisions or use something like my plugin, which gives you net predicted soft collisions (I use these in my single player game too because they feel great, and I can make NPCs get annoyed at a player walking into them, or shove them)
https://github.com/Vaei/PushPawn
interesting, thanks for this info. do i need to have GAS implemented to use this?
It uses GAS so yes, but there is a guide that simply includes the steps it took to set it up for a third person template, which is the minimum setup required
https://github.com/Vaei/PushPawn#how-to-use
If you start from the "Ability System" header that should show you how to integrate minimally
dope thanks im going to give this a try, i dont know cpp very much i just do things like this from time to time so if i have any qualms i'll let you know lol
would this also help w things like when i hit the enemy i can do push backs etc? i had this implemented but it also caused desync
- Scans for anyone near the player pawn in a given radius
- If someone is near the player pawn, they hand the player their unique ability
- The player activates this ability, which in the case of PushPawn, results in them being pushed back by a force, and the ability can also make the pusher play animations or do anything at all
So probably not. But you can certainly use GAS to do such things
lmao man, everything i want to implement can be done via GAS and i just done know cpp enough to fully use it
Hi all, I'm having trouble getting PlayerState::CopyProperties() working for the Listen Server's player state specifically. It works 100% as expected for the clients' Player State, but doesn't execute on the host's Player State at all.
Has anyone gone through this?
Tested on PIE and Standalone. GameMode uses Seamless Travel.
Wasn't override with supposed to be the inverted logic? I can never remember what old and new was for that one. But that should also only matter for reconnecting I guess
It is inverted, I already switched it up. But it wasn't even being used anyway
The rest looks fine. There is nothing speaking against this. Only requirement might be that they both share the same class or at least parent class
Same class. I can't find anybody else reporting this on Discord or on the forums. Guess I'll try reproducing on a blank project and, if it happens there also, just treat it as a UE bug and work around it.
I don't think I ever had an issue for the ListenServer with it
Are you able to use c++?
Yeah I'm fine with C++
If so I would suggest you breakpoint a bit
PIE can't use seamless travel without the experimental console variable
So I wouldn't trust that
You mean all the way from PlayerState's DispatchCopyProperties and such?
Yeah I would hook into the standalone process of the server
And breakpoint the part where it's supposed to call it
Awesome, I'll do that
And then work my way up in case it isn't being called
I can't recall this not calling for the ListenServer
I also highly doubt that was a thing
is there a way to test remote play together with friends without a published steam page?
That's probably easier asked on steam's end than here. Also the first time I see that specific question. Fair question though
I see. Yeah, I mean obviously it would work as long as the local version works. Just would be nice to test a build for "fun" factor without having to make a steam page
Is there a place that I can ask such a question to steam?
I guess steam community maybe
Interesting
It appears you can hack a solution by deleting all the files of another remote play game, replacing them with your game and renaming your exe to the old exe's name
Im testing it now to see if it works lol
You shouldn't have to make a whole page, but at least get your app id
if i wrap hitresult in another struct, and pass it through an rpc, what happens to the netserialize on the hitresult ? still gets called as normal ?
You would tell it to serialize
bool FMyThing::NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess)
{
// ...etc
HitResult.NetSerialize(Ar, Map, bOutSuccess);
// ...etc
}
ah ok yea makes sense
how are you supposed to netserialize a pointer to a replicated actor ?
map->SerializeObject ?
@ember vine Look at the HitResults NetSerialize function
It serializes all sorts of data types
ah jeez 4am, its what ive been looking at i just didnt see them, even tho i know hitresult has like 20 ptrs on it 
Hey guys I'm using the advanced sessions plugin and trying to update session but every time I do the current players returned is incorrect.
Ex. 1 player connected with 2 max players set updated to have 3 max players will return 2 current players even though no one additional players connected
anyone have any clue or idea why this might be?
how can I create a custom replication condition?
I don't think Blueprints can, but I could be wrong
Hello, I have a basic question, If I make 2 actor and all replicates to enabled and then if I put actorB to inside the ActorA components -child actor-. Child actor-actorB whichs inside ActorA- will replicate from server to clients properly like a normal Actor?
I have an Issue: spawned component isn't exist for new joining clients.
How do you spawn the component
In theory yes but I would highly recommend not using child actor components
They are a bandaid fix from Epic that will break in random ways at the slightest inconvenience
don't worry about that, it works when clients are in the session, but after they leave session then enter again, they don't find it
So did you figure it out or?
my tests always failed too so I asked if problem is me or not then ok I need to change my way ๐ Thanx
I don't know how to make it replicated like actors
Well, the question I asked is important :p
I don't know the solution, as components by default I have to spawn it on multicast, not as actors which I only need to spawn on server
so spawned components doesn't show up for any new joining client
You dont spawn them using RPCs
You spawn them on the server and make sure they are replicated
doesn't work
even if the server spawned them, still any new joining client can't see it
and it's set to replicates already
You need to spawn it on the server, mark it replicated if it isn't, and register the component
all done, doesn't solve it
Show your code, sounds weird
the second one uses mulitcast, one before the client join the session, and the other after it joins
you can see the difference @solar stirrup
HasAuthority() returns inconsistent errors when running on Dedicated
True, false alternately
It's like it's delayed. Who can answer?
Shouldn't happen. Server has auth. As well as client if actor is locally spawned. That's all there is to it
It has an uncertain value.
The listen server works fine. when Join Dedicated receives an uncertain value from hasauthority.
this on p2p listen server
You're gonna have to show some code ^^
on listen server it working hasauthority() is alway true
on dedicated hasauthority() true false alternately It's like a delay from the network.
this false 4-5 time , true 1 time ๐ฅฒ
@tulip oyster Well, I can only tell you that whatever HasAuthority returns is not random
from you video it looks like notify is only getting called once at the end
If you get False or True, then either of them is correct
else it would say HasAuthority(): false
Also if this is AnimNotify based, make sure to use Branching Points for the Notifies
And ensure that the Mesh SkeletalMeshComponent is set to always update bones and tick pose
If HasAuth returns false, then you called it on the Client on a Replicated Actor.
And if it returns true, then you either called it on the Server.
Or you called it on a local Actor on the Client, where the Actor doesn't exist replicated.
this on listen server = = it working .
me get this problem from dedicated server only
I still don't see the actual problem. The problem is NOT that it returns a random value
You are calling this on different Instances
Please ensure the MeshComp stuff I wrote
Yes
It's already tick pose
Then ensure that your Notifies are branching points
Hi!
I'm trying to make a system where I would change the player speed on scroll wheel and I want it to be with the CharacterMovementComponent's prediction architecture. I'm still struggling to understand cmc. I've got most of the delgoodie setup. The problem is that I won't have a sprint key and so the player speed is going to be changed on scroll wheel (up to speed up, down to slow down). Do I use serverrpc for this? How do I make the prediction?
Plus I won't be able to use the safe_bWantsToSprint to do the prediction since I'm not using a sprint key. Unless there's another way.
You won't use additional RPCs
If you can't wait for 5.4 and the new mover2.0 stuff or you simply don't want to, then you will need to integrate it directly into the CMC.
You can specify a container for move data to send additional data to the server. I would suggest you send the multiplier from the scroll wheel via that and also save it in the saved move. Also clamp the multiplier on the server side so one can't send a higher value than you want
You might want to check the pinned repo for the CMC
The one from Vaei
I've checked it. Since I'm assuming when 5.4 mover 2.0 will come out it'll be a lot easier to use CMC I'll probably wait and work on other stuff.
It might be easier to use yeah. Time will tell
Hey, I'm trying to spawn a niagara system in a multicast and set ownerNoSee to true, But it's working, maybe the owner is lost?
UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), MuzzleFlash, Location, Rotation)->SetOwnerNoSee(true);
Pretty sure OwnerNoSee only works if that thing is a Component part of the ViewTarget
You are better of checking IsLocallyControlled if that's not an option
Can I do that in the multicast RPC?
Where is that Multicast called on?
The rpc is only playing a muzzle flash niagara, called in a BP_Gun owned by the player
Yeah then get the Owner, which is the player, and check if it's locally controlled
Or add a helper ufnction to your BP_Gun that does that for you
working fine thanks
I can also getplayepawn at index 0 and compare it with the owner
Sure, as long as you don't have local coop players
Hi! I'm trying to replicate player movement through listen server and I have a problem with the movement looking jittery on the client. On the server everything looks good, on the client the client's player movement looks good but the server-player movement is jittery. I am using RPC events (Run on server and the Multicast) to replicate the movement. Does anyone know what I'm doing wrong? Concidering that the clients own player works fine it must only be the server's own player I'm replicating wrong? Would really appreciate the help! ๐
Your problem is that you are implementing this as naive as possible
There is a lot more to replicated movement than 2 RPCs
Clients, if you want it to be predicted, yet authoritative, need to keep track of their moves.
Server needs to be able to send corrections. Clients need to be able to apply those an replay newer moves.
SimulatedProxies need to smooth locations.
And potentially much more.
That's why, up to 5.3, you are supposed to use the Character class with the CharacterMovementComponent (CMC), and you are required to extend the CMC in most cases via C++ if you need additional movement (such as Sprinting).
With 5.4, there is something coming called "Mover 2.0", which might make this all a bit easier
okay so if I understand you correctly I should start handling the movement replication from the character class instead? I have tried to do predicted movement, basically doing the logic locally and then calling the rpc's to later adjust but haven't noticed any difference, but I'm might just not be doing the prediction correctly
There is just a lot more involved in this. Enough for this to almost certainly not be possbile in BPs anyway
If you need a controlled movable actor, that is smooth locally and somewhat smooth across the net, you are currently more or less forced to use the Character class
ah okay I see, thanks for the help!
Hi! Im making a game, where each player has some points, that they can spend on purchasing items. These points should only be known to Owning Player and Server, nobody else. Currently these points are in PlayerState. Do I need this UPROPERTY to be Replicated? If it's not replicated, then is it known to Server or Owning Player?
If i just mark this UPROPERTY as Replicated, does it allow cheaters to see such values?
To ensure the value is Authoritative, you would need to make sure the Server sets it, and that it's replicated. Even if only known to the local player.
Now, if you replicate the variable in the PlayerState, it will be known to others by default too.
You have two options:
- Move it to the PlayerController, as that doesn't exist on SimulatedProxies (other Clients).
- Mark the Replication Condition as Owner Only.
Oh, i see. Thank you very much!
Is it set in GetLifetimeReplicatedProps? DOREPLIFETIME_CONDITION or something iirc
Yes
Thanks!
Who actually owns APlayerState? Is it owned by Server, associated Client, both?
I created RPC to add points, but not sure if it will actually change on Server and then replicate to only one Client
I guess maybe it's just easier to move it to APlayerController after all
@viscid monolith PlayerState is owned by the Client
So you can perform RPCs in it
But do you really think that RPC there makes sense to exist?
Your original post sounded like you don't want cheating to happen
What stops the owning client from call that function with a huge number
Yeah, i just noticed, that only side that changes these points is a server
So yeah, it's stupid to make it an RPC
I do want to add though, that if that is your goal, then the Server needs to be a DedicatedServer.
And if it's a DedicatedServer, it has to be hosted away from the Clients, which means by you, using some backend.
Yeah, or else host can cheat
That is very, very expensive. Just so you are aware
Yep, i know it, but im just playing around with it to learn, not making any game right now
Alrighty!
Thank you for the help, once again!
Hey is this known that if the Server has less FPS than the Clients then the Line Traces done might not register ? I'm having an issue where when I play on my big computer and play as listen server then all my friends hit register but if she plays with a shitty pc as Listen server then none of my hits register ? or very rarely ?
any solutions or known issue ?
How are you performing the traces and communicating the results?
Tick line trace for the duration of the animation and the rest with a GAS setup
well that's still missing a bunch of context
and I'm not sure how you're testing this. there's also a reason lag compensation exists in a bunch of games
guys idk why but i think i want to make a multiplayer game its hard??
of course it's hard
so single player is the best
Hmm well for now only the way described above
Starting to investigate
Wanted to know if it is something known
I wouldn't say so? If you want things to be easy all the time this ain't the career for you
Well animation timings for gameplay can be bad on the server too, the notify could not fire for instance
I have a quick question about how IsLocallyControlled() works. Right now I'm trying to have some logic only run on the local/owning clients of an actor component. I have a function on the actor component to get the locally controlled player:
bool UTestComponent::IsLocallyControlled() const
{
if (const ACharacter* character = Cast<ACharacter>(GetOwner());)
{
return character->IsLocallyControlled();
}
return false;
}
And then in the component's on begin play:
void UTestComponent::BeginPlay()
{
Super::BeginPlay();
if (IsLocallyControlled())
{
// Initialize client only logic (Client or Listen Server)
}
}
If I debug it in PIE with 2 players and as a listen server, BP_Player_C_0 (ListenServer) triggers the initialize code for both components and BP_Player_C_1 (Client) doesn't trigger it at all
I'd expect the ListenServer to trigger its component initialization code once, and the Client to trigger its code once. Why would the ListenServer be returning true on IsLocallyControlled() for the other character's component, and not at all on the client?
Well for the start is the character that owns the component valid, and has the first client actually posessed the character by the time BeginPlay is run
this is where I would share debug.jpg
hey guys whats your opoinion about EOS Integration Kit
Hmm so I need to check if the notify goes out and if the trace hits
The second player/client can get a valid character, and the component is also valid as the breakpoint can be hit for it
But yep I just traced it back, its failing because the controller hasn't been replicated yet
Okay now the player controller is valid, but still no dice. That also doesn't explain why the ListenServer's character would be returning true for being locally controlled for the second character's component
Can somebody help me understand the difference between "is dedicated server" and "has authority"? If I want server-side logic, which one should I be using?
IsDedicatedServer would only ever return true if called on the DedicastedServer. So it's false for Clients and ListenServer.
HasAuthority is a bit more context dependent. On a Replicated Actor, HasAuthority would return True for the Server (Listen and Dedi), and False for the Clients.
However(!), if a Client spawns an Actor locally (for whatever reason), HasAuthority would return True for them, cause they have Authority over their locally spawned Actor.
Wow, you explained that very well. Thank you!
--
Looking at Mover 2.0 atm, I gotta say that it looks a lot like one huge hell of structs in structs that have some structs for your structs.
I believe it. Especially considering how struct heavy StateTree is
Will take a bit getting used to. The actual MoverComp is simple enough, but that's just the tip of the iceberg atm
Does the movecomp inherit from one of the other move comps?
No, it's just an Actorcomp
lol
But that's the thing that is a bit tricky to understand at the start
Cause the MoverComp is just one of many things
It's not as centralized as the CMC
You have those Liaison Components
Am I right in thinking that if you are going the dedicated server route you will probably need one for each continent if your game will be available there?
That kinda work as an inbetween
Possibly, yes, due to ping across the ocean
exactly
So I guess they want to get rid of the entire current family of movement components
Now, is it possible to mix listen server and dedicated server in one game? Like do dedicated server for some modes and for some listen servers? For example it could be competitive team deathmatch would be dedicated server but private matches with friends only listen servers
that would allow for more capacity probably
Could be, but then you have this:
FMoverInputCmdContext()
{
// TODO: Consider eliminating this default input, considering non-character / non-controlled Mover actors (like platforms)
InputCollection.FindOrAddDataByType<FCharacterDefaultInputs>();
}
hi, does UChildActorComponent required some specific preferences for replication? I'm faced with problem when child actors not attaching to parent if I launch game in Client mode
Public match - connect to the server that you're hosting
Private match - just open the map as a listen server
It's really quite easy
From what I heard, ChildActorComponents are pretty buggy if you are unlucky.
I would suggest just spawning regular Actors and attaching them
Don't use that component for networking. Has some bad interactions with networking. Especially clean up operations.
Yes, you can mix that.
I see, alright just wanted to make sure, thank you! Do you maybe have a good tutorial playlist on yt that shows how to set up dedicated servers right from a beginner level? I know pretty much about listen server replication but didn't yet try dedicated servers
Despite needing Source Engine to build them, there isn't much to them
They are just processes that you can show the log of with -log when starting
Also about the code maybe. How to set it up correctly
When coding you just have to keep in mind that some stuff will run on a Dedicated server etc.
@quasi tide It seems to be an InputCollection though. My current thought ,without diving too deep into it, is that I want my own struct wit hthe sprint input added to that somehow
But that's where it starts getting hard to follow the code
So anything you can recommend? I became very careful with learning new things from any youtuber because many teach bad coding behaviors which can be very harmful for a beginner in the longrun ๐
That's not really something I can write down here. It's a lot of stuff that more or less naturally makes sense
Nope. I don't really watch YT. Maybe SneakyKittyDev?
okay, gonna note that one down.
E.g. if you spawn a VFX/SFX via a Multicast, you should filter the DediServer, stuff like that
Or if you support both, you gotta make sure you only filter the DediServer and not Auth/Server in generaly
Uggghhh - I hate hard to follow code
oh so it's not that much of a step from listen server to dedicated?
No, not really
I am still in early development in my game so I only have a lobby one can connect to
no replicated game modes yet
Dedicated is pretty much just a listen server without visuals
Yea, alright. Going to look sneakykittendev up regarding how to set up dedicated servers and stuff
thank you two for answering my questions!
So I am having a networking issue with my golf game.
- In UGACharacter class I have Server function to create an instance of UGABall.
- I have a delegate in UGACharacter OnUGABallSpawned that is broadcast after I create it.
- Now in the UGAPlayerController I subscribe to UGACharacter's OnUGABallSpawned to save that instance in the player controller (I need it to pass possession between the golfer and ball while it has been hit).
So after the server creates it the player controller gets a reference on the server player. But the client does not UNLESS I add a short delay (I just use timer to call broadcast function in 0.1s). Is there a better way to handle this? Like calling a BroadcastOnSpawnedDelegate() function after the SpawnActor() has finished or am I just stuck with the short delay on a timer?
I hope I will make sense of all of this. Maybe it's just a matter of "this is not the final product" sort of thing.
UWalkingMode::OnGenerateMove fills FGroundMoveParams (notably no option to override the filling part, and MaxSpeed is just pulled from a legacy config).
That calls ComputeControlledGroundMove with the GroundMoveParams, which is static...
In there we fill FComputeVelocityParams, seemingly duplicated data (+-), and call ComputeVelocity, again static... Code in there looks similar to CalcVelocity of the CMC.
Result velocity gets pushed into a FProposedMove back in the GroundMove function.
That, alongside other data, gets then returned back to OnGenerateMove and set as the OUT value.
Back in the MovementModeStateMachine (yes, that is a thing now), the new Move (let's ignore combining), gets added to FSimulationTickParams alongside other data.
And that ultimately gets pushed back into the Walking MovementMode, that originally executed OnGenerateMove, via UWalkingMode::OnSimulationTick, where it is then extracted from the TickParams to actually move the Owner.
While that is somewhat clear, I do wonder where I would be supposed to add a Sprint Logic, namely modifying MaxSpeed sigh
If you need that Broadcast to call on Clients and Server when the Actor is valid, you gotta put the Actor into a RepNotify variable and execute the delegate in the matching function.
Ah ok. I did that at one point last night but thought there might be a better way haha. I will go that way then Thanks!
Probably a whole new movement mode
u doing mover?
they were pawns when i looked lul
I know, that's not what I meant hehe
Yeah I hope not. Cause despite the speed change, it's all the same code as walking. Jumping is also not a different mode
I want my CMC back
hahahaha
static functions, and tons of Structs
its based on Npp yeah... kinda expected ๐คฃ
Yeah but that part isn't even NPP related
i think we will get new docus on how to do stuff with it
Why is the calc velocity function a static helper
ah, i havent reached that yet XD
i was only exploring Snaps' movement system on raw Npp for starters
Yeah I will look into it more tomorrow. But the current assumption is that for sprinting I will need to override the whole GenerateMove function cause there is no speed getter that one can override.
I hope the base modes improve a lot. Otherwise I see myself just copying it all into a custom one and make it all more virtual, less static
i c!
Also some bJustJumped Boolean, which looks redundant. But the input action is set to hold, so maybe the person was just battling that the triggered event called every frame while holding
Idk
So basically bPressedJump, and bJustPressedJump
Hey guys, just a quick general one, can you give me a quick overview of what mover 2.0 is?
I'm familiar with the original, but we have a new MMORPG in development, this would potentially make our lives 100x easier, if I'm reading right about mover 2.0? I remember in UE2 the mover in that is very bad, and there's actually a hard engine limit on the speed of updating each character's position on the screen
There is like no information about it. Download the source and look through the source yourself. That's the best information you'll find. You can scroll up a wee bit in this channel and Cedric was just talking a little bit about it.
It's on the 5.4 branch.
Thanks, that's why I was asking, I'm currently doing other tasks so I don't really have the time to look into the code extensively
That's why I wanted a quick overview
The quickest overview you'll find is what is on UE's roadmap
I looked at that, it looked promising
just people have made multiplayer games in here before
Congrats - you know as much as 99.9% of people
got it then
I wouldn't be using most of the mover stuff anyway, would be impossible, we just say to the UE client, move to this location
then braodcast it to all clients in the area
custom backend, not using UE networking
just curious how "improved" it is when it comes to actually moving the characters smoothly and such
If you're doing an MMORPG, I'd imagine you'd already have that part figured out and solved.
original mover in UE4 requires some techniques to prevent jittering
we do
but there's limits
mover 2.0 jumped out as something pretty cool and that could remove a lot unneeded code
that's really why I'm asking
quick 8 minute overview https://vorixo.github.io/devtricks/mover-show/
i dont get in depth, just a first impressions, i also provide some content on how to run it
Trying to add a slide system but it doenst work on client. Crouching works fine despite being called in same function. Input called in Server & input calls this function which is NetMulticast
// net multicast, called from server function
void APlayerCharacter::HandleCrouch_Implementation()
{
// Crouch
if (bIsCrouching)
{
// Crouch
Crouch();
}
else
{
// Uncrouch
UnCrouch();
// Reset slide
CurrentSlideForce = SlideForce;
}
// Slide
if (bIsSliding && bIsCrouched)
{
// Add Forward Force
LaunchCharacter(SlideDirection, true, false); // Works on server, not on client
// Add Counterforce
CurrentSlideForce -= CounterSlideForce;
// Disable movement when turning camera
bUseControllerRotationYaw = false;
// Disable jump force
bIsAwaitingSlideJump = false;
}
else
{
// Unslide
bCanMove = true;
bUseControllerRotationYaw = true;
}
}```
I do appreciate it
:) glad it helps, there might be a follow up with a hands on likely soon, im still doing exploration
can show more code if needed
I'll follow your progress then ๐ we'll be in a position in about 3-5 months to decide on using the current mover or 2.0