#multiplayer

1 messages ยท Page 131 of 1

fair latch
#

I guess if i were in your shoes, i will broadcast to client that a new player join and tell them to update their widget

dark edge
#

Playerstates BeginPlay could be the spot to do it.

fair latch
#

I dont see why not but something tethered to player character like health. I would dump that in player state

dark edge
#

I would put health in the pawn.

#

The pawn has health. The player has a score

fallow kettle
# dark edge Playerstates BeginPlay could be the spot to do it.

I am trying to do it that way... I am currently binding the OnPawnSet event in the begin play and when the player is possessed... I am calling a server method to call the multicast method in the game state which can replicate the data to all the clients

dark edge
#

That sounds way more complicated than it needs to be. What exactly is the problem you have right now?

#

If you just want to update the UI when a player joins, just update UI on the begin play of player state.

#

No need for any run-on server events or multicast or any of that stuff

#

One problem you might have is that certain other actors aren't well formed at that time, like maybe the player state is there but the pawn isn't. But that's a different matter

fair latch
#

There isnt many instance where multicast should be used.

A dev even said he went as far as shipping the game w.o a single multicast rpc

quasi tide
#

That sounds silly. Use a multicast if it fits the criteria

dark edge
#

Yes, use multicast for transient events, rely on replication for stateful stuff. Mostly anyway.

fair latch
#

He said it creates problem most of the time. Even spaghetti cant fix it

quasi tide
#

Sounds like they used it incorrectly then

fair latch
#

Edge case usage of multicast is probably like chat massages

#

Where u dont care about late joiners

dark edge
#

I would certainly multicast a grenade explosion.

fallow kettle
# dark edge That sounds way more complicated than it needs to be. What exactly is the proble...

The game flow:

The Controller is spawned by the game mode with a spectator pawn...
The controller spawns the Team Choosing widget where it triggers an interface from the HUD class.

On Button click, the Controller spawns the pawn and possess it...

The Overhead widget updates like in the picture:

The new player joins and the widget updates for them as well...

The problem is that the overhead widget wont update for the other players on the client and only the server can see that

atm the thing is working for me because I am doing it from the game state... but I dont feel this is the correct way to do it

fair latch
fallow kettle
dark edge
dark edge
quasi tide
dark edge
fallow kettle
#

the game state:

#

the game mode:

dark edge
fallow kettle
#

the player:

dark edge
#

Then it should update on repnotify of the variable AND on begin play of the pawn

#

Possibly on possession too

fallow kettle
dark edge
#

Update on possess as well.

urban palm
#

@quasi tideno I haven't yet. Was focusing on something else meanwhile. I checked everything, it should be fine in principle. In practice it doesn't work though. Before I start digging into the source code, maybe you/someone else know the answer.

quasi tide
#

It's like bTickSkeletalAnimationOnClient or something like that

urban palm
#

@quasi tideI believe it is this which you are referring to:

/** True if calling TickPose() from Autonomous networking updates. See ACharacter. */
    UPROPERTY(Transient)
    uint8 bIsAutonomousTickPose : 1;
#

Need to check how it is used. On the other hand it refers to ACharacter, so it may not apply to APawn.

quasi tide
#

It might not, but Epic be Epic. So who knows if it could have some weird side effect

#

But the character class could also be switching that in its class.

#

But I've seen this kind of issue be solved because of this. But most people use Character, so it might not be the same.

#

ABP not ticking on client though, is what leads me to this.

urban palm
#

That's what I would need to check

sullen fern
#

Hello !!
Im working on a project with UE5.3 and I have concerns about replication.
My game mode store a information I will need in the PC. (TSubClassOf<>)
So my flow is :

  • Set it in the game mode blueprint
  • in AGameMode::InitGameState, I set the member store in the game state, this one is written as replicated, since I want it available on client's PC.
  • I want to use is in APlayerController::PostInitializerComponent, but my GameState is still nullptr, so I want to use in BeginPlay for example, and so it's working.
    My concerns is : Ok, I test it on me pc it's working, but, can I be sure at 100% that a replicated member set in AGameMode::InitGameState() with be replicated on client Game State before the call of APlayerController::beginPlay ?

Thanks by advances !

urban palm
#

Did some modifications to my project, now all the AnimBP's are ticking also on the client side but no update to the animation on clients. Still missing something to make it work...

green delta
#

are pawns easy to replicate? i cannot see them on screen at the moment (fully custom pawn)

urban palm
#

The root of my pawn is a skeletal mesh and I can see it properly on both server and client, struggling to replicate the animations at the moment

#

@green delta but in general it works

fair latch
#

R u playing on stand alone?

green delta
#

my root is a capsule

#

hahah no?

#

2 windows pop up

fair latch
#

But they cant see each other?

green delta
#

oh

#

good point

#

yes i was

#

ty

#

what a mess

#

cameras are all over the place

fair latch
#

Speaking of cameras, how do you guys tackle camera looking at 0,0,0 before possesing a pawn?

#

Its more evident when lag is higher

#

I planned to just keep showing the loading screen until a player posses a pawn but would like to know alternative ways

limpid parcel
#

when learning about multiplayer/replication, at what point do i need to consider whether im gonna use eos or steam?

fair latch
#

Chosing which platform to use have nothing to do with your learning?

opal fox
#

I just realized here after some debugging that my client has the role of authority when im checking it like this, anyone has any idea how that occurs? Its a component attached to a player client. The listenserver has role authority AND role simulatedproxy, and the client has role authority, im a bit confused how this can occur at the moment, would appreciate any help.

#

Its 2 characters derived from ACharacter and spawned in the world with the playerstart

#

Im debugging in the editor with 2 clients open, and 1 is the listenserver

sullen fern
#

@opal fox Maybe you know that and so my answer is not the good one, but you still have 3 PlayerController leaving in the server side, and they all will have the authority! 2 other PC are leaving in local,instance, one in the client instance 1 and one in the client instance 2. and these two will not have authority ! I'm not 100% sure of this, and so you should wait for other people to answer you !

dark edge
#

It depends on the game really, if it's just a server that people join then it's fairly simple. If you want to have parties etc then it's a bit more complicated.

opal fox
#

@sullen fern thanks yeah i guess the controllers should have authority, but i thought im checking the PlayerCharacter Actor, which i thuoght didnt have authority if its just a client connecting to the server

#

when i check authority on listenserver it says simualtedproxy and authority which makes sense, but i would expect other client to say simulatedproxy

true stream
#

Hi, basic question, in a tower defense of sorts game where each player place their own towers, do I need to replicate the bullets that are being shot by the towers, or just calling a RPC with the action of placing a tower is enough?

dark edge
#

If you make the game deterministic enough you can avoid that but it all depends on how you do things

#

There's a middle ground, you can replicate the act of firing. Basically a multicast with the tower and the target

#

"Hey everyone, Tower 23 shot at Enemy 854"

true stream
#

in my specific case the "bullets" kind of travel along a path, then hit a target when they reach its end.

#

or other "bullets" from the enemy player.

dark edge
#

Can they miss? I mean, are they aimed or always hit the target like WoW?

#

You want to replicate the minimum amount of data required to end up with the same result on everyones machines

true stream
#

no, they are shot in a direction, if they encounter other bullets they sort of cancel each other out

dark edge
#

Yeah that's gonna be hard

#

Do they have gravity or just fly in a straight line?

true stream
#

no, very simple straight line movements

#

to the point it could be precalculated

dark edge
#

It should be enough to just replicate "Tower 32 just shot in yaw 239"

#

but you'll have to make sure your timing is tight so the end results are predictable

true stream
#

right, thing is, what if some random slow happens and the bullets slow down

dark edge
#

Why would they slow down?

#

don't make their movement framerate dependent

true stream
#

just a possible future scenario

#

no I mean, slow as game mechanic

dark edge
#

You'll have to replicate that too

#

How many bullets in flight at any given time do you think?

#

100+?

true stream
#

yeh easily

dark edge
#

yeah it's gonna be hard to get it all synced up well

true stream
#

but the bullets will never accumulate

#

meaning, they will always die against something

dark edge
#

I would start by just replicating each shot and go from there

#

What are the players pawns, characters? Are they predicted or no?

true stream
#

players are like, not really players, its more like a chess game of sorts

#

so 2 players without characters or anything

#

ingame at least

dark edge
#

that's good, you shouldn't need any prediction

#

Basically, whatever happens on the server is what the client sees, just delayed in time by their ping

true stream
#

yeh

#

so you are saying that in the eventuality I have 10k "bullets" I shouldnt be too worried about it since I shouldnt need to replicate them

#

only the initial trigger actions

dark edge
#

Yeah it all depends on how/when they are spawned but just replicating each shot should be good enough

true stream
#

thats good to hear

dark edge
#

you shouldn't have to replicate the movement after the shot as that should all be deterministic

true stream
#

are you sure about that

dark edge
#

I mean it depends on how complex your mechanics get and whether or not stuff can bounce etc

true stream
#

I had a version of this game working with a different engine before and I had terrible desyncs problems

#

nothing like bouncing or anything

dark edge
#

The clients view of the world should be cosmetic only anyway, so even if a bullet barely misses on their screen but hits on the server, it should still kill the thing it hit

#

That should be rare though, if it happens at all

true stream
#

so the action of a bullet damaging something should be replicated

dark edge
#

yeah probably

#

Test it

true stream
#

not every tick of movement, for example

dark edge
#

Yeah the data from server to client about 1 bullet should be something like:

Bullet spawned at x location going in y direction

OK it hit Dude32

#

I'd start by just replicating the spawning and see how it behaves

#

you'll want to make sure your math is right for your projectile system

true stream
#

right

#

the initial position of the bullet should be random (in a specific range), Im guessing that gets replicated to the clients

dark edge
#

yeah

#

start with the least amount of variability

true stream
#

makes sense

dark edge
#

start with zero randomness and just the timing of shots and see how it lines up on both screens, then proceed

#

you probably don't want bullets as actors if you're gonna have 10k of them

true stream
#

yeah no, wont use actors, the towers probably will be though

dark edge
#

I've had good luck with a subsystem and projectiles as structs doing line traces but for projectile/projectile hits you'll have to have sphere colliders probably

true stream
#

in my very specific case I wont use collisions like that, it will be like.. emm.. tile based of sorts.

#

very cheap

#

so basically if a bullet occupies a tile, it will check if enemy bullets exist there too, in that case "fight"

#

something like that

#

but that comes after, first I will test basic MP functionality I guess

#

thanks for the help

unkempt tiger
#

Anyone got a clue for why multicast RPCs aren't recorded in replays in 5.3, when recorded in a (non-networked) standalone game?

flat halo
#

Hey folks, I am looking to implement the network for my game based on Rocket League (Its Rocket Science GDC talk).
Just like rocket league, I have 6 boxes(players) and the ball. That enables me to send all my physics world state into one packet.
The idea is for both the server and the client to send the full world state into one packet, e.g. {FrameId = 1, SimulationTime = 0.2, StepTime = 0.2, Bodies[] = {position, velocity, ...}}.
I am new in Unreal, so its not clear for me how I would achieve that.
I am thinking that I need to have one Actor that owns all the custom physics state for all objects, then send RPC from this actor after each simulation frame together with the frame id.
Doesnt feel like I should be using replicated properties for this at all, but I am not sure.
I am also afraid of fighting the engine too much with this approach.
Hopefully someone here can help me get into the right train of thought.
Thank you.

dark edge
#

Have you watched the Rocket League netcode talk?

flat halo
#

yes

dark edge
#

You probably want a subsystem with an actor to network through or just an actor really

#

If it's all custom physics it won't be too insanely complicated. If you're trying to get the engine's physics to play nice with predicted multiplayer movement then it'll be a doozy

#

How are you planning to handle prediction?

flat halo
#

yes, I am okay with writting my own physics and simplifying a lot. I am considering integrating bullet just like rocket league.

for prediction, also like rocket league. Both client and server runs the simulation, both snapshot the world state each simulation frame, the clients record and send the input for each simulation frame, then the server issues corrections, by using rollback/replay.

keen hound
#

my dedicated server is stuck on this message:
[2023.11.20-17.13.58:101][ 49]LogOnlineSession: Display: OSS: Session creation completed. Automatic start is turned on, starting session now.

magic vessel
#

My packaging process is being blocked by OwningObject not appearing in my fast array

#

From what I can tell, this is what is causing it


#if WITH_PUSH_MODEL
    // Object that is replicating this fast array
    UObject* OwningObject;

    // Property index of this array in the owning object's replication layout
    int32 RepIndex;
#endif // WITH_PUSH_MODEL
#

How can I define WITH_PUSH_MODEL to allow it to go through packaging?

#

Never mind, I'll do a small refactor to add an additional object ref

jaunty palm
#

Just a humble question. Does anyone know or have experience how lyra (more specifically inventory system) will perform in a MMO game? I am thinking about building on top of it as it has already so many features built in that I could use but I am not sure about all the details as I am not deep dived on it yet.

rustic drum
jaunty palm
#

Good to know!๐Ÿ‘๐Ÿฝ

boreal scarab
#

In most tutorial code, including Tom Looman's stuff, it seems like people just handle their server code with their client code by just checking HasAuthority. Is this the best way to do it? Or in the real world do people actually split their server and client code so that on the server, you're only running code where you can assume HasAuthority == true?

short arrow
#

Has authority is great for situations where client and server need to fire the same event, but there's no reason to create a whole new event dedicated to server or client

#

An example I can give is a multicast event always fires on server and clients, but sometimes you don't want the following logic to fire on the server, there's no way to avoid it other then to check for authority

#

TL;DR it's totally fine and acceptable to split your code using has authority checks. It's a super common thing

thin stratus
#

In CPP it's theoretically also possible, not sure how common, to complete kick out code that runs on server only, by wrapping it into WITH_SERVER so it isn't included in Client builds

#

Different use case though than the HasAuthority check

boreal scarab
# short arrow Both, you might be overthinking it a little

I see, okay fair enough. Yeah I was probably overthinking it. I guess in the context of UE5 there's no point in having someone be a "server engineer" vs "client engineer". You're just a "gameplay engineer" that makes sure stuff works on both client and server. And there's not much "server" work because all the networking stuff is done for you I suppose heh

thin stratus
#

Even the WITH_SERVER stuff is barely used, mainly only to hide some stuff from clients for cheating etc. reasons

boreal scarab
#

got it, makes sense. Thanks ๐Ÿ™‚

unkempt tiger
arctic minnow
#

Could someone help me with my steam hosting and joining not being able to find each other the internet?

gusty slate
#

You're using 2 Steam accounts?

arctic minnow
#

No just 1

#

To test

gusty slate
#

You're using a packaged or standalone version?

arctic minnow
#

it seams to be able to find each other over lan if I host it in the editor new editor pie

arctic minnow
#

But they cant find each other

gusty slate
#

It won't work if you use one account and one machine

arctic minnow
gusty slate
#

Because you're technically using the same Steam account

arctic minnow
#

How come it works in the editor?

gusty slate
#

Let me clarify something

#

when you test in standalone/Packaged, Steam is being initialized? You get the Steam overlay with Shift+Tab?

gusty slate
#

Then you can't test on a single machine because at that point both clients connect to one Steam account

#

in editor it just emulates multiple clients

arctic minnow
#

I see

gusty slate
#

in editor for example you don't get the steam overlay/user info/etc

arctic minnow
#

Hmm then I probable need a friend to help me?

gusty slate
#

I haven't looked into ways to do it apart from just using 2 machines or asking someone yeah

arctic minnow
#

lol

gusty slate
#

๐Ÿ˜‚ or a different PC

arctic minnow
#

Ya LOL

gusty slate
#

or maybe there's some way of cheating it inside a single PC I don't know tbh

arctic minnow
#

I have people they just wont be on for awhile

arctic minnow
#

Ill find a way thank you! ๐Ÿ™‚

gusty slate
#

No worries

urban palm
#

Trying to ask again since I made some steps forward, but it still doesn't animate on the clients. UE5.3.2. I have a Pawn based actor (helicopter) with a Skeletal Mesh as root and an AnimBP which animates the two rotors. When playing in multiplayer all the movements work fine, both on client and listen server (or clients), but the SkM only animates on the listen server. All the variables necessary for the animation are replicated. When debugging I see the EventGraph and AnimGraph properly ticking for all the clients, but no animation is visible on the client. What did I miss?

arctic minnow
jaunty palm
urban palm
jaunty palm
urban palm
#

@jaunty palmin this case would be the AnimBP using variables which are replicated as basid for the animation

#

In fact it ticks both on Server and Client, but on the client the animation is not applied to the SkM and I cannot figure out if this is normal (so I need to check how the Character/CMC does it and copy it) or if I simply forgot something

jaunty palm
#

You need to make server function that replicates those variables to all clients

urban palm
#

Like a different client set?

#

And assign them on Rep_Notifies?

#

That would also mean I need a different AnimBP for the clients, sounds weird

jaunty palm
#

No no. You make funtion that only runs on server and replicates some variables in the pawn, then you set animBP local variables to those replicated variables

arctic minnow
#

So sorry to @ your just the only one Ive talked to that seamed to know this how could I test if steam servers work online without 2 people?

urban palm
#

@jaunty palmyep, that's exactly what I am doing already and I see the values of the local animation variables being set in the Event Graph of the client, but not in the AnimGraph for some reasons.

#

You can see the values changing, so the replication works

#

In the AnimGraph, nothing

tranquil yoke
tranquil yoke
# urban palm

I think for this issue you want to create local variable, but not sure why your variables are replicated inside Animation Blueprint

dark parcel
tranquil yoke
#

Local to the ANimation Blueprint

urban palm
#

@tranquil yokethese are not animations or inputs to a state machine, I am just transforming bones

tranquil yoke
urban palm
#

@tranquil yokethe rotation of the rotor depends on the input which is passed to the server, so logically I would calculate on the server side and then replicate to the client

jaunty palm
#

Make the tail rot angle as local variable and do not replicate it

tranquil yoke
#

create a float parameter inside Animation Blueprint, Called LocalRot something, Then using your replicated Parameter calculate and store inside LocalRot, and use LocalRot inside AnimGraph

urban palm
#

@jaunty palmtried both, doesn't make any difference. I believe the problem is with the AnimGraph but I need to figure out why. Everything works fine all the way to the Event Graph of the client

urban palm
#

And I can see those locals vars being updated also on the client, but not in the AnimGaph

arctic minnow
urban palm
#

Unless those Transform (Modify) bone nodes are not working on the client for some reasons

dark parcel
#

Ask Ur friend to join

arctic minnow
#

Alr all of my friends are offline at the moment lol

dark parcel
#

Use Ur other laptop or pc

arctic minnow
#

Can I use the same steam account?

dark parcel
#

Otherwise I don't know. Go sleep and wait for weekend I guess

dark parcel
tranquil yoke
# urban palm

little confused because here it is using replicated parameter.

arctic minnow
#

Ok thank you! ๐Ÿ™‚

urban palm
#

@tranquil yokeso client gets input --> passes it to server --> server calculates the various speeds and replicates them to client --> client uses the various speeds to calculate the rotor speed and applies them to the SkM

#

This last part does not work, rest works fine

tranquil yoke
#

I am getting off in 20 mins, wanna do a call then ?

fallow kettle
jaunty palm
urban palm
#

@jaunty palmyes I know, in fact I am setting them on the server and the Event Graph for the client shows the local variable are updated correctly. I am starting to suspect the problem is with the AnimGraph and the functions I am using in it

#

@tranquil yokeAppreciate the offer but I am multi-tasking while in a meeting ๐Ÿ˜‰

jaunty palm
gusty slate
#

Hello everyone,
If we have let's say Actor A set to replicate and it's placed in the level, this actor comes with a replicated actor component Component A who has ownership of that component then? the server?
Issue is, I am calling a multicast RPC on server-side of Component A and it only triggers for server ๐Ÿค”

urban palm
#

@jaunty palmhere?

jaunty palm
#

not it looks good

tranquil yoke
#

This should happen inside PawnActor and PawnActor Should have OwningClient
Client_SendInputToServer() -> Server_Calculate_And_SetReplicatedSpeed()

InsideClientsOnly->
AnimTick -> Calculate_LocalRotationFromReplicatedSpeedAndSetLocalSpeed()
LocalSpeed should be float inside ANimation Blueprint.
AnimGraph->Use LocalSpeed to set RotatingBone.

jaunty palm
#

now use those two things that you have set where ever you need in the anim bp

urban palm
#

Which is this

jaunty palm
#

alright and dont work?

urban palm
#

Which produces the animation on the server but not on the client

jaunty palm
#

alright now show me the helicopter pawn code

urban palm
#

So I think the issue is with the two nodes

#

Input handling on server from the client

tranquil yoke
#

can you print the value for MainRotAngle inside EventGraph after setting, i wonder if it is getting 0 1, 0 1 something like that

urban palm
#

RPC's' called from the Player Controller

#

Tick on the server, with multicast call at the end

#

Multicast to update clients (engine sound)

#

I even forced the Anim on the SkM via a custom BP Lib Function

tranquil yoke
#

if the node is working correclty, it will rotate for everyone, by default

urban palm
#

yes I could try to tweak it to test

#

but the 2 rot variable in the event graph are set properly, I see them changing when I debug, so the only explanation is that the AnimGraph cannot use them or it can but the Transform (Modify) Bone nodes are failing

#

This on the client, on the server works fine

tranquil yoke
#

so try what i said above, because if that is true, it should still behave the same

urban palm
#

Tried this

#

Works on server, not on clients

#

Had to disable multithreaded update to make it work as the random float are not multi-thread safe

#

So the problem is with the animgraph on the clients

#

I wonder if an animation asset would work

#

Or a control Rig

tranquil yoke
#

I wonder if it is some ListenServer bug, where Server is doing something and client is also doing something

urban palm
#

That's also possible yes

jaunty palm
#

I can confirm that those nodes work

urban palm
#

@jaunty palmcool, good to know. How did you test?

tranquil yoke
#

maybe do it like this

jaunty palm
tranquil yoke
#

I just tested this and it seems to work, not sure what is wrong with his setup

jaunty palm
#

copied from you and it will run on server and clients when the state is triggered

urban palm
#

@jaunty palmwhich state?

#

are the inside a state machine?

arctic minnow
# dark parcel Don't think so

I got the server to pop up on my second game but when I join it on my other game it crashes both games but probable cause I'm on the same pc and steam account right?

jaunty palm
#

yeah I just made it inside already ready locomotion state

urban palm
#

ok need to try that as well

jaunty palm
#

the state is only changing when this happens

#

idk atleast my helicopters are working XD

tranquil yoke
#

Mesh Space Ref pose is also working, you should try printing the values, i hope you are not getting 0 1 kind of state.

gusty slate
urban palm
#

@jaunty palm@tranquil yoke appreciate your help, will do some more tests once I am out of this meeting and let you know

jaunty palm
#

Anytime.

tranquil yoke
gusty slate
#

Is that the case with actors placed in the level as well?

dark parcel
urban palm
#

@jaunty palmsorry did you test with a Character or a Pawn?

#

Because a Character has an own handling of the replication, including animations

#

I am using a Pawn for the helicopter

arctic minnow
#

@dark parcel Sorry for the @ but when I host a server it works but the second someone joins we both crash why?

dark parcel
#

So you can see your match?

arctic minnow
#

Yes

dark parcel
#

Hosted session*

arctic minnow
#

Yes

dark parcel
#

How do you crash exactly

#

R u still using the same pc?

arctic minnow
#

No my friend is connecting and when he joins the server we both instantly crash?

dark parcel
#

No idea, maybe test with basic level and fresh game mode

#

Just to make sure it's not one of your logic that caused the crash

arctic minnow
#

Well I guess not completly okaay ill tryy that

#

Also the ip must be working cause on steam it launches space wars

dark parcel
#

Wdym by ip must be working

jaunty palm
#

I created new BP pawn and copied all components and the small code from character except CMC

gusty slate
#

and his steam setup

dark parcel
#

App id != ip

gusty slate
#

x)

dark parcel
#

U can use app id 480 space war and connects

#

That's what I used before I get my own app id

meager briar
#

Hello

#

I have an problem with replications

#

My callback (COND_OwnerOnly) is called on server too

urban palm
#

@jaunty palmok thanks for checking. then it is a mistery while mine doesn't seem to work

meager briar
#

but it shouldn't

jaunty palm
sinful tree
meager briar
#

I have widget which shows on collision spehere overlap event

#

When I trigger overlap as server widget is visible

#

Then I trigger it as client

#

Both players see that widget

#

But when client leaves sphere, it also hides on server

dark parcel
#

The overlap happend in all machines

meager briar
#

So why doesn't it work the other way?

#

Client can't hide widget for server player

sinful tree
#

Are you able to show some code? It's not exactly clear what you mean by "work the other way" or "client can't hide widget for server player".
Widgets don't replicate, so whatever is happening is local to the machine that is creating and removing the widgets.

meager briar
#
AWeapon::AWeapon() {
    bReplicates = true;
        // ...
}

void AWeapon::OnSphereBeginOverlap(/*...*/) {
    if (const auto PlayerCharacter = Cast<AGameCharacter>(OtherActor)) {
        PlayerCharacter->SetOverlappingWeapon(this);
    }
}

void AWeapon::ShowPickupWidget(bool Visibility) const noexcept {
    PickupWidget->SetVisibility(Visibility);
}
#
UCLASS()
class MULTIPLAYERSHOOTER_API AGameCharacter : public ACharacter {
// ...
private:

    UPROPERTY(ReplicatedUsing = OnRep_OverlappingWeapon)
    AWeapon* OverlappingWeapon;

    UFUNCTION()
    void OnRep_OverlappingWeapon(AWeapon* PreviousWeapon);
};```
#
void AGameCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const {
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);

    DOREPLIFETIME_CONDITION(AGameCharacter, OverlappingWeapon, COND_OwnerOnly);
}

void AGameCharacter::SetOverlappingWeapon(AWeapon* Weapon) noexcept {
    if(OverlappingWeapon)
        OverlappingWeapon->ShowPickupWidget(false);
    OverlappingWeapon = Weapon;
    if (IsLocallyControlled() && OverlappingWeapon)
        OverlappingWeapon->ShowPickupWidget(true);
}

void AGameCharacter::OnRep_OverlappingWeapon(AWeapon* PreviousWeapon) {
    if (OverlappingWeapon)
        OverlappingWeapon->ShowPickupWidget(true);
    if (PreviousWeapon)
        PreviousWeapon->ShowPickupWidget(false);
}
#

I just started learning how to make multiplayer games and I don't know much

arctic minnow
#

Does anybody know what I could have done wrong that can cause my game to crash when both player join it? steam

sinful tree
meager briar
sinful tree
# meager briar Only on overlapping player's machine

Ok, so you shouldn't need to worry about OnReps for doing something like that and can do it entirely locally.

void AWeapon::OnSphereBeginOverlap(/*...*/) {
    if (const auto PlayerCharacter = Cast<AGameCharacter>(OtherActor)) {
        if (PlayerCharacter->IsLocallyControlled())
            PickupWidget->SetVisibility(true); // Will only show the widget if the actor overlapping is locally controlled.
        
        if (HasAuthority())
            PlayerCharacter->SetOverlappingWeapon(this);  // Sets the overlapping weapon only on the authority.
    }
}

void AWeapon::OnSphereEndOverlap(/*...*/) {
    if (const auto PlayerCharacter = Cast<AGameCharacter>(OtherActor)) {
        if (PlayerCharacter->IsLocallyControlled())
            PickupWidget->SetVisibility(false); // Will only hide the widget if the actor overlapping is locally controlled.

        if (HasAuthority())
            PlayerCharacter->SetOverlappingWeapon(nullptr); // Clears the overlapping weapon only on the authority.
    }
}

void AGameCharacter::SetOverlappingWeapon(AWeapon* Weapon) noexcept {
    OverlappingWeapon = Weapon;
}

OverlappingWeapon doesn't need to be replicated at all and you can use it just for a state on the server so your client can call a simple RPC like "PickupOverlappedWeapon" passing in no arguments and the server can then know immediately which weapon to pick up.

#

If you want the client to know specifically about what weapon any characters are overlapping, you can just remove the HasAuthority() checks, then each side will be keeping track themselves what weapon they're overlapping currently.

meager briar
#

thank you

urban palm
#

@jaunty palm@tranquil yoke fixed! Stupid me had derived my custom game mode from GameMode instead of GameModeBase, which made everything work except the animations on the client. Need to investigate why by looking through the source code.

#

Many thanks for thinking along and your tests as well.

quasi tide
#

That's very strange

#

AGameMode is the preferred base for networked games

urban palm
#

Yep, but in this setup it breaks the client animations

#

Need to investigate

quasi tide
#

I'm definitely interested in w/e findings you may find

#

(I really enjoyed typing that sentence out ๐Ÿ˜…)

keen hound
#

why am I unable to join my dedicated server when others can?

urban palm
quasi tide
#

This is very very very very very weird that simply changing from AGameMode to AGameModeBase fixes this.

#

I would've never led you down that path yesterday ๐Ÿ˜…

#

Because it just doesn't make sense

urban palm
#

I know, but it fixed it

#

No worries, I take full responsibility for my own mistakes

keen hound
worn flint
#

Hello I made a function in C++ that I call in a blueprint but whenever I click the button the exectution stops right before calling the said function, any idea on why it does that ? (I have no related errors on the console)

#

function is server player is ready btw

jaunty palm
#

cast failes

quasi tide
worn flint
#

thanks a lot

jaunty palm
urban palm
#

I know. Weird but now it works flawlessly.

#

Same code. I just changed the base class of my custom Game Mode.

quasi tide
#

Just need to summon the high council of WizardCell, Cedric, Jambax, and Zlo

rose turret
#

is there an Iris tutorial or good example anywhere? I need to do some delta state syncing stuff and I think it'll be cleaner to just use Iris for it

sinful tree
quasi tide
#

Ahh, right right. Completely forgot to even ask about the game state class. @urban palm

#

I just always have them match so they slip my brain

urban palm
#

Yes it is very likely that they were not matching, let me check

#

Indeed, Game Mode was AGameMode and Game State was AGameStateBase.

#

May also mean that if I switch both to be the same GameMode and GameState it would work?

#

Let me try

sinful tree
#

Yep

#

GameMode I think has some additional logic pertaining to spawning and stuff in it though? I'm not sure.

urban palm
#

When I switch the game mode to AGameMode the state classes switches as well

#

In BP

quasi tide
#

Yeah, like I said, I just literally always make them the same so them mismatching is not something that even registers for me. Just one of those things where you've done it so much that it is like breathing so you kinda forget about it.

urban palm
#

I don't do much multiplayer, just getting my feet wet with it

#

Yep confirmed. Using GameMode + GameStateBase blocks the animations on the clients.

quasi tide
urban palm
#

Doing my best, but want to improve on multiplayer too so I can be with the cool kids ๐Ÿ˜‰

quasi tide
#

Might as well rename it from "chaos-physics" to "physics-with-marco"

urban palm
#

The community of physics practitioners has actually grown

#

Need to try reversing game mode and game state

#

So GameModeBase + GameState, now the animaton is gone on the server too

#

But I removed my custom code which was forcing the animation tick

#

GameModeBase + GameStateBase everything works perfectly

quasi tide
#

Wonder if there were some log events complaining about the mismatch

urban palm
#

Same with GameMode + GameState (no Base on both)

#

Like if one had read the log...

quasi tide
urban palm
#

Yep

#

Ok ok I learned my lesson

#

--> RTFL

quasi tide
#

I wonder if it'd be better to just...crash actually.

#

Like assert that they're the same or something

urban palm
#

That would have been less painful

#

Also because everything works but the animations on the client

#

The weird thing is that when you reparent to GameMode the GameState class is automatically changed, at least in the override

#

Tested with 4 choppers

quasi tide
#

All I can think about is the Fortunate Son song ๐Ÿ˜…

urban palm
#

All I can think is the Wall by Pink Floyd

quasi tide
#

Just randomize the color. No longer The Wall

urban palm
#

Yeah, let's do that

urban palm
#

They got a colorful nose

quasi tide
#

Marco is about to be doing networked physics tutorials with chaos

urban palm
#

These are kinematic actors, so easy-peasy

#

Physics is next ๐Ÿ˜‰

keen hound
#

forgot a censor\

#

what is this error?

#

censored areas are just the ip and port

fathom aspen
urban palm
#

Wish I had checked the log more in details before spending a lot of time debugging it.

#

Anyway, learned the lesson.

#

Also searching online/forum etc. for "multiplayer skeletal mesh animations working on server but not on client" does not lead to any suggestion regarding GameBase/GameState wrong mix

true stream
#

how do I make it so when testing 2 players, I can have 2 equally sized windows occupying half the screen

#

instead of this sort of modal window popping up

graceful flame
true stream
#

currently running both instances on my PC

graceful flame
#

I just use PIE and then drag the windows to the edge of my monitor and windows snaps them over to become half the screen

#

I think there's some settings you can adjust to set the default PIE window sizes as well

true stream
#

yeah I spent some time inside the editor preferences and I thought it would be faster to ask

#

btw, if I understand correctly, it is possible to host a session and other player to connect to me through an IP address right

#

for testing purposes only

arctic minnow
#

How come I can host a server but the second my client joins it crashes? I tried it with another player character and it works fine but I disconnect event tick and begin play and it still wont work on my main character why? ๐Ÿ™‚

#

Steam servers

fossil spoke
#

You havent provided any information that would help us help you.

#

Have you checked the Logs?

#

Was a Crash Reporter with a Stack Trace produced?

#

If so, did you read it to find out what line of code is crashing?

arctic minnow
#

But have an amazing night/day! ๐Ÿ™‚ god bless you all! ๐Ÿ™‚ jesus loves you! ๐Ÿ™‚

keen hound
fossil spoke
keen hound
fossil spoke
dark parcel
pseudo wagon
#

Hi guys, what is the best way to handle RPC in standalone and listen server mode. Currently when in client RPC, I have to check if IsNetMode(NM_Standalone) then skip because the logic already run.

dark edge
dark edge
#

What's the actual order of your logic?

pseudo wagon
#

Method FuncA will be call twice.

thin stratus
dark edge
thin stratus
#

@pseudo wagon That's what you kinda do. You would just not RPC if the caller Has Authority

dark edge
#

I'd instead branch clientside and call FuncA logic locally if not server, that should cover all paths

#

I think we're saying the same thing

thin stratus
#

Jop

pseudo wagon
dark edge
#

or don't do the local change if you don't have authority

#

depending on what you want the default path to be

pseudo wagon
dark edge
#

Entry
if !HasAuthority
TellServerToDoThing
DoThing

TellServerToDoThing
DoThing

pseudo wagon
dark edge
#

oh in that case just do that all the time and it should work in all cases

#

er, sec

#

Is this a single client rpc or multicast?

pseudo wagon
#

It is single client,

dark edge
#

yeah your best bet will to be to gate by that or if netmode is dedicated or listen

#

depending on if a client can ever reach this code

thin stratus
#

If it's a Client RPC then you would have the same problem with ListenServer

#

The check for authority would then go into the client RPC instead

limber gyro
#

every tutorial on the CMC says to update the movement values on "OnMovementUpdated()", why is it done there an not on "Tick()" for example?

thin stratus
#

Well, Tick is used to split between all the different proxies that can run the code. There is a lot that happens between Tick and when you might actually want to do your stuff.

#

Basically, Tick might be way too early

#

There is prediction somewhere in between, and also parts where you might not want SimProxies to even call your code

limber gyro
#

thats very interesting, so is there any scenario that u can think of that you might wanna do it inside tick istead of OnMovementUpdated? or should i just do everything inside OnMovementUpdated as a rule?

limber gyro
#

can i consider OnMovementUpdated to be like a second tick?

gusty slate
#

Hello,
Is checking IsLocallyControlled the proper way to identify if a pawn is a proxy or not?

limber gyro
#

if its ur pawn, the one that is locally controlled then its an autonomous proxy, if it is someone elses than its a remote proxy

#

there are probably some edge cases where that is not true but im not sure

#

i thinks its safe to assume what i just told u

#

unless some one else wants to add anything to that explanation, im not an expert by any means

gusty slate
#

I feel like you're correct and when I said proxy I did mean an autonomous proxy ie a client controlled pawn

mystic estuary
#

Hello, does anyone know whether there's an event that is present both server and client sides to notify anytime a player enter/leaves the game?

jade ibex
#

is gamestate and playerstate just there to encourage a specific game structure? It doesnt do any server-to-client replication on its own?

jade ibex
#

oh not client

#

hmm

mystic estuary
twilit radish
#

The gamemode doesn't exist on clients yeah ๐Ÿ˜›

jade ibex
#

yeah forgor ๐Ÿ’€ that part

twilit radish
#

I think the gamestate has a certain event, Tony. One sec.

mystic estuary
#

I actually forgot to write an answer I found. GameState has Add/Remove PS functions, and it can be used for that. Initially I thought it is called server-side only, as nothing mentions anything about clients, but apparently it does

twilit radish
#

That's the one I was thinking of yeah.

#

It runs on the client as well as all it does is register it self whenever a playerstate gets created or replicated ๐Ÿ™‚

mystic estuary
#

Apparently it's called from here:

void APlayerState::PostInitializeComponents()
{
    Super::PostInitializeComponents();

    UWorld* World = GetWorld();
    AGameStateBase* GameStateBase = World->GetGameState();

    // register this PlayerState with the game state
    if (GameStateBase != nullptr )
    {
        GameStateBase->AddPlayerState(this);
    }
#

So yeah, it must work client-side

jade ibex
#

nice

#

kind of what i was asking as well lol

#

so playerstate has special events relating to server connection

#

and gamestate has special events relating to players connecting

#

?

twilit radish
#

The playerstate is mostly for as the name suggests storing data for a player, by default I don't think it stores much. I think it stores the player ping by default.

mystic estuary
jade ibex
#

awesome ty

twilit radish
#

But yeah, they are there to encourage a certain way to interact with Unreal's framework ๐Ÿ˜›

#

Technically you can work just fine without them but I would say it's definitely good practice to use them.

jade ibex
#

yea its cool, moving from unity to unreal, u dont have to do a lot of boilerplate work. The structure is there, its just, now you gotta spend time learning it instead of having to implement your own

twilit radish
#

I do like the way Unreal does these things yeah. The ones that allow you to optionally use extra stuff are great as well, sometimes you want more control versus something that might already be there. Obviously not everything Epic makes is going to work for all games or situations ๐Ÿ™‚

deft schooner
#

Hello,

does a component need to check "Component Replicated", when using events like these? Asking because it seems to work without it checked.

jovial mantle
#

Hi, I just found out that animation montages (especially for root animation) its automatically networked for other clients too by unreal engine. Is there any known drawbacks to using them extensively? since they are automatically replicated to the other users?

gusty slate
#

Hello,
I'm in a strange usecase where I need a certain object with collision can be visible/collision enbaled on Client only, but obviously Character movement is replicated and it feels that it is server authoritative, which makes my Client character be able to go through that object

#

Is there any way of making movement more client based?

#

or basically take into account what the client-side character is colliding with

arctic minnow
#

Does anybody know what could cause my game to crash when the second client joins the server steam advanced servers it seamed to work when I tried another starting character but I have no clue why my main one wont work? I tried disconnecting event begin plays and ticks and everything it still wont work does anybody have any clue why any help would be so amazing thank you!!!! so much! ๐Ÿ™‚ god bless you all! ๐Ÿ™‚ jesus loves you! ๐Ÿ™‚

hybrid crown
#

We agree that Net Culling Distance is calculated from posseded pawn to other actors, correct ?

arctic minnow
arctic minnow
#

Could steam vr cause it to crash?

thin stratus
#

@arctic minnow Would need more than that. Do you have any Callstack?

#

The last thing that I see is AGameModeBase::HandleStartingNewPlayer

#

But not what line or what followed

arctic minnow
arctic minnow
thin stratus
#

No clue, my ๐Ÿ”ฎ is broken

#

Would need the callstack to say more

#

The log doesn't seem to have any

arctic minnow
thin stratus
#

You can check if there are any additional files in the Saved folder related to crashes

#

Or if you can repro this maybe in Standalone

#

Does this crash in a packaged build or what are you doing here?

thin stratus
#

I would actually say: Depends

#

It uses

    /** Where the viewer is looking from */
    UPROPERTY()
    FVector ViewLocation;
#

So a Third Person Character might be calculated based on the Camera Location

#

First Person would give the idea of it being the Pawn Location, since they are mostly the same

thin stratus
#

If you don't change anything, then you will get corrections

#

Cause the Server won't run against the object of course

#

There is a boolean to ignore client corrections or so

#

That you could toggle

#

But that is of ocurse a free card for cheating

gusty slate
#

Hmm what I would prefer actually is to make movement client-side

#

Because im basically working on a chunk system

#

So the server knows about the chunk but i dont want the player hosting necessarily to load those object

hybrid crown
thin stratus
# hybrid crown Hum... that interessing. Thanks. So this is ViewLocation who determine that.
FNetViewer::FNetViewer(UNetConnection* InConnection, float DeltaSeconds) :
    Connection(InConnection),
    InViewer(InConnection->PlayerController ? InConnection->PlayerController : InConnection->OwningActor),
    ViewTarget(InConnection->ViewTarget),
    ViewLocation(ForceInit),
    ViewDir(ForceInit)
{
    check(InConnection->OwningActor);
    check(!InConnection->PlayerController || (InConnection->PlayerController == InConnection->OwningActor));

    APlayerController* ViewingController = InConnection->PlayerController;

    // Get viewer coordinates.
    ViewLocation = ViewTarget->GetActorLocation();
    if (ViewingController)
    {
        FRotator ViewRotation = ViewingController->GetControlRotation();
        ViewingController->GetPlayerViewPoint(ViewLocation, ViewRotation);
        ViewDir = ViewRotation.Vector();
    }
}
#

ViewingController->GetPlayerViewPoint(ViewLocation, ViewRotation); returns the CameraViewPoint

#

At least in some cases

#

Best to read the code yourself

hybrid crown
flat halo
#

Hey folks, I am trying to replicate movement on my pawn (not ACharacter and ACharacterMovement).
My game is LAN multiplayer, so I am trying to do everything on the Server, and not account for lag at all.
On the client side, I just send the raw user inputs, like a direction from AWSD.
On the server, I receive this input and move the pawn.
The server also has a pawn. (listen server)
On the server instance, I see both pawns moving as expected, so the input from the client is working.
But on the client instance, I see only the server pawn moving.
OnRep_ReplicatedMovement never gets called for the client pawn.
Replicates and ReplicatedMovement is all turned on, as well as AlwaysRelevant.
I am not finding whats the issue, and not finding anything online.
I have been putting breakpoints on the engine source, but still no luck.
Does anyone know what I am missing?
Thank you!

unkempt tiger
#

i know this sounds like a silly idea but do non-player controllers have a playerstate of their own? because it sure would be nice and could solve some design problems

thin stratus
#

Otherwise UT bots would have a problem :P

unkempt tiger
#

Oh? thats awesome, so here's a question, why is the AActor's Instigator member a pawn and not a playerstate?

thin stratus
unkempt tiger
#

a pawn is transient, it can die and stuff

thin stratus
#

I assume this is marked as Sim Only

thin stratus
#

The PlayerState didn't instigated e.g. a Weapon firing

#

The PlayerState is available to APlayerController and AAIController

#

But the function to spawn one is available to AController

#

So you could also inherit from that and simply call InitPlayerState on the Server inside PostInitializeComponents

#

For AIController you simply need to flip bWantsPlayerState to true

#

That already exists and is set up

unkempt tiger
#

Thats good to know, thank you ๐Ÿ‘

thin stratus
#

Well AddForceAtLocation is Physics stuff

#

Can't really be compared to the CMC

unborn nimbus
#

What is the correct way to load into a listen server map? CommonSessionSubsystem calls GetWorld()->ServerTravel(PendingTravelURL); but this doesn't actually tell the NetDriver to start listening

thin stratus
#

@twin juniper Well, the thing is, you just shouldn't use Physics in Multiplayer as you said

#

Applying a Force via the CMC also works

thin stratus
#
void UCharacterMovementComponent::ApplyAccumulatedForces(float DeltaSeconds)
{
    const FVector GravityRelativePendingImpulseToApply = RotateWorldToGravity(PendingImpulseToApply);
    const FVector GravityRelativePendingForceToApply = RotateWorldToGravity(PendingForceToApply);
    if (GravityRelativePendingImpulseToApply.Z != 0.0 || GravityRelativePendingForceToApply.Z != 0.0)
    {
        // check to see if applied momentum is enough to overcome gravity
        if ( IsMovingOnGround() && (GravityRelativePendingImpulseToApply.Z + (GravityRelativePendingForceToApply.Z * DeltaSeconds) + (GetGravityZ() * DeltaSeconds) > UE_SMALL_NUMBER))
        {
            SetMovementMode(MOVE_Falling);
        }
    }

    Velocity += PendingImpulseToApply + (PendingForceToApply * DeltaSeconds);
    
    // Don't call ClearAccumulatedForces() because it could affect launch velocity
    PendingImpulseToApply = FVector::ZeroVector;
    PendingForceToApply = FVector::ZeroVector;
}
#

This is being called by the CMC

#
void UCharacterMovementComponent::AddForce( FVector Force )
{
    if (!Force.IsZero() && (MovementMode != MOVE_None) && IsActive() && HasValidData())
    {
        if (Mass > UE_SMALL_NUMBER)
        {
            PendingForceToApply += Force / Mass;
        }
        else
        {
            UE_LOG(LogCharacterMovement, Warning, TEXT("Attempt to apply force to zero or negative Mass in CharacterMovement"));
        }
    }
}
#
void UCharacterMovementComponent::AddImpulse( FVector Impulse, bool bVelocityChange )
{
    if (!Impulse.IsZero() && (MovementMode != MOVE_None) && IsActive() && HasValidData())
    {
        // handle scaling by mass
        FVector FinalImpulse = Impulse;
        if ( !bVelocityChange )
        {
            if (Mass > UE_SMALL_NUMBER)
            {
                FinalImpulse = FinalImpulse / Mass;
            }
            else
            {
                UE_LOG(LogCharacterMovement, Warning, TEXT("Attempt to apply impulse to zero or negative Mass in CharacterMovement"));
            }
        }

        PendingImpulseToApply += FinalImpulse;
    }
}
#

Will of course cause corrections if not done on Server and Client in the same timestamp, but that's as usual

unborn nimbus
thin stratus
#

UEngine::SetClientTravel does some extra checks to not connect to yourself etc.

#

So you can use that

#

I would even go as far as just using OpenLevel

#

No, I usually dump info

#

You can see the function names

#

They are even BP exposed

#
    /** 
     * Add impulse to character. Impulses are accumulated each tick and applied together
     * so multiple calls to this function will accumulate.
     * An impulse is an instantaneous force, usually applied once. If you want to continually apply
     * forces each frame, use AddForce().
     * Note that changing the momentum of characters like this can change the movement mode.
     * 
     * @param    Impulse                Impulse to apply.
     * @param    bVelocityChange        Whether or not the impulse is relative to mass.
     */
    UFUNCTION(BlueprintCallable, Category="Pawn|Components|CharacterMovement")
    ENGINE_API virtual void AddImpulse( FVector Impulse, bool bVelocityChange = false );

    /** 
     * Add force to character. Forces are accumulated each tick and applied together
     * so multiple calls to this function will accumulate.
     * Forces are scaled depending on timestep, so they can be applied each frame. If you want an
     * instantaneous force, use AddImpulse.
     * Adding a force always takes the actor's mass into account.
     * Note that changing the momentum of characters like this can change the movement mode.
     * 
     * @param    Force            Force to apply.
     */
    UFUNCTION(BlueprintCallable, Category="Pawn|Components|CharacterMovement")
    ENGINE_API virtual void AddForce( FVector Force );
#

Velocity += PendingImpulseToApply + (PendingForceToApply * DeltaSeconds);

Math behind it

unborn nimbus
thin stratus
#

Don't think that's a thing for the CMC

#

If you are planning on rotating the Character by applying upwards force offset from the center or so, you might need to start coding your own :D

#

If you can use C++, I would suggest you add a custom MovementMode

#

They usually, in Swim or PhysFlying, call this SafeMoveUpdatedComponent(Delta, UpdatedComponent->GetComponentQuat(), true, Hit);

#

That allows passing in a Rotation

#

Back when I coded my own I used that to rotate a 360ยฐ hover drone

#

But that needed a lot more code so I don#t think you need your own, but just a child class

#

You could then add your own AddForce functions that apply a force offset to the center and calculate the resulting rotation quat

#

Should totally be possible

#

Just needs a bit of work :D

#

And since it's a Quat, you should not have problems with gimbal lock

#

Unless Quat defeat you, like they did me a couple of times already

#

Ah so, you don't need to rotate the character?

#

Or at least not pitch and roll?

#

I mean

#

The CMC doesn't rotate the Character on pitch and roll via the applied force

#

That's why it just passes the current Quat to the function

#

It only moves it

#

Eh :D I'm not sure that matters match given that the CMC is not physics

#

All it does is applyed a Velocity (not rotational) to the Character's Location

#

Or rather its root component

#

While keeping the Rotation the same

#

Yeah...

#

Usually people rotate the character via the ControlRotation

#

Which might also affect all 3 axis

#

but if you only need Z and thus not care about gimbal, you could try to apply it by hand locally via the ControlRotation

#

It will replicated to the server then

#

Ya then you could only modify the Rotation of the Actor directly

#

I would go with the CMC child :P

#

Yeah, CMC Child -> Custom Movement Mode -> Calculate Quat and Location offset yourself, call SafeMoveUpdatedComponent with those values

#

Everything Physics is shite for Multiplayer

#

So yes

#

Def not Physics haha

dark edge
#

They modified the physics so much that they basically made their own version of CMC

thin stratus
#

You can just watch their video

#

But it's not really in-depth

dark edge
#

I mean there's not really a super strict divide between a movement component and physics. It's still simulating physics, just with different code and different rules, and doesn't really interface with the "real" physics scene

#

You could think of the CMC as its own physics engine

#

The sim isn't the hard part, it's the prediction and reconciliation that is

#

a local multiplayer Rocket League would be super easy

thin stratus
#

CMC isn't really its own physics engine, but I get why you would say that

dark edge
#

yup.
A character is a capsule with these rules to move around that somewhat simulate Newtonian physics with the modifications you come to expect from character movement.

thin stratus
#

Either way, Physics + Multiplayer bad

#

Maybe Chaos improved on that

dark edge
#

I'm doing physics + multiplayer but I'm very glad I'm not having to do prediction

thin stratus
#

But in general you want to stick to silly little vector math

dark edge
#

Physics + multiplayer = hard but doable. //World of Tanks is here
Physics + multiplayer + prediction = hell naw //Rocket League is here

thin stratus
#

Maybe ยฏ_(ใƒ„)_/ยฏ

#

But I'm not here to discuss that. I think you have enough on your hands to get that stuff working with the CMC :P

flat halo
true stream
#

I got a doubt, Im reading the multiplayer compendium, and trying to simulate a simple chess-ish game where both players can create new pieces and place them on the board, it works if I just RPC on the server to the client, both get the newly added piece, but when I try on the client it doesn't.

#

Obviously Im not understanding something, what is the right way to tell the server to create an actor for both listen-server and client, from either of these instances?

sinful tree
# true stream I got a doubt, Im reading the multiplayer compendium, and trying to simulate a s...

You want to use replicated actors and spawn them only on the server. This means if you want to allow a client to tell the server to spawn an actor, you must send a server RPC with some details about what the client wants and when running on the server spawn the actor as desired. No need for any special listen server specific code for this as they can just use the same inputs that call the server RPC and spawn the actors.

true stream
#

this works only server -> client, what piece of the puzzle Im missing to complete the other side of things?

thin stratus
#

Is that piece actor marked as replicated?

#

Also where are you calling this in?

#

What is "Main"

#

@true stream

true stream
true stream
thin stratus
#

You can't call Server RPCs in there

#

You need a client owned actor

#

Your puzzle piece is Ownership

#

Which the compendium has a page or so about

true stream
#

yeh Im currently reading that

thin stratus
#

The RPC has to be in e.g. the PlayerController or the Pawn/Character if you have one possessed. Or the PlayerState but that makes no sense here

#

PlayerController probably makes the most sense at this point

true stream
#

so whats the context/scope/ownership of the level blueprint?

thin stratus
#

Server is the owner in theory

#

That's what it's like with most single actors where only one exists per march

#

GameState too

true stream
#

alright, so I will bring this logic to playerController and try again

thin stratus
#

Yus

true stream
#

I dont have a "Pawn" in this chess-ish game, no character either.

thin stratus
#

Yeah then PC

true stream
#

but I've heard some people recommend to always have one

#

even if its hidden

thin stratus
#

No, doesn't make sense if you don't need one

true stream
#

k

dark edge
rose turret
#

I have a TArray of FMyCustomGameEvent* which represents events that happen in the game and I want to replicate to all clients via the game state. these game events are polymorphic so there's a like FUserScoredPointsEvent etc. that I create on via NewObject and then just put a pointer into the TArray

do I need to do anything special to replicate that via GameState so it comes out identical on the other end? if so, what?

sinful tree
# true stream Im currently using blueprints, and this is what I have:

As well as what Cedric was recommending, hit result under cursor only triggers on the client, so you can't get the value from a client while running on the server. You'd have to pass the information as an input on your RPC so the server receives it - you should only need to pass the hit result location that you're using rather than the full hit result data.

true stream
#

the actors were being set at 0,0,0

true stream
dark edge
#

Probably can with ignorecollision too but I'd lean towards channels if you're gonna have a lot of stuff but not a ton of teams

true stream
#

is that for actors only or I can have my own lightweight object (bullet) in the future and still use that

dark edge
sinful tree
dark edge
#

Instead of a collision channel Pawn, you might have RedTeam and BlueTeam which are the same except they don't collide with their own team.

#

and a red person shooting a bullet will be tracing for hits vs BlueTeam but ignore RedTeam

true stream
dark edge
#

it doesn't have to be

#

but something somewhere will be the actor

true stream
#

what does that mean

dark edge
#

maybe it's your ProjectileManagerActor which handles all "bullets"

true stream
#

ah

dark edge
#

If you were making ARMA you could just have bullets that exist as data only and have nothing renderable, but you usually want to see yours

true stream
#

so the pooling would happen inside a manager actor

dark edge
#

yeah, or a subsystem (that's my approach)

#

but I'll still need something to do the visualization for all the bullets in the world which would have to be an actor somewhere

true stream
#

got it

#

when I get there I will start having some fun with that

dark edge
#

now if you need bullets to hit bullets thats another matter

true stream
#

because collisions only work for actors?

dark edge
#

mostly because there's nothing to hit

#

a line trace hits things in the world

#

the "bullet" isn't in the world, it's just data that says where to trace each frame and what to do if you hit something.

#

you could have that same manager move colliders around for you for the certain projectiles that need to be hittable

true stream
#

Yeh, it will depend on my very specific use case

#

Bottom line is, I can have a visual representation of the "bullet", and detect collisions through different methods

#

without them being an actor

dark edge
#

Say you wanted bullets and grenades to be handled by the same system, but a grenade should be able to be hit by a bullet and destroyed:

struct Projectile
Position
Velocity
OnHitEffect
bHittable

MyProjectileManager.Tick
for each ProjectileStruct
Update Velocity
Trace
if Hit
Do Hit logic
Update Position
If bHittable
Move a SphereCollider there

thin stratus
#

Pawns are fully optional

dark edge
#

TIL

true stream
#

thats defined in the gamemode right

thin stratus
#

The DefaultPawnClass for example ys

#

Yes*

#

But it could also be manually spawned

thin stratus
#

And replicating them with the base class will of course object slice them

#

You should have a look at the FInstancedStruct

#

Both for replication and for the polymorphic stuff

steel vault
#

Having some slight issues with seeing characters and projectiles in my game. A listen server spawns and can see the health bar of a client far across the map and knows where he is and sees the projectiles he fires from there. The client, can't see the health bar of the listen server character nor his projectiles until he gets close enough. Which variable am I to mess with to make sure the distance is greater for seeing such things? It's not net cull distance is it? Or is it a rendering distance elsewhere?

steel vault
#

Yep, seems to be net cull distance squared not being high enough. Not sure what the repercussions are for greatly increasing this on players and actors

fossil spoke
#

The higher it is, the further from that Actor you need to be for it to removed from "relevancy".

#

Relevancy is basically something like, "Am I to far away to matter to who might be viewing me".

steel vault
#

Right. Makes total sense. I guess I'll play with the values now that I know the real issue and try to get something that makes sense for my game type.

#

Thanks!

fossil spoke
#

The Listen Server can see everything at all times, because its the Server.

arctic minnow
#

Anyone understand this?

fossil spoke
#

Its a function in C++

arctic minnow
lost inlet
#

Well without more context, it's impossible to tell

arctic minnow
#

https://forums.unrealengine.com/t/dedicated-server-crash-gamemodebase-handlestartingnewplayer/258958/1 Seams as if this person had a issue kinda the same but mine is with steam

Epic Developer Community Forums

Hello everybody, my dedicated server crash when the first player is joining. The only output in log is the following: โ€œLogOutputDevice: Warning: Script Stack (1 frames): GameModeBase.HandleStartingNewPlayerโ€ โ€œLogWindows: Windows GetLastError: The operation completed successfully. (0)โ€ โ€œLog file closed, 11/02/21 15:56:41โ€ No callstack is pre...

lost inlet
#

Yes, so what's the callstack? This is the BP callstack so not really applicable

arctic minnow
#

Wdym callstack?

lost inlet
#

A list of function calls in reverse order. It's usually part of the crash log, or if you're debugging through VS/Rider then it'll halt execution there and show the issue with more info

arctic minnow
#

Crash Log

lost inlet
#

Not really enough info here, is this a BP only game?

lost inlet
#

This also shows up in almost everyone's log and can be ignored

#

Assertion failed: this->PropertyClass [File:Runtime\CoreUObject\Public\UObject/UnrealType.h] [Line: 2234]

Is also right there

jaunty palm
#

@arctic minnow I think there is still bug in the steam subsystem. You can try to add these to your game's defaultengine.ini:

#

[ConsoleVariables]
net.CurrentHandshakeVersion=2
net.MinHandshakeVersion=2

arctic minnow
jaunty palm
rose turret
#

I'm not sure I understand instancing/replicating TArrays of UObjects

I have a dynamic TArray on the server and I want it to contain UMyGenericClass* which has lots of different overriding classes. this should then replicate down to the client

I declared UMyGenericClass with UCLASS(Abstract, EditInlineNew, BlueprintType, DefaultToInstanced) and marked the TArray and instanced (?)

but I just get an array of NULLs on the other side

fossil spoke
#

Only AActors are replicated.

arctic minnow
rose turret
jaunty palm
#

I am not familiar with steam as I donโ€™t use it but this seems to be problem in your gamemode base as you need to handle the spawning by yourself

arctic minnow
#

Oh I see thank you! ๐Ÿ™‚ have an amazing day! ๐Ÿ™‚ god bless you! ๐Ÿ™‚ jesus loves you! ๐Ÿ™‚

rose turret
arctic minnow
#

Also should parent class for my gamemode be gamemode or gamemodebase?

fossil spoke
#

Everytime you call NewObject to create your next UMyGenericClass object, you need to add that object as a replicated subobject

#

You would do this before adding it to the TArray

rose turret
#

ooooooh I see I see

fossil spoke
#

Read the page I linked, its rather straightforward.

rose turret
# fossil spoke Read the code samples on the page.

ok then one more question before I go this route: if I use FInstancedStruct instead for this, will it do smart things with GUIDs if I have a pointer to e.g. a player state in my struct?

FInstancedStruct seems a bit lighter weight for what I'm doing since these objects won't change after they're created

fossil spoke
#

Actors are always referenced by a NetGUID once they have been initially resolved.

#

It doesnt matter if its inside of a Struct or another Actor

#

A Struct sounds like a better choice for you if all you are doing is passing around a pointer to another Actor

#

You also shouldnt need an instanced struct

#

A regular struct would be fine

#

Unless you plan on taking advantage of the instanced struct functionality.

rose turret
# fossil spoke A regular struct would be fine

my TArray has generics in it. it's a big log of everything that's happened in the game, so it's a TArray of UMyGameEvent* and those can be arbitrary subclasses (UPlayerDiedGameEvent*, etc.)

fossil spoke
#

Why on earth are you replicating that?

rose turret
rose turret
# fossil spoke Why on earth are you replicating that?

I had it as individual properties + onreps but things got crazy when I added bots because they would take multiple actions really quickly and the user would just get one on rep. so they wouldn't see the individual actions that led to the end state and they couldn't animate everything properly on the client side without a ton of hacks

this way they can see "bot rolled a 5", "bot purchased a house", etc. and animate everything in order

fossil spoke
#

If its turn based why not just pack all of that into the turn state. Why do you need a replicated historical log? That seems extremely silly.

rose turret
fossil spoke
#

You record everything a Player (or Bot) does in their "turn", then when their turn is done, all that turn information is sent to the others (probably should be via an RPC). Those Players can then just hold a local copy of that Players turn for historical data.

rose turret
fossil spoke
#

Current state would still be handled by individual actors etc

#

The โ€œturnโ€ state would probably only notify Players of what actions were taken. Not what the new gamestate is.

#

A system like this is far more involved than what i can explain here

#

There is a lot to consider when designing systems for multiplayer.

rose turret
#

hmm yeah I think because of the disconnect/reconnect and spectator thing + that I want users to be able to see the history of all actions (it's important for this game) I'll just rep the history

since it's append-only, my worst-case is I'll do some custom delta serialization thing to only send over the new events. but I doubt I'll be bandwidth limited on this

#

thanks -- this helped me understand UObject replication a lot better!

limber gyro
#

is there any scenario that you might wanna do logic inside tick istead of OnMovementUpdated in the CMC? or should i just do everything inside OnMovementUpdated as a rule? can i consider OnMovementUpdated to be like a second tick?

hushed rain
#

Getting this fatal error on the Client after seamlessly travelling from 1 map to another, any idea what it could be from/how to fix? I saw this bug tracker which I think may be what it is... but not sure https://issues.unrealengine.com/issue/UE-200510

Assertion failed: NumDormantObjectsPerConnectionRef > 0 [File:D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\NetworkObjectList.cpp] [Line: 350]

*Also using SteamCore pro.

Unreal Engine

Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

sinful tree
hushed rain
sinful tree
#

Fairly certain that is the issue. The line you're crashing on is the one referenced in the bug report which is line 350 that is contained in the FnetworkOjectList::MarkActiveInternal:

check(NumDormantObjectsPerConnectionRef > 0) hit in FNetworkObjectList::MarkActiveInternal

hushed rain
#

Awesome, yea, I need to just get source one of these days lol. So annoying tho ๐Ÿ˜ฆ

limber gyro
#

when is "PrepMoveFor()" called in the CMC?

sinful tree
# limber gyro when is "PrepMoveFor()" called in the CMC?

It looks like it's called in ClientUpdatePositionAfterServerUpdate() and during a loop:

    // Replay moves that have not yet been acked.
    UE_LOG(LogNetPlayerMovement, Verbose, TEXT("ClientUpdatePositionAfterServerUpdate Replaying %d Moves, starting at Timestamp %f"), ClientData->SavedMoves.Num(), ClientData->SavedMoves[0]->TimeStamp);
    for (int32 i=0; i<ClientData->SavedMoves.Num(); i++)
    {

Based on what I'm seeing here, I'm guessing it gets called if there is any saved moves that the client has sent but haven't been acknowledged by the server and there was a correction received from the server. Not 100% on that tho.

abstract pike
#

At the moment when a player gains some resource I use a Client RPC on the player controller to show a little number at the place the resource was gained. Naturally there have become quite a few ways to gain resource and as such is leading to fairly consistent stream of RPCs. Is there a better way to do this with a property or is it fine just sending a bunch of unreliable RPCs?

Cheers in advance

limber gyro
#

when ur actor "loses" a resource you can have that variable replicate and make the effect show on a rep_notify

#

that would be the least expensive way i belive

limber gyro
abstract pike
#

Well these are by definition one off events though basically. It's not exactly a "state" to keep in sync. I thought about how to use a property but it could get overriden by the next resource gain and trample the value that was in the middle of sending.

#

I guess I don't really know how much back and forth happens to "sync" a replicated prop vs fire a RPC and forget about it.

#

I could see RPCs being cheaper somehow depending how they're coded

limber gyro
#

honestly it will depend greatly on what ur doing

#

if ur gattering resources rly fast u could possibly fake that resource gathered visual "pop" with a change in state and a timer

#

say for example, u have a var " ResourcesAreBeingGathered" that u can turn on and off

#

it turns on in the server, replicates to the client and on a timer u do the "pop" animation

#

locally

abstract pike
#

Yea that's possible with regular resource gains

limber gyro
#

it all depends on ur project

abstract pike
#

Some aren't as regular so that wouldn't work but maybe that's enough to just make the timed ones simulate it

limber gyro
#

is cheating an issue?

abstract pike
#

Could be a little weird if it's out of sync and the popup happens not when the resource incrreases but it's worth an investigate

limber gyro
#

how many players are u looking to support per server?

abstract pike
limber gyro
#

if ur not gonna have many people play at the same time just let the RPC's be lol

#

its not worth the trouble

abstract pike
#

At the moment it's more like 4 or less

limber gyro
#

im by no means an expert, but ive been running tests on my game which is 3v3 and i have yet to have issues with rpc's

abstract pike
#

Given no clearly better thing has leaped out at me it's probably just best to leave it until it shows up in a profile as a networking issue

sinful tree
# limber gyro so it happens sporadicly and not in any specific order i would assume?

ClientUpdatePositionAfterServerUpdate() is called on tick of the CMC under certain conditions (looks like it would be only on the owning client of the character and if there was some data sent back from the server indicating that there was an update to their position)

        const bool bIsClient = (CharacterOwner->GetLocalRole() == ROLE_AutonomousProxy && IsNetMode(NM_Client));
        if (bIsClient)
        {
            FNetworkPredictionData_Client_Character* ClientData = GetPredictionData_Client_Character();
            if (ClientData && ClientData->bUpdatePosition)
            {
                ClientUpdatePositionAfterServerUpdate();
            }
        }
thin stratus
#

RPCs for one time events that show some UI with how much was gained are theoretically fine. The main resource should of course be a Variable and not an RPC.

If you are worried about too many RPCs, you can add some central object, like a component on the PlayerController, which collects all the requests and sends an array of data instead of multiple RPCs if you get more than one event per frame.

#

@abstract pike

limber gyro
#

other question that i asked earlier but didnt get a response:
is there any scenario that you might wanna do logic inside tick istead of OnMovementUpdated in the CMC? or should i just do everything inside OnMovementUpdated as a rule? can i consider OnMovementUpdated to be like a second tick?

abstract pike
thin stratus
limber gyro
thin stratus
limber gyro
#

i will do a quick search to see if i missed it

thin stratus
abstract pike
thin stratus
#

An RPC with an Array Param, yes

thin stratus
limber gyro
#

heres the one that you answered

abstract pike
limber gyro
#

then i asked that one

#

thank you for answering now

#

as always u are very helpfull

thin stratus
#

I still feel it's basically the same question haha

thin stratus
#

And then only sent when the array has an entry

#

Then you don't have to worry in the future

#

Epic does RPC batching for their systems too

#

Such as Gameplay Ability System

#

You can also not do it now and later refactor if you notice bandwidth issues or similar

sinful tree
#

I was going to say it could be worth it, but it's also like pre-optimizing before knowing there's an actual problem.

abstract pike
limber gyro
#

say i want to do timed speed increase in the CMC so that i have replication, i set my bool in the "SavedMoves" like ur suposed to, than based on that bool i do a timer to turn it off to end the speed increased in the "OnMovementUpdated". Is this a thing that you can do that wont break the prediction? if yes, is it a good or "correct" way to do timed moves in the cmc? anything that i should look out for when using timers in the CMC?

chrome bay
silent valley
#

Anyone else seeing a lot of this spam after upgrading to 5.3?
LogNetPlayerMovement: Error: FCharacterNetworkSerializationPackedBits::NetSerialize: Dropping move due to NumBits (4398) exceeding allowable limit (4096). See NetPackedMovementMaxBits.

We have a custom CMC, but we only have 4 extra bits added to the savedmove struct ๐Ÿค” .

#

Game seems to work fine, no obvious corrections etc.

formal adder
#

General question if im unsure whether i want to do multiplayer because of general lack of experience and knowledge with mp stuff Do i need to decide right at the start of my project to make a multiplayer game?

silent valley
plucky prawn
#

is it possible to make an actor/component only tick on the client? i guess disabling tick initially then enabling it on beginplay if its locally controlled or the owner is locally controller

frozen wraith
#

is there any difference in replicating a Anim Montage than a Anim Sequence?

#

Like, they should both work, right?

limber gyro
#

i dont think animation stuff is replicated at all

#

well at least animation blueprints arent

frozen wraith
#

Well because I have tried to replicate the animation sequence of firing a pistol. Here's how I've done it:

#

I've followed through with breakpoints and prints and all nodes are valid (as in they are recieving data) but It keeps giving me a null error when it fires too.

#

Blueprint Runtime Error: "Accessed None trying to read property K2Node_CustomEvent_Target_Multicast". Node: Play Animation Multicast Graph: Server Function: Execute Ubergraph BP Third Person Character Blueprint: BP_ThirdPersonCharacter

#

Like I'm so confused lmao

#

I've done the same replication of Anim Montages as in the screenshot above, which works somehow (?) ๐Ÿ˜…

#

but maybe these kinda anims are not usually played in online games, something I haven't actually thought about nor paid attention to

lost inlet
#

Though the principle I've usually followed is replicate the data necessary to reproduce animation on each client

#

Though this node is odd, the client sends an RPC to the server and then the server multicasts the event. Why all the target parameters?

limber gyro
#

looking at my c++ code ur suposed to get the animation instance in the mesh

#

are u doing that?

#

something like this

limber gyro
#

im trying to do a dash in the CMC but im a bit stuck as to how i would pash the dash direction to the class and how that would work with replication

#

i mean, i can set the flag locally and it will replicate to the server CMC but how would the direction even be processed?

tall drum
#

Hi folks

I am struggling with ISM for the clients.
How do you replicate AddInstance ()?

arctic minnow
#

Does anybody know some common causes for this? when a client connects to server, the server will crash immediately. 4.27 steam advanced sessions.

silent valley
limber gyro
silent valley
#

you might use Cusom_0 to indicate that your dash direction was set for example

limber gyro
#

but what would be the advantage of that if i can just pass a bool for example?

#

im just so confused with the CMC

silent valley
#

he does it for sprint but the same concept applies for anything you want the character to do

limber gyro
#

thats exactly the tutorial that i am following

#

and while he does half of what i need i still have questions

true stream
#

Question, I got a listen server and a client, the server player start camera is working fine, but the client doesnt seem to care about the second player start camera, not sure why, any ideas?

#

basically the angle the client is looking at is reset to 0.

#

while the server follows the playerstart properties correctly

#

must be a setting somewhere I cant find

hot steppe
#

Hi, just wanted to ask, cause i cant find the answer anywhere. I wanted to make a game for my friends and its like a murder mystery / among us / deceit in one. 5 players, 1 is a deadly creature, but acts as a normal player so people have to guess who it is and do everything to stop the creature. Exactly like secret neighbour. So, the question here is What replication type should I use for this game? I thought about listen server, but I get too confused about all of these types, so thats why Im asking here. Im kind of new in making multiplayer games, so any advice will be ultra helpful. Thx to all of you in advance, have an awesome day ;>
(Also im using blueprints)

silent plank
#

how do i get a FUniqueNetId from a FUniqueNetIdRepl

silent valley
hot steppe
silent valley
#

yeah it's fine

#

just means one player is the 'host'

#

all gamelogic runs on the host and is replicated to the other clients

sinful tree
limber gyro
#

so its just there for eficiency, in theory they are not needed?

sinful tree
#

Yes. The reason for using the flags is because this data is replicated every frame, and multiplied by the number of characters that are using this movement component.
So if you're sending that 1 byte for 10 characters, at 60 FPS, that's 600 bytes of data that has to be replicated to all the players every second vs what could be 75 bytes if you were to only send that bool as a flag. And the fact is, regardless, that 1 byte being used for the flags is already always sent, so there's no additional overhead by you utilizing what is there, but there is if you're sending your own variables in the structure.

quasi tide
#

Trade CPU perf for bandwidth perf

#

(We talkin' about packing?)

limber gyro
#

i mean for ur regular 10 or so players game its not gonna make a diference right?

sinful tree
#

If I remember right, Unreal was designed to run on dial up connections, where you may only have maybe a max of about 6KB/s available so any bandwidth savings is good and allows your game to be played by those even with lower bandwidth connections and it can help facilitate a higher amount of players - only about 20% of the world is using broadband, and only about 40% if you only count developed parts of the world. Imagine using an additional 1% of available bandwidth per character just to indicate whether they're sprinting or not. Even if your bool isn't set true, it's still going to be sending its value every frame.

If anything adding an additional byte is redundant as the engine is already sending the flags byte regardless if you decide to turn on another bit within it. If you're sending another byte when all you need to send is a bit, why send the byte? It is an optimization, sure, but it's already built in, so you may as well use it.

pearl bear
#

Hello everyone, I want to learn how networking works and its basics in Unreal Engine. I know about Layer 4 networking, I'm currently unhappy with the netcode of the game I'm developing and I'm sure there's something I'm missing. Can you recommend comprehensive texts about Unreal Engine networking that I can read, apart from the documentation?

fair latch
flat halo
#

Hey guys,
I am sending an Unreliable RPC to the Client on every tick.
If I mark this RPC as Client, it is called in the client at high rate like expected.
However if I mark it as NetMulticast, it is called in the client at a much lower rate.
Both tests running with only 1 client connected.
Is this the intended behavior?
How can I get the Unreliable NetMulticast RPC to get called at high frequency?
Thank you.

flat halo
#

Okay, I just run more tests and got different results with the NetMulticast:

  • If I run the server in the editor and the client on standalone, the client runs the rpc at slow rate.
  • If I run the client on the editor and the server on standalone, the client runs the rpc at high rate.
  • If I run both on standalone, the client runs the rpc at high rate as well.

So it seems like its a problem only when I run the server on the editor. But again, if I change the RPC to be Client instead of NetMulticast, then even when I run the server in the editor I get high rate updates on the client.

keen hound
#

I'm trying to join a server though the IP, when I try connecting it doesn't allow me to join and gives me this error. When the server provider tested it however they were able to.

fair latch
#

@flat halo calling multicast rpc on client is useless and will just get dropped

fair latch
solid river
#

Does the body of input handling functions, for example Move() or Look() in Third Person Template, registered with UEnhancedInputComponent::BindAction() run only on the owning client?

sinful tree
lost inlet
#

There is absolutely no networking with input

keen hound
#

Via Pingperfect

lost inlet
# keen hound Via Pingperfect

Might need more info here, are both the client and server built with the same online subsystem configuration (looks like null OSS here) and from the same commit?

keen hound
lost inlet
#

If earlier you did a dev or test build, and this is shipping then you might need to do the Target.cs setup

#

But it'd be good to know the setup

solid river
#

I see. That is why in the code below I don't see any network mode check used in the input handling function.

// it is a function decorated with UFUNCTION(server) in the header file
void AMyCharacter::Server_HandleFire_Implementation()
{
    // ...
    GetWorld()->SpawnActor<ABomb>(...);
    UE_LOG(LogTemp, Warning, TEXT(__FUNCTION__));
}

// No network mode check is used. It means that this body is always executed on the owning client, right?
void AMyCharacter::Fire(const FInputActionValue& Value)
{
    // ...
    Server_HandleFire();
}
lost inlet
#

Yes, input actions will only be run on the controlling client. Input components are only created on clients

flat halo
flat halo
#

to clarify and summarize:

  • I am sending the RPC from the Server to the Client.
  • The RPC is Unreliable.
  • I am sending it on Tick.
  • If I mark the RPC as Client, the client will have the _Implementation called at a high rate as expected.
  • If I mark the RPC as NetMulticast, the client will have the _Implementation called at a much lower rate.
  • The issue occurs only when using NetMulticast and running the Server on the editor.
keen hound
#

my bad for the ghost ping, forgot a censor

#

It's not working still

lost inlet
#

and what is the difference?

keen hound
lost inlet
#

so did you build a game/client target with the same settings?

keen hound
#

do I need a clienttarget.cs?

lost inlet
#

well if you make a dedicated client, then yes. but you need either a game or client target with matching settings

lost inlet
#

yes

solid river
#

Why doesn't UHT automatically define the body of GetLifetimeReplicatedProps()? It seems UHT can do it automatically based on specifiers we pass to UPROPERTY().

keen hound
lost inlet
solid river
lost inlet
#

push model is where you explicitly invalidate properties for replication rather than a comparison happening on each net update deciding it instead

#

see PushModel.h

solid river
#

What can we infer from each of the following cases? GetLocalRole() returns ROLE_Authority but GetRemoteRole() returns

case 1: ROLE_None (I guess it is a pawn that is not replicated)
case 2: ROLE_SimulatedProxy (I guess it is a pawn spawned on a listen server and controlled by it)
case 3: ROLE_Authority ( I have no idea)

#

It seems it is impossible for both local and remote roles to be ROLE_Authority.

sinful tree
steep rock
#

Hello, how do I persist data stored in player state when using seamless travel?
I have searched around and found that I had to override CopyProperties and OverrideWith and grab the values from there
But the function doesnt seem to be called when I travel to new map, is there something that I might have missed or overlooked? Or my approach can be done better? Thanks!

solid river
#

What are non-replicated actors available only on the clients when the game starts?

jovial mantle
#

Im kinda new too but u can get more information here
https://youtu.be/Hsr6mbNKBLU?si=qoB0Dqgm9VUL3mOE&t=654

๐Ÿ‘จโ€๐Ÿซ My Patreon link:
https://www.patreon.com/kekdot
Download Project Files | Premium Tutorials | Courses

๐Ÿ’ฆ Get our Game on Steam | Kekdot Center:
https://store.steampowered.com/app/1487180/Kekdot_Center/


๐Ÿง‘๐Ÿปโ€๐Ÿš€Support us on our ๐Ÿ’ฒPatreon for awesome benefits: https://www.patreon.com/kekdot

In this video we talk about the Unreal Engine Multi...

โ–ถ Play video
lost inlet
#

AHUD is created locally by the player controller

#

though I'm not sure of the context of the question. technically the game state (an actual replicated actor) is guaranteed to be valid by the time BeginPlay is called on pre-existing actors

latent heart
#

World settings might be non replicated? I'm not sure on that one.

#

I think it's probably local only.

lost inlet
#

Oddly enough it is

#

The level script actor also is

#

World gravity and time dilation are replicated properties in AWorldSettings

latent heart
#

I see. I guess those can change!

solid river
#

What is the blueprint equivalent for GetNetMode()?

latent heart
#

Depends what you're using it for, I guess?

solid river
#

I want to print the net mode in the begin play.

sinful tree
#

This is the closest I know of.

solid river
#

Too complicated in blueprint. ๐Ÿ™‚

sinful tree
#

Inclusion of standalone for completeness ๐Ÿ˜›

limber gyro
#

if i run out of bit flags, does the engine have support for me to make my own or do i just switch to regular variables?

keen hound
#

why is my server not showing on the steam playtest?

fair latch
flat halo
#

@fair latch so, I found out is not something specific with the multicast RPC. I tried with the replicated property and it also has low frequency. I think the problem is something related to playing as the server from the editor, maybe something specific on PIE, that is limitting the rate of this messages. In standalone it works as expected. I havent changed any editor config, I have all on default. I will dig more into it.

solid river
#

From where can I set bReplicates of the level actor to false?

#

The level actor has bReplicates=true by default. I want to change it.

#

It might be too late if I set it from Begin Play.

#

I made a new level script actor in blueprint with bReplicates=false. Now I cannot change the default level script actor to mine. How to do this?

sinful tree
# limber gyro ok so lets imagine for sake sake of understanding the CMC better that i throw op...

I really can't answer a question like this as I myself have limited exposure to the CMC and haven't done tons of research in to how it works.
If you modify the flags, then it's relatively simple as the CMC is already set up to read and pass along that byte, and check things based on the values in that byte. That's about the extent I even know about the CMC.

From my understanding of Unreal and the CMC, what you're saying would seem correct. If it's a structure of data being sent and if you are creating your own child version of the structure and adding more variables to it and sending that structure instead, then it should theoretically be received by the server. I would think the difficult part is having all the parts of the CMC decipher the new data of that custom structure and apply it appropriately by overriding anything that needs to interpret that data (I don't know what does) and that the server could appropriately play back and handle corrections of the moves based on that new structure data (I wouldn't know how to do this really) and also ensuring that any moves based on the new data of the structure are appropriately replicated to other clients.

sinful tree
upbeat basin
#

Is it possible to check if an AActor is owned by local player controller without actually knowing what the Actor is? Like directly getting the top of the ownership chain to see if it's local player controller?

#

Hmm I believe AActor::IsOwnedBy() would work?

limber gyro
#

theres a function for that