#multiplayer
1 messages ยท Page 242 of 1
Current player still gets the updates from server, but it uses them to verify position instead
I meant only sinlge rpc
its not broadcasted back
so I kinad have to upadte it locally
or implement another function that executes specificly on server and then sends data back to all Pawns
Yea thatโs a confusing way to put it., cause they do receive the replicated update they just donโt use it
ah I see
RPC + Local updates should be fine. Since I don't need server to verify stuff ๐ค
altho I need to get to know how predicting works
just btw doing prediction when the tick rate isn't fixed makes everything 100x harder lol
one of the reasons CMC is so complex is cause it cause to deal with varying tick rates
I've been working on implementing Steam Dedicated Server and MatchMaking Sessions (P2P). I'm trying to call some functions from the GameSession class from the Client when searching for sessions, however am i correct in thinking that it will not work because the GameSession Class does not exist / run on the client?
The client isn't a client when it's searching for sessions. It should be in the main menu as it's own singleplayer instance.
Yeah thats how im trying to do it
It keeps getting a null ptr when checking game session, (child of game session)
BaseGameMode = World->GetAuthGameMode();
if (BaseGameMode)
{
UE_LOG(LogTemp, Warning, TEXT("MainMenu: MenuSetup: Casting Game Mode Base!"));
TUEGameMode = Cast<ATUEGameMode>(BaseGameMode);
if (TUEGameMode)
{
UE_LOG(LogTemp, Warning, TEXT("MainMenu: MenuSetup: Casting Game Mode Session!"));
TUEGameSession = Cast<ATUEGameSession>(TUEGameMode->GameSession);
if (TUEGameSession)
{
UE_LOG(LogTemp, Warning, TEXT("MainMenu: MenuSetup: TUEGameSession Is Valid."));
TUEGameSession->MultiplayerOnCreateSessionComplete.AddDynamic(this, &ThisClass::OnCreateSession);
TUEGameSession->MultiplayerOnFindSessionsComplete.AddUObject(this, &ThisClass::OnFindSessions);
TUEGameSession->MultiplayerOnJoinSessionComplete.AddUObject(this, &ThisClass::OnJoinSession);
TUEGameSession->MultiplayerOnDestroySessionComplete.AddDynamic(this, &ThisClass::OnDestroySession);
TUEGameSession->MultiplayerOnStartSessionComplete.AddDynamic(this, &ThisClass::OnStartSession);
}
}
}
}
In the GameMode im doing:
ATUEGameMode::ATUEGameMode()
{
GameSessionClass = GetGameSessionClass();
}
TSubclassOf<AGameSession> ATUEGameMode::GetGameSessionClass() const
{
return ATUEGameSession::StaticClass();
}
Hello people, so I am running into an issue with the Unreal Engine itself, and it's priorities when it comes to replication for multiplayer.
Basically; The engine stops replicating the Playerstate for the client if the client loads too fast compared to the host.
The issue is described here in more details; https://forums.unrealengine.com/t/player-state-not-valid-after-servertravel/473321
I have spent countless hours trying to figure out a way to solve this problem, but having tried several fixes, nothing seems to fix the problem. Anyone have any ideas as to how I can go about trying to fix this problem?
Hello, I have a problem in a multiplayer game and player state. Actually I do server travel with seamless travel from a lobby-level to gameplay-level. Often everything works fine, but sometimes on Clients they somehow do not have a valid playerstate. I think same for game state, but letโs focus on player state first. I do nothing curios in the...
Does calling a server RPC on the server invoke it the same frame or later and is there any overhead to calling it when already on the server compared to a normal function call wondering about network overhead not so much cpu perf.
In other words should i check if im already on the server and instead of calling the RPC just run the code the RPC invokes.
hello, quick question, does ownership determine network roles for a replicated actor?
im trying to have an actor be replicated with server authority but occasionally switch to client authority when needed, am i on the right track?
It's considerably simpler to just call it
And no there is no network overhead
And yes it will call immediatelly like a regular function call
oh sweet thats good to know thanks
Man there is a post in there that says that you don't need CopyProperties when seamless traveling. That's just wrong lol. So much false info everywhere
Here my debugging sessions are going. I call ServerInteract in my host when i click E, and it is printed in both host and client? Why is the reason? I only send it to server, so how the other client is seeing this print debug? What might be I am doing wrong?
Here is a video of me trying.. On the client, nothing will happen
Server: <print> indicates it was the server printing it. Client#: <print> indicates it was a client printing it.
even if you see it on both windows, it still means it was either the server or a client printing it.
The print is both seen in clients, but if i try to change "stone" material, it wont be synced because of normally its not multicasted or rep notified
Hmm. so it doesnt mean that it is replicated right? I thought it was replicated on the second client for a moment..
Because i only call RunOnServer RPC, from host, didnt do any client distribution inside the interactable for example.
Prints aren't replicated.
I couldnt understand why its printed on **both **actually. I only call it on the server
Because you're testing in the editor and it's likely running under one process. Know that if you see Server: <print> that means the print was triggered on the server, and only the server, regardless of what window it appears on. Same with Client#: <print> ... You may see it appear on multiple windows, but the the differentiator is the fact that you either see Server: or Client#: to denote where the print was actually triggered.
Is this about ownership or smth? Since I have 2 instance in the client, it is printing for both or idk
Hmm, thank you!
I was very confused for a moment why my other client can see the print! ๐ Was going to remove all my knowledge about RPC's and check them all again
Its all synced now, I did it with multicasting, but dont worry, i already understood what are the "caveats" of MC's. So i will go on try RepNotify now. <3,
Hmm, when i try to print text while playing with second client (not host), where was no prints. I think its only printed on server side like you said if no replication
Which probably means you're not reaching the server.
For in best practise, lets assume i am changing color of the stone, which i want to be persistent, i will go for "RepNotify". But what type of variable i should create for that? Bool? So that i can test like, changedColor or smth, or directly state of itself, what guideline i should follow for cases like that?
In Unity, NetworkVariable<bool> isColorChanged, would return "bool newValue" as return,
like
isColorChanged.OnValueChanged += () => (x) SetColor(x);
But as i understood in OnRep_ChangedColor, it doesnt return any new value or smth. Can i just use my variable ChangedColor to get updated version of it?
So something like that.
Another test i made is, This Event Interact is called on Run On Server, So i tried to scale it down a bit on the server. If i do that inside host, it works. But if I do that on client, I waited a result that it would "scale" on the "host" since it is executed on the server, but neither on host or client had the change of scale.
The state you wish to replicate. The actual value of it.
If you only have 2 colors that are predefined, then the boolean would be fine.
If the color can be "whatever", then it should be the color itself.
Yeah, the Variable that is linked to the OnRep has your value.
Aha, gotcha.
In C++ you can add the old value as a param to the OnRep
This seems like not working on the client. If I interact on the host, it will be replicated to host and client, but if i interact on the client, its not changing the color neither on both.
ActorScale might be replicated by default. Like internally. Not sure what you mean with "do that on client".
Then your Interact stuff has a problem.
Make sure to put some print strings up
What is "GetInteractable"? How does the Server get that?
Does that even return a valid value when you do this via the Client with a ServerRPC?
And the ClientRPC at the end is kinda redundant. Whatever you are doing there could just be done locally before/after the ServerRPC.
GetInteractable is a method that returns last element of my "Interactables in Range", I set it inside Overlap on the client
I thought that would cause an issue. But i can see why it might not work like you said. We are sending the event to server, but server not be knowing Get Active Interactable?
Please start debugging this a bit with PrintStrings.
Eh
That SwitchHasAuthority is wrong.
This will block the Client from ever calling the RPC.
Authority of a replicated Actor spawned on the Server is the Server.
Everyone else will be Remote.
Just remove that for now.
Try to place some Print Strings throughout your code, and see what calls when and where.
That can go a long way in understanding and solving problems like this.
Breakpoints also help.
Yeah anyway, that was one of the issues. I will do that. From what i understand, second client is calling Server Interact,
And server is calling "Get Active Interactable""'s Interact method. But server might not have access GetInteractable, right (i dont get any index error etc. anyway..)? Because we set it locally in the second client. But who is the Server in our instance in that case? The other character that is replicated? Ahhhhhhhhhhhhhhhhhhhh. ๐
Im almost there.
I thought it would check GetInteractable of "sending clients" here. not the server one
After the ServerRPC you are on the Server.
It's the memory of the Server. It has no access to the Client.
Maybe i should send interactable with event, and it can execute by that.
That is one option, but then you allow cheating.
Cause then you can pass any interactable as a client
Where are you filling that array?
Then how would i react to that client's interactable, and i dont want to really send a huge data like that. (not sure its huge. :D)
It's not huge.
UObject pointers (or AActor here) are send as NetGUIDs.
Then split that logic a bit. Run the AddUnique in general and limit the EnableWidget stuff only on LocallyControlled.
Thats good to know! I will go on a binge! ๐
Hmm, so that server would also know that client has interactables, right?
When you meant in general, in Server?
Both will fill the Array then.
Why? Is this because character is already replicated? Because my array is not replicated. Ah, man thank you very much for your patience. I read your documentation today on the underground metro on 2 times, but i still have issues. ๐ฆ
Remember the Square image I drew?
Anyway, going to log this to see whats going on! I have disaster scenearios. ๐
Yes, was going there actually. ๐
The blue circle is the replicated pawn. And the gray triangle your interactable.
The blue circle will move inside all 2-3 Squares (Worlds), cause it's movement is already replicated via the CharacterMovementComponent.
Well, not really for a Pawn, but for a Character at least.
So if the Client walks into the overlap range of the Stone, so will the Server's version of the Client's Pawn.
So both trigger the Overlap on their end for the Pawn of that Client.
And both will fill the Array.
Is Server version of the Client's Pawn exist in the world?
I cant seem to understand Server version of the client pawn, "imagining it" as like the second character in my game which i do NOT OWN.
Assuming the Blue Circle is the pawn of Client 1, your "IsLocallyControlled" causes this:
For example, this is my client pawn, Where does the Server version of it?
In a duplicate world. It's easier to imagine it if you would run the game on 2 different PCs.
Hmm, so you mean Remote side?
Thats much more clear.
So you play with 2 players here, ListenServer and 1 Client.
The screenshot is of the Client. The center is the Character of the Client.
The right one is the Character of the Server, on the Client's PC.
If you run the game twice on the same PC, then it's still 2 different game processes, with 2 different sections of memory.
Yes, I started to understand now. What i dont make sense to me is, when my "Character of the Client" is overlapping, and adding things to list,
How the "Server version of my client" knows i added to the list? Since i didnt replicate or send RPC?
Thats what that doesnt click for me. I feel like I do it for local-single by adding to list after overlapping, But how server version of it also fills the list
Am I missing something like I need to replicate my Array or smth?
Hm, can you picture yourself in your own room right now.
And then imagine that exact room, with you, exists a second time.
And all your movements are mirrored between the two rooms.
If you would pick up an apple in that room, it would be picked up in the other one too. Without having to manually sync your pocket having that apple.
No, the Array doesn't need to be replicated for this.
That's because the Movement of the Character is replicated.
The Client running forward will make the Puppet of the Character on the Server's Game also run forward.
They will both run into their version of the Stone, triggering the overlap.
So when you say movement of the character, you also mean "Overlap"?
No, that's a by-product. I literally mean you holding forward.
If you put both windows, Server and Client, next to each other, and you walk against the Stone on the Client, you see the Server's Version of the Client's Pawn also run into the Stone, right?
Hmm, for a second I thought I am using IS Locally Controlled, just because not to add to the other character in my world.
For example, when I move to that stone and pick it up, if i dont check Is Locally Controlled, that would also cause an issue of adding to the other character in my world (local).
For example in Unity, If i give input to my character, and dont check for IsOwner, it would move both character. Since its both instance in my local.
No, that's the wrong thought
I mean
Actually it's not
It's the correct thought
But you are thus also stopping the Server from keeping track of the Stone
I might be confusing you more with this Answer.
So let me rephrase.
If the left one walks into the stone, no matter if you use IsLocallyControlled or not, it won't add the Stone to the right one.
IsLocallyControlled makes sure that, if you watch the other Player run into the Stone, it won't be added to their Pawn on your Game.
Because of the Overlap Event, But if add some events like "E" key, it would both work but in local. Its like setting Random position with Keyboard Input, It would both work on them, but since its local, it would be randomized in both, which is wrong positioning.
No, you are only binding on the local Pawn.
Thanks man, I am full-time gem dev working in Unity, and learning multiplayer in my free times at evenings, trying to accomplish my dream game..
hmm, if its binding, right. I got it.
I meant smth. like, Think an enemy spawner. It can both work on local, it can spawn at the same time, but if its setting random positioning, it would cause an issue that both client see different positioning on enemies "if its not replicated".
On top of that, the CharacterMovementcomponent won't even let you move the other char.
That is true.
Because the Random value will be different on each.
SO, In Character blueprint, IF I make some changes in LOCAL, are there any chance it affects the other CHARACTER on my local?
Hmm, thats what differ from Unity for me, alright.
Suggestion from someone who used Unity 15 years ago before going to UE: Forget about Unity. Stop comparing them.
OK. One last question, and i want to validate it; So in here, I add **Interactables **by checking Is Locally Controlled, IF I dont check like that, It will also add that to Server version of the PAWN, but I cant really seem to visualize who is the SERVER version of the pawn, you mean "MY PAWN" in the Server's Instance? Even though I dont replicate it, Can server still know I added that? Is that because Movement Component is "REPLICATED" and its "ADDING IT LOCALLY" in server VERSION?
OMG I understood now!!!
Something along thos lines, y.es
The "Server Version of Pawn" is more or less literally the other Pawn you see running around in the Server's Window.
On Begin Overlap WORKS Both on Server and CLIENT! For example, if there was a lag, or if my character's speed is 300 in Server, and 500 in client, Even though my client is arrived and added to that list, server would add that "when arrived in his version of it.""
Well its not possible to do that but anyway I understand what you meant.
Yeah, in theory at least. Different Movement Speeds would cause Corrections, but yes.
If your Movement wouldn't be replicated, and you moving locally would not move the Puppet on the Server, then walking into the Stone would also only add it locally.
In left client, I moved to that, and begin overlap.. It added locally in the client.
In right client, the second PAWN in server instance moved that stone, and ADDED its own version of it's list.
So For example, If THAT STONE wasnt exist in server somehow, (lets assume it)
It would still add in client's version, but not in SERVER!!
OMG I'm illuminated now that what you meant actually "SERVER VERSION of the pawn".
You meant my PAWN that exist in the SERVER's instance.
SO By meaning of this, WHEN I call ServerRPC from client, ITS WORKING in the SERVER VERSION OF MY PAWN.. "NOT THE OWNER'S CHARACTER PAWN".
RPC WILL be called on that PAWN in the SERVER INSTANCE..
OH SHIT MAN. This is game changer.
And it made "Click".
So If i spawn a stone in CLIENT in our forward. AND MOVE there, it would add it to CLIENT's list.
But in SERVER, since there is no STONE there, it wont add "ITS OWN VERSION OF THE PAWN".
On another note. My spacebar doesn't work anymore. I'm ctrl+v whitespaces atm... MONDAY.
Thats causing SERVER's PAWN instance interactable list's empty.
MAN, this will be really really game changer for me and going to change HOW I think about it.
Yop, or in your actual case, you are limiting it to IsLocallyControlled.
Which is called on Server and Client Instance of that Pawn, and will return true only for the actual Owner. So for the Client in the Client Pawn.
It returns false in the Client Pawn on the Server Instance.
That's why it was empty.
Lets overengineer it and lets write a python script that, if your key hit interval is higher than 0.2, it automatically adds space.
Removing the IsLocallyControlled ensure that Server also adds it.
You do gotta leave the IsLocallyControlled for the Widget stuff though.
MAN, I literally understand %100 of it. THAN YOU. Now its time to understand switch Authority.
Cuase you don't want the Server to open a Widget when the Client's pawn steps into the Stone :D
SwitchHasAuthority is as a stupid one. It works based on the "NetRole" of the Actor.
And that has some special rules.
For most Replicated Actors, the Role on the Server will return AUTHORITY and on the Clients it will return SIMULATED PROXY.
Yes, Thats game changer. Thats why i added ISLocallyController actually. ๐ Everytime client moves to stone, it shows up on both. And THATS why i thought "ITS about" ownership.. IT was actually other PAWN was spawning the widget on the screen in MY SERVER..
For Pawns that are possessed, it will return AUTHORITY on the Server, AUTONOMOUS PROXY on the owning Client, and SIMULATED PROXY on the other Clients.
That's why, when you look at another player in your game, you'd call thos SimulatedProxies.
Cause you are.. simulating them.
Are there any use cases or examples you can provide? Man I wont forget your help. I am so f.. excited.
So SwitchHasAuthority passes the Top Pin for AUTHORITY role and the bottom pin for any other.
Most people use SwitchHasAuthority to simply split between Server and Client logic.
I couldnt find many examples in your docs, OR I remember wrong. Going to check your docs now!
I don't think i have a lot of examples there about it.
Can we simply say its a bool that "IsServer" XD
No. That's the confusing part.
If you spawn an Actor locally, its role will be AUTHORITY.
Anyway never mind man, I already got illuminated, and wont be trying to understand that. Dont waste your time for me. ๐
If you want to 100% only call something on the Server, you use the "IsServer" node.
I got so boosted that now i will enable GAS plugin in my game (hello adhd)
It's very rare that someone spawns an Actor locally on a Client and runs code through SwitchHasAuthority. In 99.9% of cases, people use SwitchHasAuthority in a replicated Actor that got spawned by the Server (e.g. your Pawn).
And there, yes, you could call it IsServer.
GAS Plugin is pretty complex. :D Maybe wait a tiny bit still.
Get your Interaction stuff working first, so that the ServerRPC changes the Color.
Yeah yeah, i am joking. Actually I almost finished the GAS course half of it 6 months ago. And i can really understand WHAT IS DOREPLIFETIME macro.. ๐
And then try to read up on the Game Framework classes agian, understand what GameState, PlayerState et.c is for.
Dude BTW, those are super helpful. Do you recommend creating my OWN frameworks for my game in C++?
Yeaah, C++ needs some extra steps when doing things, like the checkbox in BPs is a bit more in C++.
You should, for Multiplayer especially, stick to using the available Framework Classes.
You can create whatever Actors etc. you need beyond that.
I will exercise RPC's etc in blueprint, then going to move forward on C++ because i really have hard time convrting my blueprints to C++. Especially today when i couldnt manage simple task. ๐
But I would suggest not replacing the ones that exist.
They are deeply tied into the Engine.
Then i will create my own SurvivalGameState, SurvivalPlayerState etc.
Doesn't go for ALL of them, but for beginners, it's best to just use what is there for now.
Just in case.
I actually used that framework in some of my Unity projects. ๐
BaseGameState -> MainMenuGameState
BaseGameState -> GameplayGameState
GameplayGameState -> SurvivalGameState
You are doing yourself a favor building up inheritance chains, to have reusable code that you can override in child classes.
Until now, I was really ignoring GameState, GameMode etc. I was even swearing Why the f. i have "score" etc. But i can understand now why.
Yeah, that's cause UE has a lot of First Person Shooter logic from Unreal Tournament days.
But you gotta just ignore those variables and functions for now.
Hi everyone! I made simple RTS-like movement to control everything from the server, so "move to" command comes from client with location info and server call Move To Location, if it's just one click - everything is fine, but when I tried to make some "hold mouse button to follow cursor" and just resend info with 0.1 period - client side start jittering. I play a little-bit with replication options on my character class but nothing helped. Maybe somebody could tell me in which way I need to go to fix that issue?
(I disable animations so effect is more notable)
exAres trying to find a point where they can finally ask
These game frameworks are really good for inheriting, I love Composition over Inheritance but its not valid at that point.
You can do some composition via Components fwiw
And later on via UObjects, but that is bit more advanced,.
Yes, built my Interaction system whole on Component, so that i can simply add the component and boom, my character can interact others, no other one.
But i couldnt understand how its replicated though. It can use ServerRPC's etc. and Replicate Component is not "ticked".
Problem is that if you aren't using the Character Movement Component and you aren't using its prediction logic to move the Character, you won't have smooth movement.
I think it would need to be marked as replicated to allow ServerRPC, but maybe I'm misremembering. It follows the same idea that, since the Component is part of the Pawn, if the Pawn exists on the other Instance, so does the Component.
There is some more advanced logic going on about what can communicate and be communicated over the net.
But I don't want to overload you with that info.
Now its time to combine Blueprint and C++ together. My ADHD is not allowing me though. I am in a deep thought that, once C++ whole c++, once blueprint, whole blueprint.. I think thats because of my less experience.
You can, fwiw, send a Component of a replicated Actor through an RPC and the other side knows how to resolve it. Even if it's not replicated (the Component).
That's cause it'll be resolved through the replicated Actor, since both Instances in theory would need to have the Component.
Yeah you mix them actually. Core logic in C++, more defined things, and setups (like positioning Component, setting default values, etc.) in BPs.
GAS does a lot of stuff in Abilities via Blueprints too
It's not black and white, it's mostly about performance in the end. Just do what you want for now.
Well and for Multiplayer it's about having access to roughly 80% of the stuff that otherwise is not existing in BPs lol
I have also Perfectionism, and thats really slowing me down. For example, I removed my whole inventory system in blueprint, and started to write in C++. ๐ I didnt even try to replicate it in Blueprint.
Yes, I actually experienced that in LYRA framework while doing a case for a company.
Hmm.. I'm using CMC, just not using inputs from client, so client lag could lead to some delay, and client will see things later, but why jittering?(especially when everything is on one machine) It's the same as client just watch and do nothing
This will be a career changer man. This node is where everything start for me, A WHOLE another world. ๐ I can really understand Server & Client relationship now in basics.
If you aren't using the AddMovementInput locally for a POSSESSED Character, you won't have smooth prediction.
I don't use AddMovementInput , I am using Move To Location Or Actor on the server, client just send location
And the Character is possessed by what?
I want to be in a position that I understand why C++ is much better in Multiplayer, but for now, it would be enough for me. Also read a documentation from Wizard etc. smth like that, talking about Replication Graph and NetSerialize etc.
But i am not in a position for now to decide. ๐
Yeah no, that's a few weeks away.
By AI, no pure control from client
Stick to learning the basics first.
who tried mover here ?
Then you get jittering and corrections.
cedric you did iirc ?
I think I have to leave. I'm suddenly feeling very ill.
go rest
Something fishy.
:(
What do you want to know about M๐คฎver
Thanks man, I wont be in hesitate. Just going to replicate. I dont really have complex stuff, Just interacting without anims, adding to inventory etc.
how fine is the physic based movement in SP
because im about to convert my BP prototype to c++
I have no clue. I only used the non-physics, FixedTick version of it in Multiplayer.
okay
And I still can't recommend using that over CMC.
Especially if you are doing Singleplayer.
ill go back to my solution then x)
Anyway, Cedric-sama, thank you very much for your time and its really really game-changer for me. You really made my way much clearer.
No worries.
Replication SUCCEED!
I didn't get "why", if it's just from server, no corrections needed) But thx very much, go and rest)
The "feeling ill" was a joke cause I didn't want to deal with Mover.
The CMC is set up for Client Predicted Movement through the AddMovementInput call, as well as calls like Jump and Crouch.
Those are send, internally in the CMC, as ServerRPCs.
The whole CMC works differently based on who is running the code.
The smoothest is when the AutonomousProxy uses it to predict.
I really heard "custom movement" is a really headache on multiplayer
If you use an AiController, then the local player is just a SimulatedProxy.
GASP already published a replicated version of it in 5.5. Do you think its worth using it?
And that one can't predict and only gets the transform replicated back and smoothed.
Why it's jitterting that crazy? Not sure, probably cause you aren't sending the info every frame, but only every 0.1 seconds.
As in client & server with 0 ping, it looks great but.. ๐
No clue, I barely use third party solutions.
Hmm, does Unreal Engine's Game Animation Sample count as third party? 
@midnight torrent Try either sending it more often (every frame, with an Unreliable RPC), or fwiw less often?
Anyway, i gotta go. Have a good day sir!
You will always have a delay of course, since the RPC + the replication back is what the Client has to wait for the movement to have an effect.
In theory, yes, but there I'm a bit more trusting. :D
Although my adventures with MotionMatching and Mover the last weeks have been semi fun.
Anyway, i will stick into TPS character for now. ๐
It's trembling and become some jittering chaos) I'm start thinking that the problem is inside Move To Location Or Actor, but need to make clear project to check it.
I can now understand a potential bug can exist on future, If there are many "Interactables" in ground, there is a slight chance that in Client's list last element & Server's version of it's can have different last elements, causing wrong item to be interacted.
If the sync latency or ping can happen,
Correct. There are a lot of ways to fix that. But it can get complex quickly
To validate %100, maybe i can send interactable paremeter with RPC, and call its interact method
I dont care about cheating in my CO op survival. ๐
The simplest solution is to use SwitchHasAuthority on overlap and marking the array as replicated. Then only the pawns instances on the server fills the array and it replicates back
Hmm, sounds like a good idea as simplest.
Adds a slight delay but that wouldn't be too drastic in this case cause the client won't know how close it really is to the object anyway
So that only SERVER version will handle array, going to replicate it to "MY CLIENT" ACTUALLY.
And if you want to react to the array changing to show UI, you mark it as RepNotify again and limit to IsLocallyControlled in the OnRep
Yop
Fastest simplest trash way? Can I just send Interactable as parameter, and call directly on Server version of it?
To have seamless and fast reactions.
As i said, i wont be caring about cheating in CO-OP game, and i would be happy if they cheat if my game grows up that much. ๐
Then yes, you can trust the client and pass it to the sevrer
Then you can also keep the array only filled locally
Look at you, actually understanding this shit now.
Well, thanks to you Mr. GOD MULTIPLAYER DEVELOPER
I cant wait to get my hands dirty on the weekend. Now i will watch tutorials much better. (not the shitty ones that MC everywhere.)
Bis spรคter
It's good to watch a bunch of them anyway and question everything they do.
Yes, Actually like KEKDot for now because of explanation of things.
see you sir
Did you watch the video that is in the resources of my docs?
That explains the basics too
I didnt reach there actually, But are you talking about the guy who explains framework then stuffs?
An overview of the essential concepts for writing multiplayer game code in Unreal, in under 25
minutes or your money back.
Sample project: https://github.com/awforsythe/Repsi/
Patreon: https://patreon.com/alexforsythe
Twitter: https://twitter.com/alexforsythe
00:00 - Introduction
01:24 - Net Mode
03:33 - Replication System Basics
05:13 - Acto...
Yus
Yesterday I watched that, I was a bit overwhelmed for me. But now I can watch this peacefully. Still confusing parts though, it will be different.
Any tips or workarounds on implementing a character controlled by multiple players? Think mario party co op minigame. For example, feeding the addinput function an average of each player's replicated input direction.
Can't give technical info but just from thinking about it for a second even as a dummy, that's a LAN game right? Sounds like something that would rely heavily on it being a LAN setup, if you tried to do this for a game connecting people with ping it would either be unworkable or very very complicated
Can I somehow compensate speed of clients pawns ? They feel much slower than server ones
I would implement that as an AI controlled character being fed data from everyone
is it even possible to achieve the multiplayer performance of Ark / Fortnite / etc's player buildable objects with blueprint?
cant seem to figure out a setting that isnt hugely heavy on the network when at 10,000+ player build objects that replicate
Hi all, it's been a long time since I've dealt with replication and I think I'm a bit lost, I'm doing an inventory with a grid and I'm using a TMap of FVector and bool to check if a cell of the grid is occupied or not. I know that TMap doesn't support replication and I only want to do these calculations on client because I don't want the server to have all these calculations. The thing is that I was interacting with the inventory system of the Lyra project and it turns out that when I update the TMap to add an object from code everything goes fine, but if I want to make any change from the inventory widget then it does not enter the execution, I have put break points and nothing, but this is funny because I have put logs, and the logs are printed, so there must be some discrepancy that I'm not considering. The method where I update the TMap when I add a variable is BlueprintCallable and when I call it, it doesn't update and it doesn't enter the breakpoint or anything. I'm a bit lost, I don't know if anyone has any idea about this.
No
thats kind of what i am experiencing lol
i know that Fortnite and Ark both basically went entirely C++ after their initial launches
Why would you make that assumption?
Generally speaking, you will want to do core implementation details in C++, with BP extending that.
not assuming, info from tech chats / unreal fest / etc
Suggesting its entirely C++ is an over simplification of what probably happened.
There is nothing wrong with prototyping in BP, to prove out of a feature or idea.
definitely an over simplication - but migrating a lot of the heavier aspects of the games to C++ is how a lot of performance was brought back
Then rewriting in C++ with BP supporting the designer friendly elements.
Thats how you should have said it to start with, would be more accurate.
ARK was terrible for perf for like the longest time.
indeed lol
Anyway, back to your initial question.
The main reason is that you have so much more opportunities for optimization in C++ than in BP
Especially in Multiplayer.
There is just a lot of important things you cannot do in BP.
anything specific you can share easily?
its definitely looking like ill need to migrate the player built objects to C++ instead of being BP actors for sure
Fast Arrays, Push Model Replication, better async support... all types of things.
BP doesn't support push model even with Iris?
It kinda does, but also doesnt AFAIK.
Push Model is opt in per property.
So unless BP now supports it natively out of the box, I dont know how they would be managing it.
yeah i dont see anything that would change it to being opted in at the moment in bp
If you are making a serious game, you just dont do Multiplayer in BP.
End of story basically.
so if you already made an entire game in bp exclusively, and then start having multiplayer performance problems at higher clips (like 10,000 player built objects for example), the answer is to redo a lot of stuff in C++?
even using the latest engine version, Iris, etc
Pretty much
thats a bummer
especially with how many assets on Fab / marketplace advertise as being ready for a big multiplayer game
Just converting it into C++ isnt going to change much. But you need to redesign that particular feature to take advanatage of different optimization techniques.
There would be very very very few that actually live to that.
I'd put money on that answer being zero of them, lol. From experience.
most of them are also probably made in c++ and just exposed to bp
Im giving the benefit of the doubt ๐
Very few assets on the marketplace are even remotely ready for large scale multiplayer. They work to prototype a game / idea, but if you try and push them to scale - they just flat don't work. Most of them will even tell you that if you ask, but that info isn't on the marketplace for obvious reasons.
Most of the C++ assets Ive seen are dog shit to though
I would wager a guess that the reason thats the case is 99% of people that could make systems for large scale games are working their asses off doing just that at companies paying more than the Marketplace would ever make them.
And I say that because thats the reason I dont do MP stuff either lol
Its just not worth it.
After working at this for years now, I honestly think a lot of the marketplace stuff is kind of giving people false hope that they can make a game like Ark or Fortnite using BP / without knowing how to code stuff themselves, and it just isn't true. Straight up. I've learned this the hard way* after shipping a game made in BP and trying to scale it.
Its just catering to a demand.
People think they want to make a game, they go searching for how to do that. They buy stuff that thinks will help them... Simple as that.
Its not like the Marketplace was the reason there is a huge demand for that now.
That demand existed before. It just wasnt being served.
Do you think that demand is kind of misleading though? "Making a game" vs "making a prototype that can't scale in the way you make it"
thats most prototypes tbh
Sure you could look at it that way, but whose fault is that really?
The person that didnt do their research first?
Or the Marketplace.
I think the argument could be made for both.
Can you really blame the Marketplace for someone wanting to explore an interest.
marketplace assets are great as long as you arent trying to make a AAAA open world MMO rougelike blockchain AI enhanced live service game
for their target audience they are fine
When an asset on the marketplace is advertised as "large scale multiplayer," "multiplayer ready," etc with no fine print, when it isn't true at all? Meh.
Its not feasible to judge that though, because a lot of the times its a skill issue as well.
I had a recent example of this with an interactable foliage plugin that was advertised as multiplayer ready for "massive worlds" including world tiling etc. and in practice - it can only support 150 "harvested" objects in multiplayer before it no longer works haha
That entirely depends on how you as an individual want to use it, and also what you define as "masssive"
Im just playing devils advocate here. I think most of the MP stuff is garbage.
It can be depending on the asset for sure. Obviously it's possible to take an asset and fuck up the implementation and every breaks.
Most of the assets on the marketplace don't work out of the box at scale, I don't see that as a skill problem.
I agree with this 100%.
I also don't mind playing devils advocate for the sake of game dev chat lol
Its like complaining that UE itself is bad at making certain types of games.
While that is true
i think if someone is trying to make a large scale game and buys assets off the marketplace and kludges them together, they are going to be disappointed.
i see SO MANY NEW PEOPLE who come here having never even run the editor wanting to make the next multiplayer skyrim.
That doesnt mean you cant.
People think making games is easy, thats the real crime IMO.
making a game is genuinely, not as hard as a lot of people make it out to be. its just as complex and as hard as you make it.
want to make a flappy bird game? you can do it in like 2 days.
want to make a multiplayer shooter that doesnt feel like ass? much much more difficult...
this is a huge bummer
Yeah, which is why I try and advise people to start small, instead of trying to make the next Call of Duty.
Im talking about from someone who has never made a game before.
A professional could crank out flappy birds real quick.
Someone who has no idea what an Editor even is, wouldnt.
Yeah, the rose colored glasses come off pretty harshly.
so without C++ a multiplayer game like Ark is just out of the question?
like ark ๐
You could do ARK in BP with plugins and stuff, but its not going to be great.
Probably worse than ARK was.
ARK isnt a small game though dude.
Yeah forgot about 100 players.
No chance you will get that in BP
Be lucky to manage 20
im having issues with 5 players after they build a shitload of stuff, not trying to hit 100 players haha
There you go
does even the dedicated server struggle?
after players have built thousands of objects it is pretty brutal
This is one of those forks in the road, where you either give up, or decide to grit your teeth and bear the heart ache of pushing forward and learning something new to get better to reach your goal.
Giving up is easy.
Learning something new is hard
And will take a lot of time
And effort.
But the rewards will stay with you forever
tbh, if you know how bp works at all and can makes things in it, the logic is the same in c++. just literally a different language.
That makes no sense lol
depends on where the poor performance comes from
"How do I get C++, without C++"
Take the plunge man, go and learn something new, you might find you like it more than you thought.
Really the only way is to make functions in C++ that you can call from blueprint.
You don't have to rewrite entire systems in C++
You can just convert the expensive functions and call from bp if you prefer
It won't be 100% of C++'s performance but will still be very close
IMO just converting something to c++ isnt going to meaningfully improve performance as the bad performance is probably stemming from a single source
im sure my functions arent perfect but my main issue seems to be the same with players building a lot of shit making the performance tank eventually
FPS or multiplayer / network performance??
both lol
did you confirm if its actually lag related to multiplayer or just because you have a ton of graphics?
i would be shocked if 1000 dormant actors is causing network issues
are they doing anything with the network after they're created?
You can scale the relevancy and net update settings down
do you need to replicate max health and the static mesh?
set them as dormant
If they don't do anything on the network and are pre-placed, you don't need to have them set to replicate at all
i have no idea how iris works compared to normal unreal
in my mind, i cannot understand why 10000 actors would cause performance issues (on the server) if they arent ticking and are dormant
At this point I would also recommend that you actually do some Profiling.
^^^^^^^^^
Find out exactly what is the bottleneck.
Address that issue as best you can.
Then profile again.
Address whatever becomes the new bottleneck.
Etc etc
Then go touch
Can still profile in a listen server, stuff that's causing network problems in a dedicated server will also do so in a listen server as well
Just a random guess, the server still has to check if those 10000 actors had any changes to their replicated properties that would remove them from their dormant state.
i dont think dormant actors check replicated properties
for health on player built objects, would repnotify be any better than replicated? when using Iris
You're probably right ๐
performance would be the same (or worse)
It would likely be worse, since it incurs another function call.
dont use an rpc for that
Why not? What's the alternative to that?
normal replicated properties
Health is stateful, RPCs are not.
^
RepNotify does the same thing as a replicated variable but also does a function call on top of it, more expensive
i think any more discussion on performance is entirely pointless until you profile your game
This
if your objects are dormant, those 10000 actors arent doing anything bad for performance on the server
i thought replicated variables kept updating and repnotify only updated when needed?
no
That's old info as far as I'm aware
i dont think that was ever true
replicated variables also only update when changed
They even only send deltas instead of whole values (when applicable)
is there a way to check if they are actually dormant? my current setup they dont despawn after leaving the range that they spawned in originally
The whole 10k Player Built Actor thing could easily be solved inside of 1 replicated Actor BTH.
do network managers work with individual relevancy on actors?
Yeah just make a manager actor for buildings
i never understood how they handled that
No, relevancy for a manager like that isnt really a thing.
that sounds like relevancy
Depends how you architect it
You could have a manager per chunk
Which is then affected by relevancy
thats what i figured
On the topic of network managers, anyone have any thoughts on how to architect a manager that can just replicate "tagged" variables? The true data exists within subsystems, although I'd be open to going to components on GameState.
What do you mean exactly?
So right now my system is architected like this, using subsystems
MasterSubsystem (thing that has the tick)
DeviceSubsystemA
TArray<FDeviceModelA> DevicesA
DeviceSubsystemB
TArray<FDeviceModelB> DevicesB
DeviceSubsystemC
TArray<FDeviceModelC> DevicesC
And say FDeviceModelA looks like:
float F
float G //I want this single property to be authoritatively synced
float H
It's a big sim, and I only want certain values to be synced authoritatively, all other values can update independently on all machines
just mark float G as replicated?
Just mark it as NotReplicated?
If its inside a USTRUCT
Alternatively, if you override NetSerialize for that Struct you can literally just not serialize the other properties
I'll have to think about that, right now not everyone has the entire background sim going, they only have the portions that relate to their relevent nearby actors.
Unless I just toss relevency and have everyone run everything
is insights the best tool to profile networking stuff?
I would say so, yes.
I think I'll see about maybe just doing the replication through each "avatar" actor. The entire sim runs in the background, but there are actors that represent sim state.
Say I had the simplest vehicle with 4 wheels, an engine, a gearbox, and a cockpit. That'd be 7 replicated actors which locally instantiate models in the sim when they begin play. I don't care about intermediate sim values being synced as long as the final end results are.
So, in this case, I'd replicate the movement of the actors, the cockpit input state (where your controls actually go in to the sim), and the one replicated sim state value would be the gearboxe int CurrentGear, because it's discrete, not continuous. Although the server and clientside sim will both change Gearbox.CurrentGear when it detects GearChangeSignal transition from < 1.0 to >= 1.0, the serverside version will also change that for the client in OnRep. That'll handle the cases for sim divergence. This approach would also move the responsibility for networking from the sim side to the actors side, leaving it open to designers.
hey boys
So I have this game which I want to run local standalone instances of, I've got it running and working BUT, when all windows are deselected GPU recources are split and everything runs at 30fps, however, when I focus a single instance, the fps & gpu usage drops on the other ones ( to 1-3fps) . How do I combat that? Is that nVidia setting or something in editor?
I have "run under one process" disabled in PIE settings
checking off ''use less cpu while in bacgkround'' in the editor settings may help
That is done as well
I remember there was setttings for mouse focus & auto steal but I cant find em right now
will see and hope that this helps -=
nope, its still picking favorites
why are so many things I do with multiplayer so inconsistent no matter what? like right now Im working on a simple explosion actor, very simple script, replicated it and it just... works most of the time. like enemies take damage but dont always get pushed by the radial force/launch character, and I just dont get how things can be so inconsistent when its so simple
things like this I cant see any other way to do it so I cant even imagine how to fix it
show code
Show what triggers an explosion and what it do
It's not that multiplayer is inconsistent, there's just many stuff to take into consideration like latency, relevancy, ownership etc.
It depends on your implementation
yeah I guess if anything the problem is within the enemies since they got so much going on
always lots of little things
also though I cant seem to get a sound working no matter where I put it, begin play, server event etc the sound just does not play in multiplayer despite every other sound effect working just fine, idk if this is anything anyone can even help with but
I often post my problems and then realise no one else would really be able to help because the project is about a year and a half in and everything I do now will be working with so many other things which is kinda impossible to explain it all to anyone else
Can't even begin to help without seeing the code
it's probably something simple
just show the causal path between BitThatTriggersTheExplosion and the end result
Alright, so, limiting the max fps cheats around the issue .
but it feels like a cheat, not the proper way to do it
well thats why Im saying theres so much else going on that I would have to show like 10 screenshots of every different part and then it still might not even be the right part
and this explosion thing was only one example, most of my problems seem to be related to physics (no surprise there) like sometimes when the enemy ragdolls, their mesh was teleporting to 0,0,0 but if I simply add a small delay it fixes it
and I can have a script where everything in it works but a sound effect within that script just doesnt
same with radial force
sound really is just simple as
spawns actor just fine, but no sound at all
like how does that make any sense
The majority of objects don't have any replication. The things that usually have any replication are Actors and Actor Components, but even with them not everything about them will be replicated for you.
of course, but in this specific case I cant replicate a sound with server event or even multicast (multicast has fixed some things even in non player actors which I dont understand at all since I thought they only needed server events)
Server Events are a means of allowing clients to call that event to have the server do something. If the actor isn't owned by a client, then they won't act any differently as clients won't be able to call them, however, the server itself can still execute said events.
Assuming this is a cannonball actor, and assuming it is a replicated actor, it's unlikely to be client owned. The server should be the one doing any logic relating to the cannonball anyway, as you probably wouldn't want a client to prematurely allow their cannonballs to explode by letting them tell the server to explode it.
If the "Explosion" actor is a replicated actor, then you could technically just attach a sound component to it that would play the sound automatically when the actor spawns on any clients.
If you still want to use a multicast to play the sound at this point in time, you can, just don't immediately use the "DestroyActor" node as that can potentially cause the multicast to fail to be received before removed on clients. To cirumvent this, you can use the "Set Lifetime" node instead and delay it by a certain amount of seconds, after which the actor will destroy itself.
ooh right, in this case these cannonballs are fired from the player so I can set them as their owners. although I think I already did that...
and I did also try just playing the sound on begin play and even then it didnt work which I really dont get
ah, sound component works though
so whats the difference between sound component and just spawning the sound in this case? I wouldnt have thought it would make a difference
especially since the cannonballs already play a sound when bouncing off walls and those work fine too
Pretty sure spawn sound at location attaches a sound component to this actor, and since you're immediately destroying it, the sound component goes with it.
makes sense but then Id expect it not to work in singleplayer as well
and spawning it on the explosions begin play doesnt work, but playing the audio component does
also on the subject, if I had another actor that also spawned this explosion actor but used a different sound, I would want to change the sound after spawning it, but since its on begin play it most likely would change after playing the sound, same thing goes for any variables changed like this, whats the best way to do that?
and I still dont see why radial force wouldnt work
Hey all. I have a listen-server setup and am using the Character Movement Component. When emulating, clients see the server and all other client animations play just fine. The server however, sees the clients' animations play at a much slower rate. If I override the Character's OnPossess function to set bOnlyAllowAutonomousTickPose to false, the animations play way too fast at a higher FPS. How can I achieve smooth client animations on the server?
The Animation, and the Pose, are ticked by the ServerRPC of the CMC. That's done to ensure that the Animation events are more in sync.
Traditional solution was to do what you are doing, but then you gotta remove the parts where the CMC ticks the Pose.
That was usually just one place, but I think that has changed, so no clue anymore.
I do remember people usually telling me that this is solvable differently. Potentially just through changing some of the smoothing variables? Not sure.
void AAGCharacterBase::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
GetMesh()->bOnlyAllowAutonomousTickPose = false;
}
Also below I have this run on Character's Tick.
if (auto* mesh = GetMesh())
{
if (mesh
&& IsReplicatingMovement()
&& (GetRemoteRole() == ROLE_AutonomousProxy && GetNetConnection() != nullptr))
{
if (HasAnyRootMotion())
mesh->bOnlyAllowAutonomousTickPose = true;
else
mesh->bOnlyAllowAutonomousTickPose = false;
}
}
@elfin plover this is what I do and I haven't encounter issue YET. Another approach is just using dedicated server I guess.
I solved problem with faster actor
, i was moving actor twice on server, so server player was faster not others slower
RPC are replication independet?
I disabled replicaiton and rpc still goes to server ๐ค interesting
Is it a component that you disabled the replication from?
Components should just being registered as subobjects to their owning actors and using their net connection, so they might be able to work as replicated even though their replicated bool is not set to true. I'm telling all this from a very old conversation I had in here though, I might not be remembering it correctly or misunderstood the concept. So take this with a grain of suspicion (and I would be happy to be corrected)
I have no idea to spit if it's an actor though. But no, RPCs should be dependent of replication or a channel at least
no, just in CDO for pawn
this->SetReplicates(false);
//bReplicates=false;
Hi. I'm here again) Maybe someone could help me understand what could lead to such strange behavior(it works correctly on clean project, but I can't find differences in project configurations what could make such things).
Movement logic is just on server, but when it's triggered FROM server it works like charm, MoveToLocationOrActor works perfectly, when mouse button is down - both characters move to the cursor, but when it's triggered from client - MoveToLocationOrActor works only when clicked(and released), but all server code is firing as always, no differences, all needed data etc. I can't get it.
Doesn't matter because as soon as you possess it the engine will tell it to replicate anyway
Can someone give me a sanity check on architecture? I am working with UI components that quickly change based on use state (fighting vs rapidly building weapons) and am using RPCs to take in client requests and then RPCs to send out updates to the clients UI. This is mainly whether or not some submenu is displayed. I can see doing this with RPCs or some onReps, but wasn't sure if there is a best practice. But RPCs feels fragile to me somehow. Is there a best practice for doing this sort of setup?
- Users are initiating menu change events almost as quickly as they can type.
- I am supporting 4 players
UI is just the place the data is presented to the player, you don't need to network menu changes it should be totally client-sided
Just replicate the game data and let the client UI pull that data by itself without instructions from the server
hello, does anybody know how to get the JoinSession node working in 5.5?
it keeps failing instantly, before it even fires the normal execution pin
i've found people with this problem already, and the plugin im using (AdvancedSessions) supposedly fixes it (ive also checked the code and it does appear to be trying to fix it)
https://forums.unrealengine.com/t/ue-5-5-online-subsystem-join-session-always-results-in-on-failure/2125579/6
still, even with the workarounds implemented i cant get it to work
so I can just disable it locally in on posses?
or must be on server too ?
You can't have a non-replicated pawn, how would that work
locally ๐
<@&213101288538374145>
How can I log distinct messages on client side? Every player controller seems to use same name ๐ค
Ballpark how hard would it be to make my own simple character movement component? Anyone here done that?
Using a fucntion of GEngine you can get client id
I think it only works in PIE tho
bump? ive tried anything i could think of but to no avail
it really just seems like joinsession node doesnt work in 5.5
Depends on how "simple" you're talking. For something fairly simple, shouldn't be too much effort. The main challenge, at least imo, is handling client corrections.
I'm probably talking about a capsule and only supporting acceleration-type inputs, no root motion or anything like that. Just something like a baby CMC, I just prefer to be able to wrap my head around the entirety of a system. I really like the idea of physics driven characters so maybe something to accomplish that in a simple way.
Are you gonna do sim proxy smoothing
If not, how are you going to handle low update frequencies
I think you'll find yourself reintroducing a massive amount of CMC because a lot of it exists out of necessity ๐
From a learning perspective I think you should just start piecing together your own CMC, it is a good experience for growth
Make it support a cube
Add angular velocity
Make it simulate the cube same as how chaos simulates a cube
Then extend it so it can be kept upright, or similar
Now you have arcade vehicles with net prediction ๐
I think there can maybe be some room for something akin to the physics replication system, where it's not as strict and the corrections are all smooth
I'm working on a physics vehicle game so yeah I think a generic system could work.
Cubes have edge cases, literally. Spheres and capsules are ez pz
Ive been stuck with something for so long, has anyone else had ragdolls (just setting simulate physics on a skeletal mesh) teleporting to 0,0,0 when physics is enabled?
Ive assumed this is a me problem but I genuinely cannot find out what the hell would be causing it
specifically on enemies btw
but I dont even set location or anything anywhere I literally just enable physics
seems to happen specifically when using launch character on the enemy right before they ragdoll
its literally just this
I dont even know how to DEBUG it let alone fix it
I dont know if this is even helpful at all but I just dont know how else to even explain this
Does it only happen to clients?
Does replicate movement, is limited to replication only location / rotation, and for any other stuff I must enable "replicates" ?
I'm pretty sure replicate movement will do nothing without enabling Replicates
"hey everyone, the actor that you don't know about is now over here"
no, thats default pawn settings
unless unreal is switching "recplicates" after begin play or something
I can't find related varaible in my pawn code
maybe its private
private:
/**
* If true, replicate movement/location related properties.
* Actor must also be set to replicate.
* @see SetReplicates()
* @see https://docs.unrealengine.com/InteractiveExperiences/Networking/Actors
*/
UPROPERTY(ReplicatedUsing=OnRep_ReplicateMovement, Category=Replication, EditDefaultsOnly)
uint8 bReplicateMovement:1;
ok, you were kinda right
not sure, hard to tell but itโs definitely only multiplayer
Can this not be properly replicated?
a variable in this SaveGame is CharacterName
when i put this in tick...the server says "Tugs" and the Client says None
condition is none
set to intial or something else
None just means default in this context
It's an object reference, the object might not exist in the clients
by default objects are not replicated to clients automatically unlike replicated actors
i hate this ๐ not a single tutorial that just shows how to do multiplayer savegames just with a name or health value...no they all show 700 different variables and shit noone needs and it takes forever to learn this xD
whats default replication then?
default means: objects no, actors yes ?
No it means there are no special conditions, so the variable just replicates like normal whenever it changes
conditions like owner only, initial only etc
You could just replicate a struct instead
ye,he means this
yeah, i tried to only have the variables i need to save in a file for future gaming sessions in one place...
Why do you need the save game replicated? Only the server needs to save it and it already has all the information about the game world
well, how does the client know those variables ? ๐
It's the server that does the loading, why would clients need to know
e.g. i logged out with 67/100 mana.... if only the server knows, how can i return to this sttate when i close the game and then start playing again?
You'd have that variable replicated
and thats what i tried ๐
Your mana is a replicated variable, it exists on the server and is replicated to the client
When the server sets a replicated variable it's automatically sent to clients
your savegame system should make a save slot or something to the effect per player
Are you pulling everything from a single save object during runtime?
If the savegame is per player with the player ID being the slot name, then that can work. You can also have the savegame have an array of some data with an entry per player
and thats exactly my issue, how doi get the 67mana variable from the savegame to the client,given that we just figured out the savegame aint replicated ๐
you don't replicate the savegame itself
you replicate what the savegame loads data INTO
Yeah you only need to make a savegame when you actually want to save, like right before shutdown
thats what it currently does
no
is ChosenCharacter the PLAYER id?
don't confuse player and their pawn
Here's what your savegames should look like on the server
/Savegames/
TUGs
Adriel
Spynora
yes, i save via charactername , so i got a tugs.sav file created
Why is that an RPC?
What class does that code live in
I think the problem is that you're trying to replicate the savegame object
I don't think they can replicate
just have them wrap some structure if you must have a lot of data, but you really don't need to replicate the savegame data directly as a single thing, loading the savegame should have effects that are replicated on their own
yes the number.sav is my steam ID...it basically only has a list in it with all characters i created with that steamID
so test.sav and tugs.sav are my characters i created so far
I think the problem is that you're keeping the save game alive and trying to use its variables during runtime
And it's an object and can't be replicated
correct, reasoning was as stated above ๐ only wanted to have one area that i have alll variables.... all that stuff here:
i assumed having a savegame already "made" would be better to,lets say just alter the mana variable and then save it,instead of "creating a savegame each time a change occurs".
Yeah, you need to keep those in the actor itself, or in an actor component or something, (that way you can also set them to replicate)
Only when you want to save and exit the game you need a save game
Save games are one time use objects, don't keep them alive
so if i want to save the game every lets say 5minutes, i would let it create the savegame every 5minutes instead of just updating it and then saving it?
i didnt want to ๐ i wanted to save every time a quest progress has changed inside the savegame, but if health or mana changed it just keeps the 5min cycle.
make a struct my guy
there might be some wizardry to make a savegame actually replicate but just make a struct
heard you,will do that now, well..i was about to just do 1 variable, turning it into a struct after i can do myself easily.
SaveGameObject
YourStruct
CharName
Mana
Hunger
PlayerState
YourStruct
CharName
Mana
Hunger
you put all that in playerstate not an AC_Hunger system AC_ExperienceSystem AC_Resource(Mana,energy,rage)System?
put it wherever you want
You can also do that like
SaveGame
HungerData
XPData
ResourceData
HungerComponent
HungerData
XPComponent
XPData
ResourceComponent
ResourceData
im starting to get it ๐
so.... if youre fine with it, lets do it step by step.... i have an AC_Experience connected to the BP_PlayerCharacter. in it i have a replicated variable called CurrentExperience. lets see how we get this from an AC_LoadingSystem that is connected to a PlayerController to said xp system? ๐
SaveGameForPlayerID -> make save game object -> pull all the data from the players various objects and shove it in save game object -> save game to slot with player ID
LoadGameForPlayerID -> load game from slot into object -> spawn all the stuff for the player, shove data from save game object into the various objects like hunger component etc -> done
OnJoinServer -> LoadGameForPlayerID
trying to implement this. ill try for an hour or two on my own with this as guidance, but its getting late here, would u be cool if id tag you tomorrow if i still have an issue with it?
and thanks @dire cradle of course too ๐
was Skip Simulating Bones, tried Skip All Bones and it does this
interesting that when it teleports to 0,0,0 it actually goes back to where it should be
can you show the physics asset and the details panel for the root?
Are pawn instances numerated different client and server?
I print GetLabelOrName() and it always prints Pawn0 for each player
The display name of objects can be different across clients.
yes, it feels that way at least for starting pawns
is there shared property that can help me identify actors or pawns across network ?
The reference to the object itself is the way to identify it across the network.
You really shouldn't need to worry too much about what the display name is. When you pass a reference to the server for example, the server will know which one you are talking about. When you set a variable with a replicated actor reference, then the clients will know which one is the right one.
You technically could use a replicated variable set on the server and assign an arbitrary integer value that you increment each time to any actors you're wanting to keep track of, and then you can use that replicated variable on clients to read that number to verify, but it's not really necessary.
I have not used RPC with pointers yet ๐คทโโ๏ธ so I have no idea
Does anyone know if mesh visibility can be client-specific for replicated actors? I had this working in 5.0, but no luck in current versions. I have checkpoints for a racing game that I toggle their visibility dynamically, via a client RPC. So in theory, its only the client-side actor that's being toggled. In my debugging, I can confirm that my execution chain is happening on the owning client (StaticMesh->SetVisibility seems to be working), but what I am seeing on screen does not line up with the object data, and it doesn't matter if I run as standalone, as listen server, or client.
Alternatively, I am thinking this is all too much of a hassle and I would be better off spawning new actors for visual indicators that are netrelevant only to specific players.
Use HiddenInGame if you don't want it replicated.
On Actors: HiddenInGame is replicated, and there is no visibility setting.
On Components: Visibility is replicated, HiddenInGame is not.
Thanks will try that
And it works!! You are a savior. I've wasted literal hours on this and it was 1 line of code to fix
Thank you!
Yo
I get an error
This error
In this level blueprint
but
ONLY if I run the game as a client
It's throwing an error because your playercontroller is null. Is this happening when you stop PIE?
Maybe the Pc hasn't replicated yet?
Just add a check loop to wait for the player controller's spawn
level might be loading before the controller
ideally you dont want it to be the level that's spawning the ui but if you're just testing it's fine
Uhhh
how?
A do once?
then a branch?
ahhhhh
It'll just try every tick until the controller loads
Yeah yeah I see
but uhhh
it's
freaking out about this
just put another delay until next tick so it executes the next frame after the pc loads
it's most likely just a timing issue
This is creating problems because the level blueprint is not the place to spawn widgets
especially in multiplayer
Where should I do this then?
also if i put delay until next tick
it still gives the error
in the player contorller itself, or the hud
hmmmmm....
But how would I make sure that the player controller
or rather wait
Sorry no
How would I make sure that it only adds this widget in the main menu map?
cuz this is the main menu
Is your menu multiplayer?
and it ONLY does this error if I run as a CLIENT
Then don't, you don't need to test this map as a client if it's gonna be local only
oh shit wait
Your right ๐ญ
Bro I was overthinking this so hard
@dire cradle thank you
I was overthinking this so hard lmao
lol we all do that at some point
Do I need to add Steam_appid.txt into my shipping build game folder, before uploading the depot to steam?
Or will Steam do it automatically for anyone who downloads the game?
yeah you do need to put it in
Same folder where the .exe file is in?
yeah
Thanks!
After you release the game you no longer need the text file though afaik
how can I replicate a loaded sublevel on a listen server?
sending a multicast RPC fails: LogPlayerController: Warning: ServerUpdateLevelVisibility() ignored non-existant package
is there an event you can run on clients when a uobject replicates? I tried PostInitProperties, PostLoad, PostNetReceive, and even an onrep but nothing works for triggering when the first replication happens. PostNetInit doesn't exist on uobjects. I don't want to tick through a boatload of maybe-existing uobjects every client frame :\
What do you mean more specifically?
Are you looking for something on the Server side?
Or on the Client side?
On the client side specifically, as in, a uobject successfully replicated to the client, therefore i want to run some code on that client within the replicated uobject
Oh, so not an Actor?
Yes not an actor
I feel like there has to be some way to process clientside that we just created some uobjects from the network system and respond to that happening, but i cant find one that works
UObjects don't really exist in a vaccuum. They're typically associated with an Actor. In the OnRep of the property for said actor, run your logic.
Replication happens through actor channels
Oh that could work, but the critical thing is: if the property pointer in the actor, that points to the replicated uobject has replicated, is it guaranteed the uobject has successfully replicated too at that point in time?
Is it "safe" To do some operations (assuming that if the ReplicateSubobjects is already written properly to include everything) on the uobjects for the actor channel at that point in time?
I haven't bothered much with the replicate subobject stuff. So can't say for certain.
Ok that gives me a starting point at least. worried i'll have to just have to keep looping every frame checking on the actor until the uobjects all load on the network, sounds painful both performance and architecture wise
The Actor's PostNetInit should run when all of its replicated variables have been received for the first time (if I recall correctly). So, if the UObject is a default subobject, and is replicated, it should be valid when that lifecycle method runs. (Don't hold me to it though!)
uobjects seem to basically never be replicated/ready at the time the containing onrep triggers. The only option might be ticking until everything replicates, dang
Is OnRep not working again when the object itself replicates? ๐ค Is that a TArray specific behavior?
There is IInterface_ActorSubobject which has two functions:
OnCreatedFromReplication and OnDestroyedFromReplication
They often wont be. The OnRep will be called multiple times as the object pointers populate/depopulate.
Unless the objects are subobjects of the actor itself, you have pretty much no garauntee they will be valid when that object replicates.
oh man this confused the heck out of me for AttachmentReplication until i realized SocketName was getting replicated before the AttachParent pointer
subobjects here means only defaultsubobjects right, so only constructor stuff? hmmm all the uobjects are outer'd to the actor who contains the array with the onrep so they are subobjects but not default subobjects, they are created during play with the actor as an outer, independent from the actor spawn time.
Do you have any reccomended method for where to run code to respond to a uobject replicating, such as "this item has appeared and is in an equipment slot, now apply the stats to the local copy of the actor"? Anything better than ticking and waiting for the references to be valid? ๐ I especially worry that, if an object is created on server and gets deleted more quickly than it took to replicate it, the client might be left ticking forever or something waiting to resolve something that never will. I suppose that if i check the whole uobject array every tick rather than ticking for just the one pointer, eventually the pointer will be removed but i worry about this solution too
After possesing Pawn, what function is called afterwards on client side? ๐ค
AcknowledgePossession
that's what I use to do client side stuff after possession
Before I attempt it, anybody know if you can specialise ShouldWriteFastArrayItem for Fast Array Serializer? I really wanna believe it'll work with all the template shenanigans
Hi everyone! Network prediction is just awful: itโs a real nightmare for high-speed vehicles, and in multiplayer with a custom physics-based suspension system, it almost never works properly with prediction. Does anyone know any alternatives? I looked at GMCv2, but thereโs no information or examples, and the Discord is locked until you pay ($600 โ thatโs insane).
$600 is definitely not insane for what you get with that plugin
$600 is much much cheaper than someone who could make it would cost
Thats the point) i don't know what i get with that plugin
The page tells you. It is a pretty good plugin.
it fit or no
Also, it is fairly common for high speed stuff to be more client-trusted.
I haven't tried Chaos Vehicles stuff yet, so don't know how that is expected to be handled.
I can't even begin to imagine the work it takes to have networked high speed vehicles with prediction
It's not too bad, until you have to handle inter-vehicle collisions
speed not the biggest problem, suspension thats a problem
I'd imagine suspension is a locally derived thing. But I'm no vehicle expert, so /shrug
Hey guys, is destroying actors related with Relevancy? For example, if there is some loot, and Server destroys it after collected, and if the other client is far away, would that object still be destroyed on his Instance?
Why is your suspension not local only? Who cares if everyone agrees on the fine details as long as everyone agrees on the general position and velocity of the vehicle
I just discovered that UUserWidget::NativePaint runs on both the server (non-dedicated) and client at the same time ๐ฎ . I expected it to be totally local
It running on listen server makes sense though. Because someone is the server in that setup.
Though I've just realized that it only runs on the listen server and client at the same time when both PIE windows have the implementing NativePaint widget displayed (visible and on viewport), so I'm not sure if it'll still run on both machines in a real scenario when they're remote from each other
What's the current state of networked vehicles? I'm looking to implement a variety (cars, tracked vehicles like tanks, helicopters).
- Chaos Vehicles from what i gather aren't very robust and have issues with replication?
- Chaos Modular Vehicles are in their infancy
- any standout plugins?
what would be the best approach as of now?
I recommend waiting for Blue Man to complete his new plugin + wait for him to add net prediction ๐
There is nothing if you want a proper sim and don't want to rewrite CMC to produce arcade vehicles or have client authoritative movement
thank you for the very quick answer. I'm not looking for physics accurate vehicles, the game vibe is pretty much the opposite of that xd
as for blue mans v2 plugin is there any release date insight or is it only written in the stars?
Last he messaged me (recently), he was just waiting until he has time to do the docs, but net prediction isn't available on first release, i.e. planned for future update
i've found his YT channel and in one of the comments it's targeted release date is in 1 or 2 monthsโฆ that was a month ago
too bad about not having replication out of the box since that would be the selling point for me
It would only if you did a multicast for the item being destroyed. If itโs purely a server thing, the other clients wonโt see the change
@dark edge @dire cradle thanks for the help, changing to structs worked ...so far ๐ now I have to figure out how to display the replicated values into the UI.... I just dont get where to do that and when lol. but ill try to figure that out tomorrow on my own. imma ask tomorrow if i cant. for now just wanted to update and say thanks again โค๏ธ
Design it such that the UI knows about game state, don't make game state know about UI at all. It should never even have a reference to it.
either poll from the UI, or have a dispatcher that the UI binds to
game state doesnt know anything about the information i want displayed though ๐
I have a HUD class that creates a user Widget called WB_PlayerUI wich looks like this:
I mean game state in the general sense
not the game state actor
UI knows about the game, game doesn't know or care about UI
yeah im aware of that already ๐ server is dedicated most times anyway,so doesnt have a HUD class to begin with
Currently the order is:
Spawn Player_BP
Load data vom savegame and put it in the actor components attached to Player_BP
in Player_BP Begin-> cast to HUD class and call the "Show UI" function wich creates the WB_PlayerUI
and now i dont know how to get the UI to show the data ๐ but I barely got the stuff working 20min ago from all the changes I had to make to get the new structs method working so ill spend tomorrow on that
Hello! How can i get player controller of player who overlapped with trigger, i get the reference to played, but in need to disable his controls, haw can i do it in level blueprint?
Assuming the other actor would be a pawn or character, cast "other actor" to one of these classes, then you can use "Get Controller" from it and then cast that to PlayerController.
Helloo i need help anyone can help me in this >>>> I want to add enemies in Lyra who will shoot at my Lyra character, reducing its health and eventually causing death. I have disabled bots, so I want to add enemies as regular AI characters instead. These enemies should behave similarly to Lyra botsโattacking when they see my character.
Additionally, my Lyra character should also be able to shoot at them. The enemies should only start shooting when they spot my character. If my character dies, it should respawn. Similarly, if any enemies have been killed, they should also respawn after some time.
Would it be a bad idea to carry PlayerState's adding itself to tha PlayerArray logic from PostInitializeComponents to PostNetInit?
Or should I just create a different "player joined" event depending on the PlayerState::BeginPlay instead of GameMode::AddPlayerState?
Our suspension local, we replicate only spring delta
i dont suppose theres a way to increase the default NetCullDistanceSquared is there
Not without modifying engine
dang, i guess i'll just manually set them lol
Hi Guys, maybe one of you knows what Iยดm doing wrong? Iยดve been trying for ages to get a local 2 player (multiplayer) project to work. I tried most online ressources/ tutorials (some paid ones too) but none of them feature my exact goal of locally having 2 different player blueprints. for now, all i want is for both players, who are different pawns (meaning they each have their own blueprint) to spawn into the level and be controllable via a shared keyboard. (WASD / arrow keys to move). this is my PlayerController blueprint: (P1 White is player1, P2 Azure is player 2)
when starting the game, this happens:
this shows that p2 (azure) is assigned controller 0, who is supposed to be assigned to p1
so i can only control player 1 (white)
and nothing happens when i try to press the arrow keys to move p2 (azure)
here to explain whatยดs getting printed on screen:
Iirc UE has no Shared Keyboard stuff by default.
Your PlayerController0 is getting the Keyboard. The other one is lacking an input device.
Btw you might want to move the input mapping stuff to the pawns blueprint. You can just tell each of them which player they are fwiw. Or pass the IMC they should use along when spawning them.
Then you don't have to check for the controller 0 stuff twice
Also, you are doing Online Multiplayer mixed with Local Coop, correct?
At least that's what it seems like. If this is a mix and not pure local coop, then you gotta make sure that you handle Authority vs Local Player properly.
Your delays are not a solution for that ๐
Your current setup would also cause clients to spawn their own local copy of the pawns and have duplicates.
This is a pure local co-op. The delay somehow fixes some issue that apparently the imc p2 can't access the controller with ID 1 (maybe because at that point it doesn't exist yet? Idk)
^
Isee. That's a very useful input, thanks!
Yeah i did that before i thought it might change something if i moved them to the playercontroller. I'll move them back to the pawns
Do u have any idea for a workaround for the shared keyboard?
Without c++, only really ugly ones, like having just one PlayerController and spawning two pawns of which one is not possessed and handling the inputs in the PlayerController and forwarding them
Thank you, will try it! ๐
For my game's turn-based local multiplayer, I did the following:
Launch single player Standalone, use CreatePlayer node to create the additional players. In my case they all had PlayerControllers and Possessed Pawns.
When turn changes, SetViewTargetWithBlend to the Current Turn Pawn.
For the controllers, as suggested above, I forward the inputs. In my case there was no movement, just rotation, so inside the player controller I did Get CurrentTurnPlayer -> SetControlRotation on input.
For movement you would probably use the equivalent - SetMovementDirection, or SetMovementInput.
If you have different keys for different players (Example: WASD for player 1, Arrows for player 2), just use the above suggested nodes on the respective players from the corresponding inputs.
And yes, it is quite ugly. But works.
I'm trying to save data for connected clients between sessions. will FUniqueNetId remain consistent for clients between sessions? epic's comment says "NOTE: the internals of this property should never be exposed to the player as it's transient and opaque in meaning (ie it might mean date/ time followed by something else)".
The date/time bit makes me wonder if some platforms add a new date/time every time they connect
hello, are there any ripercussions or sideffects of having a higher bandwidth limit? i tested with 4 players and i was using around 100kb i think (which ik is quite a lot tbh, and ill try to optimize it)
im currently cranking the limits up to ensure i wont have issues but i would like to know if this can cause performance issues or anything else or if its just a limit and nothing more
Simply depends on the backend. Steam should stay consistent
EOS probably too
from what I heard the defualt settings are basically setup for mobile games. Its perfectly reasonable to increase these to your needs, but obviously you are increasing the networking needed to run your game smoothly
as far as performance, I'm not sure if there are any repercussions of this
At least in UE4 the limits were extremely low even then so it is fine to increase them
https://dev.epicgames.com/community/learning/knowledge-base/5kwY/unreal-engine-tech-note-anim-notifies-are-not-fired-on-listen-servers has this been actually fixed?
I'm still having that problem using latest version
Would it be valid to put Player State variable on every unit/building anything that player can ''Own'' to use as a Ownership variable and also for finding Player Controller of that Player State?
Like so, because Unit is Aactor, it's not owned by client, because it's owned by AiController. Because of that I cannot send RPC from it directly. So I first call normal event ''DoSomething'' to Player Controller of that unit by getting assigned Player State and calling Do Something on player controller for something to happen. Then that DoSomething event calls ServerRPC_DoSomething which does the thing.
Does it make any sense?
example
Network Level-change PlayerController Question
Have multiple gamemodes: GM_Login & GM_PlayLevel.
They have different PlayerControllers: PC_Login & PC_PlayLevel
Client starts on Level_Login with GM_Login and PC_Login. That gets some credential about that player.
Client connects to a server. That will initiate a level change and a game mode change.
Client is now connected to Level_PlayLevel with GM_PlayLevel and PC_PlayLevel.
What is a good approach for having the information I derived in PC_Login reach the Server and be associated with that player?
I thought that OnPostLogin's PlayerController reference would be of the previous game mode's PC, but it is the new PC.
Hi, I have a problem about CharacterMovement & PawnMovement Replications on Listen Server project. On stabile times I always get 60 - 70ms around in clients -in live tests with dev build- with a good network and when I check profile network. the replicated locations and movements always seen on top replicated but its makes this pings itself so how can I decrease this ping?
Can this problem because of I m testing with Steam Develop app ID? ๐ค
not really.
Did you mark the character as always relevant?
You probably shouldn't
Despite that the CMC in itself shouldn't be too expensive. You'd hit a CPU limit before the bandwidth becomes a problem afaik
Ohh the stats decreased to 1/4.. It looks fine rn but I need test it with steam connection later. I I will write worked or not. Thanx for now ๐
when to use always relevannt?
Its not something often used. Typically used for things the Player wont see, but is integral to providing some abstract pieces of information.
The PlayerState is a good example.
Certain types of Managers are also another.
It also heavily depends on what feature you are trying to implement.
interesting...i will need to read up further
Just because something is Always Relevant doesnt necessarily mean its going to be expensive either.
hmm?
i have 10 multiplayer characters with about 100 npcs... i chose to always relevant on the characters but maybe thats not necasssary... like you said it heavily depends on implementation
Why do you think you need them to be Always Relevant?
i have a large level and i was having issues with character far away... maybe it wasnt necassary... it ties into the relevancy distance settings right?
Be more specific, what was the "issue with character far away"?
Was it something Cosmetic you needed to still see?
Like an Icon on the Character?
So other Players know exactly where they are?
Something like that can be solved by decoupling the "Icon" from the Character and allowing it to become Always Relevant instead of the Character.
When optimizing the Network, you should always consider, what is the approach that is going to send the least amount of data.
What is going to cost the least amount of CPU time.
While still achieving a satisfactory result
intersting... goo dknowledge thank you
yeah it was mostly cosmetics... that makes sense to make the cosmetics themselves always relevant. if not "always relevant" the server still recieves updates?
The best approach I know of might be something like a GameInstanceSubsystem which has a longer lifecycle than a PC, but I don't need a long lifecycle.
I'm trying out temporarily storing it in static access classes' variable until I find a better solution.
My temp solution:
On PC_Login after it gets its credential, I store that to a static variable.
On PC_GameLevel I retrieve from the static class and empty that value. Then I re-store it in the PC_GameLevel variable which the server can access. Server then clears it once it got it in OnPlayerLogin
Is this a janky hack or a fine enough solution?
You want to use the Options string
Clients can pass arbitrary data to the Server about themselves during connection via the Options
UGameplayStatics::OpenLevel(const UObject* WorldContextObject, FName LevelName, bool bAbsolute, FString Options)
See the Options at the end
This corresponds directly to
AGameModeBase::PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)
The Options on PreLogin and Login within the GameMode.
AGameModeBase::Login(UPlayer* NewPlayer, ENetRole InRemoteRole, const FString& Portal, const FString& Options, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)
The GameplayStatics class has utility functions for interfacing with the Options string.
UGameplayStatics::HasOption( FString Options, const FString& Key );
FString ParseOption( FString Options, const FString& Key );
To name a few
As an example.
We use Options to pass the PartyId of a Player through to the Server, so the Server can know that a Player belongs to a certain Party. Allowing it to join each Client of the same Party together on its end.
if (UGameplayStatics::HasOption(Options, TEXT("PartyId")))
{
const FString PartyId = UGameplayStatics::ParseOption(Options, TEXT("PartyId"));
if (!PartyId.IsEmpty())
{
PlayerState->PartyId = PartyId;
Among other things.
The Options string needs to be in the following format.
Does this concept have a specific name? (Search engines for 'Options' isnt really a useful disambiguation for finding helpful docs)
?Option1=Value1?Option2=Value2?Option3=Value3?....
This is exactly the sort of thing I hoped existed and couldn't find
It looks like they're actually command line arguments under the hood?
Nope, guess not
https://old.reddit.com/r/unrealengine/comments/hxf25h/c_what_does_the_options_parameter_do_in_openlevel/
https://dev.epicgames.com/documentation/en-us/unreal-engine/command-line-arguments-in-unreal-engine?application_version=5.4
They are not Command Line Args
They are literally just a string thats appended to the outgoing/incoming connection to a Server.
From a Client
To the Server
Huh, interesting
It can be used however you like.
You could send information about the user selected Cosmetics or something.
?Head=TopHat?Chest=TShirt?Legs=Pants?Feet=Boots
This is super helpful, I'll try to arrange some time to reimplement to use the Options (which is probably better security wise than what I'm doing)
We use GameLift as well, so when a Client Reserves a PlayerSession, we get that Client to pass its PlayerID along to the Server via the Options, so that the Server knows that the right Client joined the Reserved Slot.
Options can be used in whatever way you need them to be used.
You could even use it to preselect a desired Team or something
Client wants to be on TeamB instead of TeamA (maybe there is a preselection lobby before joining the actual Server).
Options are boundless.
as a side note,
In UGameplayStatistics you have a few functions to read option values from a Options string such as HasOption, GrabOption.
you can get the Options string from GM and World iirc.
but irrc in one those class the variable isnt named "Options" but a synonym
how is a characters aiming position usually replicated? like if youre aiming a weapon, and you move your mouse really fast then it should appear the same on the other end, but shouldnt be replicating this constantly, Im trying to update it based on the speed of the players mouse movements but not sure if I got the right idea
also dont even have a solid way of getting the mouse movement speed as a reliable variable Im doing it badly rn
tried looking that up but just get results for sensitivity
Aiming usually goes through ControlRotation which is at least partially replicated through GetBaseAimRotation AFAIK
are you using ControlRotation to represent the aim direction?
huh, I am but only for horizontal turning since I dont use horizontal aim animations, only vertical
should mention its third person so the character aims at where the cursor hit result lands
Which one does ControlRotation represent?
the rotation from cam to aim point, or from char to aim point?
Hi, Iโm using player states to store team id, I have a problem where certain clients are unable to receive other player states on time, besides increasing the net frequency of the player states, is there a better way to solve this?
how long is it taking?
control rotation is just used to turn the character horizontally, wherever you turn the mouse
that doesnt do anything with the aim point
There's a built-in replicated compressed pitch in Pawn
Typically that is used
it comes from ControlRotation, maybe you can manually set it or reformulate to use ControlRotation to represent the pawn -> aim rotation, or you can just roll your own
if it's just pitch just spam a pitch at the server and have it replicate it, skipping owner, but you already have that in Pawn
Basically I need team id info of all player states for each clients to do something, less than a second I think
I'd just turn up the freq a bit, it won't hurt
but I think there's a way to force replication instantly, problem is you'd have a race condition on join
yeah thats basically what Im doing but every frame, that cant be a good idea
sure it can
what do you think CMC does?
well I was wondering actually
because I knew some things had to be replicated every frame but
Other clients won't recieve it every frame but it doesn't hurt to unreliable rpc it to server every frame
but like I said, that can already happen
there already is a compressed pitch in Pawn
just use that
Yup, ForceNetUpdate, is a race condition issue, I will try higher net frequency then, I was thinking of tracking the player states in each client before executing rest of the logic
Yeah if you think about it, forceing a net update before the client is ready doesn't help you. Just put it on 10hz freq or something and call it a day. The amount of data in Playerstate is probably tiny
Alright, thanks a bunch!
I dont get it because its not about the camera angle its about the character mesh to the aim point
Doesn't matter, it can be about anything
it's just a number
but it's the number that's already there, already replicated, and typically used for exactly waht you're talking about
Instead of:
input -> ControlRotation -> camera -> aim point -> look at rotation (the char to aim point rotation)
you can:
input -> camera rotation -> aim point -> look at rotation -> control rotation
Then it'll automagically work, GetBaseAimRotation will have a replicated pitch for you
but you can also just replicate AimPoint or AimDirection or AimRotation or AimPitch or whatever you want on your own
so its essentially the same thing in the end
come to think of it I guess Im making the mistake of thinking any server/multicast event is bad, when really its about how much youre actually sending through those isnt it
You want to send the minimal amount of data across the Network that you can manage such that you get the result you need.
Key points there:
- Minimal Data
- Desired Result
If you are adhering to that then nothing is "bad"
Using an RPC for something isnt inherently "bad".
So long as its the absolute cheapest way for you to get the desired outcome.
well I just assumed that sending any event every tick would be a horrible idea but if its just one variable then I dont know
Is it important that everyone knows about the aim direction continuously and smoothly?
well kinda? player interaction is important, its a very noticeable thing
if anything Id like some way to see how good the connection is and what makes it worse
Just use the network profiler and look
this is a total nothing burger, there's way more data than that already crossing the network
Is there a way I can log RPCs through a console command or see how many are being sent?
You're asked that by people who don't know what they are talking about
Tick is the event that you hook into to do stuff per frame
lots of stuff in a game needs to update per frame
if the thing is updating per frame, something somewhere is ticking
Unreal Insights should be able to do it for you
Not really, thats what the profiling tools are for.
is the game state promised to be replicated and up to date by the time a client spawns in?
Depends on what you mean by a client spawns in?
The GameState is replicated when all Actors have BeginPlay called on them.
Its literally what calls BeginPlay
I mean replicated values on the game state
say the game state had a value that dictates how the game is played, similar to lyra experiences, would this be up to date for all clients by the time begin play is called as a promise or just guess work
unmapped ones yes
Not guaranteed that the game state will have called rep notifies in begin play
but the (unmapped) properties will be there on the frame it gets created
ok ill read that and see what unmapped means in that context. thanks.
non-UObject properties
This goes for any replicated UObject, all of their replicated properties that don't map to another UObject are guaranteed to be available on creation
*guaranteed *? Even if I had an array of like 2mb? Thanks that makes sense though, I assume guaranteed within reason
You're guaranteed to get an error saying you can't replicate over 65kb of data per bunch in that case
I'm trying to get the socket location to cast an ability on an AI Enemy in a dedicated server setting. I've gotten this to work on the player by setting the mesh to "Always Tick Pose and Refresh Bones".
But so far, this same setting doesn't work for AI Enemies. Is there a way to enable this through an option?
i have done a build on my game and when i launch the EOTAServer.exe -log I get a window come up but no logs on whats going on i left it over night yet nothing was there in the morning
hello
im having an issue where when i change the game state from game state base to game state my character gets stuck and i can only move the camera(not like moving in the editor but where my character is at only) i tried making a new game state base and it worked just fine but making a new game state the issue repeats it's self again and i can not move.
if its a shipping build you have to add
bUseLoggingInShipping = true;
in your Server.target.cs