#multiplayer

1 messages ยท Page 242 of 1

fallen fossil
#

not movement

tardy fossil
#

Current player still gets the updates from server, but it uses them to verify position instead

fallen fossil
#

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

tardy fossil
#

Yea thatโ€™s a confusing way to put it., cause they do receive the replicated update they just donโ€™t use it

fallen fossil
#

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

tardy fossil
#

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

subtle gulch
#

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?

kindred widget
#

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.

subtle gulch
#

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();
}
frigid meteor
#

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?

sonic obsidian
#

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.

snow trail
#

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?

chrome bay
#

And no there is no network overhead

#

And yes it will call immediatelly like a regular function call

sonic obsidian
thin stratus
remote tusk
#

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?

sinful tree
#

even if you see it on both windows, it still means it was either the server or a client printing it.

remote tusk
#

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

remote tusk
#

Because i only call RunOnServer RPC, from host, didnt do any client distribution inside the interactable for example.

sinful tree
#

Prints aren't replicated.

remote tusk
#

I couldnt understand why its printed on **both **actually. I only call it on the server

sinful tree
#

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.

remote tusk
#

Is this about ownership or smth? Since I have 2 instance in the client, it is printing for both or idk

remote tusk
#

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,

remote tusk
sinful tree
#

Which probably means you're not reaching the server.

remote tusk
#

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.

thin stratus
#

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.

thin stratus
thin stratus
#

In C++ you can add the old value as a param to the OnRep

remote tusk
thin stratus
remote tusk
thin stratus
remote tusk
thin stratus
#

Make sure to put some print strings up

thin stratus
# remote tusk

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.

remote tusk
#

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?

thin stratus
#

Please start debugging this a bit with PrintStrings.

thin stratus
#

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.

remote tusk
#

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

thin stratus
#

After the ServerRPC you are on the Server.

#

It's the memory of the Server. It has no access to the Client.

remote tusk
#

Maybe i should send interactable with event, and it can execute by that.

thin stratus
#

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?

remote tusk
#

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)

thin stratus
#

It's not huge.

remote tusk
thin stratus
#

UObject pointers (or AActor here) are send as NetGUIDs.

thin stratus
# remote tusk

Then split that logic a bit. Run the AddUnique in general and limit the EnableWidget stuff only on LocallyControlled.

remote tusk
remote tusk
remote tusk
thin stratus
#

No, I mean just not limited to LocallyControlled

thin stratus
remote tusk
#

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. ๐Ÿ˜ฆ

thin stratus
#

Remember the Square image I drew?

remote tusk
#

Anyway, going to log this to see whats going on! I have disaster scenearios. ๐Ÿ˜„

remote tusk
thin stratus
#

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.

remote tusk
#

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.

thin stratus
#

Assuming the Blue Circle is the pawn of Client 1, your "IsLocallyControlled" causes this:

remote tusk
#

For example, this is my client pawn, Where does the Server version of it?

thin stratus
#

In a duplicate world. It's easier to imagine it if you would run the game on 2 different PCs.

remote tusk
#

Hmm, so you mean Remote side?

thin stratus
#

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.

remote tusk
#

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?

thin stratus
#

Yeah, I know what you are struggling with

#

It's difficult to explain

remote tusk
#

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?

thin stratus
#

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.

remote tusk
#

So when you say movement of the character, you also mean "Overlap"?

thin stratus
#

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?

remote tusk
#

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.

thin stratus
#

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.

remote tusk
#

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.

thin stratus
#

No, you are only binding on the local Pawn.

remote tusk
remote tusk
#

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".

thin stratus
#

On top of that, the CharacterMovementcomponent won't even let you move the other char.

thin stratus
#

Because the Random value will be different on each.

remote tusk
#

SO, In Character blueprint, IF I make some changes in LOCAL, are there any chance it affects the other CHARACTER on my local?

thin stratus
#

No

#

They are two different Instances.

remote tusk
#

Hmm, thats what differ from Unity for me, alright.

thin stratus
#

Suggestion from someone who used Unity 15 years ago before going to UE: Forget about Unity. Stop comparing them.

remote tusk
#

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!!!

thin stratus
#

The "Server Version of Pawn" is more or less literally the other Pawn you see running around in the Server's Window.

remote tusk
#

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.

thin stratus
#

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.

remote tusk
#

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.

thin stratus
#

And it made "Click".

remote tusk
#

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".

thin stratus
#

On another note. My spacebar doesn't work anymore. I'm ctrl+v whitespaces atm... MONDAY.

remote tusk
#

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.

thin stratus
#

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.

remote tusk
thin stratus
#

Removing the IsLocallyControlled ensure that Server also adds it.

#

You do gotta leave the IsLocallyControlled for the Widget stuff though.

remote tusk
thin stratus
#

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.

remote tusk
thin stratus
#

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.

remote tusk
thin stratus
#

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.

remote tusk
thin stratus
#

I don't think i have a lot of examples there about it.

remote tusk
#

Can we simply say its a bool that "IsServer" XD

thin stratus
#

No. That's the confusing part.

#

If you spawn an Actor locally, its role will be AUTHORITY.

remote tusk
#

Anyway never mind man, I already got illuminated, and wont be trying to understand that. Dont waste your time for me. ๐Ÿ˜‚

thin stratus
#

If you want to 100% only call something on the Server, you use the "IsServer" node.

remote tusk
#

I got so boosted that now i will enable GAS plugin in my game (hello adhd)

thin stratus
#

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.

thin stratus
#

Get your Interaction stuff working first, so that the ServerRPC changes the Color.

remote tusk
thin stratus
#

And then try to read up on the Game Framework classes agian, understand what GameState, PlayerState et.c is for.

remote tusk
thin stratus
thin stratus
#

You can create whatever Actors etc. you need beyond that.

remote tusk
#

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. ๐Ÿ˜„

thin stratus
#

But I would suggest not replacing the ones that exist.

#

They are deeply tied into the Engine.

remote tusk
#

Then i will create my own SurvivalGameState, SurvivalPlayerState etc.

thin stratus
#

Doesn't go for ALL of them, but for beginners, it's best to just use what is there for now.

remote tusk
#

Just in case.

thin stratus
#

Yes.

#

And keep in mind that UE/C++ is an Inheritance-based Language.

remote tusk
#

I actually used that framework in some of my Unity projects. ๐Ÿ˜„

thin stratus
#

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.

remote tusk
thin stratus
#

But you gotta just ignore those variables and functions for now.

midnight torrent
#

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)

thin stratus
#

exAres trying to find a point where they can finally ask

remote tusk
thin stratus
#

You can do some composition via Components fwiw

#

And later on via UObjects, but that is bit more advanced,.

remote tusk
# thin stratus You can do some composition via Components fwiw

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".

thin stratus
thin stratus
#

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.

remote tusk
#

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.

thin stratus
#

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.

thin stratus
#

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

remote tusk
#

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.

remote tusk
midnight torrent
remote tusk
#

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.

thin stratus
midnight torrent
thin stratus
#

And the Character is possessed by what?

remote tusk
#

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. ๐Ÿ˜„

thin stratus
#

Yeah no, that's a few weeks away.

midnight torrent
thin stratus
#

Stick to learning the basics first.

lament flax
#

who tried mover here ?

thin stratus
lament flax
#

cedric you did iirc ?

thin stratus
#

I think I have to leave. I'm suddenly feeling very ill.

lament flax
#

go rest

thin stratus
#

Something fishy.

lament flax
#

:(

thin stratus
#

What do you want to know about M๐Ÿคฎver

remote tusk
lament flax
#

because im about to convert my BP prototype to c++

thin stratus
#

I have no clue. I only used the non-physics, FixedTick version of it in Multiplayer.

lament flax
#

okay

thin stratus
#

And I still can't recommend using that over CMC.

#

Especially if you are doing Singleplayer.

lament flax
#

ill go back to my solution then x)

remote tusk
#

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.

thin stratus
#

No worries.

remote tusk
#

Replication SUCCEED!

midnight torrent
thin stratus
midnight torrent
#

Ah

#

lol

thin stratus
#

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.

remote tusk
#

I really heard "custom movement" is a really headache on multiplayer

thin stratus
#

If you use an AiController, then the local player is just a SimulatedProxy.

remote tusk
#

GASP already published a replicated version of it in 5.5. Do you think its worth using it?

thin stratus
#

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.

remote tusk
#

As in client & server with 0 ping, it looks great but.. ๐Ÿ˜„

thin stratus
remote tusk
thin stratus
#

@midnight torrent Try either sending it more often (every frame, with an Unreliable RPC), or fwiw less often?

remote tusk
#

Anyway, i gotta go. Have a good day sir!

thin stratus
#

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.

thin stratus
#

Although my adventures with MotionMatching and Mover the last weeks have been semi fun.

remote tusk
#

Anyway, i will stick into TPS character for now. ๐Ÿ˜„

midnight torrent
remote tusk
#

If the sync latency or ping can happen,

thin stratus
remote tusk
#

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. ๐Ÿ˜›

thin stratus
#

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

remote tusk
thin stratus
#

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

remote tusk
#

So that only SERVER version will handle array, going to replicate it to "MY CLIENT" ACTUALLY.

thin stratus
#

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

remote tusk
#

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. ๐Ÿ˜›

thin stratus
#

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.

remote tusk
#

Well, thanks to you Mr. GOD MULTIPLAYER DEVELOPER

thin stratus
#

Gonna watch some TV now. Getting late in Germany. Need to rest a bit.

remote tusk
#

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.)

thin stratus
remote tusk
#

see you sir

thin stratus
#

Did you watch the video that is in the resources of my docs?

#

That explains the basics too

remote tusk
thin stratus
remote tusk
#

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...

โ–ถ Play video
thin stratus
#

Yus

remote tusk
#

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.

ashen plume
#

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.

formal solar
#

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

fallen fossil
#

Can I somehow compensate speed of clients pawns ? They feel much slower than server ones

dark edge
steep panther
#

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

cerulean forge
#

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.

steep panther
#

thats kind of what i am experiencing lol

#

i know that Fortnite and Ark both basically went entirely C++ after their initial launches

fossil spoke
#

Generally speaking, you will want to do core implementation details in C++, with BP extending that.

steep panther
#

not assuming, info from tech chats / unreal fest / etc

fossil spoke
#

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.

steep panther
#

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

fossil spoke
#

Then rewriting in C++ with BP supporting the designer friendly elements.

fossil spoke
#

ARK was terrible for perf for like the longest time.

steep panther
#

indeed lol

fossil spoke
#

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.

steep panther
#

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

fossil spoke
#

Fast Arrays, Push Model Replication, better async support... all types of things.

steep panther
#

BP doesn't support push model even with Iris?

fossil spoke
#

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.

steep panther
#

yeah i dont see anything that would change it to being opted in at the moment in bp

fossil spoke
#

If you are making a serious game, you just dont do Multiplayer in BP.

#

End of story basically.

steep panther
#

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

fossil spoke
#

Pretty much

steep panther
#

thats a bummer

#

especially with how many assets on Fab / marketplace advertise as being ready for a big multiplayer game

fossil spoke
#

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.

fossil spoke
hallow sand
exotic wasp
fossil spoke
hallow sand
#

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.

fossil spoke
fossil spoke
#

And I say that because thats the reason I dont do MP stuff either lol

#

Its just not worth it.

hallow sand
#

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.

fossil spoke
#

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.

hallow sand
#

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"

exotic wasp
#

thats most prototypes tbh

fossil spoke
#

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.

hallow sand
#

I think the argument could be made for both.

fossil spoke
#

Can you really blame the Marketplace for someone wanting to explore an interest.

exotic wasp
#

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

hallow sand
#

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.

fossil spoke
hallow sand
#

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

fossil spoke
#

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.

hallow sand
hallow sand
#

I also don't mind playing devils advocate for the sake of game dev chat lol

fossil spoke
#

Its like complaining that UE itself is bad at making certain types of games.

#

While that is true

exotic wasp
#

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.

fossil spoke
#

That doesnt mean you cant.

fossil spoke
exotic wasp
#

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...

steep panther
#

this is a huge bummer

fossil spoke
#

Yeah, which is why I try and advise people to start small, instead of trying to make the next Call of Duty.

fossil spoke
#

A professional could crank out flappy birds real quick.

#

Someone who has no idea what an Editor even is, wouldnt.

fossil spoke
steep panther
#

so without C++ a multiplayer game like Ark is just out of the question?

fossil spoke
#

Not exactly.

#

It will just run like crap.

exotic wasp
#

like ark ๐Ÿ™‚

fossil spoke
#

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.

exotic wasp
#

^

#

open world survival game with up to hundreds of players is not simple in any way

fossil spoke
#

Yeah forgot about 100 players.

#

No chance you will get that in BP

#

Be lucky to manage 20

steep panther
#

im having issues with 5 players after they build a shitload of stuff, not trying to hit 100 players haha

fossil spoke
#

There you go

exotic wasp
#

does even the dedicated server struggle?

steep panther
#

after players have built thousands of objects it is pretty brutal

fossil spoke
#

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

exotic wasp
#

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.

fossil spoke
#

That makes no sense lol

exotic wasp
#

depends on where the poor performance comes from

fossil spoke
#

"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.

sinful tree
#

Really the only way is to make functions in C++ that you can call from blueprint.

dire cradle
#

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

exotic wasp
#

IMO just converting something to c++ isnt going to meaningfully improve performance as the bad performance is probably stemming from a single source

steep panther
#

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

hallow sand
#

FPS or multiplayer / network performance??

steep panther
exotic wasp
#

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?

dire cradle
#

You can scale the relevancy and net update settings down

#

do you need to replicate max health and the static mesh?

exotic wasp
#

set them as dormant

dire cradle
#

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

exotic wasp
#

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

fossil spoke
#

At this point I would also recommend that you actually do some Profiling.

exotic wasp
#

^^^^^^^^^

fossil spoke
#

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

dire cradle
#

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

sinful tree
exotic wasp
#

i dont think dormant actors check replicated properties

steep panther
#

for health on player built objects, would repnotify be any better than replicated? when using Iris

sinful tree
exotic wasp
#

performance would be the same (or worse)

fossil spoke
exotic wasp
#

dont use an rpc for that

hallow sand
exotic wasp
#

normal replicated properties

fossil spoke
#

Health is stateful, RPCs are not.

exotic wasp
#

^

dire cradle
exotic wasp
#

i think any more discussion on performance is entirely pointless until you profile your game

exotic wasp
#

if your objects are dormant, those 10000 actors arent doing anything bad for performance on the server

steep panther
hallow sand
exotic wasp
#

i dont think that was ever true

dire cradle
#

They even only send deltas instead of whole values (when applicable)

steep panther
fossil spoke
#

The whole 10k Player Built Actor thing could easily be solved inside of 1 replicated Actor BTH.

exotic wasp
#

do network managers work with individual relevancy on actors?

dire cradle
#

Yeah just make a manager actor for buildings

exotic wasp
#

i never understood how they handled that

fossil spoke
fossil spoke
#

Depends how you architect it

#

You could have a manager per chunk

#

Which is then affected by relevancy

exotic wasp
dark edge
#

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.

dark edge
# fossil spoke 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

exotic wasp
#

just mark float G as replicated?

fossil spoke
#

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

dark edge
#

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

steep panther
#

is insights the best tool to profile networking stuff?

thin stratus
#

I would say so, yes.

dark edge
#

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.

molten moss
#

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

dire cradle
#

checking off ''use less cpu while in bacgkround'' in the editor settings may help

molten moss
#

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

oak pond
#

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

dark edge
#

Show what triggers an explosion and what it do

dire cradle
#

It depends on your implementation

oak pond
#

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

dark edge
#

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

molten moss
#

Alright, so, limiting the max fps cheats around the issue .

#

but it feels like a cheat, not the proper way to do it

oak pond
#

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

sinful tree
# oak pond sound really is just simple as

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.

oak pond
#

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)

sinful tree
# oak pond of course, but in this specific case I cant replicate a sound with server event ...

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.

oak pond
#

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

sinful tree
#

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.

oak pond
#

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

elfin plover
#

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?

thin stratus
# elfin plover Hey all. I have a listen-server setup and am using the Character Movement Compon...

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.

dark parcel
#
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.

fallen fossil
#

I solved problem with faster actor facepalm , i was moving actor twice on server, so server player was faster not others slower

fallen fossil
#

RPC are replication independet?
I disabled replicaiton and rpc still goes to server ๐Ÿค” interesting

upbeat basin
#

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

fallen fossil
midnight torrent
#

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.

chrome bay
surreal plaza
#

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
dire cradle
#

Just replicate the game data and let the client UI pull that data by itself without instructions from the server

snow trail
#

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

chrome bay
#

You can't have a non-replicated pawn, how would that work

fallen fossil
dire cradle
#

steames community

#

^dont trust the link

fallen fossil
#

<@&213101288538374145>

fallen fossil
#

How can I log distinct messages on client side? Every player controller seems to use same name ๐Ÿค”

dark edge
#

Ballpark how hard would it be to make my own simple character movement component? Anyone here done that?

lament flax
#

I think it only works in PIE tho

snow trail
quasi tide
dark edge
grand kestrel
#

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 ๐Ÿ˜›

dark edge
dark edge
dark edge
oak pond
#

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

dire cradle
#

Does it only happen to clients?

fallen fossil
#

Does replicate movement, is limited to replication only location / rotation, and for any other stuff I must enable "replicates" ?

dark edge
#

"hey everyone, the actor that you don't know about is now over here"

fallen fossil
#

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

oak pond
elfin plover
# oak pond

On the mesh, what is your KinematicBonesUpdateType value set as?

ruby parrot
#

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

fallen fossil
#

set to intial or something else

dire cradle
dire cradle
#

by default objects are not replicated to clients automatically unlike replicated actors

ruby parrot
#

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

fallen fossil
#

default means: objects no, actors yes ?

dire cradle
#

conditions like owner only, initial only etc

dire cradle
ruby parrot
#

ye,he means this

ruby parrot
dire cradle
#

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

ruby parrot
#

well, how does the client know those variables ? ๐Ÿ™‚

dire cradle
#

It's the server that does the loading, why would clients need to know

ruby parrot
#

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?

dire cradle
#

You'd have that variable replicated

ruby parrot
#

and thats what i tried ๐Ÿ˜„

dark edge
dire cradle
#

When the server sets a replicated variable it's automatically sent to clients

dark edge
#

your savegame system should make a save slot or something to the effect per player

dire cradle
dark edge
#

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

ruby parrot
#

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 ๐Ÿ˜„

dark edge
#

you replicate what the savegame loads data INTO

dire cradle
#

Yeah you only need to make a savegame when you actually want to save, like right before shutdown

dark edge
#

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

ruby parrot
dark edge
#

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

ruby parrot
dire cradle
#

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

ruby parrot
#

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".

dire cradle
#

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

ruby parrot
#

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?

dire cradle
#

yeah basically

#

You don't need to save every time a variable changes

ruby parrot
#

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.

dark edge
#

there might be some wizardry to make a savegame actually replicate but just make a struct

ruby parrot
dark edge
#

SaveGameObject
YourStruct
CharName
Mana
Hunger

#

PlayerState
YourStruct
CharName
Mana
Hunger

ruby parrot
dark edge
#

put it wherever you want

#

You can also do that like
SaveGame
HungerData
XPData
ResourceData

HungerComponent
HungerData

XPComponent
XPData

ResourceComponent
ResourceData

ruby parrot
#

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? ๐Ÿ˜„

dark edge
#

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

ruby parrot
oak pond
#

interesting that when it teleports to 0,0,0 it actually goes back to where it should be

elfin plover
oak pond
#

this is pelvis though, no physics body for the actual root bone

fallen fossil
#

Are pawn instances numerated different client and server?
I print GetLabelOrName() and it always prints Pawn0 for each player

sinful tree
fallen fossil
#

yes, it feels that way at least for starting pawns

fallen fossil
sinful tree
#

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.

fallen fossil
#

I have not used RPC with pointers yet ๐Ÿคทโ€โ™‚๏ธ so I have no idea

supple cypress
#

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.

kindred widget
supple cypress
#

Thank you!

shut vigil
#

Yo

#

I get an error

#

This error

#

In this level blueprint

#

but

#

ONLY if I run the game as a client

supple cypress
#

It's throwing an error because your playercontroller is null. Is this happening when you stop PIE?

latent heart
#

Maybe the Pc hasn't replicated yet?

dire cradle
#

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

shut vigil
#

how?

#

A do once?

#

then a branch?

dire cradle
shut vigil
#

ahhhhh

dire cradle
#

It'll just try every tick until the controller loads

shut vigil
#

but uhhh

#

it's

#

freaking out about this

dire cradle
#

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

shut vigil
#

also if i put delay until next tick

#

it still gives the error

dire cradle
shut vigil
#

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

dire cradle
#

Is your menu multiplayer?

shut vigil
#

no

#

the main menu is just what will eventually allow players to matchmake

shut vigil
dire cradle
#

Then don't, you don't need to test this map as a client if it's gonna be local only

shut vigil
#

oh shit wait

#

Your right ๐Ÿ˜ญ

#

Bro I was overthinking this so hard

#

@dire cradle thank you

#

I was overthinking this so hard lmao

dire cradle
#

lol we all do that at some point

hexed path
#

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?

dire cradle
#

yeah you do need to put it in

hexed path
#

Same folder where the .exe file is in?

dire cradle
#

yeah

hexed path
#

Thanks!

dire cradle
#

After you release the game you no longer need the text file though afaik

sterile gazelle
#

how can I replicate a loaded sublevel on a listen server?

#

sending a multicast RPC fails: LogPlayerController: Warning: ServerUpdateLevelVisibility() ignored non-existant package

tiny falcon
#

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 :\

fossil spoke
#

Are you looking for something on the Server side?

#

Or on the Client side?

tiny falcon
#

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

fossil spoke
#

Oh, so not an Actor?

tiny falcon
#

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

quasi tide
#

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

tiny falcon
#

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?

quasi tide
#

I haven't bothered much with the replicate subobject stuff. So can't say for certain.

tiny falcon
#

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

quasi tide
#

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!)

tiny falcon
#

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

upbeat basin
twin vessel
chrome bay
chrome bay
#

Unless the objects are subobjects of the actor itself, you have pretty much no garauntee they will be valid when that object replicates.

tardy fossil
tiny falcon
# chrome bay Unless the objects are subobjects of the actor itself, you have pretty much no g...

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

fallen fossil
#

After possesing Pawn, what function is called afterwards on client side? ๐Ÿค”

dark parcel
#

that's what I use to do client side stuff after possession

chrome bay
#

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

narrow wadi
#

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).

quasi tide
#

$600 is definitely not insane for what you get with that plugin

dark edge
narrow wadi
#

Thats the point) i don't know what i get with that plugin

quasi tide
#

The page tells you. It is a pretty good plugin.

narrow wadi
#

it fit or no

quasi tide
#

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.

dark edge
#

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

narrow wadi
#

speed not the biggest problem, suspension thats a problem

quasi tide
#

I'd imagine suspension is a locally derived thing. But I'm no vehicle expert, so /shrug

remote tusk
#

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?

dark edge
blazing bear
#

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

quasi tide
#

It running on listen server makes sense though. Because someone is the server in that setup.

blazing bear
#

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

near rapids
#

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?

grand kestrel
#

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

near rapids
#

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?

grand kestrel
near rapids
#

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

fallow bison
ruby parrot
#

@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 โค๏ธ

dark edge
#

either poll from the UI, or have a dispatcher that the UI binds to

ruby parrot
#

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:

dark edge
#

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

ruby parrot
#

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

hasty rampart
#

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?

sinful tree
mental rock
#

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.

upbeat basin
#

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?

narrow wadi
tardy fossil
#

i dont suppose theres a way to increase the default NetCullDistanceSquared is there

chrome bay
#

Not without modifying engine

tardy fossil
#

dang, i guess i'll just manually set them lol

hearty steppe
#

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:

thin stratus
#

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.

hearty steppe
#

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)

hearty steppe
hearty steppe
#

Do u have any idea for a workaround for the shared keyboard?

thin stratus
#

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

hasty rampart
hexed path
# hearty steppe Do u have any idea for a workaround for the shared keyboard?

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.

twin sable
#

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

snow trail
#

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

thin stratus
#

EOS probably too

quiet yarrow
#

as far as performance, I'm not sure if there are any repercussions of this

grizzled stirrup
torpid crest
#

I'm still having that problem using latest version

normal viper
#

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

hot scroll
#

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.

karmic trellis
#

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? ๐Ÿค”

thin stratus
#

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

karmic trellis
# thin stratus You probably shouldn't

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 ๐Ÿ˜ƒ

tender idol
#

when to use always relevannt?

fossil spoke
#

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.

tender idol
#

interesting...i will need to read up further

fossil spoke
#

Just because something is Always Relevant doesnt necessarily mean its going to be expensive either.

tender idol
#

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

fossil spoke
#

Why do you think you need them to be Always Relevant?

tender idol
#

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?

fossil spoke
#

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

tender idol
#

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?

hot scroll
# hot scroll **Network Level-change PlayerController Question** Have multiple gamemodes: GM_L...

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?

fossil spoke
#

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.

hot scroll
#

Does this concept have a specific name? (Search engines for 'Options' isnt really a useful disambiguation for finding helpful docs)

fossil spoke
#

?Option1=Value1?Option2=Value2?Option3=Value3?....

hot scroll
#

This is exactly the sort of thing I hoped existed and couldn't find

fossil spoke
#

Its specific to UE

#

And not well documented

fossil spoke
#

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

hot scroll
#

Huh, interesting

fossil spoke
#

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

hot scroll
#

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)

fossil spoke
#

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.

lament flax
#

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

oak pond
#

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

dark edge
#

are you using ControlRotation to represent the aim direction?

oak pond
#

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

dark edge
#

the rotation from cam to aim point, or from char to aim point?

cold temple
#

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?

oak pond
#

control rotation is just used to turn the character horizontally, wherever you turn the mouse

#

that doesnt do anything with the aim point

dark edge
#

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

cold temple
dark edge
#

but I think there's a way to force replication instantly, problem is you'd have a race condition on join

oak pond
dark edge
#

what do you think CMC does?

oak pond
#

well I was wondering actually

#

because I knew some things had to be replicated every frame but

dark edge
#

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

cold temple
dark edge
oak pond
dark edge
#

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

oak pond
#

so its essentially the same thing in the end

oak pond
#

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

fossil spoke
#

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.

oak pond
#

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

dark edge
oak pond
#

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

dark edge
#

Just use the network profiler and look

#

this is a total nothing burger, there's way more data than that already crossing the network

oak pond
#

well thats what I was hoping

#

its just Im often being asked why I use event tick ever

dim trail
#

Is there a way I can log RPCs through a console command or see how many are being sent?

dark edge
#

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

fossil spoke
opal pulsar
#

is the game state promised to be replicated and up to date by the time a client spawns in?

fossil spoke
#

The GameState is replicated when all Actors have BeginPlay called on them.

#

Its literally what calls BeginPlay

opal pulsar
#

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

verbal ice
#

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

opal pulsar
#

ok ill read that and see what unmapped means in that context. thanks.

verbal ice
#

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

opal pulsar
#

*guaranteed *? Even if I had an array of like 2mb? Thanks that makes sense though, I assume guaranteed within reason

verbal ice
tawny parcel
#

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?

open wave
#

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

flint scaffold
#

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.

tawny parcel
unkempt tiger
#

I keep thinking how player states and controllers should actually be one object, am I missing some key insight?

#

i don't really understand why they are two distinct actors, when both are some 'player info' actor that represents a player